summaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorAhila <ahila.pandaram@wipro.com>2020-12-04 18:08:32 +0530
committerAhila <ahila.pandaram@wipro.com>2020-12-04 21:02:25 +0530
commitf6fe21b365fc6b89f79b01d6b08a2f75d7ea4dad (patch)
tree58e50c2da1a3ffd73ceede048eaa0a3d0a4cd4ee /components
parent4b2b1445bef3b760ed29efa1c7c78977dde73452 (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')
-rw-r--r--components/slice-analysis-ms/pom.xml2
-rw-r--r--components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/policy/AAI.java14
-rw-r--r--components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/models/policy/OnsetMessage.java6
-rw-r--r--components/slice-analysis-ms/src/main/java/org/onap/slice/analysis/ms/service/PolicyService.java14
-rw-r--r--components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/service/PolicyServiceTest.java2
-rw-r--r--components/slice-analysis-ms/src/test/resources/onsetMessage.json37
-rw-r--r--components/slice-analysis-ms/version.properties2
7 files changed, 26 insertions, 51 deletions
diff --git a/components/slice-analysis-ms/pom.xml b/components/slice-analysis-ms/pom.xml
index b1e3eee8..88e3dce4 100644
--- a/components/slice-analysis-ms/pom.xml
+++ b/components/slice-analysis-ms/pom.xml
@@ -32,7 +32,7 @@
<groupId>org.onap.dcaegen2.services.components</groupId>
<artifactId>slice-analysis-ms</artifactId>
- <version>1.0.2-SNAPSHOT</version>
+ <version>1.0.3-SNAPSHOT</version>
<name>dcaegen2-services-slice-analysis-ms</name>
<description>Network slice PM analyser</description>
<packaging>jar</packaging>
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);
}
diff --git a/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/service/PolicyServiceTest.java b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/service/PolicyServiceTest.java
index 1131a5e5..fef9eb35 100644
--- a/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/service/PolicyServiceTest.java
+++ b/components/slice-analysis-ms/src/test/java/org/onap/slice/analysis/ms/service/PolicyServiceTest.java
@@ -78,7 +78,7 @@ public class PolicyServiceTest {
actual = new Gson().toJson(policyService.formPolicyOnsetMessage(snssai,addProps,input));
assertThatJson(actual)
- .whenIgnoringPaths("requestID","payload.additionalProperties.nsiInfo.nsiId","closedLoopAlarmStart", "AAI", "target_type", "aai", "targetType")
+ .whenIgnoringPaths("requestID","payload","closedLoopAlarmStart", "AAI", "target_type", "aai", "targetType")
.isEqualTo(expected);
}
}
diff --git a/components/slice-analysis-ms/src/test/resources/onsetMessage.json b/components/slice-analysis-ms/src/test/resources/onsetMessage.json
index 7f91ad12..033e9b94 100644
--- a/components/slice-analysis-ms/src/test/resources/onsetMessage.json
+++ b/components/slice-analysis-ms/src/test/resources/onsetMessage.json
@@ -5,42 +5,13 @@
"closedLoopEventStatus": "ONSET",
"requestID": "c7c6a4aa-bb61-4a15-b831-ba1472dd4a65",
"target_type": "VNF",
- "target": "vserver.vserver-name",
+ "target": "generic-vnf.vnf-id",
"AAI": {
"vserver.is-closed-loop-disabled": "false",
"vserver.prov-status": "ACTIVE",
- "vserver.vserver-name": "e51a9b12-f313-11ea-adc1-0242ac120003"
+ "generic-vnf.vnf-id": "e51a9b12-f313-11ea-adc1-0242ac120003"
},
- "payload": {
- "name":"e51a9b12-f313-11ea-adc1-0242ac120003",
- "globalSubscriberId":"5GCustomer",
- "subscriptionServiceType":"5G",
- "networkType":"AN",
- "serviceInstanceID":"e51a9b12-f313-11ea-adc1-0242ac120003",
- "additionalProperties":{
- "modifyAction":"reconfigure",
- "snssaiList":[
- "001-100001"
- ],
- "sliceProfileId":"e51a9b12-f313-11ea-adc1-0242ac120002",
- "resourceConfig":{
- "1":{
- "dLThptPerSlice":50,
- "uLThptPerSlice":40
- },
- "2":{
- "dLThptPerSlice":50,
- "uLThptPerSlice":30
- }
- },
- "nsiInfo":{
- "nsiId":"UUID",
- "nsiName":""
- },
- "scriptName": "AN"
- }
-
-},
+ "payload": "{\"name\":\"e51a9b12-f313-11ea-adc1-0242ac120003\",\"globalSubscriberId\":\"5GCustomer\",\"subscriptionServiceType\":\"5G\",\"networkType\":\"AN\",\"serviceInstanceID\":\"e51a9b12-f313-11ea-adc1-0242ac120003\",\"additionalProperties\":{\"modifyAction\":\"reconfigure\",\"snssaiList\":[\"001-100001\"],\"sliceProfileId\":\"e51a9b12-f313-11ea-adc1-0242ac120002\",\"resourceConfig\":{\"1\":{\"dLThptPerSlice\":50,\"uLThptPerSlice\":40},\"2\":{\"dLThptPerSlice\":50,\"uLThptPerSlice\":30}},\"nsiInfo\":{\"nsiId\":\"UUID\",\"nsiName\":\"\"},\"scriptName\":\"AN\"}}",
"from": "DCAE",
"version": "1.0.2"
-} \ No newline at end of file
+}
diff --git a/components/slice-analysis-ms/version.properties b/components/slice-analysis-ms/version.properties
index 34780e89..20c177b9 100644
--- a/components/slice-analysis-ms/version.properties
+++ b/components/slice-analysis-ms/version.properties
@@ -20,7 +20,7 @@
###############################################################################
major=1
minor=0
-patch=2
+patch=3
base_version=${major}.${minor}.${patch}
release_version=${base_version}
snapshot_version=${base_version}-SNAPSHOT