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 private String policyName;
51 private String policyVersion;
53 @JsonProperty("Action")
54 private String action;
55 private String payload;
60 public PolicyNotification() {
67 public PolicyNotification(String closedLoopControlName, String requestId, Long alarmStartTime, String pnfName,
69 this.closedLoopControlName = closedLoopControlName;
70 this.requestId = requestId;
71 this.closedLoopEventClient = "microservice.PCI";
72 this.closedLoopEventStatus = "ONSET";
73 this.closedLoopAlarmStart = alarmStartTime;
75 this.version = "1.0.2";
77 this.target = "generic-vnf.vnf-id";
78 this.targetType = "VNF";
79 this.aai = new HashMap<>();
80 aai.put("generic-vnf.is-closed-loop-disabled", "false");
81 aai.put("generic-vnf.prov-status", "ACTIVE");
82 aai.put("generic-vnf.vnf-id", pnfName);
85 public long getClosedLoopAlarmStart() {
86 return closedLoopAlarmStart;
89 public void setClosedLoopAlarmStart(long closedLoopAlarmStart) {
90 this.closedLoopAlarmStart = closedLoopAlarmStart;
93 public String getClosedLoopEventClient() {
94 return closedLoopEventClient;
97 public void setClosedLoopEventClient(String closedLoopEventClient) {
98 this.closedLoopEventClient = closedLoopEventClient;
101 public String getClosedLoopEventStatus() {
102 return closedLoopEventStatus;
105 public void setClosedLoopEventStatus(String closedLoopEventStatus) {
106 this.closedLoopEventStatus = closedLoopEventStatus;
109 public String getRequestId() {
113 public void setRequestId(String requestId) {
114 this.requestId = requestId;
117 public String getFrom() {
121 public void setFrom(String from) {
125 public String getVersion() {
129 public void setVersion(String version) {
130 this.version = version;
133 public String getAction() {
137 public void setAction(String action) {
138 this.action = action;
141 public String getClosedLoopControlName() {
142 return closedLoopControlName;
145 public void setClosedLoopControlName(String closedLoopControlName) {
146 this.closedLoopControlName = closedLoopControlName;
149 public String getPayload() {
153 public void setPayload(String payload) {
154 this.payload = payload;
157 public String getTargetType() {
161 public void setTargetType(String targetType) {
162 this.targetType = targetType;
165 public String getTarget() {
169 public void setTarget(String target) {
170 this.target = target;
173 public Map<String, String> getAai() {
177 public void setAai(Map<String, String> aai) {
182 public String toString() {
183 return "PolicyNotification [closedLoopControlName=" + closedLoopControlName + ", closedLoopAlarmStart="
184 + closedLoopAlarmStart + ", closedLoopEventClient=" + closedLoopEventClient + ", closedLoopEventStatus="
185 + closedLoopEventStatus + ", targetType=" + targetType + ", target=" + target + ", requestId="
186 + requestId + ", aai=" + aai + ", from=" + from + ", version=" + version + ", action=" + action
187 + ", payload=" + payload + "]";
191 public int hashCode() {
192 final int prime = 31;
194 result = prime * result + ((aai == null) ? 0 : aai.hashCode());
195 result = prime * result + ((action == null) ? 0 : action.hashCode());
196 result = prime * result + (int) (closedLoopAlarmStart ^ (closedLoopAlarmStart >>> 32));
197 result = prime * result + ((closedLoopControlName == null) ? 0 : closedLoopControlName.hashCode());
198 result = prime * result + ((closedLoopEventClient == null) ? 0 : closedLoopEventClient.hashCode());
199 result = prime * result + ((closedLoopEventStatus == null) ? 0 : closedLoopEventStatus.hashCode());
200 result = prime * result + ((from == null) ? 0 : from.hashCode());
201 result = prime * result + ((payload == null) ? 0 : payload.hashCode());
202 result = prime * result + ((requestId == null) ? 0 : requestId.hashCode());
203 result = prime * result + ((target == null) ? 0 : target.hashCode());
204 result = prime * result + ((targetType == null) ? 0 : targetType.hashCode());
205 result = prime * result + ((version == null) ? 0 : version.hashCode());
210 public boolean equals(Object obj) {
214 return (this.hashCode() == obj.hashCode());
217 public String getPolicyName() {
221 public void setPolicyName(String policyName) {
222 this.policyName = policyName;
225 public String getPolicyVersion() {
226 return policyVersion;
229 public void setPolicyVersion(String policyVersion) {
230 this.policyVersion = policyVersion;