summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java55
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy26
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy10
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy196
9 files changed, 196 insertions, 115 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java
index f25d4b440a..5f0cab3da8 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/util/OofInfraUtils.java
@@ -52,7 +52,7 @@ public class OofInfraUtils {
getCloudsite = Optional.ofNullable(client.getCloudSite(cloudSite.getId(), endpoint + "/cloudSite/"))
.orElse(new CloudSite());
if (!cloudSite.getId().equals(getCloudsite.getId())) {
- client.postCloudSite(cloudSite);
+ client.postOofHomingCloudSite(cloudSite);
logger.debug("Did not findd cloudsite : {}", cloudSite.getId());
logger.debug("Will create cloudSite: {}", cloudSite.toString());
} else {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java
index 4b35371594..8ec780479a 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VfModuleCDSRequestProvider.java
@@ -105,9 +105,10 @@ public class VfModuleCDSRequestProvider implements CDSRequestProvider {
final GeneralBuildingBlock buildingBlock = execution.getGeneralBuildingBlock();
List<Map<String, Object>> userParamsFromRequest =
buildingBlock.getRequestContext().getRequestParameters().getUserParams();
-
- configureInstanceParamsForVfModule.populateInstanceParams(vfModuleObject, userParamsFromRequest,
- modelCustomizationUuidForVnf, modelCustomizationUuidForVfModule);
+ if (userParamsFromRequest != null && userParamsFromRequest.size() != 0) {
+ configureInstanceParamsForVfModule.populateInstanceParams(vfModuleObject, userParamsFromRequest,
+ modelCustomizationUuidForVnf, modelCustomizationUuidForVfModule);
+ }
} catch (Exception e) {
throw new PayloadGenerationException("Failed to buildPropertyObject for VF-Module", e);
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java
index 7425d09721..6251eb6fad 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/cds/VnfCDSRequestProvider.java
@@ -93,9 +93,10 @@ public class VnfCDSRequestProvider implements CDSRequestProvider {
final GeneralBuildingBlock buildingBlock = execution.getGeneralBuildingBlock();
List<Map<String, Object>> userParamsFromRequest =
buildingBlock.getRequestContext().getRequestParameters().getUserParams();
-
- configureInstanceParamsForVnf.populateInstanceParams(vnfObject, userParamsFromRequest,
- modelCustomizationUuid);
+ if (userParamsFromRequest != null && userParamsFromRequest.size() != 0) {
+ configureInstanceParamsForVnf.populateInstanceParams(vnfObject, userParamsFromRequest,
+ modelCustomizationUuid);
+ }
} catch (Exception e) {
throw new PayloadGenerationException("Failed to buildPropertyObjectForVnf", e);
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java
index 9c3ce60400..06defaa84c 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/AbstractVnfCDSRequestProviderTest.java
@@ -44,6 +44,7 @@ import org.onap.so.serviceinstancebeans.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import java.util.LinkedList;
import java.util.Map;
@RunWith(MockitoJUnitRunner.Silent.class)
@@ -202,4 +203,10 @@ public abstract class AbstractVnfCDSRequestProviderTest {
executeBuildingBlock.setBuildingBlock(buildingBlock);
buildingBlockExecution.setVariable(BUILDING_BLOCK, executeBuildingBlock);
}
+
+ protected void setScopeAndActionWithoutUserParams(String scope, String action) {
+ buildingBlockExecution.getGeneralBuildingBlock().getRequestContext().getRequestParameters()
+ .setUserParams(new LinkedList<>());
+ setScopeAndAction(scope, action);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java
index 2ca09d9ab3..f224ebf21e 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/cds/VfModuleCDSRequestProviderTest.java
@@ -25,8 +25,14 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.Test;
import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Spy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.client.exception.PayloadGenerationException;
+import org.onap.so.serviceinstancebeans.Service;
+import org.springframework.beans.factory.annotation.Autowired;
+import java.util.List;
+import java.util.Map;
import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -34,11 +40,19 @@ import static org.mockito.Mockito.*;
public class VfModuleCDSRequestProviderTest extends AbstractVnfCDSRequestProviderTest {
+ @Autowired
+ private ObjectMapper objectMapper;
+
+ @Spy
+ protected ExtractServiceFromUserParameters extractServiceFromUserParameters;
+
+ @Spy
+ @InjectMocks
+ protected ConfigureInstanceParamsForVfModule configureInstanceParamsForVfModule;
+
@InjectMocks
private VfModuleCDSRequestProvider vfModuleCDSRequestProvider;
- @Mock
- protected ConfigureInstanceParamsForVfModule configureInstanceParamsForVfModule;
@Test
public void testRequestPayloadForConfigDeployVfModule() throws Exception {
@@ -52,7 +66,8 @@ public class VfModuleCDSRequestProviderTest extends AbstractVnfCDSRequestProvide
ResourceKey.GENERIC_VNF_ID);
doReturn(createVfModule()).when(extractPojosForBB).extractByKey(buildingBlockExecution,
ResourceKey.VF_MODULE_ID);
- doNothing().when(configureInstanceParamsForVfModule).populateInstanceParams(any(), any(), anyString(),
+ doReturn(getUserParams()).when(extractServiceFromUserParameters).getServiceFromRequestUserParams(anyList());
+ doCallRealMethod().when(configureInstanceParamsForVfModule).populateInstanceParams(any(), any(), anyString(),
anyString());
// when
@@ -76,5 +91,39 @@ public class VfModuleCDSRequestProviderTest extends AbstractVnfCDSRequestProvide
assertThat(propertiesNode.get("vnf-id").asText()).isEqualTo(GENERIC_VNF_ID);
}
+ @Test
+ public void testRequestPayloadForConfigDeployVfModuleWithoutUserParams() throws Exception {
+ // given
+ setScopeAndActionWithoutUserParams(VF_SCOPE, DEPLOY_ACTION);
+ ServiceInstance serviceInstance = createServiceInstance();
+
+ doReturn(serviceInstance).when(extractPojosForBB).extractByKey(buildingBlockExecution,
+ ResourceKey.SERVICE_INSTANCE_ID);
+ doReturn(createGenericVnf()).when(extractPojosForBB).extractByKey(buildingBlockExecution,
+ ResourceKey.GENERIC_VNF_ID);
+ doReturn(createVfModule()).when(extractPojosForBB).extractByKey(buildingBlockExecution,
+ ResourceKey.VF_MODULE_ID);
+ doReturn(getUserParams()).when(extractServiceFromUserParameters).getServiceFromRequestUserParams(anyList());
+ doCallRealMethod().when(configureInstanceParamsForVfModule).populateInstanceParams(any(), any(), anyString(),
+ anyString());
+
+ vfModuleCDSRequestProvider.setExecutionObject(buildingBlockExecution);
+ String payload = vfModuleCDSRequestProvider.buildRequestPayload(DEPLOY_ACTION).get();
+ // verify
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode payloadJson = mapper.readTree(payload);
+ JsonNode requestNode = payloadJson.findValue("configDeploy-request");
+ JsonNode propertiesNode = payloadJson.findValue("configDeploy-properties");
+
+ assertNotNull(payload);
+ assertTrue(verfiyJsonFromString(payload));
+ assertThat(requestNode.get("resolution-key").asText()).isEqualTo(VF_MODULE_NAME);
+ assertThat(propertiesNode.get("service-instance-id").asText()).isEqualTo(SERVICE_INSTANCE_ID);
+ assertThat(propertiesNode.get("vf-module-id").asText()).isEqualTo(VF_MODULE_ID);
+ assertThat(propertiesNode.get("vf-module-name").asText()).isEqualTo(VF_MODULE_NAME);
+ assertThat(propertiesNode.get("vf-module-customization-uuid").asText()).isEqualTo(VF_MODULE_CUSTOMIZATION_UUID);
+ assertThat(propertiesNode.get("service-model-uuid").asText()).isEqualTo(SERVICE_MODEL_UUID);
+ assertThat(propertiesNode.get("vnf-id").asText()).isEqualTo(GENERIC_VNF_ID);
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy
index 3233bfff61..17b37bfd86 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CheckServiceProcessStatus.groovy
@@ -128,8 +128,8 @@ class CheckServiceProcessStatus extends AbstractServiceTaskProcessor {
/**
* check service status through request operation id, update operation status
- */
- def preCheckServiceStatusReq = { DelegateExecution execution ->
+ */
+ void preCheckServiceStatusReq(DelegateExecution execution) {
logger.trace(Prefix + "preCheckServiceStatusReq Start")
String serviceInstanceId = execution.getVariable("serviceInstanceId") as String
String operationId = execution.getVariable("operationId") as String
@@ -142,7 +142,7 @@ class CheckServiceProcessStatus extends AbstractServiceTaskProcessor {
* handle service status, if service status is finished or error, set the service status
* @param execution
*/
- def handlerServiceStatusResp = { DelegateExecution execution ->
+ void handlerServiceStatusResp(DelegateExecution execution) {
logger.trace(Prefix + "handlerServiceStatusResp Start")
String msg
try {
@@ -203,7 +203,7 @@ class CheckServiceProcessStatus extends AbstractServiceTaskProcessor {
}
- def timeWaitDelay = { DelegateExecution execution ->
+ void timeWaitDelay(DelegateExecution execution) {
Long startTime = execution.getVariable("startTime") as Long
Long timeOut = execution.getVariable("timeOut") as Long
@@ -221,7 +221,7 @@ class CheckServiceProcessStatus extends AbstractServiceTaskProcessor {
}
- private handlerTimeOut = { DelegateExecution execution ->
+ private handlerTimeOut(DelegateExecution execution) {
Map<String, Object> paramMap = execution.getVariable("timeOutParamMap") as Map
@@ -229,7 +229,7 @@ class CheckServiceProcessStatus extends AbstractServiceTaskProcessor {
}
- private handlerSuccess = { DelegateExecution execution, String result ->
+ private handlerSuccess(DelegateExecution execution, String result) {
Map<String, Object> paramMap = execution.getVariable("successParamMap") as Map
@@ -237,7 +237,7 @@ class CheckServiceProcessStatus extends AbstractServiceTaskProcessor {
}
- private handlerError = { DelegateExecution execution, String result ->
+ private handlerError(DelegateExecution execution, String result) {
Map<String, Object> paramMap = execution.getVariable("errorParamMap") as Map
@@ -245,7 +245,7 @@ class CheckServiceProcessStatus extends AbstractServiceTaskProcessor {
}
- private handlerProcess = { DelegateExecution execution, String result, def paramMap, def status, def msg ->
+ private handlerProcess(DelegateExecution execution, String result, def paramMap, def status, def msg) {
if (paramMap != null) {
for (Map.Entry<String, Object> entry : paramMap.entrySet()) {
@@ -260,7 +260,7 @@ class CheckServiceProcessStatus extends AbstractServiceTaskProcessor {
if (isBlank(execution.getVariable("operationContent") as String)) {
- String operationContent = execution.getVariable("processServiceType") + " " +
+ String operationContent = execution.getVariable("processServiceType") + " " +
execution.getVariable("operationType") + " operation finished " + msg
execution.setVariable("operationContent", operationContent)
}
@@ -275,7 +275,7 @@ class CheckServiceProcessStatus extends AbstractServiceTaskProcessor {
/**
* judge if the service processing success finished
*/
- private isSuccessCompleted = { DelegateExecution execution, String result ->
+ private Boolean isSuccessCompleted(DelegateExecution execution, String result) {
//successConditions: processing end success conditions
List<String> successConditions = execution.getVariable("successConditions") as List
@@ -291,7 +291,7 @@ class CheckServiceProcessStatus extends AbstractServiceTaskProcessor {
/**
* judge if the service processing error finished
*/
- private isErrorCompleted = { DelegateExecution execution, String result ->
+ private Boolean isErrorCompleted(DelegateExecution execution, String result) {
//errorConditions: processing end error conditions
List<String> errorConditions = execution.getVariable("errorConditions") as List
@@ -304,7 +304,7 @@ class CheckServiceProcessStatus extends AbstractServiceTaskProcessor {
}
- def preUpdateOperationProgress = { DelegateExecution execution ->
+ void preUpdateOperationProgress(DelegateExecution execution) {
logger.trace(Prefix + "prepareUpdateOperationStatus Start")
def progress = execution.getVariable("progress") as Integer
@@ -314,7 +314,7 @@ class CheckServiceProcessStatus extends AbstractServiceTaskProcessor {
def resProgress = (initProgress + (endProgress - initProgress) / 100 * progress) as Integer
def operationType = execution.getVariable("operationType")
- def operationContent = execution.getVariable("processServiceType") + " " +
+ def operationContent = execution.getVariable("processServiceType") + " " +
operationType + " operation processing " + resProgress
// update status creating
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy
index 680bcca837..2fd17d84d5 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy
@@ -293,11 +293,11 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor {
//2. profile info
- Integer expDataRateDL = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.expDataRateDL")
- Integer expDataRateUL = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.expDataRateUL")
- Integer latency = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.latency")
- Integer maxNumberOfUEs = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.maxNumberofUEs")
- String uEMobilityLevel = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.uemobilityLevel")
+ Integer expDataRateDL = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.expDataRateDL") as Integer
+ Integer expDataRateUL = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.expDataRateUL") as Integer
+ Integer latency = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.latency") as Integer
+ Integer maxNumberOfUEs = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.maxNumberofUEs") as Integer
+ String uEMobilityLevel = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.uEMobilityLevel")
String resourceSharingLevel = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.resourceSharingLevel")
String coverageArea = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.coverageAreaList")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
index 4ab6647a38..00d986c68d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
@@ -324,6 +324,7 @@ class DoAllocateNSSI extends org.onap.so.bpmn.common.scripts.AbstractServiceTask
sliceProfile.setExpDataRate(0)
sliceProfile.setTrafficDensity(0)
sliceProfile.setConnDensity(0)
+ sliceProfile.setSNssai(sliceProfileMap.get("sNSSAI").toString())
sliceProfile.setExpDataRateUL(Integer.parseInt(sliceProfileMap.get("expDataRateUL").toString()))
sliceProfile.setExpDataRateDL(Integer.parseInt(sliceProfileMap.get("expDataRateDL").toString()))
sliceProfile.setActivityFactor(Integer.parseInt(sliceProfileMap.get("activityFactor").toString()))
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
index a4b360276d..8eb367eea9 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy
@@ -136,7 +136,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
String OOFResponse = httpResponse.readEntity(String.class)
logger.debug("NSI OOFResponse is: " + OOFResponse)
execution.setVariable("OOFResponse", OOFResponse)
- int index = 0
//This needs to be changed to derive a value when we add policy to decide the solution options.
Map OOFResponseObject = new JsonSlurper().parseText(OOFResponse)
Map solutions = OOFResponseObject.get("solutions")
@@ -145,41 +144,12 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
Boolean isSharable = resourceSharingLevel.equals("shared")
if (solutions != null) {
- if (isSharable) {
+ if (isSharable && hasSharedNSIsolutions(solutions)) {
//sharedNSISolution
processSharedNSISolutions(solutions, execution)
- } else {
- //TODO test OOF
- if (solutions.containsKey("newNSISolutions")) {
- List<Map> newNSISolutions = solutions.get("newNSISolutions")
- List<Map> NSSImap = new ArrayList<>()
- if (newNSISolutions != null && newNSISolutions.size() > 0) {
- NSSImap = newNSISolutions.get(index).get("NSSISolutions") as List<Map>
- }
- for (Map nssi : NSSImap) {
- def nssiSolution = nssi.get("NSSISolution") as Map<String, ?>
- String nssiName = nssiSolution.getOrDefault("NSSIName", "")
- String nssiId = nssiSolution.getOrDefault("NSSIId", "")
- String domain = nssiSolution.getOrDefault("domainName", "").toString().toUpperCase()
- switch (domain) {
- case "AN":
- sliceTaskParams.setAnSuggestNssiId(nssiId)
- sliceTaskParams.setAnSuggestNssiName(nssiName)
- break
- case "CN":
- sliceTaskParams.setCnSuggestNssiId(nssiId)
- sliceTaskParams.setCnSuggestNssiName(nssiName)
- break
- case "TN":
- sliceTaskParams.setTnSuggestNssiId(nssiId)
- sliceTaskParams.setTnSuggestNssiName(nssiName)
- break
- default:
- break
- }
- }
- //TODO sliceProfile
- }
+ }
+ else if(solutions.containsKey("newNSISolutions")) {
+ processNewNSISolutions(solutions, execution)
}
}
execution.setVariable("sliceTaskParams", sliceTaskParams)
@@ -188,17 +158,45 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
logger.debug("*** Completed options Call to OOF ***")
}
- private void processSharedNSISolutions(Map solutions, DelegateExecution execution) {
- if (!solutions.containsKey("sharedNSISolutions"))
- {
- logger.error("OOF don't return sharedNSISolutions")
- return
+ private boolean hasSharedNSIsolutions( Map solutions){
+ if(solutions.containsKey("sharedNSISolutions")){
+ List sharedNSIsolutions = solutions.get("sharedNSISolutions")
+ if (sharedNSIsolutions != null && !sharedNSIsolutions.isEmpty()) {
+ return true
+ }
+ }
+ return false
+ }
+
+ private void processNewNSISolutions(Map solutions, DelegateExecution execution) {
+ int index = 0
+ List<Map> newNSISolutions = solutions.get("newNSISolutions")
+ List<Map> NSSImap = new ArrayList<>()
+ if (newNSISolutions != null && newNSISolutions.size() > 0) {
+ NSSImap = newNSISolutions.get(index).get("NSSISolutions") as List<Map>
+ for (Map nssi : NSSImap) {
+ Map oofSliceProfile = nssi.get("sliceProfile")
+ String domain = oofSliceProfile.getOrDefault("domainType","")
+ logger.debug("OOF newNSISolutions SliceProfile: " +oofSliceProfile.toString()+",domain:${domain}")
+ if(null != domain){
+ //TODO
+// def nssiSolution = nssi.get("NSSISolution") as Map<String, ?>
+// String nssiName = nssiSolution.getOrDefault("NSSIName", "")
+// String nssiId = nssiSolution.getOrDefault("NSSIId", "")
+// saveNSSIId(nssi, sliceTaskParams)
+ Map<String, Object> sliceProfile = getSliceProfile(domain, execution, oofSliceProfile)
+ saveSliceProfile(execution, domain, sliceProfile)
+
+ }
+ }
}
+ }
+
+ private void processSharedNSISolutions(Map solutions, DelegateExecution execution) {
String nsiName, nsiInstanceId, nssiId, nssiName
- Map sliceProfile
SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
- Map sharedNSIsolution = ((List) solutions.get("sharedNSISolutions")).get(0)
+ Map sharedNSIsolution = ((List) solutions.get("sharedNSISolutions"))?.get(0)
nsiInstanceId = sharedNSIsolution.getOrDefault("NSIId", "")
nsiName = sharedNSIsolution.getOrDefault("NSIName", "")
sliceTaskParams.setSuggestNsiId(nsiInstanceId)
@@ -206,77 +204,102 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
//Temporary modification
List NSSIs = sharedNSIsolution.get("NSSIs")
- if(NSSIs.size()==1){
- Map nssi = NSSIs.get(0)
+ for(Map nssi : NSSIs){
+ Map oofSliceProfile = ((List)nssi.get("sliceProfile"))?.get(0)
+ String domain = oofSliceProfile.getOrDefault("domainType","")
nssiId = nssi.getOrDefault("NSSIId","")
nssiName = nssi.getOrDefault("NSSIName","")
- sliceTaskParams.setCnSuggestNssiId(nssiId)
- //TODO Need update after OOF return camel key and domainType
- sliceProfile = ((List)nssi.get("sliceProfile"))?.get(0)
- sliceTaskParams.setCnSuggestNssiName(nssiName)
-// execution.setVariable("sliceProfileCn", sliceProfile)
-// sliceTaskParams.setSliceProfileCn(sliceProfile)
+ saveNSSIId(domain, nssiId, nssiName,execution)
+ Map<String, Object> sliceProfile = getSliceProfile(domain, execution, oofSliceProfile)
+ saveSliceProfile(execution, domain, sliceProfile)
+ logger.debug("OOF sharedNSISolution SliceProfile:"+oofSliceProfile.toString()+",domain:${domain}")
+ logger.debug("OOF sharedNSISolution nsiInstanceId:${nsiInstanceId}, nsiName:${nsiName}, nssiId:${nssiId}, nssiName:${nssiName}")
}
- logger.debug("OOF sharedNSISolution nsiInstanceId:${nsiInstanceId}, nsiName:${nsiName}, nssiId:${nssiId}, nssiName:${nssiName}")
- logger.debug("OOF SliceProfile:"+sliceProfile.toString())
}
- void parseServiceProfile(DelegateExecution execution) {
+ private void parseServiceProfile(DelegateExecution execution) {
logger.debug("Start parseServiceProfile")
String serviceType = execution.getVariable("serviceType")
Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
// set sliceProfile for three domains
if(!sliceTaskParams.getSliceProfileAn()){
- Map<String, Object> sliceProfileAn = getSliceProfile(serviceType, "AN", serviceProfile)
- execution.setVariable("sliceProfileAn", sliceProfileAn)
- sliceTaskParams.setSliceProfileAn(sliceProfileAn)
- logger.debug("sliceProfileAn: " + sliceProfileAn)
+ Map<String, Object> sliceProfileAn = getSliceProfile( "AN", execution,null)
+ saveSliceProfile(execution,"AN",sliceProfileAn)
}
if(!sliceTaskParams.getSliceProfileTn()){
- Map<String, Object> sliceProfileTn = getSliceProfile(serviceType, "TN", serviceProfile)
- execution.setVariable("sliceProfileTn", sliceProfileTn)
- sliceTaskParams.setSliceProfileTn(sliceProfileTn)
- logger.debug("sliceProfileTn: " + sliceProfileTn)
+ Map<String, Object> sliceProfileTn = getSliceProfile( "TN", execution,null)
+ saveSliceProfile(execution,"TN",sliceProfileTn)
}
if(!sliceTaskParams.getSliceProfileCn()){
- Map<String, Object> sliceProfileCn = getSliceProfile(serviceType, "CN", serviceProfile)
- execution.setVariable("sliceProfileCn", sliceProfileCn)
- sliceTaskParams.setSliceProfileCn(sliceProfileCn)
- logger.debug("sliceProfileCn: " + sliceProfileCn)
+ Map<String, Object> sliceProfileCn = getSliceProfile( "CN", execution,null, )
+ saveSliceProfile(execution,"CN",sliceProfileCn)
}
logger.debug("Finish parseServiceProfile")
}
- Map getSliceProfile(String serviceType, String domain, Map<String, Object> serviceProfile) {
+ private void saveSliceProfile(DelegateExecution execution, String domain, Map<String, Object> sliceProfile){
+ SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+ if(domain.equalsIgnoreCase("AN")){
+ execution.setVariable("sliceProfileAn", sliceProfile)
+ sliceTaskParams.setSliceProfileAn(sliceProfile)
+ logger.debug("sliceProfileAn: " + sliceProfile)
+ }
+ else if(domain.equalsIgnoreCase("TN")){
+ execution.setVariable("sliceProfileTn", sliceProfile)
+ sliceTaskParams.setSliceProfileTn(sliceProfile)
+ logger.debug("sliceProfileTn: " + sliceProfile)
+ }
+ else if(domain.equalsIgnoreCase("CN")){
+ execution.setVariable("sliceProfileCn", sliceProfile)
+ sliceTaskParams.setSliceProfileCn(sliceProfile)
+ logger.debug("sliceProfileCn: " + sliceProfile)
+ }
+ }
+
+ private void saveNSSIId(String domain, String nssiId, String nssiName, DelegateExecution execution) {
+ SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams")
+ if(domain.equalsIgnoreCase("AN")){
+ sliceTaskParams.setAnSuggestNssiId(nssiId)
+ sliceTaskParams.setAnSuggestNssiName(nssiName)
+ }
+ else if(domain.equalsIgnoreCase("CN")){
+ sliceTaskParams.setCnSuggestNssiId(nssiId)
+ sliceTaskParams.setCnSuggestNssiName(nssiName)
+ }
+ else if(domain.equalsIgnoreCase("TN")){
+ sliceTaskParams.setTnSuggestNssiId(nssiId)
+ sliceTaskParams.setTnSuggestNssiName(nssiName)
+ }
+ }
+
+ private Map getSliceProfile(String domain, DelegateExecution execution, Map<String, Object> oofSliceProfile) {
String profileMapStr
+ Map<String, Object> serviceProfile = execution.getVariable("serviceProfile")
Integer domainLatency = (Integer) serviceProfile.get("latency")/3
- switch (domain) {
- case "AN":
- profileMapStr = """ {
+ if(domain.equalsIgnoreCase("AN")){
+ profileMapStr = """ {
"latency": ${domainLatency},
"sNSSAI": "sNSSAI",
"uEMobilityLevel": "uEMobilityLevel",
"coverageAreaTAList": "coverageAreaTAList",
"5QI": 100
- }
- """.trim().replaceAll(" ", "")
- break
- case "TN":
- profileMapStr =""" {
+ }"""
+ }
+ else if(domain.equalsIgnoreCase("TN")){
+ profileMapStr =""" {
"latency":${domainLatency},
"sNSSAI":"sNSSAI",
"e2eLatency":"latency",
"bandwidth": 100
- }
- """.trim().replaceAll(" ", "")
- break
- case "CN":
- profileMapStr = """ {
+ }"""
+ }
+ else if(domain.equalsIgnoreCase("CN")){
+ profileMapStr = """ {
"areaTrafficCapDL":"areaTrafficCapDL",
"maxNumberofUEs":"maxNumberofUEs",
"latency":${domainLatency},
@@ -287,27 +310,26 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
"expDataRateDL":"expDataRateDL",
"activityFactor":"activityFactor",
"resourceSharingLevel":"resourceSharingLevel"
- }
- """.trim().replaceAll(" ", "")
- break
- default:
- break
- }
+ }"""
+ }
logger.debug("Profile map for " + domain + " : " + profileMapStr)
- Map<String, Object> profileMaps = objectMapper.readValue(profileMapStr, new TypeReference<Map<String, String>>(){})
+ Map<String, Object> profileMaps = objectMapper.readValue(profileMapStr.trim().replaceAll(" ", ""), new TypeReference<Map<String, String>>(){})
Map<String, Object> sliceProfile = [:]
for (Map.Entry<String, String> profileMap : profileMaps) {
String key = profileMap.key
String value = profileMaps.get(key)
- if(serviceProfile.keySet().contains(value)){
+ if(null != oofSliceProfile && oofSliceProfile.keySet().contains(key)){
+ sliceProfile.put(key, oofSliceProfile.get(key))
+ logger.debug("Get from oof, key:${key}, value: ${oofSliceProfile.get(key)}")
+ }
+ else if(serviceProfile.keySet().contains(value)){
sliceProfile.put(key, serviceProfile.get(value))
}
else{
sliceProfile.put(key, profileMaps.get(key))
}
}
-
return sliceProfile
}