2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2020 Samsung. All rights reserved.
6 * ================================================================================
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ============LICENSE_END=========================================================
21 package org.onap.so.adapters.vevnfm.event;
23 import static java.time.temporal.ChronoField.INSTANT_SECONDS;
24 import com.fasterxml.jackson.annotation.JsonProperty;
25 import java.time.Instant;
26 import java.util.UUID;
27 import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.VnfLcmOperationOccurrenceNotification;
29 public class DmaapEvent {
31 public static final String MSERVICE = "microservice.stringmatcher";
32 public static final String ONSET = "ONSET";
33 public static final String VNF = "VNF";
34 public static final String VNFID = "generic-vnf.vnf-id";
35 public static final String ETSI = "ETSI";
37 private final String closedLoopControlName;
38 private final long closedLoopAlarmStart;
39 private final String closedLoopEventClient;
40 private final String closedLoopEventStatus;
41 private final String requestId;
42 private final String targetType;
43 private final String target;
44 private final AaiEvent aaiEvent;
45 private final String from;
46 private final String version;
47 private final VnfLcmOperationOccurrenceNotification etsiLcmEvent;
49 public DmaapEvent(final String closedLoopControlName, final String version,
50 final VnfLcmOperationOccurrenceNotification etsiLcmEvent) {
51 this.closedLoopControlName = closedLoopControlName;
52 this.closedLoopAlarmStart = Instant.now().getLong(INSTANT_SECONDS);
53 this.closedLoopEventClient = MSERVICE;
54 this.closedLoopEventStatus = ONSET;
55 this.requestId = UUID.randomUUID().toString();
56 this.targetType = VNF;
58 this.aaiEvent = new AaiEvent(false, etsiLcmEvent.getId());
60 this.version = version;
61 this.etsiLcmEvent = etsiLcmEvent;
64 public String getClosedLoopControlName() {
65 return closedLoopControlName;
68 public long getClosedLoopAlarmStart() {
69 return closedLoopAlarmStart;
72 public String getClosedLoopEventClient() {
73 return closedLoopEventClient;
76 public String getClosedLoopEventStatus() {
77 return closedLoopEventStatus;
80 @JsonProperty("requestID")
81 public String getRequestId() {
85 @JsonProperty("target_type")
86 public String getTargetType() {
90 public String getTarget() {
95 public AaiEvent getAaiEvent() {
99 public String getFrom() {
103 public String getVersion() {
107 public VnfLcmOperationOccurrenceNotification getEtsiLcmEvent() {