summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/pom.xml12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy54
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy75
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy15
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy300
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy91
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy73
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy70
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy138
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/resources/logback-test.xml11
13 files changed, 526 insertions, 329 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml
index c6a4ffc01d..846af27b96 100644
--- a/bpmn/so-bpmn-infrastructure-common/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-common/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.8.0-SNAPSHOT</version>
+ <version>1.9.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-bpmn-infrastructure-common</artifactId>
@@ -132,11 +132,11 @@
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-spring-boot-starter-jaxrs</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId>
- <version>3.4.2</version>
-</dependency>
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-rs-service-description-openapi-v3</artifactId>
+ <version>3.4.2</version>
+ </dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy
index 2c1fa64609..540358fde7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/AnNssmfutils.groovy
@@ -176,9 +176,9 @@ public void createSliceProfilesInAai(DelegateExecution execution) {
org.onap.aai.domain.yang.SliceProfile ANNF_SliceProfile = new SliceProfile()
org.onap.aai.domain.yang.SliceProfile TNFH_SliceProfile = new SliceProfile()
org.onap.aai.domain.yang.SliceProfile TNMH_SliceProfile = new SliceProfile()
- ANNF_SliceProfile = createSliceProfile("AN-NF", execution)
- TNFH_SliceProfile = createSliceProfile("TN-FH",execution)
- TNMH_SliceProfile = createSliceProfile("TN-MH",execution)
+ ANNF_SliceProfile = createSliceProfile("AN_NF", execution)
+ TNFH_SliceProfile = createSliceProfile("TN_FH",execution)
+ TNMH_SliceProfile = createSliceProfile("TN_MH",execution)
ANNF_SliceProfiles.getSliceProfile().add(ANNF_SliceProfile)
TNFH_SliceProfiles.getSliceProfile().add(TNFH_SliceProfile)
@@ -194,13 +194,13 @@ public void createSliceProfilesInAai(DelegateExecution execution) {
String serviceStatus = "deactivated"
ANNF_sliceProfileInstance.setOrchestrationStatus(serviceStatus)
String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "plmnIdList")
- ANNF_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+ ANNF_sliceProfileInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0))
String serviceRole = "slice-profile-instance"
ANNF_sliceProfileInstance.setServiceRole(serviceRole)
ArrayList<String> snssaiList = execution.getVariable("snssaiList")
String snssai = snssaiList.get(0)
ANNF_sliceProfileInstance.setEnvironmentContext(snssai)
- ANNF_sliceProfileInstance.setWorkloadContext("AN-NF")
+ ANNF_sliceProfileInstance.setWorkloadContext("AN_NF")
ANNF_sliceProfileInstance.setSliceProfiles(ANNF_SliceProfiles)
String serviceFunctionAnnf = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "resourceSharingLevel")
ANNF_sliceProfileInstance.setServiceFunction(serviceFunctionAnnf)
@@ -214,10 +214,10 @@ public void createSliceProfilesInAai(DelegateExecution execution) {
TNFH_sliceProfileInstance.setServiceType(serviceType)
TNFH_sliceProfileInstance.setOrchestrationStatus(serviceStatus)
serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "plmnIdList")
- TNFH_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+ TNFH_sliceProfileInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0))
TNFH_sliceProfileInstance.setServiceRole(serviceRole)
TNFH_sliceProfileInstance.setEnvironmentContext(snssai)
- TNFH_sliceProfileInstance.setWorkloadContext("TN-FH")
+ TNFH_sliceProfileInstance.setWorkloadContext("TN_FH")
TNFH_sliceProfileInstance.setSliceProfiles(TNFH_SliceProfiles)
String serviceFunctionTnFH = jsonUtil.getJsonValue(execution.getVariable("tnFhSliceProfile"), "resourceSharingLevel")
TNFH_sliceProfileInstance.setServiceFunction(serviceFunctionTnFH)
@@ -231,10 +231,10 @@ public void createSliceProfilesInAai(DelegateExecution execution) {
TNMH_sliceProfileInstance.setServiceType(serviceType)
TNMH_sliceProfileInstance.setOrchestrationStatus(serviceStatus)
serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "plmnIdList")
- TNMH_sliceProfileInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+ TNMH_sliceProfileInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0))
TNMH_sliceProfileInstance.setServiceRole(serviceRole)
TNMH_sliceProfileInstance.setEnvironmentContext(snssai)
- TNMH_sliceProfileInstance.setWorkloadContext("TN-MH")
+ TNMH_sliceProfileInstance.setWorkloadContext("TN_MH")
TNMH_sliceProfileInstance.setSliceProfiles(TNMH_SliceProfiles)
String serviceFunctionTnMH = jsonUtil.getJsonValue(execution.getVariable("tnMhSliceProfile"), "resourceSharingLevel")
TNMH_sliceProfileInstance.setServiceFunction(serviceFunctionTnMH)
@@ -267,7 +267,7 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
SliceProfile result = new SliceProfile()
Map<String,Object> profile
switch(domainType) {
- case "AN-NF":
+ case "AN_NF":
profile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)//pending fields - cSReliabilityMeanTime, cSAvailabilityTarget, terminalDensity, msgSizeByte
result.setJitter(profile.get("jitter"))
result.setLatency(profile.get("latency"))
@@ -288,7 +288,7 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
result.setExpDataRate(profile.get("expDataRate"))
result.setProfileId(execution.getVariable("ANNF_sliceProfileId"))
break
- case "TN-FH":
+ case "TN_FH":
profile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class)
result.setJitter(profile.get("jitter"))
result.setLatency(profile.get("latency"))
@@ -296,7 +296,7 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
result.setResourceSharingLevel(profile.get("resourceSharingLevel"))
result.setProfileId(execution.getVariable("TNFH_sliceProfileId"))
break
- case "TN-MH":
+ case "TN_MH":
profile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class)
result.setJitter(profile.get("jitter"))
result.setLatency(profile.get("latency"))
@@ -361,7 +361,8 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
if(domainType.equals("TN_FH")) {
serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNFH_modelInvariantUuid"))
serviceInfo.addProperty("serviceUuid", execution.getVariable("TNFH_modelUuid"))
- serviceInfo.addProperty("nssiName", execution.getVariable("TNFH_modelName"))
+ serviceInfo.addProperty("nssiName", "nssi_"+execution.getVariable("TNFH_modelName"))
+ serviceInfo.addProperty("sst", execution.getVariable("sst"))
allocateTnNssi.addProperty("nsstId", execution.getVariable("TNFH_modelUuid"))
allocateTnNssi.addProperty("nssiName", execution.getVariable("TNFH_modelName"))
Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class)
@@ -373,7 +374,8 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
}else if(domainType.equals("TN_MH")) {
serviceInfo.addProperty("serviceInvariantUuid", execution.getVariable("TNMH_modelInvariantUuid"))
serviceInfo.addProperty("serviceUuid", execution.getVariable("TNMH_modelUuid"))
- serviceInfo.addProperty("nssiName", execution.getVariable("TNMH_modelName"))
+ serviceInfo.addProperty("nssiName", "nssi_"+execution.getVariable("TNMH_modelName"))
+ serviceInfo.addProperty("sst", execution.getVariable("sst"))
allocateTnNssi.addProperty("nsstId", execution.getVariable("TNMH_modelUuid"))
allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_modelName"))
Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class)
@@ -383,26 +385,40 @@ private SliceProfile createSliceProfile(String domainType, DelegateExecution exe
endpoints.addProperty("transportEndpointB", execution.getVariable("tranportEp_ID_CUIN"))
connectionLinksList.add(endpoints)
}
-
- //Connection links
- connectionLinks.add("connectionLinks", connectionLinksList)
- transportSliceNetworksList.add(connectionLinks)
- allocateTnNssi.add("transportSliceNetworks", transportSliceNetworksList)
}else if(action.equals("modify-allocate")) {
+ JsonObject endpoints = new JsonObject()
if(domainType.equals("TN_FH")) {
allocateTnNssi.addProperty("nssiName", execution.getVariable("TNFH_nssiName"))
allocateTnNssi.addProperty("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId"))
allocateTnNssi.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
serviceInfo.addProperty("nssiId", execution.getVariable("TNFH_NSSI"))
serviceInfo.addProperty("nssiName", execution.getVariable("TNFH_nssiName"))
+ Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnFhSliceProfile"), Map.class)
+ sliceProfile.put("sliceProfileId", execution.getVariable("TNFH_sliceProfileInstanceId"))
+ allocateTnNssi.add("sliceProfile", jsonConverter.toJsonTree(sliceProfile))
+ endpoints.addProperty("transportEndpointA", execution.getVariable("tranportEp_ID_RU"))
+ endpoints.addProperty("transportEndpointB", execution.getVariable("tranportEp_ID_DUIN"))
+ connectionLinksList.add(endpoints)
}else if(domainType.equals("TN_MH")) {
allocateTnNssi.addProperty("nssiName", execution.getVariable("TNMH_nssiName"))
allocateTnNssi.addProperty("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId"))
allocateTnNssi.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
serviceInfo.addProperty("nssiId", execution.getVariable("TNMH_NSSI"))
serviceInfo.addProperty("nssiName", execution.getVariable("TNMH_nssiName"))
+ Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("tnMhSliceProfile"), Map.class)
+ sliceProfile.put("sliceProfileId", execution.getVariable("TNMH_sliceProfileInstanceId"))
+ allocateTnNssi.add("sliceProfile", jsonConverter.toJsonTree(sliceProfile))
+ endpoints.addProperty("transportEndpointA", execution.getVariable("tranportEp_ID_DUEG"))
+ endpoints.addProperty("transportEndpointB", execution.getVariable("tranportEp_ID_CUIN"))
+ connectionLinksList.add(endpoints)
}
}
+
+ //Connection links
+ connectionLinks.add("connectionLinks", connectionLinksList)
+ transportSliceNetworksList.add(connectionLinks)
+ allocateTnNssi.add("transportSliceNetworks", transportSliceNetworksList)
+
JsonParser parser = new JsonParser()
String nsiInfo = jsonUtil.getJsonValue(execution.getVariable("sliceParams"), "nsiInfo")
allocateTnNssi.add("nsiInfo",(JsonObject) parser.parse(nsiInfo))
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy
index 567c703496..f3fca050a2 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateAccessNSSI.groovy
@@ -53,6 +53,7 @@ import org.onap.aaiclient.client.aai.AAINamespaceConstants
import org.onap.aaiclient.client.aai.AAIObjectType
import org.onap.aai.domain.yang.NetworkPolicy
import org.onap.aai.domain.yang.NetworkRoute
+import org.json.JSONArray
class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
@@ -85,7 +86,8 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
" subscriptionServiceType - "+execution.getVariable("subscriptionServiceType")+
" jobId - "+execution.getVariable("jobId")+
" sliceParams - "+execution.getVariable("sliceParams")+
- " servicename - "+ execution.getVariable("servicename"))
+ " servicename - "+ execution.getVariable("servicename")+
+ " sst - "+ execution.getVariable("sst"))
//validate slice subnet inputs
@@ -101,7 +103,14 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
String sliceProfileId = jsonUtil.getJsonValue(sliceProfile, "sliceProfileId")
def snssaiList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "snssaiList"))
def plmnIdList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "plmnIdList"))
- def coverageAreaTAList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceProfile, "coverageAreaTAList"))
+ String jsonArray = jsonUtil.getJsonValue(sliceProfile, "coverageAreaTAList")
+ List<Integer> list = new ArrayList<>();
+ JSONArray arr = new JSONArray(jsonArray);
+ for (int i = 0; i < arr.length(); i++) {
+ int s = (int) arr.get(i);
+ list.add(s);
+ }
+ def coverageAreaTAList = list;
if (isBlank(sliceProfileId) || (snssaiList.empty) || (plmnIdList.empty)
|| (coverageAreaTAList.empty)) {
@@ -131,16 +140,16 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
execution.setVariable("job_timeout", 10)
//set BH end point
- List<String> BH_endPoints = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "endPoints"))
- logger.debug("BH end points list : "+BH_endPoints)
- if(BH_endPoints.empty) {
- msg = "End point info is empty"
- logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
- }else {
- execution.setVariable("bh_endpoint", BH_endPoints.get(0))
- }
-
+ def BH_endPoints = jsonUtil.getJsonValue(sliceParams, "endPoint")
+ logger.debug("BH end points list : "+BH_endPoints)
+ if(isBlank(BH_endPoints)) {
+ msg = "End point info is empty"
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg)
+ }else {
+ execution.setVariable("bh_endpoint", BH_endPoints)
+ }
+
} catch(BpmnError e) {
throw e
} catch(Exception ex) {
@@ -261,6 +270,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
String requestId = execution.getVariable("msoRequestId")
String messageType = "NSISelectionResponse"
Map<String, Object> profileInfo = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class)
+ profileInfo.put("sST",execution.getVariable("sst"))
String modelUuid = execution.getVariable("modelUuid")
String modelInvariantUuid = execution.getVariable("modelInvariantUuid")
String modelName = execution.getVariable("ranModelName")
@@ -377,8 +387,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
serviceInfo.addProperty("nssiId", execution.getVariable("RANServiceInstanceId"))
serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
serviceInfo.addProperty("nssiName", execution.getVariable("servicename"))
- String sST = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
- serviceInfo.addProperty("sST", sST)
+ serviceInfo.addProperty("sST", execution.getVariable("sst"))
serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("plmnIdList")))
serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
@@ -475,6 +484,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
List<String> ranConstituentSliceProfiles = jsonUtil.StringArrayToList(execution.getVariable("RanConstituentSliceProfiles"))
anNssmfUtils.createDomainWiseSliceProfiles(ranConstituentSliceProfiles, execution)
Map<String, Object> profileInfo = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)
+ profileInfo.put("sST",execution.getVariable("sst"))
String modelUuid = execution.getVariable("ANNF_modelUuid")
String modelInvariantUuid = execution.getVariable("ANNF_modelInvariantUuid")
String modelName = execution.getVariable("ANNF_modelName")
@@ -518,6 +528,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
ServiceDecomposition serviceDecomposition = execution.getVariable("ANNF_ServiceDecomposition")
serviceDecomposition.setServiceInstance(serviceInstance);
execution.setVariable("ANNF_ServiceDecomposition", serviceDecomposition)
+ execution.setVariable("modifyAction","allocate")
execution.setVariable("isRspRanNfNssi", true)
}else {
logger.debug("No solutions returned from OOF .. Create new RAN NF NSSI")
@@ -544,17 +555,18 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
String sliceInstanceName = execution.getVariable("servicename")
ANServiceInstance.setServiceInstanceName(sliceInstanceName)
String serviceType = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
- ANServiceInstance.setServiceType(serviceType)
+ ANServiceInstance.setServiceType(execution.getVariable("sst"))
String serviceStatus = "deactivated"
ANServiceInstance.setOrchestrationStatus(serviceStatus)
String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "plmnIdList")
- ANServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+ ANServiceInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0))
String serviceRole = "nssi"
ANServiceInstance.setServiceRole(serviceRole)
- List<String> snssaiList = objectMapper.readValue(execution.getVariable("snssaiList"), List.class)
+ List<String> snssaiList = execution.getVariable("snssaiList")
String snssai = snssaiList.get(0)
- ANServiceInstance.setEnvironmentContext(snssai)
- ANServiceInstance.setWorkloadContext("AN")
+ //ANServiceInstance.setEnvironmentContext(snssai)
+ ANServiceInstance.setEnvironmentContext("an") //Network Type
+ ANServiceInstance.setWorkloadContext("AN") //domain Type
logger.debug("completed AN service instance build "+ ANServiceInstance.toString())
String msg = ""
@@ -610,7 +622,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
String sliceInstanceName = execution.getVariable("servicename")
ANServiceInstance.setServiceInstanceName(sliceInstanceName)
String serviceType = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
- ANServiceInstance.setServiceType(serviceType)
+ ANServiceInstance.setServiceType(execution.getVariable("sst"))
String serviceStatus = "deactivated"
ANServiceInstance.setOrchestrationStatus(serviceStatus)
String serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "plmnIdList")
@@ -630,19 +642,19 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
logger.debug("completed AN service instance build "+ ANServiceInstance.toString())
//create RAN NF NSSI
ANNFServiceInstance.setServiceInstanceId(execution.getVariable("RANNFServiceInstanceId"))
- sliceInstanceName = execution.getVariable("ANNF_modelName")
+ sliceInstanceName = "nssi_"+execution.getVariable("ANNF_modelName")
ANNFServiceInstance.setServiceInstanceName(sliceInstanceName)
- ANNFServiceInstance.setServiceType(serviceType)
+ ANNFServiceInstance.setServiceType(execution.getVariable("sst"))
ANNFServiceInstance.setOrchestrationStatus(serviceStatus)
serviceInstanceLocationid = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "plmnIdList")
- ANNFServiceInstance.setServiceInstanceLocationId(serviceInstanceLocationid)
+ ANNFServiceInstance.setServiceInstanceLocationId(jsonUtil.StringArrayToList(serviceInstanceLocationid).get(0))
ANNFServiceInstance.setServiceRole(serviceRole)
snssaiList = execution.getVariable("snssaiList")
snssai = snssaiList.get(0)
ANNFServiceInstance.setEnvironmentContext(snssai)
ANNFServiceInstance.setModelInvariantId(execution.getVariable("ANNF_modelInvariantUuid"))
ANNFServiceInstance.setModelVersionId(execution.getVariable("ANNF_modelUuid"))
- ANNFServiceInstance.setWorkloadContext("AN-NF")
+ ANNFServiceInstance.setWorkloadContext("AN_NF")
String serviceFunctionAnnf = jsonUtil.getJsonValue(execution.getVariable("ranNfSliceProfile"), "resourceSharingLevel")
ANNFServiceInstance.setServiceFunction(serviceFunctionAnnf)
logger.debug("completed AN service instance build "+ ANNFServiceInstance.toString())
@@ -720,8 +732,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
execution.setVariable("esrInfo", esrInfo.toString())
JsonObject serviceInfo = new JsonObject()
serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
- String sST = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
- serviceInfo.addProperty("sST", sST)
+ serviceInfo.addProperty("sST", execution.getVariable("sst"))
serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("plmnIdList")))
serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
@@ -902,7 +913,7 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
String requestId = execution.getVariable("msoRequestId")
Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("ranNfSliceProfile"), Map.class)
sliceProfile.put("sliceProfileId", execution.getVariable("ANNF_sliceProfileInstanceId"))
- sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSessions"))
+ sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSession"))
sliceProfile.put("uLThptPerSlice", sliceProfile.get("expDataRateUL"))
sliceProfile.put("dLThptPerSlice", sliceProfile.get("expDataRateDL"))
@@ -912,11 +923,11 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
JsonObject commonHeader = new JsonObject()
JsonObject payload = new JsonObject()
JsonObject payloadInput = new JsonObject()
- commonHeader.addProperty("TimeStamp",new Date(System.currentTimeMillis()).format("yyyy-MM-dd'T'HH:mm:ss.sss'Z'", TimeZone.getDefault()))
+ commonHeader.addProperty("timeStamp",new Date(System.currentTimeMillis()).format("yyyy-MM-dd'T'HH:mm:ss.sss'Z'", TimeZone.getDefault()))
commonHeader.addProperty("api-ver", "1.0")
+ commonHeader.addProperty("originator-id", "testing")
commonHeader.addProperty("request-id", requestId)
commonHeader.addProperty("sub-request-id", "1")
- commonHeader.add("request-track", new JsonObject())
commonHeader.add("flags", new JsonObject())
Gson jsonConverter = new Gson()
payloadInput.add("sliceProfile", jsonConverter.toJsonTree(sliceProfile))
@@ -924,6 +935,8 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
payloadInput.addProperty("NSIID", execution.getVariable("nsiId"))
payloadInput.addProperty("RANNFNSSIId", execution.getVariable("RANNFServiceInstanceId"))
payloadInput.addProperty("callbackURL", callbackUrl)
+ payloadInput.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
+ payloadInput.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
payloadInput.add("additionalproperties", new JsonObject())
payload.add("input", payloadInput)
input.add("common-header", commonHeader)
@@ -948,8 +961,8 @@ class DoAllocateAccessNSSI extends AbstractServiceTaskProcessor {
String bh_routeId = UUID.randomUUID().toString()
execution.setVariable("tranportEp_ID_bh", bh_routeId)
String role = "CU"
- String CU_IpAddress = jsonUtil.getJsonValue(bh_endpoint, "IpAddress")
- String LogicalLinkId = jsonUtil.getJsonValue(bh_endpoint, "LogicalLinkId")
+ String CU_IpAddress = jsonUtil.getJsonValue(bh_endpoint, "ipAddress")
+ String LogicalLinkId = jsonUtil.getJsonValue(bh_endpoint, "logicInterfaceId")
String nextHopInfo = jsonUtil.getJsonValue(bh_endpoint, "nextHopInfo")
NetworkRoute bh_ep = new NetworkRoute()
bh_ep.setRouteId(bh_routeId)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy
index a1afe9ae95..2801c11e47 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy
@@ -94,12 +94,12 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
execution.setVariable("networkServiceModelUuid", networkServiceModelUuid)
String sliceParams = execution.getVariable("sliceParams")
logger.debug("sliceParams "+sliceParams)
- List<String> bhEndPoints = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "endPoints"))
+ String bhEndPoints = jsonUtil.getJsonValue(sliceParams, "endPoint")
if(bhEndPoints.empty) {
logger.debug("End point info is empty")
exceptionUtil.buildAndThrowWorkflowException(execution, 500, "End point info is empty")
}else {
- execution.setVariable("bh_endpoint", bhEndPoints.get(0))
+ execution.setVariable("bh_endpoint", bhEndPoints)
}
logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice::: preProcessRequest ****")
}
@@ -130,6 +130,10 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
+ //set shared or non shared value from sliceProfile object in request
+ String additionalParams = execution.getVariable("sliceParams")
+ //Get resourceSharingLevel from sliceProfile
+ String serviceFunction = jsonUtil.getJsonValue(additionalParams, "sliceProfile.resourceSharingLevel")
String serviceInstanceName = "nssi_"+execution.getVariable("nsstName")
ServiceInstance si = new ServiceInstance()
si.setServiceInstanceId(execution.getVariable("nssiServiceInstanceId"))
@@ -141,6 +145,7 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
si.setModelVersionId(execution.getVariable("modelUuid"))
si.setEnvironmentContext(environmentContext)
si.setWorkloadContext(workloadContext)
+ si.setServiceFunction(serviceFunction)
logger.debug("AAI service Instance Request Payload : "+si.toString())
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(serviceType).serviceInstance(serviceInstanceId))
getAAIClient().create(uri, si)
@@ -225,7 +230,7 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
logger.debug(("Service Vnfs JSON: "+jsonUtil.getJsonValue(json, "serviceResources.serviceVnfs")))
List serviceVnfs = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(json, "serviceResources.serviceVnfs"))
String networkServiceVnfJson = serviceVnfs.get(0)
- String vnfInstanceName = (jsonUtil.getJsonValue(networkServiceVnfJson, "modelInfo.modelInstanceName")).trim() ?: ""
+ String vnfInstanceName = (jsonUtil.getJsonValue(networkServiceVnfJson, "modelInfo.modelInstanceName")).replace(" ","") ?: ""
execution.setVariable("vnfInstanceName", vnfInstanceName)
}
@@ -420,8 +425,8 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
String bh_routeId = UUID.randomUUID().toString()
execution.setVariable("coreEp_ID_bh", bh_routeId)
String role = "CN"
- String cnIpAddress = jsonUtil.getJsonValue(bh_endpoint, "IpAddress")
- String LogicalLinkId = jsonUtil.getJsonValue(bh_endpoint, "LogicalLinkId")
+ String cnIpAddress = jsonUtil.getJsonValue(bh_endpoint, "ipAddress")
+ String LogicalLinkId = jsonUtil.getJsonValue(bh_endpoint, "logicInterfaceId")
String nextHopInfo = jsonUtil.getJsonValue(bh_endpoint, "nextHopInfo")
NetworkRoute bh_ep = new NetworkRoute()
logger.debug("bh_endpoint: {}, bh_routeId: {}, cnIpAddress: {}, role: {}, LogicalLinkId: {}, nextHopInfo: {}, bh_ep: {}", bh_endpoint, bh_routeId, cnIpAddress, role, LogicalLinkId, nextHopInfo, bh_ep)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy
index b3c99c6e9a..61528de793 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSlice.groovy
@@ -80,14 +80,7 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: preProcessRequest ****")
//Get NSSI Solutions
String nssisolutions = execution.getVariable("solutions")
-
- //Get First Object
- List<String> nssiSolutionList = jsonUtil.StringArrayToList(nssisolutions)
-
- logger.debug("nssiSolutionList : "+nssiSolutionList)
-
- String nssiId = jsonUtil.getJsonValue(nssiSolutionList.get(0), "NSSIId")
- logger.debug("NSSIId : "+nssiId)
+ String nssiId = jsonUtil.getJsonValue(nssisolutions, "NSSIId")
if (isBlank(nssiId)) {
String msg = "solution nssiId is null"
@@ -98,12 +91,20 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
}
String sNssaiListAsString = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "snssaiList")
- logger.debug("sNssaiListAsString "+sNssaiListAsString)
List<String> sNssaiList = jsonUtil.StringArrayToList(sNssaiListAsString)
- logger.debug("sNssaiList "+sNssaiList)
String sNssai = sNssaiList.get(0)
execution.setVariable("sNssai", sNssai)
- logger.debug("sNssai: "+sNssai)
+
+ //Setting this value in Map
+ Map<String, Object> spiWithsNssaiAndOrchStatus = new LinkedHashMap<>()
+ spiWithsNssaiAndOrchStatus.put("snssai", sNssai)
+ spiWithsNssaiAndOrchStatus.put("status", "created")
+
+ List <Map<String, Object>> spiWithsNssaiAndOrchStatusList = new ArrayList<>();
+ spiWithsNssaiAndOrchStatusList.add(spiWithsNssaiAndOrchStatus)
+
+ execution.setVariable("snssaiAndOrchStatusList", spiWithsNssaiAndOrchStatusList)
+ logger.debug("service Profile's NSSAI And Orchestration Status: "+spiWithsNssaiAndOrchStatus)
String serviceType = execution.getVariable("subscriptionServiceType")
execution.setVariable("serviceType", serviceType)
@@ -125,79 +126,77 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
String networkServiceInstanceId =""
if(nsi.isPresent()) {
List<Relationship> relationshipList = nsi.get().getRelationshipList()?.getRelationship()
- List spiWithsNssaiAndOrchStatusList = new ArrayList<>()
+
+ List spiWithsNssaiAndOrchStatusList = execution.getVariable("snssaiAndOrchStatusList")
+
+ if(spiWithsNssaiAndOrchStatusList == null) {
+ spiWithsNssaiAndOrchStatusList = new ArrayList<>();
+ }
for (Relationship relationship : relationshipList) {
String relatedTo = relationship.getRelatedTo()
- if (relatedTo == "service-instance") {
+ if ("service-instance".equals(relatedTo)) {
List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
List<RelatedToProperty> relatedToPropertyList = relationship.getRelatedToProperty()
for (RelationshipData relationshipData : relationshipDataList) {
- if (relationshipData.getRelationshipKey() == "service-instance.service-instance-id") {
+ if ("service-instance.service-instance-id".equals(relationshipData.getRelationshipKey())) {
logger.debug("**** service-instance.service-instance-id 1 :: getServiceInstanceRelationships :: "+ relationshipData.getRelationshipValue())
- execution.setVariable("networkServiceInstanceId", relationshipData.getRelationshipValue())
- }
- }
- for (RelatedToProperty relatedToProperty : relatedToPropertyList) {
- if (relatedToProperty.getPropertyKey() == "service-instance.service-instance-name") {
- execution.setVariable("networkServiceInstanceName", relatedToProperty.getPropertyValue())
- }
- }
- }
- //If related to is allotted-Resource
- if (relatedTo == "allotted-resource") {
- //get slice Profile Instance Id from allotted resource in list by nssi
- List<String> sliceProfileInstanceIdList = new ArrayList<>()
- List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
- for (RelationshipData relationshipData : relationshipDataList) {
- if (relationshipData.getRelationshipKey() == "service-instance.service-instance-id") {
- sliceProfileInstanceIdList.add(relationshipData.getRelationshipValue())
- }
- }
- for (String sliceProfileServiceInstanceId : sliceProfileInstanceIdList) {
- String errorSliceProfileMsg = "Slice Profile Service Instance was not found in aai"
-
- //Query Slice Profile Service Instance From AAI by sliceProfileServiceInstanceId
- AAIResultWrapper sliceProfileInstanceWrapper = queryAAI(execution, Types.SERVICE_INSTANCE, sliceProfileServiceInstanceId, errorSliceProfileMsg)
- Optional<ServiceInstance> sliceProfileServiceInstance = sliceProfileInstanceWrapper.asBean(ServiceInstance.class)
- if (sliceProfileServiceInstance.isPresent()) {
- String orchestrationStatus= sliceProfileServiceInstance.get().getOrchestrationStatus()
- String sNssai = sliceProfileServiceInstance.get().getSliceProfiles().getSliceProfile().get(0).getSNssai()
- if(sNssai.equals(execution.getVariable("sNssai"))) {
- orchestrationStatus = execution.getVariable("oStatus")
- //Slice Profile Service Instance to be updated in AAI
- execution.setVariable("sliceProfileServiceInstance", sliceProfileServiceInstance)
- }
- Map<String, Object> spiWithsNssaiAndOrchStatus = new LinkedHashMap<>()
- spiWithsNssaiAndOrchStatus.put("snssai", sNssai)
- spiWithsNssaiAndOrchStatus.put("status", orchestrationStatus)
- spiWithsNssaiAndOrchStatusList.add(spiWithsNssaiAndOrchStatus)
- logger.debug("service Profile's NSSAI And Orchestration Status: "+spiWithsNssaiAndOrchStatus)
+ //Query Every related Service Instance From AAI by service Instance ID
+ AAIResultWrapper instanceWrapper = queryAAI(execution, Types.SERVICE_INSTANCE, relationshipData.getRelationshipValue(), "No Instance Present")
+ Optional<ServiceInstance> relatedServiceInstance = instanceWrapper.asBean(ServiceInstance.class)
+ if (relatedServiceInstance.isPresent()) {
+ ServiceInstance relatedServiceInstanceObj = relatedServiceInstance.get()
+
+ String role = relatedServiceInstanceObj.getServiceRole();
+
+ if(role == null || role.isEmpty()) {
+ networkServiceInstanceId = relatedServiceInstanceObj.getServiceInstanceId()
+ networkServiceInstanceName = relatedServiceInstanceObj.getServiceInstanceName()
+
+ logger.debug("networkServiceInstanceId: {} networkServiceInstanceName: {} ",networkServiceInstanceId, networkServiceInstanceName)
+
+ execution.setVariable("networkServiceInstanceId", networkServiceInstanceId)
+ execution.setVariable("networkServiceInstanceName", networkServiceInstanceName)
+
+ } else if("slice-profile-instance".equals(role)) {
+
+ String orchestrationStatus= relatedServiceInstanceObj.getOrchestrationStatus()
+ String sNssai = relatedServiceInstanceObj.getEnvironmentContext()
+ if(sNssai.equals(execution.getVariable("sNssai"))) {
+ orchestrationStatus = execution.getVariable("oStatus")
+ //Slice Profile Service Instance to be updated in AAI
+ execution.setVariable("sliceProfileServiceInstance", relatedServiceInstanceObj)
+ }
+
+ Map<String, Object> spiWithsNssaiAndOrchStatus = new LinkedHashMap<>()
+ spiWithsNssaiAndOrchStatus.put("snssai", sNssai)
+ spiWithsNssaiAndOrchStatus.put("status", orchestrationStatus)
+ spiWithsNssaiAndOrchStatusList.add(spiWithsNssaiAndOrchStatus)
+ logger.debug("service Profile's NSSAI And Orchestration Status: "+spiWithsNssaiAndOrchStatus)
+ }
+
+ }
}
+
}
+
}
}
execution.setVariable("snssaiAndOrchStatusList", spiWithsNssaiAndOrchStatusList)
}
-
logger.debug("NSSI Id: ${serviceInstanceId}, network Service Instance Id: ${networkServiceInstanceId}, serviceName: ${networkServiceInstanceName}")
-
//Get ServiceInstance Relationships
getServiceInstanceRelationships(execution)
-
//Get Vnf Relationships
getVnfRelationships(execution)
logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: getNetworkInstanceAssociatedWithNssiId ****")
- }
+ }
private void getServiceInstanceRelationships(DelegateExecution execution) {
-
- logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: getServiceInstanceRelationships ****")
-
+ logger.debug(Prefix +" **** Enter DoAllocateCoreSharedSlice ::: getServiceInstanceRelationships ****")
String serviceInstanceId = execution.getVariable("networkServiceInstanceId")
-
String errorMsg = "query Network Service Instance from AAI failed"
AAIResultWrapper wrapper = queryAAI(execution, Types.SERVICE_INSTANCE, serviceInstanceId, errorMsg)
Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
@@ -208,47 +207,45 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
List<Relationship> relationshipList = si.get().getRelationshipList()?.getRelationship()
for (Relationship relationship : relationshipList) {
String relatedTo = relationship.getRelatedTo()
- if (relatedTo == "owning-entity") {
+ if (("owning-entity").equals(relatedTo)) {
List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
for (RelationshipData relationshipData : relationshipDataList) {
- if (relationshipData.getRelationshipKey() == "owning-entity.owning-entity-id") {
+ if (("owning-entity.owning-entity-id").equals(relationshipData.getRelationshipKey())) {
execution.setVariable("owningEntityId", relationshipData.getRelationshipValue())
}
}
- } else if (relatedTo == "generic-vnf") {
+ } else if (("generic-vnf").equals(relatedTo)) {
List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
List<RelatedToProperty> relatedToPropertyList = relationship.getRelatedToProperty()
//Get VnfId
for (RelationshipData relationshipData : relationshipDataList) {
- if (relationshipData.getRelationshipKey() == "generic-vnf.vnf-id") {
+ if (("generic-vnf.vnf-id").equals(relationshipData.getRelationshipKey())) {
execution.setVariable("vnfId", relationshipData.getRelationshipValue())
}
}
-
//Get Vnf Name Check If necessary
for (RelatedToProperty relatedToProperty : relatedToPropertyList) {
- if (relatedToProperty.getPropertyKey() == "generic-vnf.vnf-name") {
+ if (("generic-vnf.vnf-name").equals(relatedToProperty.getPropertyKey())) {
execution.setVariable("vnfName", relatedToProperty.getPropertyValue())
}
}
- } else if (relatedTo == "project") {
+ } else if (("project").equals(relatedTo)) {
List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
for (RelationshipData relationshipData : relationshipDataList) {
- if (relationshipData.getRelationshipKey() == "project.project-name") {
+ if (("project.project-name").equals(relationshipData.getRelationshipKey())) {
execution.setVariable("projectName", relationshipData.getRelationshipValue())
}
}
}
}
-
- logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: getServiceInstanceRelationships ****")
+ logger.debug(Prefix +" **** Exit DoAllocateCoreSharedSlice ::: getServiceInstanceRelationships ****")
}
}
private void getVnfRelationships(DelegateExecution execution) {
- logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: getVnfRelationships ****")
+ logger.debug(Prefix +" **** Enter DoAllocateCoreSharedSlice ::: getVnfRelationships ****")
String msg = "query Generic Vnf from AAI failed"
try {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(execution.getVariable('vnfId')))
@@ -261,33 +258,34 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
List<Relationship> relationshipList = vnf.get().getRelationshipList()?.getRelationship()
for (Relationship relationship : relationshipList) {
String relatedTo = relationship.getRelatedTo()
- if (relatedTo == "tenant") {
+ if (("tenant").equals(relatedTo)) {
List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
for (RelationshipData relationshipData : relationshipDataList) {
- if (relationshipData.getRelationshipKey() == "tenant.tenant-id") {
+ if (("tenant.tenant-id").equals(relationshipData.getRelationshipKey())) {
execution.setVariable("tenantId", relationshipData.getRelationshipValue())
}
}
- } else if (relatedTo == "cloud-region") {
+ } else if (("cloud-region").equals(relatedTo)) {
List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
+
for (RelationshipData relationshipData : relationshipDataList) {
- if (relationshipData.getRelationshipKey() == "cloud-region.cloud-owner") {
+ if (("cloud-region.cloud-owner").equals(relationshipData.getRelationshipKey())) {
execution.setVariable("cloudOwner", relationshipData.getRelationshipValue())
- } else if (relationshipData.getRelationshipKey() == "cloud-region.cloud-region-id") {
+ } else if (("cloud-region.cloud-region-id").equals(relationshipData.getRelationshipKey())) {
execution.setVariable("lcpCloudRegionId", relationshipData.getRelationshipValue())
}
}
- } else if (relatedTo == "platform") {
+ } else if (("platform").equals(relatedTo)) {
List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
for (RelationshipData relationshipData : relationshipDataList) {
- if (relationshipData.getRelationshipKey() == "platform.platform-name") {
+ if (("platform.platform-name").equals(relationshipData.getRelationshipKey())) {
execution.setVariable("platformName", relationshipData.getRelationshipValue())
}
}
- } else if (relatedTo == "line-of-business") {
+ } else if (("line-of-business").equals(relatedTo)) {
List<RelationshipData> relationshipDataList = relationship.getRelationshipData()
for (RelationshipData relationshipData : relationshipDataList) {
- if (relationshipData.getRelationshipKey() == "line-of-business.line-of-business-name") {
+ if (("line-of-business.line-of-business-name").equals(relationshipData.getRelationshipKey())) {
execution.setVariable("lineOfBusinessName", relationshipData.getRelationshipValue())
}
}
@@ -301,9 +299,16 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: getVnfRelationships ****")
+ logger.debug(Prefix +" **** Exit DoAllocateCoreSharedSlice ::: getVnfRelationships ****")
}
+ /**
+ * query AAI
+ * @param execution
+ * @param aaiObjectName
+ * @param instanceId
+ * @return AAIResultWrapper
+ */
private AAIResultWrapper queryAAI(DelegateExecution execution, AAIObjectName aaiObjectName, String instanceId, String errorMsg) {
logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: queryAAI ****")
String globalSubscriberId = execution.getVariable("globalSubscriberId")
@@ -344,9 +349,7 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
public void prepareSOMacroRequestPayload(DelegateExecution execution) {
logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: prepareSOMacroRequestPayLoad ****")
String json = execution.getVariable("serviceVnfs")
- logger.debug(">>>> json "+json)
List<Object> vnfList = mapper.readValue(json, List.class);
- logger.debug("vnfList: "+vnfList)
Map<String,Object> serviceMap = mapper.readValue(execution.getVariable("serviceModelInfo"), Map.class);
ModelInfo serviceModelInfo = new ModelInfo()
serviceModelInfo.setModelType(ModelType.service)
@@ -354,19 +357,12 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
serviceModelInfo.setModelVersionId(serviceMap.get("modelUuid"))
serviceModelInfo.setModelName(serviceMap.get("modelName"))
serviceModelInfo.setModelVersion(serviceMap.get("modelVersion"))
- logger.debug("serviceModelInfo: "+serviceModelInfo)
//List of Vnfs
List<Object> vnfModelInfoList = new ArrayList<>()
Map vnfMap = vnfList.get(0)
- ModelInfo vnfModelInfo = vnfMap.get("modelInfo")
- vnfModelInfo.setModelCustomizationId(vnfModelInfo.getModelCustomizationUuid())
- vnfModelInfo.setModelVersionId(vnfModelInfo.getModelId())
- logger.debug("vnfModelInfo "+vnfModelInfo)
-
//List of VFModules
List<Map<String, Object>> vfModuleList = vnfMap.get("vfModules")
- logger.debug("vfModuleList "+vfModuleList)
//List of VfModules
List<ModelInfo> vfModelInfoList = new ArrayList<>()
@@ -376,16 +372,17 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
ModelInfo vfModelInfo = vfModule.get("modelInfo")
vfModelInfo.setModelCustomizationId(vfModelInfo.getModelCustomizationUuid())
vfModelInfo.setModelVersionId(vfModelInfo.getModelId())
- logger.debug("vfModelInfo "+vfModelInfo)
vfModelInfoList.add(vfModelInfo)
}
+
+ String networkServiceInstanceName = execution.getVariable("networkServiceInstanceName")
//RequestInfo
RequestInfo requestInfo = new RequestInfo()
//Dummy Product FamilyId
requestInfo.setProductFamilyId("test1234")
requestInfo.setSource("VID")
- requestInfo.setInstanceName(execution.getVariable("networkServiceInstanceName"))
+ requestInfo.setInstanceName(networkServiceInstanceName)
requestInfo.setSuppressRollback(false)
requestInfo.setRequestorId("NBI")
@@ -395,10 +392,13 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
serviceParams.add(serviceParamsValues)
//Cloud Configuration
+ String lcpCloudRegionId = execution.getVariable("lcpCloudRegionId")
+ String tenantId = execution.getVariable("tenantId")
+ String cloudOwner = execution.getVariable("cloudOwner")
CloudConfiguration cloudConfiguration = new CloudConfiguration()
- cloudConfiguration.setLcpCloudRegionId(execution.getVariable("lcpCloudRegionId"))
- cloudConfiguration.setTenantId(execution.getVariable("tenantId"))
- cloudConfiguration.setCloudOwner(execution.getVariable("cloudOwner"))
+ cloudConfiguration.setLcpCloudRegionId(lcpCloudRegionId)
+ cloudConfiguration.setTenantId(tenantId)
+ cloudConfiguration.setCloudOwner(cloudOwner)
//VFModules List
List<Map<String, Object>> vfModules = new ArrayList<>()
@@ -415,8 +415,6 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
}
//Vnf intsanceParams
- Map<String, Object> sliceProfile = mapper.readValue(execution.getVariable("sliceProfile"), Map.class);
-
List<Map<String, Object>> vnfInstanceParamsList = new ArrayList<>()
String supportedsNssaiJson= prepareVnfInstanceParamsJson(execution)
@@ -425,13 +423,17 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
vnfInstanceParamsList.add(supportedNssai)
Platform platform = new Platform()
- String platformName = execution.getVariable("platformName")
+ String platformName = execution.getVariable("platformName")
platform.setPlatformName(platformName)
LineOfBusiness lineOfbusiness = new LineOfBusiness()
String lineOfBusinessName = execution.getVariable("lineOfBusinessName")
lineOfbusiness.setLineOfBusinessName(lineOfBusinessName)
+ ModelInfo vnfModelInfo = vnfMap.get("modelInfo")
+ vnfModelInfo.setModelCustomizationId(vnfModelInfo.getModelCustomizationUuid())
+ vnfModelInfo.setModelVersionId(vnfModelInfo.getModelId())
+
//Vnf Values
Map<String, Object> vnfValues = new LinkedHashMap<>()
vnfValues.put("lineOfBusiness", lineOfbusiness)
@@ -449,9 +451,10 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
serviceResources.put("vnfs", vnfModelInfoList)
//Service Values
+ String serviceInstanceName = execution.getVariable("networkServiceInstanceName")
Map<String, Object> serviceValues = new LinkedHashMap<>()
serviceValues.put("modelInfo", serviceModelInfo)
- serviceValues.put("instanceName", execution.getVariable("networkServiceInstanceName"))
+ serviceValues.put("instanceName", serviceInstanceName)
serviceValues.put("resources", serviceResources)
serviceValues.put("instanceParams", serviceParams)
@@ -469,22 +472,26 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
userParams.add(userParamsValues)
//Request Parameters
+ String serviceType = execution.getVariable("serviceType")
RequestParameters requestParameters = new RequestParameters()
requestParameters.setaLaCarte(false)
- requestParameters.setSubscriptionServiceType(execution.getVariable("serviceType"))
+ requestParameters.setSubscriptionServiceType(serviceType)
requestParameters.setUserParams(userParams)
//SubscriberInfo
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
SubscriberInfo subscriberInfo = new SubscriberInfo()
- subscriberInfo.setGlobalSubscriberId(execution.getVariable("globalSubscriberId"))
+ subscriberInfo.setGlobalSubscriberId(globalSubscriberId)
//Owning Entity
+ String owningEntityId = execution.getVariable("owningEntityId")
OwningEntity owningEntity = new OwningEntity()
- owningEntity.setOwningEntityId(execution.getVariable("owningEntityId"))
+ owningEntity.setOwningEntityId(owningEntityId)
//Project
+ String projectName = execution.getVariable("projectName")
Project project = new Project()
- project.setProjectName(execution.getVariable("projectName"))
+ project.setProjectName(projectName)
RequestDetails requestDetails = new RequestDetails()
requestDetails.setModelInfo(serviceModelInfo)
@@ -500,17 +507,16 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
String requestPayload = mapper.writeValueAsString(requestDetailsMap)
logger.debug("requestDetails "+requestPayload)
execution.setVariable("requestPayload", requestPayload)
+
logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: prepareSOMacroRequestPayLoad ****")
}
private String prepareVnfInstanceParamsJson(DelegateExecution execution) {
- logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: prepareVnfInstanceParamsJson ****")
+ logger.debug(Prefix +" **** Enter DoAllocateCoreSharedSlice ::: prepareVnfInstanceParamsJson ****")
List instanceParamsvalues = execution.getVariable("snssaiAndOrchStatusList")
Map<String, Object> nSsai= new LinkedHashMap<>()
nSsai.put("sNssai", instanceParamsvalues)
String supportedsNssaiJson = mapper.writeValueAsString(nSsai)
- //SupportedNssai
- logger.debug("**** supportedsNssaiJson**** "+supportedsNssaiJson)
logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: prepareVnfInstanceParamsJson ****")
return supportedsNssaiJson
}
@@ -519,9 +525,13 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: sendPutRequestToSOMacro ****")
try {
String msoEndpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution)
- String url = msoEndpoint+"/serviceInstantiation/v7/serviceInstances/"+execution.getVariable("networkServiceInstanceId")+"/vnfs/"+execution.getVariable("vnfId")
+ String networkServiceInstanceId = execution.getVariable("networkServiceInstanceId")
+ String vnfId = execution.getVariable("vnfId")
+ String url = msoEndpoint+"/serviceInstantiation/v7/serviceInstances/"+networkServiceInstanceId+"/vnfs/"+vnfId
String requestBody = execution.getVariable("requestPayload")
- String encodeString = "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA=="
+ String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
+ String basicAuth = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
+ String encodeString = utils.getBasicAuth(basicAuth, msoKey)
logger.debug("msoEndpoint: "+msoEndpoint +" "+ "url: "+url +" requestBody: "+requestBody +" "+ "encodeString: "+encodeString)
HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO)
httpClient.addAdditionalHeader("Authorization", encodeString)
@@ -531,24 +541,28 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e
} catch (any) {
- String msg = Prefix+" Exception in DoAllocateCoreSharedSlice " + any.getCause()
+ String msg = Prefix+" Exception in DoAllocate Shared " + any.getCause()
logger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: sendPostRequestToSOMacro ****")
}
+ /**
+ * Handle SO Response for PUT and prepare update operation status
+ * @param execution
+ */
private void handleSOResponse(Response httpResponse, DelegateExecution execution){
logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: handleSOResponse ****")
+
int soResponseCode = httpResponse.getStatus()
logger.debug("soResponseCode : "+soResponseCode)
if (soResponseCode >= 200 && soResponseCode < 204 && httpResponse.hasEntity()) {
String soResponse = httpResponse.readEntity(String.class)
logger.debug("soResponse: "+soResponse)
- logger.debug("soResponse JsonUtil: "+jsonUtil.getJsonValue(soResponse, "requestReferences.requestId"))
- def macroOperationId = jsonUtil.getJsonValue(soResponse, "requestReferences.requestId")
- def requestSelfLink = jsonUtil.getJsonValue(soResponse, "requestReferences.requestSelfLink")
+ String macroOperationId = jsonUtil.getJsonValue(soResponse, "requestReferences.requestId")
+ String requestSelfLink = jsonUtil.getJsonValue(soResponse, "requestReferences.requestSelfLink")
execution.setVariable("macroOperationId", macroOperationId)
execution.setVariable("requestSelfLink", requestSelfLink)
execution.setVariable("isSOTimeOut", "no")
@@ -564,10 +578,11 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
public void getSOPUTProgress(DelegateExecution execution) {
logger.debug(Prefix+ " **** Enter DoAllocateCoreSharedSlice ::: getSOPUTProgress ****")
String url= execution.getVariable("requestSelfLink")
- logger.debug("url "+url)
HttpClient httpClient = getHttpClientFactory().newJsonClient(new URL(url), ONAPComponents.SO)
- //Hardcoding for now, will be updated in next patch
- httpClient.addAdditionalHeader("Authorization", "Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==")
+ String msoKey = UrnPropertiesReader.getVariable("mso.msoKey", execution)
+ String basicAuth = UrnPropertiesReader.getVariable("mso.adapters.po.auth", execution)
+ String encodeString = utils.getBasicAuth(basicAuth, msoKey)
+ httpClient.addAdditionalHeader("Authorization", encodeString)
httpClient.addAdditionalHeader("Accept", "application/json")
Response httpResponse = httpClient.get()
logger.debug("httpResponse "+httpResponse)
@@ -586,71 +601,80 @@ class DoAllocateCoreSharedSlice extends AbstractServiceTaskProcessor {
logger.debug(Prefix+ " **** Exit DoAllocateCoreSharedSlice ::: getSOPUTProgress ****")
}
- public void timeDelay(DelegateExecution execution) {
+ public void timeDelay() {
try {
logger.debug(Prefix+ " **** DoAllocateCoreSharedSlice ::: timeDelay going to sleep for 5 sec")
Thread.sleep(5000)
- logger.debug("**** DoAllocateCoreNonSharedSlice ::: timeDelay wakeup after 5 sec")
+ logger.debug("**** DoActivateCoreNSSI ::: timeDelay wakeup after 5 sec")
} catch(InterruptedException e) {
logger.error(Prefix+ " **** DoAllocateCoreSharedSlice ::: timeDelay exception" + e)
}
- }
+ }
void prepareUpdateResourceOperationStatus(DelegateExecution execution) {
logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: prepareUpdateResourceOperationStatus ****")
//Prepare Update Status for PUT failure and success
- if("COMPLETED".equals(execution.getVariable("requestState"))) {
+ if(execution.getVariable("isTimeOut").equals("YES")) {
+ logger.debug("TIMEOUT - SO PUT Failure")
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SO PUT Failure")
+ } else {
execution.setVariable("progress", "100")
execution.setVariable("status", "finished")
- execution.setVariable("operationContent", "AllocteCoreNSSI successful.")
- logger.debug("Success ,result:${execution.getVariable("result")}, reason: ${execution.getVariable("reason")}")
- } else {
- logger.debug("SO PUT Failure")
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "SO PUT Failure")
+ execution.setVariable("operationContent", "AllocteCoreNSSI Shared successful.")
+ logger.debug("prepareFailureStatus,result:${execution.getVariable("result")}, reason: ${execution.getVariable("reason")}")
}
setResourceOperationStatus(execution)
logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: prepareUpdateResourceOperationStatus ****")
}
+ /**
+ * prepare ResourceOperation status
+ * @param execution
+ * @param operationType
+ */
private void setResourceOperationStatus(DelegateExecution execution) {
logger.debug(Prefix+" **** Enter DoAllocateCoreSharedSlice ::: setResourceOperationStatus ****")
- String serviceId = execution.getVariable("nssiId")
+ String serviceId = execution.getVariable("nsiId")
String jobId = execution.getVariable("jobId")
- String nsiId = execution.getVariable("nsiId")
- String operationType = execution.getVariable("operationType")
- logger.debug("serviceId: "+serviceId +" "+ " jobId: "+jobId +" "+ " nsiId: "+nsiId+" nssiId: "+nssiId+" operationType: "+operationType)
+ String nssiId = execution.getVariable("nssiId")
+ String operationType = "ALLOCATE"
+ String modelUuid= execution.getVariable("modelUuid")
ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
resourceOperationStatus.setServiceId(serviceId)
+ resourceOperationStatus.setJobId(jobId)
resourceOperationStatus.setOperationId(jobId)
- resourceOperationStatus.setResourceTemplateUUID(nsiId)
- resourceOperationStatus.setResourceInstanceID(nssiId)
+ resourceOperationStatus.setResourceTemplateUUID(modelUuid)
+ resourceOperationStatus.setResourceInstanceID(nssiId)
resourceOperationStatus.setOperType(operationType)
- resourceOperationStatus.setStatus("finished")
- resourceOperationStatus.setProgress("100")
- resourceOperationStatus.setStatusDescription("Core Allocate successful")
+ resourceOperationStatus.setStatus(execution.getVariable("status"))
+ resourceOperationStatus.setProgress(execution.getVariable("progress"))
+ resourceOperationStatus.setStatusDescription(execution.getVariable("statusDescription"))
requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus)
logger.debug(Prefix+" **** Exit DoAllocateCoreSharedSlice ::: setResourceOperationStatus ****")
}
void prepareFailedOperationStatusUpdate(DelegateExecution execution){
logger.debug(Prefix + " **** Enter DoAllocateCoreSharedSlice ::: prepareFailedOperationStatusUpdate ****")
- String serviceId = execution.getVariable("nsiId")
+ String serviceId = execution.getVariable("nsiId")
String jobId = execution.getVariable("jobId")
- String nsiId = execution.getVariable("nsiId")
+ String nssiId = execution.getVariable("nssiId")
String operationType = "ALLOCATE"
- logger.debug("serviceId: "+serviceId +" "+ " jobId: "+jobId +" "+ " nsiId: "+nsiId+" operationType: "+operationType)
+ //modelUuid
String modelUuid= execution.getVariable("modelUuid")
+ logger.debug("serviceId: {}, jobId: {}, nssiId: {}, operationType: {}.", serviceId, jobId, nssiId, operationType)
ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
resourceOperationStatus.setServiceId(serviceId)
resourceOperationStatus.setJobId(jobId)
resourceOperationStatus.setOperationId(jobId)
+ resourceOperationStatus.setResourceInstanceID(nssiId)
resourceOperationStatus.setResourceTemplateUUID(modelUuid)
resourceOperationStatus.setOperType(operationType)
resourceOperationStatus.setProgress("0")
resourceOperationStatus.setStatus("failed")
- resourceOperationStatus.setStatusDescription("Core NSSI Allocate Failed")
+ resourceOperationStatus.setStatusDescription("Core NSSI Shared Allocate Failed")
requestDBUtil.prepareUpdateResourceOperationStatus(execution, resourceOperationStatus)
logger.debug(Prefix + " **** Exit DoAllocateCoreSharedSlice ::: prepareFailedOperationStatusUpdate ****")
}
-} \ No newline at end of file
+}
+
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy
index 9221067cce..dd168519e5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy
@@ -297,7 +297,7 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor {
List<String> linkStrList = jsonUtil.StringArrayToList(linkArrayStr)
for (String linkStr : linkStrList) {
- String linkId = jsonUtil.getJsonValue(linkStr, "id")
+ String linkId = jsonUtil.getJsonValue(linkStr, "name")
if (isBlank(linkId)) {
linkId = "tn-nssmf-" + UUID.randomUUID().toString()
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy
index 8695946fd6..8859af25f6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy
@@ -28,6 +28,8 @@ import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils
import org.onap.so.bpmn.common.scripts.OofUtils
import org.onap.so.bpmn.common.scripts.RequestDBUtil
import org.onap.so.bpmn.core.json.JsonUtils
+import org.onap.so.beans.nsmf.PerfReqEmbb
+import org.onap.so.beans.nsmf.PerfReq
import org.onap.so.db.request.beans.ResourceOperationStatus
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -47,6 +49,9 @@ import org.onap.aai.domain.yang.Relationship
import org.onap.aai.domain.yang.ServiceInstance
import org.onap.aai.domain.yang.SliceProfile
import org.onap.aai.domain.yang.SliceProfiles
+import org.onap.aai.domain.yang.AllottedResource
+import org.onap.aai.domain.yang.AllottedResources
+import org.onap.aaiclient.client.graphinventory.entities.uri.Depth
import org.onap.aaiclient.client.aai.entities.uri.AAISimplePluralUri
import com.fasterxml.jackson.annotation.JsonInclude
import com.fasterxml.jackson.databind.SerializationFeature
@@ -231,8 +236,28 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
Map<String, Object> profileInfo = objectMapper.readValue(execution.getVariable("RANSliceProfile"), Map.class)
ServiceInstance ranSliceProfileInstance = execution.getVariable("ranSliceProfileInstance")
profileInfo.put("sST",ranSliceProfileInstance.getServiceType())
- profileInfo.put("snssaiList",ranSliceProfileInstance.getEnvironmentContext())
- profileInfo.put("plmnIdList",ranSliceProfileInstance.getServiceInstanceLocationId())
+ profileInfo.put("snssaiList",execution.getVariable("snssaiList"))
+ profileInfo.put("plmnIdList",Arrays.asList(ranSliceProfileInstance.getServiceInstanceLocationId()))
+ profileInfo.put("uEMobilityLevel",profileInfo.get("ueMobilityLevel"))
+ profileInfo.put("cSAvailabilityTarget",profileInfo.get("csAvailabilityTarget"))
+ profileInfo.put("maxNumberofPDUSession",profileInfo.get("maxNumberOfPDUSession"))
+ profileInfo.put("maxNumberofUEs",profileInfo.get("maxNumberOfUEs"))
+
+ PerfReq perfReq = new PerfReq();
+ List<PerfReqEmbb> perfReqEmbbs = new ArrayList<>();
+ PerfReqEmbb perfReqEmbb = new PerfReqEmbb();
+ perfReqEmbb.setExpDataRateDL(profileInfo.get("expDataRateDL"));
+ perfReqEmbb.setExpDataRateUL(profileInfo.get("expDataRateUL"));
+ perfReqEmbbs.add(perfReqEmbb);
+ perfReq.setPerfReqEmbbList(perfReqEmbbs);
+ profileInfo.put("perfReq",perfReq)
+
+ profileInfo.remove("maxNumberOfUEs")
+ profileInfo.remove("resourceVersion")
+ profileInfo.remove("csAvailabilityTarget")
+ profileInfo.remove("ueMobilityLevel")
+ profileInfo.remove("maxNumberOfPDUSession")
+ profileInfo.remove("profileId")
String modelUuid = ranSliceProfileInstance.getModelVersionId()
String modelInvariantUuid = ranSliceProfileInstance.getModelInvariantId()
String modelName = execution.getVariable("servicename")
@@ -308,23 +333,25 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
logger.debug("getNssisFromAai ranConstituentNssis : "+ranConstituentNssis.toString())
ranConstituentNssis.each { key, val ->
switch(key) {
- case "AN-NF":
+ case "AN_NF":
execution.setVariable("ANNF_NSSI", val.getServiceInstanceId())
execution.setVariable("ANNF_nssiName", val.getServiceInstanceName())
execution.setVariable("ANNF_modelInvariantUuid", val.getModelInvariantId())
execution.setVariable("ANNF_modelUuid", val.getModelVersionId())
break
- case "TN-FH":
+ case "TN_FH":
execution.setVariable("TNFH_NSSI", val.getServiceInstanceId())
execution.setVariable("TNFH_nssiName", val.getServiceInstanceName())
execution.setVariable("TNFH_modelInvariantUuid", val.getModelInvariantId())
execution.setVariable("TNFH_modelUuid", val.getModelVersionId())
+ getConnectionLinks(execution, key, val)
break
- case "TN-MH":
+ case "TN_MH":
execution.setVariable("TNMH_NSSI", val.getServiceInstanceId())
execution.setVariable("TNMH_nssiName", val.getServiceInstanceName())
execution.setVariable("TNMH_modelInvariantUuid", val.getModelInvariantId())
execution.setVariable("TNMH_modelUuid", val.getModelVersionId())
+ getConnectionLinks(execution, key, val)
break
default:
logger.error("No expected match found for current domainType "+ key)
@@ -333,6 +360,50 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
}
}
+
+ private void getConnectionLinks(DelegateExecution execution, String domainType, ServiceInstance instance) {
+ AllottedResources allottedResources = instance.getAllottedResources()
+ if(allottedResources == null) {
+ String msg = "AllottedResourceFromAAI doesn't exist. " + instance
+ logger.debug(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+
+ List<AllottedResource> AllottedResourceList = allottedResources.getAllottedResource()
+ for(AllottedResource allottedResource : AllottedResourceList) {
+ List<Relationship> relationshipList = allottedResource.getRelationshipList().getRelationship()
+ for (Relationship relationship : relationshipList) {
+ String relatedTo = relationship.getRelatedTo()
+ if (relatedTo.toLowerCase() == "logical-link") {
+ String relatioshipurl = relationship.getRelatedLink()
+ String logicalLinkId=
+ relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length())
+ AAIResourcesClient client = new AAIResourcesClient()
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().logicalLink(logicalLinkId))
+ if (!client.exists(uri)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
+ "Resource was not found in aai: ${logicalLinkId}")
+ }
+ AAIResultWrapper wrapper01 = client.get(uri, NotFoundException.class)
+ Optional<org.onap.aai.domain.yang.LogicalLink> resource = wrapper01.asBean(org.onap.aai.domain.yang.LogicalLink.class)
+ if (resource.isPresent()) {
+ org.onap.aai.domain.yang.LogicalLink logicalLinkInstance = resource.get()
+ if(domainType.equalsIgnoreCase("TN-FH"))
+ {
+ execution.setVariable("tranportEp_ID_RU",logicalLinkInstance.getLinkName())
+ execution.setVariable("tranportEp_ID_DUIN",logicalLinkInstance.getLinkName2())
+ }
+ else if(domainType.equalsIgnoreCase("TN-MH"))
+ {
+ execution.setVariable("tranportEp_ID_DUEG",logicalLinkInstance.getLinkName())
+ execution.setVariable("tranportEp_ID_CUIN",logicalLinkInstance.getLinkName2())
+ }
+ }
+ }
+ }
+ }
+ }
+
def createSliceProfiles = { DelegateExecution execution ->
logger.debug(Prefix+"createSliceProfiles method start")
anNssmfUtils.createSliceProfilesInAai(execution)
@@ -446,8 +517,6 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
JsonObject serviceInfo = new JsonObject()
serviceInfo.addProperty("nsiId", execution.getVariable("nsiId"))
- String sST = jsonUtil.getJsonValue(execution.getVariable("sliceProfile"), "sST")
- serviceInfo.addProperty("sST", sST)
serviceInfo.addProperty("PLMNIdList", objectMapper.writeValueAsString(execution.getVariable("plmnIdList")))
serviceInfo.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
serviceInfo.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
@@ -506,13 +575,13 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
logger.debug("getSliceProfilesFromAai ranConstituentSliceProfiles : "+ranConstituentSliceProfiles.toString())
ranConstituentSliceProfiles.each { key, val ->
switch(key) {
- case "AN-NF":
+ case "AN_NF":
execution.setVariable("ANNF_sliceProfileInstanceId", val.getServiceInstanceId())
break
- case "TN-FH":
+ case "TN_FH":
execution.setVariable("TNFH_sliceProfileInstanceId", val.getServiceInstanceId())
break
- case "TN-MH":
+ case "TN_MH":
execution.setVariable("TNMH_sliceProfileInstanceId", val.getServiceInstanceId())
break
default:
@@ -655,7 +724,7 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor {
exceptionUtil.buildAndThrowWorkflowException(execution, 2500,
"Service Instance was not found in aai: ${serviceInstanceId} related to ${instanceId}")
}
- AAIResultWrapper wrapper01 = client01.get(uri01, NotFoundException.class)
+ AAIResultWrapper wrapper01 = client01.get(uri01.depth(Depth.TWO), NotFoundException.class)
Optional<ServiceInstance> serviceInstance = wrapper01.asBean(ServiceInstance.class)
if (serviceInstance.isPresent()) {
ServiceInstance instance = serviceInstance.get()
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy
index bb8e516c3b..10846d4cfa 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy
@@ -28,6 +28,7 @@ import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.core.json.JsonUtils
import com.fasterxml.jackson.databind.ObjectMapper
+import com.google.gson.Gson
import com.google.gson.JsonObject
import com.google.gson.JsonParser
import java.time.Instant
@@ -114,7 +115,7 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor {
logger.debug(Prefix+"createSdnrRequest method start")
String callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.message.endpoint") + "/AsyncSdnrResponse/"+execution.getVariable("msoRequestId")
String modifyAction = execution.getVariable("modifyAction")
- String sdnrRequest = buildSdnrAllocateRequest(execution, modifyAction, "InstantiateRANSlice", callbackUrl)
+ String sdnrRequest = buildSdnrAllocateRequest(execution, modifyAction, "instantiateRANSlice", callbackUrl)
execution.setVariable("createNSSI_sdnrRequest", sdnrRequest)
execution.setVariable("createNSSI_timeout", "PT10M")
execution.setVariable("createNSSI_correlator", execution.getVariable("msoRequestId"))
@@ -152,7 +153,7 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor {
if(action.equals("allocate")) {
sliceProfile = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class)
sliceProfile.put("sliceProfileId", execution.getVariable("sliceProfileId"))
- sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSessions"))
+ sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSession"))
sliceProfile.put("uLThptPerSlice", sliceProfile.get("expDataRateUL"))
sliceProfile.put("dLThptPerSlice", sliceProfile.get("expDataRateDL"))
action = "modify-"+action
@@ -174,9 +175,12 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor {
commonHeader.addProperty("request-id", requestId)
commonHeader.addProperty("sub-request-id", "1")
commonHeader.add("flags", new JsonObject())
- payloadInput.addProperty("sliceProfile", sliceProfile.toString())
+ Gson jsonConverter = new Gson()
+ payloadInput.add("sliceProfile", jsonConverter.toJsonTree(sliceProfile))
payloadInput.addProperty("RANNFNSSIId", execution.getVariable("serviceInstanceID"))
payloadInput.addProperty("callbackURL", callbackUrl)
+ payloadInput.addProperty("globalSubscriberId", execution.getVariable("globalSubscriberId"))
+ payloadInput.addProperty("subscriptionServiceType", execution.getVariable("subscriptionServiceType"))
payload.add("input", payloadInput)
input.add("common-header", commonHeader)
input.addProperty("action", action)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy
index 9440b42124..25cb2f57f6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyTnNssi.groovy
@@ -24,7 +24,11 @@ import com.fasterxml.jackson.databind.ObjectMapper
import groovy.json.JsonSlurper
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.aai.domain.yang.*
+import org.onap.aai.domain.yang.AllottedResource
+import org.onap.aai.domain.yang.AllottedResources
+import org.onap.aai.domain.yang.NetworkPolicy
+import org.onap.aai.domain.yang.ServiceInstance
+import org.onap.aai.domain.yang.SliceProfile
import org.onap.aaiclient.client.aai.AAIResourcesClient
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
@@ -38,7 +42,9 @@ import org.onap.so.db.request.beans.ResourceOperationStatus
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import static org.apache.commons.lang3.StringUtils.*
+import static org.apache.commons.lang3.StringUtils.isBlank
+import static org.apache.commons.lang3.StringUtils.isEmpty
+import static org.apache.commons.lang3.StringUtils.isNotBlank
public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
String Prefix = "TNMOD_"
@@ -150,26 +156,31 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(Types.SERVICE_INSTANCE.getFragment(serviceInstanceId))
try {
- if (resourceClient.exists(ssServiceuri)) {
- ServiceInstance ss = resourceClient.get(ServiceInstance.class, ssServiceuri)
-
- AllottedResources ars = ss.getAllottedResources()
- List<AllottedResource> arList = ars.getAllottedResource()
- List<String> arIdList = new ArrayList<>()
- Map<String, String> policyMap = new HashMap<>()
- Map<String, List<String>> logicalLinksMap = new HashMap<>()
- for (AllottedResource ar : arList) {
- String arId = ar.getId()
- arIdList.add(arId)
- String policyId = tnNssmfUtils.getPolicyIdFromAr(execution, serviceInstanceId, arId, true)
- policyMap.put(arId, policyId)
- List<String> logicalLinkList = tnNssmfUtils.getLogicalLinkNamesFromAr(execution,
- serviceInstanceId, arId, true)
- logicalLinksMap.put(arId, logicalLinkList)
+ Optional<ServiceInstance> ssOpt = resourceClient.get(ServiceInstance.class, ssServiceuri)
+ if (ssOpt.isPresent()) {
+ ServiceInstance ss = ssOpt.get()
+ AllottedResources ars = tnNssmfUtils.getAllottedResourcesFromAai(execution, serviceInstanceId, true)
+ if (ars != null) {
+ List<AllottedResource> arList = ars.getAllottedResource()
+ List<String> arIdList = new ArrayList<>()
+ Map<String, String> policyMap = new HashMap<>()
+ Map<String, List<String>> logicalLinksMap = new HashMap<>()
+ for (AllottedResource ar : arList) {
+ String arId = ar.getId()
+ arIdList.add(arId)
+ String policyId = tnNssmfUtils.getPolicyIdFromAr(execution, serviceInstanceId, arId, true)
+ policyMap.put(arId, policyId)
+ List<String> logicalLinkList = tnNssmfUtils.getLogicalLinkNamesFromAr(execution,
+ serviceInstanceId, arId, true)
+ logicalLinksMap.put(arId, logicalLinkList)
+ }
+ execution.setVariable("arIdList", arIdList)
+ execution.setVariable("arPolicyMap", policyMap)
+ execution.setVariable("arLogicalLinkMap", logicalLinksMap)
+ } else {
+ logger.error("ERROR: getExistingServiceInstance: getAllottedResources() returned null. ss=" + ss
+ .toString())
}
- execution.setVariable("arIdList", arIdList)
- execution.setVariable("arPolicyMap", policyMap)
- execution.setVariable("arLogicalLinkMap", logicalLinksMap)
} else {
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai to " +
"associate allotted resource for service :" + serviceInstanceId)
@@ -177,7 +188,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e;
} catch (Exception ex) {
- String msg = "Exception in getServiceInstance. " + ex.getMessage()
+ String msg = "Exception in getExistingServiceInstance. " + ex.getMessage()
logger.debug(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
@@ -195,6 +206,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
//ss.setServiceInstanceId(ssInstanceId)
String serviceStatus = "modified"
ss.setOrchestrationStatus(serviceStatus)
+ ss.setEnvironmentContext("tn")
AAIResourcesClient client = getAAIClient()
AAIResourceUri uri = AAIUriFactory.createResourceUri(
AAIFluentTypeBuilder.business()
@@ -279,14 +291,15 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
void updateLogicalLinksInNetwork(DelegateExecution execution, String networkJsonStr) {
try {
- String arId = getValidArId(jsonUtil.getJsonValue(networkJsonStr, "id"))
+ String arId = getValidArId(execution, jsonUtil.getJsonValue(networkJsonStr, "id"))
String linkArrayStr = jsonUtil.getJsonValue(networkJsonStr, "connectionLinks")
updateLogicalLinksInAr(execution, arId, linkArrayStr)
} catch (BpmnError e) {
throw e
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
- "Exception in updateLogicalLinksInNetwork" + ex.getMessage())
+ String msg = String.format("ERROR: updateLogicalLinksInNetwork: exception: %s", ex.getMessage())
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
}
}
@@ -351,7 +364,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
try {
int maxBw = getMaxBw(execution)
- String arId = getValidArId(jsonUtil.getJsonValue(networkJsonStr, "id"))
+ String arId = getValidArId(execution, jsonUtil.getJsonValue(networkJsonStr, "id"))
Map<String, String> policyMap = execution.getVariable("arPolicyMap")
String policyId = policyMap.get(arId)
if (isBlank(policyId)) {
@@ -365,8 +378,9 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
} catch (BpmnError e) {
throw e
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000,
- "Exception in updateNetworkPolicy" + ex.getMessage())
+ String msg = String.format("ERROR: updateNetworkPolicy: exception: %s", ex.getMessage())
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
}
}
@@ -428,7 +442,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
try {
String serviceInstanceId = execution.getVariable("sliceServiceInstanceId")
- String sdncRequest = tnNssmfUtils.buildSDNCRequest(execution, serviceInstanceId, "modify")
+ String sdncRequest = tnNssmfUtils.buildSDNCRequest(execution, serviceInstanceId, "update")
execution.setVariable("TNNSSMF_SDNCRequest", sdncRequest)
logger.debug("Outgoing SDNCRequest is: \n" + sdncRequest)
@@ -483,6 +497,7 @@ public class DoModifyTnNssi extends AbstractServiceTaskProcessor {
ResourceOperationStatus roStatus = tnNssmfUtils.buildRoStatus(modelUuid, ssInstanceId,
jobId, nsiId, operType, status, progress, statusDescription)
+ logger.debug("prepareUpdateJobStatus: roStatus={}", roStatus)
requestDBUtil.prepareUpdateResourceOperationStatus(execution, roStatus)
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
index 4624cdafe9..fc21ed4a5e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy
@@ -22,17 +22,19 @@ package org.onap.so.bpmn.infrastructure.scripts
import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.aai.domain.yang.AllottedResources
import org.onap.aai.domain.yang.LogicalLink
import org.onap.aai.domain.yang.NetworkPolicy
import org.onap.aai.domain.yang.Relationship
import org.onap.aai.domain.yang.ServiceInstance
import org.onap.aaiclient.client.aai.AAIResourcesClient
+import org.onap.aaiclient.client.aai.AAIVersion
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
import org.onap.aaiclient.client.aai.entities.Relationships
+import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
-import org.onap.aaiclient.client.generated.fluentbuilders.Activities
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.common.scripts.MsoUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
@@ -47,7 +49,7 @@ import org.slf4j.LoggerFactory
import static org.apache.commons.lang3.StringUtils.isBlank
class TnNssmfUtils {
- static final String AAI_VERSION = "v23"
+ static final String AAI_VERSION = AAIVersion.LATEST
private static final Logger logger = LoggerFactory.getLogger(TnNssmfUtils.class);
@@ -91,6 +93,9 @@ class TnNssmfUtils {
case "deactivate":
reqAction = "DeactivateTransportSliceInstance"
break
+ case "update":
+ reqAction = "ModifyTransportSliceInstance"
+ break
default:
reqAction = svcAction
}
@@ -433,7 +438,7 @@ class TnNssmfUtils {
return null
}
- return si.modelVersionId()
+ return si.getModelVersionId()
}
AAIResourceUri buildNetworkPolicyUri(String networkPolicyId) {
@@ -456,6 +461,52 @@ class TnNssmfUtils {
return allottedResourceUri
}
+ AAIPluralResourceUri buildAllottedResourcesUri(DelegateExecution execution, String serviceInstanceId) {
+
+ AAIPluralResourceUri arsUri =
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(serviceInstanceId)
+ .allottedResources())
+
+ return arsUri
+ }
+
+ AllottedResources getAllottedResourcesFromAai(DelegateExecution execution, String serviceInstanceId, boolean exceptionOnErr) {
+ AllottedResources res
+ try {
+ AAIResourcesClient client = new AAIResourcesClient()
+
+ AAIPluralResourceUri arsUri = buildAllottedResourcesUri(execution, serviceInstanceId)
+
+ //AAIResultWrapper wrapperAllotted = client.get(arsUri, NotFoundException.class)
+ //Optional<AllottedResources> allAllotted = wrapperAllotted.asBean(AllottedResources.class)
+ //AllottedResources allottedResources = allAllotted.get()
+
+ Optional<AllottedResources> arsOpt = client.get(AllottedResources.class, arsUri)
+ if (arsOpt.isPresent()) {
+ res = arsOpt.get()
+ return res
+ } else {
+ String msg = String.format("ERROR: getAllottedResourcesFromAai: ars not found. nssiId=%s", serviceInstanceId)
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ } catch (BpmnError e) {
+ if (exceptionOnErr) {
+ throw e;
+ }
+ } catch (Exception ex) {
+ if (exceptionOnErr) {
+ String msg = String.format("ERROR: getAllottedResourcesFromAai: %s", ex.getMessage())
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
+ }
+ }
+
+ return res
+ }
String getPolicyIdFromAr(DelegateExecution execution, String serviceInstanceId,
String arId, boolean exceptionOnErr) {
@@ -464,15 +515,15 @@ class TnNssmfUtils {
AAIResourcesClient client = new AAIResourcesClient()
AAIResourceUri arUri = buildAllottedResourceUri(execution, serviceInstanceId, arId)
- List<AAIResourceUri> logicalLinkUriList = getRelationshipUriListInAai(execution, arUri,
+ List<AAIResourceUri> policyUriList = getRelationshipUriListInAai(execution, arUri,
AAIFluentTypeBuilder.Types.NETWORK_POLICY, exceptionOnErr)
- for (AAIResourceUri logicalLinkUri : logicalLinkUriList) {
- Optional<NetworkPolicy> policyOpt = client.get(NetworkPolicy.class, logicalLinkUri)
+ for (AAIResourceUri policyUri : policyUriList) {
+ Optional<NetworkPolicy> policyOpt = client.get(NetworkPolicy.class, policyUri)
if (policyOpt.isPresent()) {
NetworkPolicy policy = policyOpt.get()
return policy.getNetworkPolicyId()
} else {
- String msg = String.format("ERROR: getLogicalLinkNamesFromAr: logicalLinkUri=%s", logicalLinkUri)
+ String msg = String.format("ERROR: getPolicyIdFromAr: arUri=%s", policyUri)
logger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
}
@@ -483,7 +534,7 @@ class TnNssmfUtils {
}
} catch (Exception ex) {
if (exceptionOnErr) {
- String msg = String.format("ERROR: getLogicalLinkNamesFromAr: %s", ex.getMessage())
+ String msg = String.format("ERROR: getPolicyIdFromAr: %s", ex.getMessage())
logger.error(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, msg)
}
@@ -494,7 +545,8 @@ class TnNssmfUtils {
List<AAIResourceUri> getRelationshipUriListInAai(DelegateExecution execution,
- AAIResourceUri uri, Activities.Info info,
+ AAIResourceUri uri,
+ Object info,
boolean exceptionOnErr) {
AAIResourcesClient client = new AAIResourcesClient()
AAIResultWrapper wrapper = client.get(uri);
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy
index fa1cef291e..dfbf93e3f6 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy
@@ -64,7 +64,7 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest {
"sourceModelUuid" : "f3666c56-744e-4055-9f4a-0726460898e0"
}"""
- String sliceParams= """{\r\n\t\"sliceProfile\": {\r\n\t\t\"snssaiList\": [\r\n\t\t\t\"001-100001\"\r\n\t\t],\r\n\t\t\"sliceProfileId\": \"ab9af40f13f721b5f13539d87484098\",\r\n\t\t\"plmnIdList\": [\r\n\t\t\t\"460-00\",\r\n\t\t\t\"460-01\"\r\n\t\t],\r\n\t\t\"perfReq\": {\r\n\t\t\t\"perfReqEmbbList \": [{\r\n\t\t\t\t\"activityFactor\": 50\r\n\t\t\t}]\r\n\t\t},\r\n\t\t\"maxNumberofUEs\": 200,\r\n\t\t\"coverageAreaTAList\": [\r\n\t\t\t\"1\",\r\n\t\t\t\"2\",\r\n\t\t\t\"3\",\r\n\t\t\t\"4\"\r\n\t\t],\r\n\t\t\"latency\": 2,\r\n\t\t\"resourceSharingLevel\": \"non-shared\"\r\n\t},\r\n\t\"endPoints\": [{\r\n\t\t\"IpAdress\": \"\",\r\n\t\t\"LogicalLinkId\": \"\",\r\n\t\t\"nextHopInfo\": \"\"\r\n\t}],\r\n\t\"nsiInfo\": {\r\n\t\t\"nsiId\": \"NSI-M-001-HDBNJ-NSMF-01-A-ZX\",\r\n\t\t\"nsiName\": \"eMBB-001\"\r\n\t},\r\n\t\"scriptName\": \"AN1\"\r\n}"""
+ String sliceParams= """{\r\n\t\"sliceProfile\": {\r\n\t\t\"snssaiList\": [\r\n\t\t\t\"001-100001\"\r\n\t\t],\r\n\t\t\"sliceProfileId\": \"ab9af40f13f721b5f13539d87484098\",\r\n\t\t\"plmnIdList\": [\r\n\t\t\t\"460-00\",\r\n\t\t\t\"460-01\"\r\n\t\t],\r\n\t\t\"perfReq\": {\r\n\t\t\t\"perfReqEmbbList \": [{\r\n\t\t\t\t\"activityFactor\": 50\r\n\t\t\t}]\r\n\t\t},\r\n\t\t\"maxNumberofUEs\": 200,\r\n\t\t\"coverageAreaTAList\": [\r\n\t\t\t\"1\",\r\n\t\t\t\"2\",\r\n\t\t\t\"3\",\r\n\t\t\t\"4\"\r\n\t\t],\r\n\t\t\"latency\": 2,\r\n\t\t\"resourceSharingLevel\": \"non-shared\"\r\n\t},\r\n\t\"endPoint\": {\r\n\t\t\"ipAdress\": \"\",\r\n\t\t\"logicalInterfaceId\": \"\",\r\n\t\t\"nextHopInfo\": \"\"\r\n\t},\r\n\t\"nsiInfo\": {\r\n\t\t\"nsiId\": \"NSI-M-001-HDBNJ-NSMF-01-A-ZX\",\r\n\t\t\"nsiName\": \"eMBB-001\"\r\n\t},\r\n\t\"scriptName\": \"AN1\"\r\n}"""
when(mockExecution.getVariable("serviceInstanceId")).thenReturn("123456")
when(mockExecution.getVariable("networkServiceModelInfo")).thenReturn(networkServiceModelInfo)
@@ -122,6 +122,8 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest {
ObjectMapper objectMapper = new ObjectMapper()
Map<String, Object> serviceCharacteristic = objectMapper.readValue(sliceProfile, Map.class);
+ //provide mock vnfInstance name
+ when(mockExecution.getVariable("vnfInstanceName")).thenReturn("vf00")
DoAllocateCoreNonSharedSlice allocateNssi = new DoAllocateCoreNonSharedSlice()
List characteristicList=allocateNssi.retrieveServiceCharacteristicsAsKeyValue(mockExecution, serviceCharacteristic)
assertEquals(expectedList, characteristicList)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy
index 9068692e30..34945b9135 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreSharedSliceTest.groovy
@@ -59,17 +59,12 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
@Test
void testPreProcessRequest(){
- String solutions = """ [
- {
- "invariantUUID": "y7685f64-5717-4562-b3fc-2c963f66afa6",
- "UUID": "8u785f64-5717-4562-b3fc-2c963f66afa6",
- "NSSIName": "embb-core-ser",
- "NSSIId": "f4485f64-5717-4562-b3fc-2c963f66afa6",
- "matchLevel": {
- "blob":"content"
- }
- }
- ]"""
+ String solutions = """ {
+ "NSSIId": "11c0c52a-d748-48aa-86e3-c783cbf5026f",
+ "invariantUUID": "8ebba719-f815-47e3-8473-c5f0db801356",
+ "NSSIName": "nssi_CN_NSST",
+ "UUID": "70e2b55b-8dca-4ff3-8f47-374c2965b731"
+ }"""
String sliceProfile = "{\r\n \"snssaiList\": [ \r\n \"001-100001\"\r\n ],\r\n \"sliceProfileId\": \"ab9af40f13f721b5f13539d87484098\",\r\n \"plmnIdList\": [\r\n \"460-00\",\r\n \"460-01\"\r\n ],\r\n \"perfReq\": {\r\n \"perfReqEmbbList \": [\r\n {\r\n \"activityFactor\": 50\r\n }\r\n ]\r\n },\r\n \"maxNumberofUEs\": 200, \r\n \"coverageAreaTAList\": [ \r\n \"1\",\r\n \"2\",\r\n \"3\",\r\n \"4\"\r\n ],\r\n \"latency\": 2,\r\n \"resourceSharingLevel\": \"non-shared\" \r\n }"
setUpBaseMockData()
@@ -81,13 +76,13 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
Mockito.verify(mockExecution, times(1)).setVariable(eq("nssiId"), captor.capture())
def nssiId = captor.getValue()
- assertEquals("f4485f64-5717-4562-b3fc-2c963f66afa6", nssiId)
+ assertEquals("11c0c52a-d748-48aa-86e3-c783cbf5026f", nssiId)
Mockito.verify(mockExecution, times(1)).setVariable(eq("sNssai"), captor.capture())
def sNssai = captor.getValue()
assertEquals("001-100001", sNssai)
- Mockito.verify(mockExecution,times(3)).setVariable(captor.capture() as String, captor.capture())
+ Mockito.verify(mockExecution,times(4)).setVariable(captor.capture() as String, captor.capture())
List<ExecutionEntity> values = captor.getAllValues()
assertNotNull(values)
}
@@ -155,6 +150,14 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
//Check Vnf
when(mockExecution.getVariable("vnfId")).thenReturn("eeb66c6f-36bd-47ad-8294-48f46b1aa912")
+ Map<String, Object> spiWithsNssaiAndOrchStatus = new LinkedHashMap<>()
+ spiWithsNssaiAndOrchStatus.put("snssai", "01-5C83F071")
+ spiWithsNssaiAndOrchStatus.put("status", "activated")
+ List <Map<String, Object>> spiWithsNssaiAndOrchStatusList = new ArrayList<>();
+ spiWithsNssaiAndOrchStatusList.add(spiWithsNssaiAndOrchStatus)
+ //snssaiAndOrchStatusList
+ when(mockExecution.getVariable("snssaiAndOrchStatusList")).thenReturn(spiWithsNssaiAndOrchStatusList)
+
AAIResourceUri resourceUri3 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(mockExecution.getVariable("vnfId")))
when(client.exists(resourceUri3)).thenReturn(true)
AAIResultWrapper wrapper3 = new AAIResultWrapper(mockQueryVnf())
@@ -197,10 +200,7 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
snssaiMap.put("snssai", "01-5C83F071")
snssaiMap.put("status", "activated")
snssaiList.add(snssaiMap)
- Map<String, Object> snssaiMap1 = new LinkedHashMap<>()
- snssaiMap1.put("snssai", "01-5B179BD4")
- snssaiMap1.put("status", "activated")
- snssaiList.add(snssaiMap1)
+
assertEquals(snssaiList, captor.getValue())
//Verify Project
@@ -227,12 +227,12 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
void setUpBaseMockData() {
String sliceParams ="""{
- "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
- "snssaiList": [
- "01-5B179BD4"
- ],
- "sliceProfileId": "ab9af40f13f721b5f13539d87484098"
- }"""
+ "nsiId": "NSI-M-001-HDBNJ-NSMF-01-A-ZX",
+ "snssaiList": [
+ "01-5B179BD4"
+ ],
+ "sliceProfileId": "ab9af40f13f721b5f13539d87484098"
+ }"""
when(mockExecution.getVariable("msoRequestId")).thenReturn("5ad89cf9-0569-4a93-4509-d8324321e2be")
when(mockExecution.getVariable("serviceInstanceID")).thenReturn("NSSI-C-7Q4-HDBNJ-NSSMF-01-A-ZX")
@@ -247,55 +247,55 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
String mockQueryNS() {
return """
- {
- "service-instance-id": "206535e7-77c9-4036-9387-3f1cf57b4379",
- "service-instance-name": "nsi_DemoEmbb",
- "environment-context": "General_Revenue-Bearing",
- "workload-context": "Production",
- "model-invariant-id": "848c5656-5594-4d41-84bb-7afc7c64765c",
- "model-version-id": "2de92587-3395-44e8-bb2c-b9529747e580",
- "resource-version": "1599228110527",
- "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/206535e7-77c9-4036-9387-3f1cf57b4379/service-data/service-topology/",
- "orchestration-status": "Assigned",
- "relationship-list": {
- "relationship": [{
- "related-to": "owning-entity",
- "relationship-label": "org.onap.relationships.inventory.BelongsTo",
- "related-link": "/aai/v19/business/owning-entities/owning-entity/OE-generic",
- "relationship-data": [{
- "relationship-key": "owning-entity.owning-entity-id",
- "relationship-value": "OE-generic"
- }]
- }, {
- "related-to": "generic-vnf",
- "relationship-label": "org.onap.relationships.inventory.ComposedOf",
- "related-link": "/aai/v19/network/generic-vnfs/generic-vnf/eeb66c6f-36bd-47ad-8294-48f46b1aa912",
- "relationship-data": [{
- "relationship-key": "generic-vnf.vnf-id",
- "relationship-value": "eeb66c6f-36bd-47ad-8294-48f46b1aa912"
- }],
- "related-to-property": [{
- "property-key": "generic-vnf.vnf-name",
- "property-value": "vfwuctest 0"
- }]
- }, {
- "related-to": "project",
- "relationship-label": "org.onap.relationships.inventory.Uses",
- "related-link": "/aai/v19/business/projects/project/Project-generic",
- "relationship-data": [{
- "relationship-key": "project.project-name",
- "relationship-value": "Project-generic"
- }]
- }]
- }
+ {
+ "service-instance-id": "206535e7-77c9-4036-9387-3f1cf57b4379",
+ "service-instance-name": "nsi_DemoEmbb",
+ "environment-context": "General_Revenue-Bearing",
+ "workload-context": "Production",
+ "model-invariant-id": "848c5656-5594-4d41-84bb-7afc7c64765c",
+ "model-version-id": "2de92587-3395-44e8-bb2c-b9529747e580",
+ "resource-version": "1599228110527",
+ "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/206535e7-77c9-4036-9387-3f1cf57b4379/service-data/service-topology/",
+ "orchestration-status": "Assigned",
+ "relationship-list": {
+ "relationship": [{
+ "related-to": "owning-entity",
+ "relationship-label": "org.onap.relationships.inventory.BelongsTo",
+ "related-link": "/aai/v19/business/owning-entities/owning-entity/OE-generic",
+ "relationship-data": [{
+ "relationship-key": "owning-entity.owning-entity-id",
+ "relationship-value": "OE-generic"
+ }]
+ }, {
+ "related-to": "generic-vnf",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-link": "/aai/v19/network/generic-vnfs/generic-vnf/eeb66c6f-36bd-47ad-8294-48f46b1aa912",
+ "relationship-data": [{
+ "relationship-key": "generic-vnf.vnf-id",
+ "relationship-value": "eeb66c6f-36bd-47ad-8294-48f46b1aa912"
+ }],
+ "related-to-property": [{
+ "property-key": "generic-vnf.vnf-name",
+ "property-value": "vfwuctest 0"
+ }]
+ }, {
+ "related-to": "project",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v19/business/projects/project/Project-generic",
+ "relationship-data": [{
+ "relationship-key": "project.project-name",
+ "relationship-value": "Project-generic"
+ }]
+ }]
+ }
}
- """
+ """
}
String mockQueryVnf() {
return """
- {
+ {
"vnf-id": "eeb66c6f-36bd-47ad-8294-48f46b1aa912",
"vnf-name": "vfwuctest 0",
"vnf-type": "vfwuctest/null",
@@ -379,7 +379,7 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
}]
}
}
- """
+ """
}
String mockQuerySliceServiceReturn(){
@@ -414,7 +414,7 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
"property-value": "nsi_DemoEmbb"
}]
},
- {
+ {
"related-to": "allotted-resource",
"relationship-label": "org.onap.relationships.inventory.Uses",
"related-link": "/aai/v19/business/customers/customer/5GCustomer/service-subscriptions/service-subscription/5G/service-instances/service-instance/0d3d3cce-46a8-486d-816a-954e71697c4e/allotted-resources/allotted-resource/d63c241a-4c0b-4294-b4c3-5a57421a1769",
@@ -461,7 +461,7 @@ class DoAllocateCoreSharedSliceTest extends MsoGroovyTest {
"property-value": "Allotted_DemoEmbb"
}]
}
- ]
+ ]
}
}
"""
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/logback-test.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/logback-test.xml
index 38a2ef6ef5..7a8d2a122c 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/logback-test.xml
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/logback-test.xml
@@ -1,7 +1,5 @@
<configuration>
-
-
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%d{HH:mm:ss.SSS} [%thread] |%X{RequestId}| %-5level
@@ -10,7 +8,6 @@
</encoder>
</appender>
-
<logger name="com.att.ecomp.audit" level="info" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
@@ -26,19 +23,19 @@
<logger name="org.onap" level="${so.log.level:-DEBUG}" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
-
<logger name="ch.vorburger" level="WARN" additivity="false">
<appender-ref ref="STDOUT" />
</logger>
-
- <logger name="AUDIT" level="info" additivity="true">
+
+ <logger name="AUDIT" level="info" additivity="true">
<appender-ref ref="STDOUT" />
</logger>
+ <logger name="org.reflections" level="ERROR" />
+
<root level="WARN">
<appender-ref ref="STDOUT" />
</root>
-
</configuration> \ No newline at end of file