1 /*******************************************************************************
2 * ============LICENSE_START=======================================================
4 * ================================================================================
5 * Copyright (C) 2019 Wipro Limited.
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=========================================================
20 *******************************************************************************/
22 package org.onap.dcaegen2.services.sonhms.model;
24 import com.fasterxml.jackson.annotation.JsonProperty;
26 import java.util.HashMap;
29 public class PolicyNotification {
31 private String closedLoopControlName;
32 private long closedLoopAlarmStart;
33 private String closedLoopEventClient;
34 private String closedLoopEventStatus;
36 @JsonProperty("target_type")
37 private String targetType;
39 private String target;
41 @JsonProperty("requestID")
42 private String requestId;
45 private Map<String, String> aai;
48 private String version;
50 @JsonProperty("Action")
51 private String action;
52 private String payload;
57 public PolicyNotification() {
65 public PolicyNotification(String closedLoopControlName, String requestId, Long alarmStartTime, String pnfName, String action) {
66 this.closedLoopControlName = closedLoopControlName;
67 this.requestId = requestId;
68 this.closedLoopEventClient = "microservice.PCI";
69 this.closedLoopEventStatus = "ONSET";
70 this.closedLoopAlarmStart = alarmStartTime;
72 this.version = "1.0.2";
74 this.target = "generic-vnf.vnf-id";
75 this.targetType = "VNF";
76 this.aai = new HashMap<>();
77 aai.put("generic-vnf.is-closed-loop-disabled", "false");
78 aai.put("generic-vnf.prov-status", "ACTIVE");
79 aai.put("generic-vnf.vnf-id", pnfName);
82 public long getClosedLoopAlarmStart() {
83 return closedLoopAlarmStart;
86 public void setClosedLoopAlarmStart(long closedLoopAlarmStart) {
87 this.closedLoopAlarmStart = closedLoopAlarmStart;
90 public String getClosedLoopEventClient() {
91 return closedLoopEventClient;
94 public void setClosedLoopEventClient(String closedLoopEventClient) {
95 this.closedLoopEventClient = closedLoopEventClient;
98 public String getClosedLoopEventStatus() {
99 return closedLoopEventStatus;
102 public void setClosedLoopEventStatus(String closedLoopEventStatus) {
103 this.closedLoopEventStatus = closedLoopEventStatus;
106 public String getRequestId() {
110 public void setRequestId(String requestId) {
111 this.requestId = requestId;
114 public String getFrom() {
118 public void setFrom(String from) {
122 public String getVersion() {
126 public void setVersion(String version) {
127 this.version = version;
130 public String getAction() {
134 public void setAction(String action) {
135 this.action = action;
138 public String getClosedLoopControlName() {
139 return closedLoopControlName;
142 public void setClosedLoopControlName(String closedLoopControlName) {
143 this.closedLoopControlName = closedLoopControlName;
146 public String getPayload() {
150 public void setPayload(String payload) {
151 this.payload = payload;
154 public String getTargetType() {
158 public void setTargetType(String targetType) {
159 this.targetType = targetType;
162 public String getTarget() {
166 public void setTarget(String target) {
167 this.target = target;
170 public Map<String, String> getAai() {
174 public void setAai(Map<String, String> aai) {
179 public String toString() {
180 return "PolicyNotification [closedLoopControlName=" + closedLoopControlName + ", closedLoopAlarmStart="
181 + closedLoopAlarmStart + ", closedLoopEventClient=" + closedLoopEventClient + ", closedLoopEventStatus="
182 + closedLoopEventStatus + ", targetType=" + targetType + ", target=" + target + ", requestId="
183 + requestId + ", aai=" + aai + ", from=" + from + ", version=" + version + ", action=" + action
184 + ", payload=" + payload + "]";
188 public int hashCode() {
189 final int prime = 31;
191 result = prime * result + ((aai == null) ? 0 : aai.hashCode());
192 result = prime * result + ((action == null) ? 0 : action.hashCode());
193 result = prime * result + (int) (closedLoopAlarmStart ^ (closedLoopAlarmStart >>> 32));
194 result = prime * result + ((closedLoopControlName == null) ? 0 : closedLoopControlName.hashCode());
195 result = prime * result + ((closedLoopEventClient == null) ? 0 : closedLoopEventClient.hashCode());
196 result = prime * result + ((closedLoopEventStatus == null) ? 0 : closedLoopEventStatus.hashCode());
197 result = prime * result + ((from == null) ? 0 : from.hashCode());
198 result = prime * result + ((payload == null) ? 0 : payload.hashCode());
199 result = prime * result + ((requestId == null) ? 0 : requestId.hashCode());
200 result = prime * result + ((target == null) ? 0 : target.hashCode());
201 result = prime * result + ((targetType == null) ? 0 : targetType.hashCode());
202 result = prime * result + ((version == null) ? 0 : version.hashCode());
207 public boolean equals(Object obj) {
211 return (this.hashCode() == obj.hashCode());