diff options
author | 2020-12-04 18:08:32 +0530 | |
---|---|---|
committer | 2020-12-04 21:02:25 +0530 | |
commit | f6fe21b365fc6b89f79b01d6b08a2f75d7ea4dad (patch) | |
tree | 58e50c2da1a3ffd73ceede048eaa0a3d0a4cd4ee /components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms | |
parent | 4b2b1445bef3b760ed29efa1c7c78977dde73452 (diff) |
Slice-analysis-ms and Policy integration issue fixes
Corrected the Test failure
Issue-ID: DCAEGEN2-2540
Signed-off-by: Ahila <ahila.pandaram@wipro.com>
Change-Id: I9a8515fc9ed3c8ce124ddd51815c27ccdeadb900
Diffstat (limited to 'components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms')
3 files changed, 19 insertions, 15 deletions
diff --git a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/policy/AAI.java b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/policy/AAI.java index 73d94d75..9083ff40 100644 --- a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/policy/AAI.java +++ b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/policy/AAI.java @@ -31,8 +31,8 @@ public class AAI { private String vserverIsClosedLoopDisabled; @JsonProperty("vserver.prov-status") private String vserverProvStatus; - @JsonProperty("vserver.vserver-name") - private String vserverVserverName; + @JsonProperty("generic-vnf.vnf-id") + private String vServerVNFId; public String getVserverIsClosedLoopDisabled() { return vserverIsClosedLoopDisabled; @@ -50,12 +50,12 @@ public class AAI { this.vserverProvStatus = vserverProvStatus; } - public String getVserverVserverName() { - return vserverVserverName; + public String getvServerVNFId() { + return vServerVNFId; } - public void setVserverVserverName(String vserverVserverName) { - this.vserverVserverName = vserverVserverName; + public void setvServerVNFId(String vServerVNFId) { + this.vServerVNFId = vServerVNFId; } - + } diff --git a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/policy/OnsetMessage.java b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/policy/OnsetMessage.java index 671a9561..8f863093 100644 --- a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/policy/OnsetMessage.java +++ b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/policy/OnsetMessage.java @@ -41,7 +41,7 @@ public class OnsetMessage { private AAI aai; private String target; - private Payload payload; + private String payload; private String from; private String version; @@ -109,11 +109,11 @@ public class OnsetMessage { this.aai = aAI; } - public Payload getPayload() { + public String getPayload() { return payload; } - public void setPayload(Payload payload) { + public void setPayload(String payload) { this.payload = payload; } diff --git a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/PolicyService.java b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/PolicyService.java index 165bef90..ca5bf265 100644 --- a/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/PolicyService.java +++ b/components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/PolicyService.java @@ -46,6 +46,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; public class PolicyService { private PolicyDmaapClient policyDmaapClient; private static Logger log = LoggerFactory.getLogger(PolicyService.class); + private ObjectMapper objectMapper = new ObjectMapper(); @PostConstruct public void init() { @@ -75,31 +76,34 @@ public class PolicyService { addProps.setSnssaiList(snssaiList); payload.setAdditionalProperties(addProps); - onsetmsg.setPayload(payload); + try { + onsetmsg.setPayload(objectMapper.writeValueAsString(payload)); + } catch (Exception e) { + log.error("Error while mapping payload as string , {}",e.getMessage()); + } onsetmsg.setClosedLoopControlName("ControlLoop-Slicing-116d7b00-dbeb-4d03-8719-d0a658fa735b"); onsetmsg.setClosedLoopAlarmStart(System.currentTimeMillis()); onsetmsg.setClosedLoopEventClient("microservice.sliceAnalysisMS"); onsetmsg.setClosedLoopEventStatus("ONSET"); onsetmsg.setRequestID(UUID.randomUUID().toString()); - onsetmsg.setTarget("vserver.vserver-name"); + onsetmsg.setTarget("generic-vnf.vnf-id"); onsetmsg.setTargetType("VNF"); onsetmsg.setFrom("DCAE"); onsetmsg.setVersion("1.0.2"); AAI aai = new AAI(); aai.setVserverIsClosedLoopDisabled("false"); aai.setVserverProvStatus("ACTIVE"); - aai.setVserverVserverName(serviceDetails.get("ranNFNSSIId")); + aai.setvServerVNFId(serviceDetails.get("ranNFNSSIId")); onsetmsg.setAai(aai); return onsetmsg; } protected <T> void sendOnsetMessageToPolicy(String snssai, AdditionalProperties<T> addProps, Map<String, String> serviceDetails) { OnsetMessage onsetMessage = formPolicyOnsetMessage(snssai, addProps, serviceDetails); - ObjectMapper obj = new ObjectMapper(); String msg = ""; try { - msg = obj.writeValueAsString(onsetMessage); + msg = objectMapper.writeValueAsString(onsetMessage); log.info("Policy onset message for S-NSSAI: {} is {}", snssai, msg); policyDmaapClient.sendNotificationToPolicy(msg); } |