summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql6
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/NssmfManagerBuilder.java6
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java2
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java48
-rw-r--r--adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/InternalNssmfManager.java2
-rw-r--r--adapters/mso-nssmf-adapter/src/main/resources/subnetCapability.json19
-rw-r--r--adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java4
-rw-r--r--adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java5
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java6
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java50
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java45
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java56
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java1175
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterUtils.java74
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java76
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java7
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java5
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java6
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java11
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java45
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy1
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java27
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java3
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Resource.java1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy62
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy70
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy191
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy1
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy65
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy7
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn159
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java7
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java5
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java90
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java2
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/PerfReq.java5
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java3
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/QuerySubnetCapability.java (renamed from common/src/main/java/org/onap/so/beans/nsmf/AnPerfReq.java)35
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java116
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java74
-rw-r--r--common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java14
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java6
-rw-r--r--releases/1.7.10.yaml33
-rw-r--r--releases/1.7.8.yaml33
-rw-r--r--version.properties2
47 files changed, 2238 insertions, 432 deletions
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
index 622a9c93c5..0b921ecfb4 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
@@ -228,6 +228,7 @@ values (902, 'VNF-Macro-Modify',2,'ControllerExecutionBB',1,500,'vnf','config-de
INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID, SCOPE, ACTION) VALUES
('Service-Macro-Create', '10', 'ControllerExecutionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'DEFAULT'), 'pnf', 'config-assign');
+
INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID, SCOPE, ACTION) VALUES
('Service-Macro-Create', '11', 'ControllerExecutionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Create' and CLOUD_OWNER = 'DEFAULT'), 'pnf', 'config-deploy');
@@ -951,3 +952,8 @@ VALUES
('VNFConfigModifyActivity','*','*','*','*','Manual','Abort','*', '*'),
('VNFUnsetInMaintFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
('VNFUnsetClosedLoopDisabledActivity','*','*','*','*','Manual','Abort','*', '*');
+
+UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vnf', ACTION='config-assign' WHERE COMPOSITE_ACTION = 'Service-Macro-Create' and FLOW_NAME = 'ConfigAssignVnfBB';
+UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vnf', ACTION='config-deploy' WHERE COMPOSITE_ACTION = 'Service-Macro-Create' and FLOW_NAME = 'ConfigDeployVnfBB';
+UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vnf', ACTION='HealthCheck' WHERE COMPOSITE_ACTION = 'VFModule-ScaleOut' and FLOW_NAME = 'GenericVnfHealthCheckBB';
+UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vfmodule', ACTION='ScaleOutReconfiguration' WHERE COMPOSITE_ACTION = 'VFModule-ScaleOut' and FLOW_NAME = 'GenericVnfHealthCheckBB';
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/NssmfManagerBuilder.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/NssmfManagerBuilder.java
index 0b332af607..e397201e4b 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/NssmfManagerBuilder.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/NssmfManagerBuilder.java
@@ -77,6 +77,12 @@ public class NssmfManagerBuilder {
return;
}
+ if (ExecutorType.EXTERNAL.equals(executorType) && NetworkType.TRANSPORT.equals(networkType)) {
+ this.nssmfManger = new ExternalAnNssmfManager().setEsrInfo(esrInfo).setExecutorType(executorType)
+ .setInitStatus("activated");
+ return;
+ }
+
if (ExecutorType.EXTERNAL.equals(executorType) && NetworkType.ACCESS.equals(networkType)) {
this.nssmfManger = new ExternalAnNssmfManager().setEsrInfo(esrInfo).setExecutorType(executorType)
.setInitStatus("activated");
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java
index 789f4f239d..2de6e01693 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/BaseNssmfManager.java
@@ -193,7 +193,7 @@ public abstract class BaseNssmfManager implements NssmfManager {
return doQuerySubnetCapability(nbiRequest.getSubnetCapabilityQuery());
}
- protected abstract <T> RestResponse doQuerySubnetCapability(T req) throws ApplicationException;
+ protected abstract RestResponse doQuerySubnetCapability(QuerySubnetCapability req) throws ApplicationException;
/**
* send request to nssmf
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
index 72d1b53781..3c5be7eb39 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/ExternalNssmfManager.java
@@ -20,7 +20,11 @@
package org.onap.so.adapters.nssmf.manager.impl;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.Header;
+import org.apache.http.HttpStatus;
import org.apache.http.message.BasicHeader;
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.so.adapters.nssmf.entity.NssmfInfo;
@@ -31,14 +35,23 @@ import org.onap.so.adapters.nssmf.exceptions.ApplicationException;
import org.onap.so.adapters.nssmf.util.NssmfAdapterUtil;
import org.onap.so.beans.nsmf.*;
import org.onap.so.db.request.beans.ResourceOperationStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import static java.lang.String.valueOf;
import static org.onap.so.adapters.nssmf.enums.JobStatus.*;
-import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.StatusDesc.*;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.StatusDesc.QUERY_JOB_STATUS_FAILED;
+import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.StatusDesc.QUERY_JOB_STATUS_SUCCESS;
import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.marshal;
import static org.onap.so.adapters.nssmf.util.NssmfAdapterUtil.unMarshal;
public abstract class ExternalNssmfManager extends BaseNssmfManager {
+ private static final Logger logger = LoggerFactory.getLogger(ExternalNssmfManager.class);
+
@Override
protected String wrapAllocateReqBody(NssmfAdapterNBIRequest nbiRequest) throws ApplicationException {
return doWrapExtAllocateReqBody(nbiRequest);
@@ -167,11 +180,34 @@ public abstract class ExternalNssmfManager extends BaseNssmfManager {
}
@Override
- protected <T> RestResponse doQuerySubnetCapability(T req) throws ApplicationException {
- RestResponse response = new RestResponse();
- response.setStatus(200);
- response.setResponseContent(null);
- return response;
+ protected RestResponse doQuerySubnetCapability(QuerySubnetCapability req) throws ApplicationException {
+
+ ObjectMapper oMapper = new ObjectMapper();
+ InputStream inputStream = TypeReference.class.getResourceAsStream("/subnetCapability.json");
+ Map subnetCapability = new HashMap<>();
+ try {
+ subnetCapability = oMapper.readValue(inputStream, Map.class);
+ } catch (Exception e) {
+ logger.debug("Exception while reading subnet capability value from json", e);
+ }
+ Map<String, Object> responseMap = new HashMap<>();
+ List<String> subnetTypes = req.getSubnetTypes();
+ for (String value : subnetTypes) {
+ if (subnetCapability.containsKey(value)) {
+ responseMap.put(value, subnetCapability.get(value));
+ }
+ }
+ String response = null;
+ try {
+ response = oMapper.writeValueAsString(responseMap);
+ } catch (JsonProcessingException e) {
+ logger.debug("Exception while converting subnet capability object to String {}", e.getMessage());
+ }
+
+ RestResponse rsp = new RestResponse();
+ rsp.setStatus(HttpStatus.SC_OK);
+ rsp.setResponseContent(response);
+ return rsp;
}
/**
diff --git a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/InternalNssmfManager.java b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/InternalNssmfManager.java
index 88b5071371..e89160c4ae 100644
--- a/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/InternalNssmfManager.java
+++ b/adapters/mso-nssmf-adapter/src/main/java/org/onap/so/adapters/nssmf/manager/impl/InternalNssmfManager.java
@@ -122,7 +122,7 @@ public abstract class InternalNssmfManager extends BaseNssmfManager {
protected abstract String doWrapModifyReqBody(NssmfAdapterNBIRequest nbiRequest) throws ApplicationException;
@Override
- protected <T> RestResponse doQuerySubnetCapability(T req) throws ApplicationException {
+ protected RestResponse doQuerySubnetCapability(QuerySubnetCapability req) throws ApplicationException {
// handler
return sendRequest(marshal(req));
}
diff --git a/adapters/mso-nssmf-adapter/src/main/resources/subnetCapability.json b/adapters/mso-nssmf-adapter/src/main/resources/subnetCapability.json
new file mode 100644
index 0000000000..8db52168ae
--- /dev/null
+++ b/adapters/mso-nssmf-adapter/src/main/resources/subnetCapability.json
@@ -0,0 +1,19 @@
+{
+ "AN": {
+ "latency": "5",
+ "maxNumberofUEs": "100"
+ },
+ "CN": {
+ "latency": "10",
+ "maxNumberofConns": "100"
+ },
+ "TN_FH": {
+ "latency": "10"
+ },
+ "TN_MH": {
+ "latency": "5"
+ },
+ "TN_BH": {
+ "latency": "10"
+ }
+}
diff --git a/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java b/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java
index f150f47f4f..2d79544383 100644
--- a/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java
+++ b/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/NssmfAdapterRestTest.java
@@ -77,9 +77,9 @@ public class NssmfAdapterRestTest {
private final static String ALLOCATE = "{\n" + " \"esrInfo\" : {\n" + " \"vendor\" : \"huawei\",\n"
+ " \"networkType\" : \"cn\"\n" + " },\n" + " \"allocateCnNssi\" : {\n"
+ " \"nssiId\" : \"NSST-C-001-HDBNJ-NSSMF-01-A-ZX\",\n" + " \"nssiName\" : \"eMBB-001\",\n"
- + " \"sliceProfile\" : {\n" + " \"snssaiList\" : [ \"001-100001\" ],\n"
+ + " \"sliceProfile\" : {\n" + " \"sNSSAIList\" : [ \"001-100001\" ],\n"
+ " \"sliceProfileId\" : \"ab9af40f13f721b5f13539d87484098\",\n"
- + " \"plmnIdList\" : [ \"460-00\", \"460-01\" ],\n" + " \"perfReq\" : {\n"
+ + " \"pLMNIdList\" : [ \"460-00\", \"460-01\" ],\n" + " \"perfReq\" : {\n"
+ " \"perfReqEmbbList\" : [ {\n" + " \"activityFactor\" : 50\n" + " } ]\n"
+ " },\n" + " \"maxNumberofUEs\" : 200,\n"
+ " \"coverageAreaTAList\" : [ \"1\", \"2\", \"3\" ],\n" + " \"latency\" : 6,\n"
diff --git a/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java b/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java
index 4a659e1ca3..0d86056821 100644
--- a/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java
+++ b/adapters/mso-nssmf-adapter/src/test/java/org/onap/so/adapters/nssmf/service/impl/NssmfManagerServiceImplTest.java
@@ -38,6 +38,7 @@ import org.onap.so.adapters.nssmf.entity.TokenResponse;
import org.onap.so.adapters.nssmf.enums.HttpMethod;
import org.onap.so.adapters.nssmf.util.RestUtil;
import org.onap.so.beans.nsmf.*;
+import org.onap.so.beans.nsmf.oof.SubnetCapability;
import org.onap.so.db.request.beans.ResourceOperationStatus;
import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository;
import org.springframework.http.ResponseEntity;
@@ -429,7 +430,9 @@ public class NssmfManagerServiceImplTest {
public void querySubnetCapability() {
NssmfAdapterNBIRequest nbiRequest = createNbiRequest();
- String subnetCapabilityQuery = "\"subnetTypes\": [\"TN-FH\",\"TN-MH\",\"TN-BH\"]";
+ QuerySubnetCapability subnetCapabilityQuery = new QuerySubnetCapability();
+ List<String> subnetTypes = Arrays.asList("TN-FH", "TN-MH", "TN-BH");
+ subnetCapabilityQuery.setSubnetTypes(subnetTypes);
nbiRequest.setSubnetCapabilityQuery(subnetCapabilityQuery);
ResponseEntity res = nssiManagerService.queryNSSISelectionCapability(nbiRequest);
assertNotNull(res);
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
index a6194517c2..14d0b0afc4 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
@@ -53,12 +53,18 @@ public class CreateAAIInventory {
@Autowired
protected CloudConfig cloudConfig;
+ private static final String MULTICLOUD_MODE = "MULTICLOUD";
+
@Autowired
protected Environment env;
public void heatbridge(CloudInformation cloudInformation) throws HeatBridgeException, MsoCloudSiteNotFound {
CloudSite cloudSite = cloudConfig.getCloudSite(cloudInformation.getRegionId())
.orElseThrow(() -> new MsoCloudSiteNotFound(cloudInformation.getRegionId()));
+ if (cloudSite.getOrchestrator() != null && MULTICLOUD_MODE.equalsIgnoreCase(cloudSite.getOrchestrator())) {
+ logger.debug("Skipping Heatbridge as CloudSite orchestrator is: " + MULTICLOUD_MODE);
+ return;
+ }
CloudIdentity cloudIdentity = cloudSite.getIdentityService();
String heatStackId = cloudInformation.getTemplateInstanceId().split("/")[1];
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
index 6a5381cf3e..c319fdc23c 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/PollService.java
@@ -40,6 +40,7 @@ import org.onap.so.adapters.vnfrest.DeleteVfModuleRequest;
import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
+import org.onap.so.adapters.vnf.VnfAdapterUtils;
import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.utils.MsoHeatUtils;
@@ -60,6 +61,9 @@ public class PollService extends ExternalTaskUtils {
private MsoHeatUtils msoHeatUtils;
@Autowired
+ private VnfAdapterUtils vnfAdapterUtils;
+
+ @Autowired
private AuditMDCSetup mdcSetup;
public PollService() {
@@ -84,12 +88,22 @@ public class PollService extends ExternalTaskUtils {
logger.debug("Executing External Task Poll Service for Delete Vf Module");
DeleteVfModuleRequest req =
JAXB.unmarshal(new StringReader(xmlRequest), DeleteVfModuleRequest.class);
- pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
+ if (!isMulticloud) {
+ pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ } else {
+ success.setTrue();
+ }
} else if ("deleteVolumeGroupRequest".equals(requestType.get())) {
logger.debug("Executing External Task Poll Service for Delete Volume Group");
DeleteVolumeGroupRequest req =
JAXB.unmarshal(new StringReader(xmlRequest), DeleteVolumeGroupRequest.class);
- pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
+ if (!isMulticloud) {
+ pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ } else {
+ success.setTrue();
+ }
} else if ("createNetworkRequest".equals(requestType.get())) {
determineCreateNetworkStatus(xmlRequest, externalTask, success);
} else if ("deleteNetworkRequest".equals(requestType.get())) {
@@ -133,25 +147,35 @@ public class PollService extends ExternalTaskUtils {
private void determineCreateVolumeGroupStatus(String xmlRequest, ExternalTask externalTask, MutableBoolean success)
throws MsoException {
CreateVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class);
- boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
- if (pollRollbackStatus) {
- logger.debug("Executing External Task Poll Service for Rollback Create Volume Group");
- pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
+ if (!isMulticloud) {
+ boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
+ if (pollRollbackStatus) {
+ logger.debug("Executing External Task Poll Service for Rollback Create Volume Group");
+ pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ } else {
+ pollCreateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ }
} else {
- pollCreateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ success.setTrue();
}
}
private void determineCreateVfModuleStatus(String xmlRequest, ExternalTask externalTask, MutableBoolean success)
throws MsoException {
CreateVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVfModuleRequest.class);
- boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
- if (pollRollbackStatus) {
- logger.debug("Executing External Task Poll Service for Rollback Create Vf Module");
- pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
+ if (!isMulticloud) {
+ boolean pollRollbackStatus = externalTask.getVariable("PollRollbackStatus");
+ if (pollRollbackStatus) {
+ logger.debug("Executing External Task Poll Service for Rollback Create Vf Module");
+ pollDeleteResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ } else {
+ logger.debug("Executing External Task Poll Service for Create Vf Module");
+ pollCreateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ }
} else {
- logger.debug("Executing External Task Poll Service for Create Vf Module");
- pollCreateResource(req.getCloudSiteId(), req.getTenantId(), externalTask, success);
+ success.setTrue();
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java
index c25d752cc4..d6d2264217 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/RollbackService.java
@@ -14,6 +14,8 @@ import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.so.adapters.network.MsoNetworkAdapterImpl;
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
+import org.onap.so.adapters.vnf.MsoVnfPluginAdapterImpl;
+import org.onap.so.adapters.vnf.VnfAdapterUtils;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
import org.onap.so.adapters.vnfrest.CreateVolumeGroupRequest;
import org.onap.so.logging.tasks.AuditMDCSetup;
@@ -35,6 +37,12 @@ public class RollbackService extends ExternalTaskUtils {
private MsoNetworkAdapterImpl networkAdapterImpl;
@Autowired
+ private VnfAdapterUtils vnfAdapterUtils;
+
+ @Autowired
+ private MsoVnfPluginAdapterImpl vnfPluginImpl;
+
+ @Autowired
private AuditMDCSetup mdcSetup;
public void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
@@ -51,19 +59,38 @@ public class RollbackService extends ExternalTaskUtils {
logger.debug("Executing External Task Rollback Service for Create Volume Group");
CreateVolumeGroupRequest req =
JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class);
- vnfAdapterImpl.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- req.getVolumeGroupName(), req.getMsoRequest(), false);
- pollRollbackStatus = true;
- success = true;
+ boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
+ if (!isMulticloud) {
+ vnfAdapterImpl.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVolumeGroupName(), req.getMsoRequest(), false);
+ pollRollbackStatus = true;
+ success = true;
+ } else {
+ vnfPluginImpl.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVolumeGroupName(), req.getMsoRequest());
+ pollRollbackStatus = false;
+ success = true;
+ }
} else if ("createVfModuleRequest".equals(requestType.get())) {
logger.debug("Executing External Task Rollback Service for Create Vf Module");
CreateVfModuleRequest req =
JAXB.unmarshal(new StringReader(xmlRequest), CreateVfModuleRequest.class);
- vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- req.getVfModuleName(), req.getVnfId(), req.getVfModuleId(), req.getModelCustomizationUuid(),
- req.getMsoRequest(), new Holder<>());
- pollRollbackStatus = true;
- success = true;
+ boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
+ if (!isMulticloud) {
+ vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVfModuleName(), req.getVnfId(), req.getVfModuleId(),
+ req.getModelCustomizationUuid(), req.getMsoRequest(), new Holder<>());
+ pollRollbackStatus = true;
+ success = true;
+ } else {
+ /*
+ * vnfPluginImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ * req.getVfModuleName(),req.getMsoRequest(), new Holder<>()); TODO: Figure out how to properly
+ * rollback
+ */
+ pollRollbackStatus = false;
+ success = true;
+ }
} else if ("createNetworkRequest".equals(requestType.get())) {
logger.debug("Executing External Task Rollback Service for Create Network");
Holder<Boolean> networkDeleted = new Holder<>();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java
index c9fa30d949..7be1620b0e 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/orchestration/StackService.java
@@ -48,6 +48,8 @@ import org.onap.so.adapters.nwrest.RollbackNetworkResponse;
import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
+import org.onap.so.adapters.vnf.MsoVnfPluginAdapterImpl;
+import org.onap.so.adapters.vnf.VnfAdapterUtils;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnfrest.CreateVfModuleRequest;
import org.onap.so.adapters.vnfrest.CreateVfModuleResponse;
@@ -81,6 +83,12 @@ public class StackService extends ExternalTaskUtils {
private MsoNetworkAdapterImpl networkAdapterImpl;
@Autowired
+ private MsoVnfPluginAdapterImpl vnfPluginImpl;
+
+ @Autowired
+ private VnfAdapterUtils vnfAdapterUtils;
+
+ @Autowired
private AuditMDCSetup mdcSetup;
private static final String SHARED = "shared";
@@ -160,10 +168,18 @@ public class StackService extends ExternalTaskUtils {
Holder<String> stackId = new Holder<>();
CreateVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVolumeGroupRequest.class);
String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
- vnfAdapterImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- completeVnfVfModuleType, req.getVnfVersion(), "", req.getVolumeGroupName(), "", "VOLUME", null, null,
- req.getModelCustomizationUuid(), req.getVolumeGroupParams(), false, true, req.getEnableBridge(),
- req.getMsoRequest(), stackId, outputs, vnfRollback);
+ boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
+ if (isMulticloud) {
+ vnfPluginImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ completeVnfVfModuleType, req.getVnfVersion(), "", req.getVolumeGroupName(), "", "VOLUME", null,
+ null, req.getModelCustomizationUuid(), req.getVolumeGroupParams(), false, true,
+ req.getEnableBridge(), req.getMsoRequest(), stackId, outputs, vnfRollback);
+ } else {
+ vnfAdapterImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ completeVnfVfModuleType, req.getVnfVersion(), "", req.getVolumeGroupName(), "", "VOLUME", null,
+ null, req.getModelCustomizationUuid(), req.getVolumeGroupParams(), false, true,
+ req.getEnableBridge(), req.getMsoRequest(), stackId, outputs, vnfRollback);
+ }
success.setTrue();
backout.setValue(!req.getSuppressBackout());
VolumeGroupRollback rb = new VolumeGroupRollback(req.getVolumeGroupId(), stackId.value,
@@ -181,11 +197,20 @@ public class StackService extends ExternalTaskUtils {
Holder<String> stackId = new Holder<>();
CreateVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), CreateVfModuleRequest.class);
String completeVnfVfModuleType = req.getVnfType() + "::" + req.getVfModuleType();
- vnfAdapterImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- completeVnfVfModuleType, req.getVnfVersion(), req.getVnfId(), req.getVfModuleName(),
- req.getVfModuleId(), req.getRequestType(), req.getVolumeGroupStackId(), req.getBaseVfModuleStackId(),
- req.getModelCustomizationUuid(), req.getVfModuleParams(), false, false, req.getEnableBridge(),
- req.getMsoRequest(), stackId, outputs, vnfRollback);
+ boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
+ if (isMulticloud) {
+ vnfPluginImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ completeVnfVfModuleType, req.getVnfVersion(), req.getVnfId(), req.getVfModuleName(),
+ req.getVfModuleId(), req.getRequestType(), req.getVolumeGroupStackId(),
+ req.getBaseVfModuleStackId(), req.getModelCustomizationUuid(), req.getVfModuleParams(), false,
+ false, req.getEnableBridge(), req.getMsoRequest(), stackId, outputs, vnfRollback);
+ } else {
+ vnfAdapterImpl.createVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ completeVnfVfModuleType, req.getVnfVersion(), req.getVnfId(), req.getVfModuleName(),
+ req.getVfModuleId(), req.getRequestType(), req.getVolumeGroupStackId(),
+ req.getBaseVfModuleStackId(), req.getModelCustomizationUuid(), req.getVfModuleParams(), false,
+ false, req.getEnableBridge(), req.getMsoRequest(), stackId, outputs, vnfRollback);
+ }
success.setTrue();
backout.setValue(req.getBackout());
canonicalStackId.value = stackId.value;
@@ -201,9 +226,15 @@ public class StackService extends ExternalTaskUtils {
MutableBoolean success) throws VnfException {
backout.setFalse();
DeleteVfModuleRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteVfModuleRequest.class);
- vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
- req.getVfModuleStackId(), req.getVnfId(), req.getVfModuleId(), req.getModelCustomizationUuid(),
- req.getMsoRequest(), outputs);
+ boolean isMulticloud = vnfAdapterUtils.isMulticloudMode(null, req.getCloudSiteId());
+ if (isMulticloud) {
+ vnfPluginImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVfModuleStackId(), req.getMsoRequest(), outputs);
+ } else {
+ vnfAdapterImpl.deleteVfModule(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
+ req.getVfModuleStackId(), req.getVnfId(), req.getVfModuleId(), req.getModelCustomizationUuid(),
+ req.getMsoRequest(), outputs);
+ }
success.setTrue();
if (outputs != null && outputs.value != null) {
canonicalStackId.value = outputs.value.get("canonicalStackId");
@@ -220,7 +251,6 @@ public class StackService extends ExternalTaskUtils {
MutableBoolean success) throws VnfException {
backout.setFalse();
DeleteVolumeGroupRequest req = JAXB.unmarshal(new StringReader(xmlRequest), DeleteVolumeGroupRequest.class);
-
vnfAdapterImpl.deleteVnf(req.getCloudSiteId(), req.getCloudOwner(), req.getTenantId(),
req.getVolumeGroupStackId(), req.getMsoRequest(), false);
success.setTrue();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
new file mode 100644
index 0000000000..6b979833eb
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfPluginAdapterImpl.java
@@ -0,0 +1,1175 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+/**
+ * This VNF Adapter implementation is based on the VDU Plugin model. It assumes that each VF Module definition in the
+ * MSO catalog is expressed via a set of template and/or file artifacts that are appropriate for some specific
+ * sub-orchestrator that provides an implementation of the VduPlugin interface. This adapter handles all of the common
+ * VF Module logic, including: - catalog lookups for artifact retrieval - parameter filtering and validation - base and
+ * volume module queries - rollback logic - logging and error handling
+ *
+ * Then based on the orchestration mode of the VNF, it will invoke different VDU plug-ins to perform the low level
+ * instantiations, deletions, and queries. At this time, the set of available plug-ins is hard-coded, though in the
+ * future a dynamic selection is expected (e.g. via a service-provider interface).
+ */
+package org.onap.so.adapters.vnf;
+
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import javax.jws.WebService;
+import javax.xml.ws.Holder;
+import org.onap.so.adapters.vdu.CloudInfo;
+import org.onap.so.adapters.vdu.VduException;
+import org.onap.so.adapters.vdu.VduInstance;
+import org.onap.so.adapters.vdu.VduModelInfo;
+import org.onap.so.adapters.vdu.VduPlugin;
+import org.onap.so.adapters.vdu.VduStateType;
+import org.onap.so.adapters.vdu.VduStatus;
+import org.onap.so.adapters.vdu.mapper.VfModuleCustomizationToVduMapper;
+import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists;
+import org.onap.so.adapters.vnf.exceptions.VnfException;
+import org.onap.so.cloud.CloudConfig;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.HeatEnvironment;
+import org.onap.so.db.catalog.beans.HeatTemplate;
+import org.onap.so.db.catalog.beans.HeatTemplateParam;
+import org.onap.so.db.catalog.beans.VfModule;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
+import org.onap.so.db.catalog.utils.MavenLikeVersioning;
+import org.onap.so.entity.MsoRequest;
+import org.onap.logging.filter.base.ErrorCode;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.openstack.beans.VnfRollback;
+import org.onap.so.openstack.beans.VnfStatus;
+import org.onap.so.openstack.exceptions.MsoCloudSiteNotFound;
+import org.onap.so.openstack.exceptions.MsoException;
+import org.onap.so.openstack.exceptions.MsoExceptionCategory;
+import org.onap.so.openstack.utils.MsoHeatEnvironmentEntry;
+import org.onap.so.openstack.utils.MsoHeatUtils;
+import org.onap.so.openstack.utils.MsoKeystoneUtils;
+import org.onap.so.openstack.utils.MsoMulticloudUtils;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+import org.springframework.transaction.annotation.Transactional;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@WebService(serviceName = "VnfAdapter", endpointInterface = "org.onap.so.adapters.vnf.MsoVnfAdapter",
+ targetNamespace = "http://org.onap.so/vnf")
+@Component
+@Transactional
+public class MsoVnfPluginAdapterImpl {
+
+ private static final String MSO_CONFIGURATION_ERROR = "MsoConfigurationError";
+ private static Logger logger = LoggerFactory.getLogger(MsoVnfPluginAdapterImpl.class);
+
+ private static final String CHECK_REQD_PARAMS = "org.onap.so.adapters.vnf.checkRequiredParameters";
+ private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
+
+ @Autowired
+ protected CloudConfig cloudConfig;
+
+ @Autowired
+ private VFModuleCustomizationRepository vfModuleCustomRepo;
+
+ @Autowired
+ private Environment environment;
+
+ @Autowired
+ protected MsoKeystoneUtils keystoneUtils;
+
+ @Autowired
+ protected MsoHeatUtils heatUtils;
+
+ @Autowired
+ protected MsoMulticloudUtils multicloudUtils;
+
+ @Autowired
+ protected VfModuleCustomizationToVduMapper vduMapper;
+
+ /**
+ * Health Check web method. Does nothing but return to show the adapter is deployed.
+ */
+
+ public void healthCheck() {
+ logger.debug("Health check call in VNF Plugin Adapter");
+ }
+
+ /**
+ * DO NOT use that constructor to instantiate this class, the msoPropertiesfactory will be NULL.
+ *
+ * @see MsoVnfPluginAdapterImpl#MsoVnfAdapterImpl(MsoPropertiesFactory, CloudConfigFactory)
+ */
+ public MsoVnfPluginAdapterImpl() {
+
+ }
+
+ /**
+ * This is the "Create VNF" web service implementation. This function is now unsupported and will return an error.
+ *
+ */
+ public void createVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfType, String vnfVersion,
+ String vnfName, String requestType, String volumeGroupHeatStackId, Map<String, Object> inputs,
+ Boolean failIfExists, Boolean backout, Boolean enableBridge, MsoRequest msoRequest, Holder<String> vnfId,
+ Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback) throws VnfException {
+ // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules.
+ logger.debug("CreateVNF command attempted but not supported");
+ throw new VnfException("CreateVNF: Unsupported command", MsoExceptionCategory.USERDATA);
+ }
+
+ /**
+ * This is the "Update VNF" web service implementation. This function is now unsupported and will return an error.
+ *
+ */
+ public void updateVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfType, String vnfVersion,
+ String vnfName, String requestType, String volumeGroupHeatStackId, Map<String, Object> inputs,
+ MsoRequest msoRequest, Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback)
+ throws VnfException {
+ // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules.
+ logger.debug("UpdateVNF command attempted but not supported");
+ throw new VnfException("UpdateVNF: Unsupported command", MsoExceptionCategory.USERDATA);
+ }
+
+ /**
+ * This is the "Query VNF" web service implementation.
+ *
+ * This really should be QueryVfModule, but nobody ever changed it.
+ *
+ * The method returns an indicator that the VNF exists, along with its status and outputs. The input "vnfName" will
+ * also be reflected back as its ID.
+ *
+ * @param cloudSiteId CLLI code of the cloud site in which to query
+ * @param tenantId Openstack tenant identifier
+ * @param vnfNameOrId VNF Name or ID to query
+ * @param msoRequest Request tracking information for logs
+ * @param vnfExists Flag reporting the result of the query
+ * @param vnfId Holder for output VNF ID
+ * @param outputs Holder for Map of outputs from the deployed VF Module (assigned IPs, etc)
+ */
+ public void queryVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfNameOrId,
+ MsoRequest msoRequest, Holder<Boolean> vnfExists, Holder<String> vnfId, Holder<VnfStatus> status,
+ Holder<Map<String, String>> outputs) throws VnfException {
+ logger.debug("Querying VNF " + vnfNameOrId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId);
+
+ // Will capture execution time for metrics
+ long startTime = System.currentTimeMillis();
+ long subStartTime = System.currentTimeMillis();
+
+ VduInstance vduInstance = null;
+ CloudInfo cloudInfo = new CloudInfo(cloudSiteId, cloudOwner, tenantId, null);
+
+ VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner);
+
+ try {
+ vduInstance = vduPlugin.queryVdu(cloudInfo, vnfNameOrId);
+ } catch (VduException e) {
+ // Failed to query the VDU due to a plugin exception.
+ // Convert to a generic VnfException
+ e.addContext("QueryVNF");
+ String error = "Query VNF (VDU): " + vnfNameOrId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ + ": " + e;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vnfNameOrId, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "QueryVNF", ErrorCode.DataError.getValue(), "Exception - queryVDU",
+ e);
+ logger.debug(error);
+ throw new VnfException(e);
+ }
+
+ if (vduInstance != null && vduInstance.getStatus().getState() != VduStateType.NOTFOUND) {
+ vnfExists.value = Boolean.TRUE;
+ status.value = vduStatusToVnfStatus(vduInstance);
+ vnfId.value = vduInstance.getVduInstanceId();
+ outputs.value = copyStringOutputs(vduInstance.getOutputs());
+
+ logger.debug("VNF {} found, ID = {}", vnfNameOrId, vnfId.value);
+ } else {
+ vnfExists.value = Boolean.FALSE;
+ status.value = VnfStatus.NOTFOUND;
+ vnfId.value = null;
+ outputs.value = new HashMap<String, String>(); // Return as an empty map
+
+ logger.debug("VNF {} not found", vnfNameOrId);
+ }
+ return;
+ }
+
+
+ /**
+ * This is the "Delete VNF" web service implementation. This function is now unsupported and will return an error.
+ *
+ */
+
+ public void deleteVnf(String cloudSiteId, String cloudOwner, String tenantId, String vnfName, MsoRequest msoRequest)
+ throws VnfException {
+
+ // This operation is no longer supported at the VNF level. The adapter is only called to deploy modules.
+ logger.debug("DeleteVNF command attempted but not supported");
+ throw new VnfException("DeleteVNF: Unsupported command", MsoExceptionCategory.USERDATA);
+ }
+
+ /**
+ * This web service endpoint will rollback a previous Create VNF operation. A rollback object is returned to the
+ * client in a successful creation response. The client can pass that object as-is back to the rollbackVnf operation
+ * to undo the creation.
+ *
+ * TODO: This should be rollbackVfModule and/or rollbackVolumeGroup, but APIs were apparently never updated.
+ */
+
+ public void rollbackVnf(VnfRollback rollback) throws VnfException {
+ long startTime = System.currentTimeMillis();
+ // rollback may be null (e.g. if stack already existed when Create was called)
+ if (rollback == null) {
+ logger.info("{} {} {}", MessageEnum.RA_ROLLBACK_NULL.toString(), "OpenStack", "rollbackVnf");
+ return;
+ }
+
+ // Don't rollback if nothing was done originally
+ if (!rollback.getVnfCreated()) {
+ return;
+ }
+
+ // Get the elements of the VnfRollback object for easier access
+ String cloudSiteId = rollback.getCloudSiteId();
+ String cloudOwner = rollback.getCloudOwner();
+ String tenantId = rollback.getTenantId();
+ CloudInfo cloudInfo = new CloudInfo(cloudSiteId, cloudOwner, tenantId, null);
+
+ String vfModuleId = rollback.getVfModuleStackId();
+
+ logger.debug("Rolling Back VF Module " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId);
+
+ VduInstance vduInstance = null;
+
+ // Use the VduPlugin to delete the VF Module.
+ VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner);
+
+ long subStartTime = System.currentTimeMillis();
+ try {
+ // TODO: Get a reasonable timeout. Use a global property, or store the creation timeout in rollback object
+ // and use that.
+ vduInstance = vduPlugin.deleteVdu(cloudInfo, vfModuleId, 5);
+
+ logger.debug("Rolled back VDU instantiation: {}", vduInstance.getVduInstanceId());
+ } catch (VduException ve) {
+ // Failed to rollback the VF Module due to a plugin exception.
+ // Convert to a generic VnfException
+ ve.addContext("RollbackVFModule");
+ String error = "Rollback VF Module: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ + tenantId + ": " + ve;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(), "Exception - DeleteVdu",
+ ve);
+ logger.debug(error);
+ throw new VnfException(ve);
+ }
+ return;
+ }
+
+
+ private VnfStatus vduStatusToVnfStatus(VduInstance vdu) {
+ // Determine the status based on last action & status
+ // DeploymentInfo object should be enhanced to report a better status internally.
+ VduStatus vduStatus = vdu.getStatus();
+ VduStateType status = vduStatus.getState();
+
+ if (status == null) {
+ return VnfStatus.UNKNOWN;
+ } else if (status == VduStateType.NOTFOUND) {
+ return VnfStatus.NOTFOUND;
+ } else if (status == VduStateType.INSTANTIATED) {
+ return VnfStatus.ACTIVE;
+ } else if (status == VduStateType.FAILED) {
+ return VnfStatus.FAILED;
+ }
+
+ return VnfStatus.UNKNOWN;
+ }
+
+ /*
+ * Normalize an input value to an Object, based on the target parameter type. If the type is not recognized, it will
+ * just be returned unchanged (as a string).
+ */
+ private Object convertInputValue(Object inputValue, HeatTemplateParam templateParam) {
+ String type = templateParam.getParamType();
+ logger.debug("Parameter: {} is of type ", templateParam.getParamName(), type);
+
+ if (type.equalsIgnoreCase("number")) {
+ try {
+ return Integer.valueOf(inputValue.toString());
+ } catch (Exception e) {
+ logger.debug("Unable to convert " + inputValue + " to an integer!", e);
+ return null;
+ }
+ } else if (type.equalsIgnoreCase("json")) {
+ try {
+ JsonNode jsonNode = JSON_MAPPER.readTree(JSON_MAPPER.writeValueAsString(inputValue));
+ return jsonNode;
+ } catch (Exception e) {
+ logger.debug("Unable to convert " + inputValue + " to a JsonNode!", e);
+ return null;
+ }
+ } else if (type.equalsIgnoreCase("boolean")) {
+ return new Boolean(inputValue.toString());
+ }
+
+ // Nothing else matched. Return the original string
+ return inputValue;
+ }
+
+ private Map<String, String> copyStringOutputs(Map<String, Object> stackOutputs) {
+ Map<String, String> stringOutputs = new HashMap<String, String>();
+ for (String key : stackOutputs.keySet()) {
+ if (stackOutputs.get(key) instanceof String) {
+ stringOutputs.put(key, (String) stackOutputs.get(key));
+ } else if (stackOutputs.get(key) instanceof Integer) {
+ try {
+ String str = "" + stackOutputs.get(key);
+ stringOutputs.put(key, str);
+ } catch (Exception e) {
+ logger.debug("Unable to add {} to outputs", key, e);
+ }
+ } else if (stackOutputs.get(key) instanceof JsonNode) {
+ try {
+ String str = this.convertNode((JsonNode) stackOutputs.get(key));
+ stringOutputs.put(key, str);
+ } catch (Exception e) {
+ logger.debug("Unable to add {} to outputs - exception converting JsonNode", key, e);
+ }
+ } else if (stackOutputs.get(key) instanceof java.util.LinkedHashMap) {
+ try {
+ String str = JSON_MAPPER.writeValueAsString(stackOutputs.get(key));
+ stringOutputs.put(key, str);
+ } catch (Exception e) {
+ logger.debug("Unable to add {} to outputs - exception converting LinkedHashMap", key, e);
+ }
+ } else {
+ try {
+ String str = stackOutputs.get(key).toString();
+ stringOutputs.put(key, str);
+ } catch (Exception e) {
+ logger.debug("Unable to add " + key + " to outputs - unable to call .toString() " + e.getMessage(),
+ e);
+ }
+ }
+ }
+ return stringOutputs;
+ }
+
+
+ private void sendMapToDebug(Map<String, Object> inputs, String optionalName) {
+ int i = 0;
+ StringBuilder sb = new StringBuilder(optionalName == null ? "\ninputs" : "\n" + optionalName);
+ if (inputs == null) {
+ sb.append("\tNULL");
+ } else if (inputs.size() < 1) {
+ sb.append("\tEMPTY");
+ } else {
+ for (String str : inputs.keySet()) {
+ String outputString;
+ try {
+ outputString = inputs.get(str).toString();
+ } catch (Exception e) {
+ outputString = "Unable to call toString() on the value for " + str;
+ }
+ sb.append("\t\nitem " + i++ + ": '" + str + "'='" + outputString + "'");
+ }
+ }
+ logger.debug(sb.toString());
+ return;
+ }
+
+ private void sendMapToDebug(Map<String, Object> inputs) {
+ int i = 0;
+ StringBuilder sb = new StringBuilder("inputs:");
+ if (inputs == null) {
+ sb.append("\tNULL");
+ } else if (inputs.size() < 1) {
+ sb.append("\tEMPTY");
+ } else {
+ for (String str : inputs.keySet()) {
+ sb.append("\titem " + i++ + ": " + str + "=" + inputs.get(str));
+ }
+ }
+ logger.debug(sb.toString());
+ return;
+ }
+
+ private String convertNode(final JsonNode node) {
+ try {
+ final Object obj = JSON_MAPPER.treeToValue(node, Object.class);
+ final String json = JSON_MAPPER.writeValueAsString(obj);
+ return json;
+ } catch (JsonParseException jpe) {
+ logger.debug("Error converting json to string " + jpe.getMessage());
+ } catch (Exception e) {
+ logger.debug("Error converting json to string " + e.getMessage());
+ }
+ return "[Error converting json to string]";
+ }
+
+ private Map<String, String> convertMapStringObjectToStringString(Map<String, Object> objectMap) {
+ if (objectMap == null) {
+ return null;
+ }
+ Map<String, String> stringMap = new HashMap<String, String>();
+ for (String key : objectMap.keySet()) {
+ if (!stringMap.containsKey(key)) {
+ Object obj = objectMap.get(key);
+ if (obj instanceof String) {
+ stringMap.put(key, (String) objectMap.get(key));
+ } else if (obj instanceof JsonNode) {
+ // This is a bit of mess - but I think it's the least impacting
+ // let's convert it BACK to a string - then it will get converted back later
+ try {
+ String str = this.convertNode((JsonNode) obj);
+ stringMap.put(key, str);
+ } catch (Exception e) {
+ logger.debug("DANGER WILL ROBINSON: unable to convert value for JsonNode " + key, e);
+ // okay in this instance - only string values (fqdn) are expected to be needed
+ }
+ } else if (obj instanceof java.util.LinkedHashMap) {
+ logger.debug("LinkedHashMap - this is showing up as a LinkedHashMap instead of JsonNode");
+ try {
+ String str = JSON_MAPPER.writeValueAsString(obj);
+ stringMap.put(key, str);
+ } catch (Exception e) {
+ logger.debug("DANGER WILL ROBINSON: unable to convert value for LinkedHashMap " + key, e);
+ }
+ } else if (obj instanceof Integer) {
+ try {
+ String str = "" + obj;
+ stringMap.put(key, str);
+ } catch (Exception e) {
+ logger.debug("DANGER WILL ROBINSON: unable to convert value for Integer " + key, e);
+ }
+ } else {
+ try {
+ String str = obj.toString();
+ stringMap.put(key, str);
+ } catch (Exception e) {
+ logger.debug(
+ "DANGER WILL ROBINSON: unable to convert value " + key + " (" + e.getMessage() + ")",
+ e);
+ }
+ }
+ }
+ }
+
+ return stringMap;
+ }
+
+ /**
+ * This is the "Create VF Module" web service implementation. It will instantiate a new VF Module of the requested
+ * type in the specified cloud and tenant. The tenant must exist before this service is called.
+ *
+ * If a VF Module with the same name already exists, this can be considered a success or failure, depending on the
+ * value of the 'failIfExists' parameter.
+ *
+ * All VF Modules are defined in the MSO catalog. The caller must request one of the pre-defined module types or an
+ * error will be returned. Within the catalog, each VF Module references (among other things) a collection of
+ * artifacts that are used to deploy the required cloud resources (VMs, networks, etc.).
+ *
+ * Depending on the module templates, a variable set of input parameters will be defined, some of which are
+ * required. The caller is responsible to pass the necessary input data for the module or an error will be thrown.
+ *
+ * The method returns the vfModuleId, a Map of output attributes, and a VnfRollback object. This last object can be
+ * passed as-is to the rollbackVnf operation to undo everything that was created for the Module. This is useful if a
+ * VF module is successfully created but the orchestration fails on a subsequent step.
+ *
+ * @param cloudSiteId CLLI code of the cloud site in which to create the VNF
+ * @param cloudOwner cloud owner of the cloud site in which to create the VNF
+ * @param tenantId Openstack tenant identifier
+ * @param vfModuleType VF Module type key, should match a VNF definition in catalog DB. Deprecated - should use
+ * modelCustomizationUuid
+ * @param vnfVersion VNF version key, should match a VNF definition in catalog DB Deprecated - VF Module versions
+ * also captured by modelCustomizationUuid
+ * @param vnfId - VNF ID
+ * @param vfModuleName Name to be assigned to the new VF Module
+ * @param vfModuleId Id fo the new VF Module
+ * @param requestType Indicates if this is a Volume Group or Module request
+ * @param volumeGroupId Identifier (i.e. deployment ID) for a Volume Group to attach to a VF Module
+ * @param baseVfModuleId Identifier (i.e. deployment ID) of the Base Module if this is an Add-on module
+ * @param modelCustomizationUuid Unique ID for the VF Module's model. Replaces the use of vfModuleType.
+ * @param inputs Map of key=value inputs for VNF stack creation
+ * @param failIfExists Flag whether already existing VNF should be considered
+ * @param backout Flag whether to suppress automatic backout (for testing)
+ * @param msoRequest Request tracking information for logs
+ * @param vnfId Holder for output VF Module instance ID in the cloud
+ * @param outputs Holder for Map of VNF outputs from Deployment (assigned IPs, etc)
+ * @param rollback Holder for returning VnfRollback object
+ */
+
+ public void createVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vfModuleType,
+ String vnfVersion, String genericVnfId, String vfModuleName, String vfModuleId, String requestType,
+ String volumeGroupId, String baseVfModuleId, String modelCustomizationUuid, Map<String, Object> inputs,
+ Boolean failIfExists, Boolean backout, Boolean enableBridge, MsoRequest msoRequest, Holder<String> vnfId,
+ Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback) throws VnfException {
+ // Will capture execution time for metrics
+ long startTime = System.currentTimeMillis();
+
+ // Require a model customization ID. Every VF Module definition must have one.
+ if (modelCustomizationUuid == null || modelCustomizationUuid.isEmpty()) {
+ logger.debug("Missing required input: modelCustomizationUuid");
+ String error = "Create vfModule error: Missing required input: modelCustomizationUuid";
+ logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ "VF Module ModelCustomizationUuid", "VDU", ErrorCode.DataError,
+ "Create VF Module: " + "Missing required input: modelCustomizationUuid");
+ logger.debug(error);
+ throw new VnfException(error, MsoExceptionCategory.USERDATA);
+ }
+
+ // Clean up some inputs to make comparisons easier
+ if (requestType == null)
+ requestType = "";
+
+ if ("".equals(volumeGroupId) || "null".equals(volumeGroupId))
+ volumeGroupId = null;
+
+ if ("".equals(baseVfModuleId) || "null".equals(baseVfModuleId))
+ baseVfModuleId = null;
+
+ if (inputs == null) {
+ // Create an empty set of inputs
+ inputs = new HashMap<>();
+ logger.debug("inputs == null - setting to empty");
+ } else {
+ this.sendMapToDebug(inputs);
+ }
+
+ // Check if this is for a "Volume" module
+ boolean isVolumeRequest = false;
+ if (requestType.startsWith("VOLUME")) {
+ isVolumeRequest = true;
+ }
+
+ logger.debug("requestType = " + requestType + ", volumeGroupStackId = " + volumeGroupId + ", baseStackId = "
+ + baseVfModuleId);
+
+ // Build a default rollback object (no actions performed)
+ VnfRollback vfRollback = new VnfRollback();
+ vfRollback.setCloudSiteId(cloudSiteId);
+ vfRollback.setCloudOwner(cloudOwner);
+ vfRollback.setTenantId(tenantId);
+ vfRollback.setMsoRequest(msoRequest);
+ vfRollback.setRequestType(requestType);
+ vfRollback.setIsBase(false); // Until we know better
+ vfRollback.setVolumeGroupHeatStackId(volumeGroupId);
+ vfRollback.setBaseGroupHeatStackId(baseVfModuleId);
+ vfRollback.setModelCustomizationUuid(modelCustomizationUuid);
+ vfRollback.setMode("CFY");
+
+ rollback.value = vfRollback; // Default rollback - no updates performed
+
+ // Get the VNF/VF Module definition from the Catalog DB first.
+ // There are three relevant records: VfModule, VfModuleCustomization, VnfResource
+
+ VfModule vfModule = null;
+ VnfResource vnfResource = null;
+ VfModuleCustomization vfModuleCust = null;
+
+ try {
+ vfModuleCust =
+ vfModuleCustomRepo.findFirstByModelCustomizationUUIDOrderByCreatedDesc(modelCustomizationUuid);
+
+ if (vfModuleCust == null) {
+ String error = "Create vfModule error: Unable to find vfModuleCust with modelCustomizationUuid="
+ + modelCustomizationUuid;
+ logger.debug(error);
+ logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(),
+ "VF Module ModelCustomizationUuid", modelCustomizationUuid, "CatalogDb", ErrorCode.DataError,
+ error);
+ throw new VnfException(error, MsoExceptionCategory.USERDATA);
+ } else {
+ logger.debug("Found vfModuleCust entry {}", vfModuleCust.toString());
+ }
+
+ // Get the vfModule and vnfResource records
+ vfModule = vfModuleCust.getVfModule();
+ vnfResource = vfModuleCust.getVfModule().getVnfResources();
+ } catch (Exception e) {
+
+ logger.debug("unhandled exception in create VF - [Query]" + e.getMessage());
+ throw new VnfException("Exception during create VF " + e.getMessage());
+ }
+
+ // Perform a version check against cloudSite
+ // Obtain the cloud site information where we will create the VF Module
+ Optional<CloudSite> cloudSiteOp = cloudConfig.getCloudSite(cloudSiteId);
+ if (!cloudSiteOp.isPresent()) {
+ // If cloudSiteId is not present in the catalog DB, then default to multicloud
+ logger.debug("{} is not present in cloud_site catalog DB, defaulting to Multicloud plugin adapter",
+ cloudSiteId);
+ } else {
+ CloudSite cloudSite = cloudSiteOp.get();
+ MavenLikeVersioning aicV = new MavenLikeVersioning();
+ aicV.setVersion(cloudSite.getCloudVersion());
+
+ String vnfMin = vnfResource.getAicVersionMin();
+ String vnfMax = vnfResource.getAicVersionMax();
+
+ if ((vnfMin != null && !(aicV.isMoreRecentThan(vnfMin) || aicV.isTheSameVersion(vnfMin)))
+ || (vnfMax != null && aicV.isMoreRecentThan(vnfMax))) {
+ // ERROR
+ String error =
+ "VNF Resource type: " + vnfResource.getModelName() + ", ModelUuid=" + vnfResource.getModelUUID()
+ + " VersionMin=" + vnfMin + " VersionMax:" + vnfMax + " NOT supported on Cloud: "
+ + cloudSiteId + " with AIC_Version:" + cloudSite.getCloudVersion();
+ logger.error("{} {} {} {} {}", MessageEnum.RA_CONFIG_EXC.toString(), error, "OpenStack",
+ ErrorCode.BusinessProcessError.getValue(), "Exception - setVersion");
+ logger.debug(error);
+ throw new VnfException(error, MsoExceptionCategory.USERDATA);
+ }
+ }
+ // End Version check
+
+
+ VduInstance vduInstance = null;
+ CloudInfo cloudInfo = new CloudInfo(cloudSiteId, cloudOwner, tenantId, null);
+
+ // Use the VduPlugin.
+ VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner);
+
+ long subStartTime1 = System.currentTimeMillis();
+ try {
+ vduInstance = vduPlugin.queryVdu(cloudInfo, vfModuleName);
+ } catch (VduException me) {
+ // Failed to query the VDU due to a plugin exception.
+ String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ + tenantId + ": " + me;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ "Exception - queryVdu", me);
+ logger.debug(error);
+ // Convert to a generic VnfException
+ me.addContext("CreateVFModule");
+ throw new VnfException(me);
+ }
+
+ // More precise handling/messaging if the Module already exists
+ if (vduInstance != null && !(vduInstance.getStatus().getState() == VduStateType.NOTFOUND)) {
+ VduStateType status = vduInstance.getStatus().getState();
+ logger.debug("Found Existing VDU, status=" + status);
+
+ if (status == VduStateType.INSTANTIATED) {
+ if (failIfExists != null && failIfExists) {
+ // fail - it exists
+ String error = "Create VF: Deployment " + vfModuleName + " already exists in " + cloudOwner + "/"
+ + cloudSiteId + "/" + tenantId;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(),
+ vfModuleName, cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu",
+ ErrorCode.DataError.getValue(), "VF Module " + vfModuleName + " already exists");
+ logger.debug(error);
+ throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
+ vduInstance.getVduInstanceId());
+ } else {
+ // Found existing deployment and client has not requested "failIfExists".
+ // Populate the outputs from the existing deployment.
+
+ vnfId.value = vduInstance.getVduInstanceId();
+ outputs.value = copyStringOutputs(vduInstance.getOutputs());
+ return;
+ }
+ }
+ // Check through various detailed error cases
+ else if (status == VduStateType.INSTANTIATING || status == VduStateType.DELETING
+ || status == VduStateType.UPDATING) {
+ // fail - it's in progress - return meaningful error
+ String error = "Create VF: Deployment " + vfModuleName + " already exists and has status "
+ + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ + "; please wait for it to complete, or fix manually.";
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ "VF Module " + vfModuleName + " already exists");
+ logger.debug(error);
+ throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
+ vduInstance.getVduInstanceId());
+ } else if (status == VduStateType.FAILED) {
+ // fail - it exists and is in a FAILED state
+ String error = "Create VF: Deployment " + vfModuleName + " already exists and is in FAILED state in "
+ + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ "VF Module " + vfModuleName + " already exists and is in FAILED state");
+ logger.debug(error);
+ throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
+ vduInstance.getVduInstanceId());
+ } else if (status == VduStateType.UNKNOWN) {
+ // fail - it exists and is in a UNKNOWN state
+ String error = "Create VF: Deployment " + vfModuleName + " already exists and has status "
+ + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ + "; requires manual intervention.";
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ "VF Module " + vfModuleName + " already exists and is in " + status.toString() + " state");
+ logger.debug(error);
+ throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
+ vduInstance.getVduInstanceId());
+ } else {
+ // Unexpected, since all known status values have been tested for
+ String error = "Create VF: Deployment " + vfModuleName + " already exists with unexpected status "
+ + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ + "; requires manual intervention.";
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
+ cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu", ErrorCode.DataError.getValue(),
+ "VF Module " + vfModuleName + " already exists and is in an unknown state");
+ logger.debug(error);
+ throw new VnfAlreadyExists(vfModuleName, cloudSiteId, cloudOwner, tenantId,
+ vduInstance.getVduInstanceId());
+ }
+ }
+
+
+ // Collect outputs from Base Modules and Volume Modules
+ Map<String, Object> baseModuleOutputs = null;
+ Map<String, Object> volumeGroupOutputs = null;
+
+ // If a Volume Group was provided, query its outputs for inclusion in Module input parameters
+ if (volumeGroupId != null) {
+ long subStartTime2 = System.currentTimeMillis();
+ VduInstance volumeVdu = null;
+ try {
+ volumeVdu = vduPlugin.queryVdu(cloudInfo, volumeGroupId);
+ } catch (VduException me) {
+ // Failed to query the Volume Group VDU due to a plugin exception.
+ String error = "Create VF Module: Query Volume Group " + volumeGroupId + " in " + cloudOwner + "/"
+ + cloudSiteId + "/" + tenantId + ": " + me;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
+ cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu(volume)", ErrorCode.DataError.getValue(),
+ "Exception - queryVdu(volume)", me);
+ logger.debug(error);
+ // Convert to a generic VnfException
+ me.addContext("CreateVFModule(QueryVolume)");
+ throw new VnfException(me);
+ }
+
+ if (volumeVdu == null || volumeVdu.getStatus().getState() == VduStateType.NOTFOUND) {
+ String error = "Create VFModule: Attached Volume Group DOES NOT EXIST " + volumeGroupId + " in "
+ + cloudOwner + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
+ logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), volumeGroupId,
+ cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(volume)",
+ ErrorCode.BusinessProcessError.getValue(),
+ "Create VFModule: Attached Volume Group " + "DOES NOT EXIST");
+ logger.debug(error);
+ throw new VnfException(error, MsoExceptionCategory.USERDATA);
+ } else {
+ logger.debug("Found nested volume group");
+ volumeGroupOutputs = volumeVdu.getOutputs();
+ this.sendMapToDebug(volumeGroupOutputs, "volumeGroupOutputs");
+ }
+ }
+
+ // If this is an Add-On Module, query the Base Module outputs
+ // Note: This will be performed whether or not the current request is for an
+ // Add-On Volume Group or Add-On VF Module
+
+ if (vfModule.getIsBase()) {
+ logger.debug("This is a BASE Module request");
+ vfRollback.setIsBase(true);
+ } else {
+ logger.debug("This is an Add-On Module request");
+
+ // Add-On Modules should always have a Base, but just treat as a warning if not provided.
+ // Add-on Volume requests may or may not specify a base.
+ if (!isVolumeRequest && baseVfModuleId == null) {
+ logger.debug("WARNING: Add-on Module request - no Base Module ID provided");
+ }
+
+ if (baseVfModuleId != null) {
+ long subStartTime2 = System.currentTimeMillis();
+ VduInstance baseVdu = null;
+ try {
+ baseVdu = vduPlugin.queryVdu(cloudInfo, baseVfModuleId);
+ } catch (MsoException me) {
+ // Failed to query the Base VF Module due to a Vdu Plugin exception.
+ String error = "Create VF Module: Query Base " + baseVfModuleId + " in " + cloudOwner + "/"
+ + cloudSiteId + "/" + tenantId + ": " + me;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), baseVfModuleId,
+ cloudOwner, cloudSiteId, tenantId, "VDU", "queryVdu(Base)", ErrorCode.DataError.getValue(),
+ "Exception - queryVdu(Base)", me);
+ logger.debug(error);
+ // Convert to a generic VnfException
+ me.addContext("CreateVFModule(QueryBase)");
+ throw new VnfException(me);
+ }
+
+ if (baseVdu == null || baseVdu.getStatus().getState() == VduStateType.NOTFOUND) {
+ String error = "Create VFModule: Base Module DOES NOT EXIST " + baseVfModuleId + " in " + cloudOwner
+ + "/" + cloudSiteId + "/" + tenantId + " USER ERROR";
+ logger.error("{} {} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(),
+ baseVfModuleId, cloudOwner, cloudSiteId, tenantId, error, "VDU", "queryVdu(Base)",
+ ErrorCode.BusinessProcessError.getValue(), "Create VFModule: Base Module DOES NOT EXIST");
+ logger.debug(error);
+ throw new VnfException(error, MsoExceptionCategory.USERDATA);
+ } else {
+ logger.debug("Found base module");
+ baseModuleOutputs = baseVdu.getOutputs();
+ this.sendMapToDebug(baseModuleOutputs, "baseModuleOutputs");
+ }
+ }
+ }
+
+
+ // NOTE: For this section, heatTemplate is used for all template artifacts.
+ // In final implementation (post-POC), the template object would either be generic or there would
+ // be a separate DB Table/Object for different sub-orchestrators.
+
+ // NOTE: The template is fixed for the VF Module. The environment is part of the customization.
+
+ HeatTemplate heatTemplate = null;
+ HeatEnvironment heatEnvironment = null;
+ if (isVolumeRequest) {
+ heatTemplate = vfModule.getVolumeHeatTemplate();
+ heatEnvironment = vfModuleCust.getVolumeHeatEnv();
+ } else {
+ heatTemplate = vfModule.getModuleHeatTemplate();
+ heatEnvironment = vfModuleCust.getHeatEnvironment();
+ }
+
+ if (heatTemplate == null) {
+ String error = "UpdateVF: No Heat Template ID defined in catalog database for " + vfModuleType
+ + ", modelCustomizationUuid=" + modelCustomizationUuid + ", vfModuleUuid=" + vfModule.getModelUUID()
+ + ", reqType=" + requestType;
+ logger.error("{} {} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Template ID",
+ vfModuleType, "VNF", ErrorCode.DataError.getValue(), error);
+ logger.debug(error);
+ throw new VnfException(error, MsoExceptionCategory.INTERNAL);
+ } else {
+ logger.debug("Got HEAT Template from DB: " + heatTemplate.getHeatTemplate());
+ }
+
+ if (heatEnvironment == null) {
+ String error = "Update VNF: undefined Heat Environment. VF=" + vfModuleType + ", modelCustomizationUuid="
+ + modelCustomizationUuid + ", vfModuleUuid=" + vfModule.getModelUUID() + ", reqType=" + requestType;
+ logger.error("{} {} {} {} {}", MessageEnum.RA_VNF_UNKNOWN_PARAM.toString(), "Heat Environment ID",
+ "OpenStack", ErrorCode.DataError.getValue(), error);
+ throw new VnfException(error, MsoExceptionCategory.INTERNAL);
+ } else {
+ logger.debug("Got Heat Environment from DB: " + heatEnvironment.getEnvironment());
+ }
+
+
+ // Create the combined set of parameters from the incoming request, base-module outputs,
+ // volume-module outputs. Also, convert all variables to their native object types.
+
+ HashMap<String, Object> goldenInputs = new HashMap<String, Object>();
+ List<String> extraInputs = new ArrayList<String>();
+
+ Boolean skipInputChecks = false;
+
+ if (skipInputChecks) {
+ goldenInputs = new HashMap<String, Object>();
+ for (String key : inputs.keySet()) {
+ goldenInputs.put(key, inputs.get(key));
+ }
+ } else {
+ // Build maps for the parameters (including aliases) to simplify checks
+ HashMap<String, HeatTemplateParam> params = new HashMap<String, HeatTemplateParam>();
+
+ Set<HeatTemplateParam> paramSet = heatTemplate.getParameters();
+ logger.debug("paramSet has " + paramSet.size() + " entries");
+
+ for (HeatTemplateParam htp : paramSet) {
+ params.put(htp.getParamName(), htp);
+
+ // Include aliases.
+ String alias = htp.getParamAlias();
+ if (alias != null && !alias.equals("") && !params.containsKey(alias)) {
+ params.put(alias, htp);
+ }
+ }
+
+ // First, convert all inputs to their "template" type
+ for (String key : inputs.keySet()) {
+ if (params.containsKey(key)) {
+ Object value = convertInputValue(inputs.get(key), params.get(key));
+ if (value != null) {
+ goldenInputs.put(key, value);
+ } else {
+ logger.debug("Failed to convert input " + key + "='" + inputs.get(key) + "' to "
+ + params.get(key).getParamType());
+ }
+ } else {
+ extraInputs.add(key);
+ }
+ }
+
+ if (!extraInputs.isEmpty()) {
+ // Add multicloud inputs
+ for (String key : MsoMulticloudUtils.MULTICLOUD_INPUTS) {
+ if (extraInputs.contains(key)) {
+ goldenInputs.put(key, inputs.get(key));
+ extraInputs.remove(key);
+ if (extraInputs.isEmpty()) {
+ break;
+ }
+ }
+ }
+ logger.debug("Ignoring extra inputs: " + extraInputs);
+ }
+
+ // Next add in Volume Group Outputs if there are any. Copy directly without conversions.
+ if (volumeGroupOutputs != null && !volumeGroupOutputs.isEmpty()) {
+ for (String key : volumeGroupOutputs.keySet()) {
+ if (params.containsKey(key) && !goldenInputs.containsKey(key)) {
+ goldenInputs.put(key, volumeGroupOutputs.get(key));
+ }
+ }
+ }
+
+ // Next add in Base Module Outputs if there are any. Copy directly without conversions.
+ if (baseModuleOutputs != null && !baseModuleOutputs.isEmpty()) {
+ for (String key : baseModuleOutputs.keySet()) {
+ if (params.containsKey(key) && !goldenInputs.containsKey(key)) {
+ goldenInputs.put(key, baseModuleOutputs.get(key));
+ }
+ }
+ }
+
+ // TODO: The model should support a mechanism to pre-assign default parameter values
+ // per "customization" (i.e. usage) of a given module. In HEAT, this is specified by
+ // an Environment file. There is not a general mechanism in the model to handle this.
+ // For the general case, any such parameter/values can be added dynamically to the
+ // inputs (only if not already specified).
+
+ // Check that required parameters have been supplied from any of the sources
+ String missingParams = null;
+ boolean checkRequiredParameters = true;
+ try {
+ String propertyString = this.environment.getProperty(MsoVnfPluginAdapterImpl.CHECK_REQD_PARAMS);
+ if ("false".equalsIgnoreCase(propertyString) || "n".equalsIgnoreCase(propertyString)) {
+ checkRequiredParameters = false;
+ logger.debug("CheckRequiredParameters is FALSE. Will still check but then skip blocking..."
+ + MsoVnfPluginAdapterImpl.CHECK_REQD_PARAMS);
+ }
+ } catch (Exception e) {
+ // No problem - default is true
+ logger.debug("An exception occured trying to get property " + MsoVnfPluginAdapterImpl.CHECK_REQD_PARAMS,
+ e);
+ }
+
+ // Do the actual parameter checking.
+ // Include looking at the ENV file as a valid definition of a parameter value.
+ // TODO: This handling of ENV applies only to Heat. A general mechanism to
+ // support pre-set parameter/values does not yet exist in the model.
+ //
+ StringBuilder sb = new StringBuilder(heatEnvironment.getEnvironment());
+ MsoHeatEnvironmentEntry mhee = new MsoHeatEnvironmentEntry(sb);
+ for (HeatTemplateParam parm : heatTemplate.getParameters()) {
+ if (parm.isRequired() && (!goldenInputs.containsKey(parm.getParamName()))) {
+ if (mhee != null && mhee.containsParameter(parm.getParamName())) {
+ logger.debug("Required parameter " + parm.getParamName()
+ + " appears to be in environment - do not count as missing");
+ } else {
+ logger.debug("adding to missing parameters list: " + parm.getParamName());
+ if (missingParams == null) {
+ missingParams = parm.getParamName();
+ } else {
+ missingParams += "," + parm.getParamName();
+ }
+ }
+ }
+ }
+
+ if (missingParams != null) {
+ if (checkRequiredParameters) {
+ // Problem - missing one or more required parameters
+ String error = "Create VFModule: Missing Required inputs: " + missingParams;
+ logger.error("{} {} {} {} {}", MessageEnum.RA_MISSING_PARAM.toString(), missingParams, "VDU",
+ ErrorCode.DataError.getValue(), "Create VFModule: Missing Required inputs");
+ logger.debug(error);
+ throw new VnfException(error, MsoExceptionCategory.USERDATA);
+ } else {
+ logger.debug("found missing parameters [" + missingParams
+ + "] - but checkRequiredParameters is false - " + "will not block");
+ }
+ } else {
+ logger.debug("No missing parameters found - ok to proceed");
+ }
+
+ } // NOTE: END PARAMETER CHECKING
+
+
+ // Here we go... ready to deploy the VF Module.
+ long instantiateVduStartTime = System.currentTimeMillis();
+ if (backout == null)
+ backout = true;
+
+ try {
+ // Construct the VDU Model structure to pass to the targeted VduPlugin
+ VduModelInfo vduModel = null;
+ if (!isVolumeRequest) {
+ vduModel = vduMapper.mapVfModuleCustomizationToVdu(vfModuleCust);
+ } else {
+ vduModel = vduMapper.mapVfModuleCustVolumeToVdu(vfModuleCust);
+ }
+
+ // Invoke the VduPlugin to instantiate the VF Module
+ vduInstance = vduPlugin.instantiateVdu(cloudInfo, vfModuleName, goldenInputs, vduModel, backout);
+
+ } catch (VduException me) {
+ // Failed to instantiate the VDU.
+ me.addContext("CreateVFModule");
+ String error = "Create VF Module " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ + ": " + me;
+ logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
+ cloudSiteId, tenantId, "VDU", ErrorCode.DataError.getValue(), "MsoException - instantiateVdu", me);
+ logger.debug(error);
+ // Convert to a generic VnfException
+ throw new VnfException(me);
+ } catch (NullPointerException npe) {
+ String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ + ": " + npe;
+ logger.error("{} {} {} {} {} {} {} {}", MessageEnum.RA_CREATE_VNF_ERR.toString(), vfModuleType, cloudOwner,
+ cloudSiteId, tenantId, "VDU", ErrorCode.DataError.getValue(),
+ "NullPointerException - instantiateVdu", npe);
+ logger.debug(error);
+ logger.debug("NULL POINTER EXCEPTION at vduPlugin.instantiateVdu", npe);
+ throw new VnfException("NullPointerException during instantiateVdu");
+ } catch (Exception e) {
+ String error = "Create VFModule " + vfModuleType + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
+ + ": " + e;
+ logger.debug("Unhandled exception at vduPlugin.instantiateVdu", e);
+ logger.debug(error);
+ throw new VnfException("Exception during instantiateVdu: " + e.getMessage());
+ }
+
+
+ // Reach this point if create is successful.
+ // Populate remaining rollback info and response parameters.
+ vfRollback.setVnfCreated(true);
+ vfRollback.setVnfId(vduInstance.getVduInstanceId());
+ vnfId.value = vduInstance.getVduInstanceId();
+ outputs.value = copyStringOutputs(vduInstance.getOutputs());
+
+ rollback.value = vfRollback;
+
+ logger.debug("VF Module " + vfModuleName + " successfully created");
+ return;
+ }
+
+
+ public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vfModuleId,
+ MsoRequest msoRequest, Holder<Map<String, String>> outputs) throws VnfException {
+
+ logger.debug("Deleting VF Module " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId);
+ // Will capture execution time for metrics
+ long startTime = System.currentTimeMillis();
+
+ // Capture the output parameters on a delete, so need to query first
+ VduInstance vduInstance = null;
+ CloudInfo cloudInfo = new CloudInfo(cloudSiteId, cloudOwner, tenantId, null);
+
+ // Use the VduPlugin.
+ VduPlugin vduPlugin = getVduPlugin(cloudSiteId, cloudOwner);
+
+ try {
+ vduInstance = vduPlugin.queryVdu(cloudInfo, vfModuleId);
+ } catch (VduException e) {
+ // Failed to query the VDU due to a plugin exception.
+ // Convert to a generic VnfException
+ e.addContext("QueryVFModule");
+ String error = "Query VfModule (VDU): " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/"
+ + tenantId + ": " + e;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleId, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "QueryVFModule", ErrorCode.DataError.getValue(),
+ "Exception - queryVDU", e);
+ logger.debug(error);
+ throw new VnfException(e);
+ }
+
+ // call method which handles the conversion from Map<String,Object> to Map<String,String> for our expected
+ // Object types
+ outputs.value = convertMapStringObjectToStringString(vduInstance.getOutputs());
+
+ // Use the VduPlugin to delete the VDU.
+ // The possible outcomes of deleteVdu are
+ // - a vnfInstance object with status of DELETED (success)
+ // - a vnfInstance object with status of NOTFOUND (VDU did not exist, treat as success)
+ // - a vnfInstance object with status of FAILED (error)
+ // Also, VduException could be thrown.
+ long subStartTime = System.currentTimeMillis();
+ try {
+ // TODO: Get an appropriate timeout value - require access to the model
+ vduPlugin.deleteVdu(cloudInfo, vfModuleId, 5);
+ } catch (VduException me) {
+ me.addContext("DeleteVfModule");
+ // Convert to a generic VnfException
+ String error =
+ "Delete VF: " + vfModuleId + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId + ": " + me;
+ logger.error("{} {} {} {} {} {} {} {} {}", MessageEnum.RA_DELETE_VNF_ERR.toString(), vfModuleId, cloudOwner,
+ cloudSiteId, tenantId, "VDU", "DeleteVdu", ErrorCode.DataError.getValue(),
+ "Exception - DeleteVdu: " + me.getMessage());
+ logger.debug(error);
+ throw new VnfException(me);
+ }
+
+ // On success, nothing is returned.
+ return;
+ }
+
+ // Update VF Module not yet implemented for generic VDU plug-in model.
+
+ public void updateVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfType,
+ String vnfVersion, String vnfName, String requestType, String volumeGroupHeatStackId,
+ String baseVfHeatStackId, String vfModuleStackId, String modelCustomizationUuid, Map<String, Object> inputs,
+ MsoRequest msoRequest, Holder<Map<String, String>> outputs, Holder<VnfRollback> rollback)
+ throws VnfException {
+ // This operation is not currently supported for VduPlugin-orchestrated VF Modules.
+ logger.debug("Update VF Module command attempted but not supported");
+ throw new VnfException("UpdateVfModule: Unsupported command", MsoExceptionCategory.USERDATA);
+ }
+
+ /*
+ * Dynamic selection of a VduPlugin version. For initial tests, base on the "orchestrator" defined for the target
+ * cloud. Should really be looking at the VNF Model (ochestration_mode) but we don't currently have access to that
+ * in Query and Delete cases.
+ */
+ private VduPlugin getVduPlugin(String cloudSiteId, String cloudOwner) {
+ Optional<CloudSite> cloudSiteOp = cloudConfig.getCloudSite(cloudSiteId);
+ if (cloudSiteOp.isPresent()) {
+ CloudSite cloudSite = cloudSiteOp.get();
+ String orchestrator = cloudSite.getOrchestrator();
+
+ if (orchestrator.equalsIgnoreCase("HEAT")) {
+ return heatUtils;
+ } else if (orchestrator.equalsIgnoreCase("MULTICLOUD")) {
+ return multicloudUtils;
+ } else {
+ // Default if cloudSite record exists - return HEAT plugin - will fail later
+ return heatUtils;
+ }
+ }
+ // Default if no cloudSite record exists - return multicloud plugin
+ return multicloudUtils;
+ }
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterUtils.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterUtils.java
new file mode 100644
index 0000000000..85f1a977da
--- /dev/null
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VnfAdapterUtils.java
@@ -0,0 +1,74 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * OPENECOMP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.vnf;
+
+import java.util.Optional;
+import org.onap.so.cloud.CloudConfig;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+@Component
+public class VnfAdapterUtils {
+ private static Logger logger = LoggerFactory.getLogger(VnfAdapterUtils.class);
+
+ private static final String HEAT_MODE = "HEAT";
+ private static final String MULTICLOUD_MODE = "MULTICLOUD";
+
+ @Autowired
+ private CloudConfig cloudConfig;
+
+ /*
+ * Choose which implementation of VNF Adapter to use, based on the orchestration mode. Currently, the two supported
+ * orchestrators are HEAT and CLOUDIFY.
+ */
+ public boolean isMulticloudMode(String mode, String cloudSiteId) {
+ // First, determine the orchestration mode to use.
+ // If was explicitly provided as a parameter, use that. Else if specified for
+ // the
+ // cloudsite, use that. Otherwise, the default is the (original) HEAT-based
+ // impl.
+
+ logger.debug("Entered GetVnfAdapterImpl: mode=" + mode + ", cloudSite=" + cloudSiteId);
+
+ if (mode == null) {
+ // Didn't get an explicit mode type requested.
+ // Use the CloudSite to determine which Impl to use, based on whether the target
+ // cloutSite
+ // has a CloudifyManager assigned to it
+ Optional<CloudSite> cloudSite = cloudConfig.getCloudSite(cloudSiteId);
+ if (cloudSite.isPresent()) {
+ logger.debug("Got CloudSite: " + cloudSite.toString());
+ if (MULTICLOUD_MODE.equalsIgnoreCase(cloudSite.get().getOrchestrator())) {
+ logger.debug("GetVnfAdapterImpl: mode=" + MULTICLOUD_MODE);
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
index 8ee87b50c3..eb0529c85f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -48,6 +48,7 @@ import javax.ws.rs.NotFoundException;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.UriBuilder;
import org.apache.commons.collections.CollectionUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.validator.routines.InetAddressValidator;
import org.onap.aai.domain.yang.Flavor;
import org.onap.aai.domain.yang.Image;
@@ -342,8 +343,10 @@ public class HeatBridgeImpl implements HeatBridgeApi {
}
transaction.connect(vserverUri, foundVnfcURI.get());
} else {
- throw new HeatBridgeException(
- "VF Module contains no relationships to VNFCS, cannot build edge to VServer");
+ /*
+ * throw new HeatBridgeException(
+ * "VF Module contains no relationships to VNFCS, cannot build edge to VServer");
+ */
}
}
@@ -374,44 +377,47 @@ public class HeatBridgeImpl implements HeatBridgeApi {
boolean isL2Multicast = false;
Port port = osClient.getPortById(portId);
Network network = osClient.getNetworkById(port.getNetworkId());
- LInterface lIf = new LInterface();
- lIf.setInterfaceId(port.getId());
- lIf.setInterfaceName(port.getName());
- lIf.setMacaddr(port.getMacAddress());
- lIf.setNetworkName(network.getName());
- lIf.setIsPortMirrored(false);
- lIf.setIsIpUnnumbered(false);
- lIf.setInMaint(false);
-
- if (port.getProfile() != null && port.getProfile().get("trusted") != null) {
- String trusted = port.getProfile().get("trusted").toString();
- if (Boolean.parseBoolean(trusted)) {
- isL2Multicast = true;
+ if (!StringUtils.isEmpty(port.getDeviceId())) {
+ LInterface lIf = new LInterface();
+ lIf.setInterfaceId(port.getId());
+ lIf.setInterfaceName(port.getName());
+ lIf.setMacaddr(port.getMacAddress());
+ lIf.setNetworkName(network.getName());
+ lIf.setIsPortMirrored(false);
+ lIf.setIsIpUnnumbered(false);
+ lIf.setInMaint(false);
+
+ if (port.getProfile() != null && port.getProfile().get("trusted") != null) {
+ String trusted = port.getProfile().get("trusted").toString();
+ if (Boolean.parseBoolean(trusted)) {
+ isL2Multicast = true;
+ }
}
- }
- lIf.setL2Multicasting(isL2Multicast);
- lIf.setInterfaceType(getInterfaceType(nodeType, port.getvNicType()));
- lIf.setRelationshipList(new RelationshipList());
+ lIf.setL2Multicasting(isL2Multicast);
+ lIf.setInterfaceType(getInterfaceType(nodeType, port.getvNicType()));
+ lIf.setRelationshipList(new RelationshipList());
- if (oobMgtNetIds != null && oobMgtNetIds.contains(port.getNetworkId())) {
- lIf.setInterfaceRole(OOB_MGT_NETWORK_IDENTIFIER);
- } else {
- lIf.setInterfaceRole(port.getvNicType());
- }
+ if (oobMgtNetIds != null && oobMgtNetIds.contains(port.getNetworkId())) {
+ lIf.setInterfaceRole(OOB_MGT_NETWORK_IDENTIFIER);
+ } else {
+ lIf.setInterfaceRole(port.getvNicType());
+ }
- // Update l-interface to the vserver
- transaction.createIfNotExists(
- AAIUriFactory.createResourceUri(
- AAIFluentTypeBuilder.cloudInfrastructure().cloudRegion(cloudOwner, cloudRegionId)
- .tenant(tenantId).vserver(port.getDeviceId()).lInterface(lIf.getInterfaceName())),
- Optional.of(lIf));
+ // Update l-interface to the vserver
+ transaction
+ .createIfNotExists(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId)
+ .vserver(port.getDeviceId()).lInterface(lIf.getInterfaceName())),
+ Optional.of(lIf));
- updateLInterfaceIps(port, lIf);
+ updateLInterfaceIps(port, lIf);
- if (cloudOwner.equals(env.getProperty("mso.cloudOwner.included", ""))) {
- Server server = getOpenstackServerById(port.getDeviceId());
- createVlanAndSriovVF(port, lIf, server.getHypervisorHostname());
- updateSriovPfToSriovVF(port, lIf);
+ if (cloudOwner.equals(env.getProperty("mso.cloudOwner.included", ""))) {
+ Server server = getOpenstackServerById(port.getDeviceId());
+ createVlanAndSriovVF(port, lIf, server.getHypervisorHostname());
+ updateSriovPfToSriovVF(port, lIf);
+ }
}
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
index fef7b5e6cb..a8fa6535c3 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
@@ -104,9 +104,10 @@ public class AaiHelper {
}
// vserver to vnfc relationship
- if (!StringUtils.isEmpty(server.getName())) {
- relationships.add(createVnfRelationshiptoVserver(server.getName(), genericVnfId, vfModuleId));
- }
+ /*
+ * if (!StringUtils.isEmpty(server.getName())) {
+ * relationships.add(createVnfRelationshiptoVserver(server.getName(), genericVnfId, vfModuleId)); }
+ */
// vserver to vf-module relationship
Relationship vfModuleRelationship = buildRelationship(AAIUriFactory
.createResourceUri(AAIFluentTypeBuilder.network().genericVnf(genericVnfId).vfModule(vfModuleId)));
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java
index 8d5ab8234e..60826705fd 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/PollServiceTest.java
@@ -14,6 +14,7 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.adapters.tasks.orchestration.PollService;
+import org.onap.so.adapters.vnf.VnfAdapterUtils;
import org.onap.so.logging.tasks.AuditMDCSetup;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.utils.MsoHeatUtils;
@@ -34,6 +35,9 @@ public class PollServiceTest {
private MsoHeatUtils msoHeatUtils;
@Mock
+ private VnfAdapterUtils vnfAdapterUtils;
+
+ @Mock
private AuditMDCSetup mdcSetup;
@InjectMocks
@@ -44,6 +48,7 @@ public class PollServiceTest {
String xmlString =
new String(Files.readAllBytes(Paths.get(RESOURCE_PATH + "/vnfAdapterTaskRequestCreate.xml")));
+ Mockito.when(vnfAdapterUtils.isMulticloudMode(Mockito.any(), Mockito.any())).thenReturn(false);
Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(xmlString);
Mockito.when(mockExternalTask.getVariable("PollRollbackStatus")).thenReturn(false);
Mockito.when(mockExternalTask.getVariable("stackId")).thenReturn("stackId/stack123");
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java
index 1f68106f78..3a82dd5b72 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/RollbackServiceTest.java
@@ -18,6 +18,7 @@ import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.adapters.tasks.orchestration.RollbackService;
import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
+import org.onap.so.adapters.vnf.VnfAdapterUtils;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.entity.MsoRequest;
import org.onap.so.logging.tasks.AuditMDCSetup;
@@ -41,6 +42,9 @@ public class RollbackServiceTest {
private MsoVnfAdapterImpl vnfAdapterImpl;
@Mock
+ private VnfAdapterUtils vnfAdapterUtils;
+
+ @Mock
private MsoHeatUtils msoHeatUtils;
@Mock
@@ -65,6 +69,8 @@ public class RollbackServiceTest {
Stack stack = new Stack();
stack.setId("heatId");
+
+ Mockito.when(vnfAdapterUtils.isMulticloudMode(Mockito.any(), Mockito.any())).thenReturn(false);
Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(payload);
Mockito.doNothing().when(vnfAdapterImpl).deleteVfModule(Mockito.any(), Mockito.any(), Mockito.any(),
Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any());
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java
index cc2dfa213e..afe7e17855 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/orchestration/StackServiceTest.java
@@ -7,7 +7,6 @@ import java.nio.file.Paths;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
-import javax.xml.ws.Holder;
import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
import org.junit.Test;
@@ -16,15 +15,13 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.adapters.tasks.orchestration.StackService;
import org.onap.so.adapters.vnf.MsoVnfAdapterImpl;
-import org.onap.so.entity.MsoRequest;
+import org.onap.so.adapters.vnf.VnfAdapterUtils;
+import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.logging.tasks.AuditMDCSetup;
-import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.utils.MsoHeatUtils;
import com.woorea.openstack.heat.model.Stack;
-import org.onap.so.adapters.vnf.exceptions.VnfException;
@RunWith(MockitoJUnitRunner.class)
public class StackServiceTest {
@@ -41,6 +38,9 @@ public class StackServiceTest {
private MsoVnfAdapterImpl vnfAdapterImpl;
@Mock
+ private VnfAdapterUtils vnfAdapterUtils;
+
+ @Mock
private MsoHeatUtils msoHeatUtils;
@Mock
@@ -64,6 +64,7 @@ public class StackServiceTest {
Stack stack = new Stack();
stack.setId("heatId");
+ Mockito.when(vnfAdapterUtils.isMulticloudMode(Mockito.any(), Mockito.any())).thenReturn(false);
Mockito.when(mockExternalTask.getVariable("openstackAdapterTaskRequest")).thenReturn(payload);
Mockito.doNothing().when(vnfAdapterImpl).createVfModule(Mockito.any(), Mockito.any(), Mockito.any(),
Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(), Mockito.any(),
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
index 1026284470..a18904f8f4 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
@@ -371,15 +371,15 @@ public class HeatBridgeImplTest {
org.onap.aai.domain.yang.RelationshipList relList = aaiHelper.getVserverRelationshipList(CLOUD_OWNER, REGION_ID,
"test-genericVnf-id", "test-vfModule-id", server1);
- assertEquals(3, relList.getRelationship().size());
+ assertEquals(2, relList.getRelationship().size());
org.onap.aai.domain.yang.RelationshipList relList2 = aaiHelper.getVserverRelationshipList(CLOUD_OWNER,
REGION_ID, "test-genericVnf-id", "test-vfModule-id", server2);
- assertEquals(2, relList2.getRelationship().size());
+ assertEquals(1, relList2.getRelationship().size());
org.onap.aai.domain.yang.RelationshipList relList3 = aaiHelper.getVserverRelationshipList(CLOUD_OWNER,
REGION_ID, "test-genericVnf-id", "test-vfModule-id", server3);
- assertEquals(2, relList3.getRelationship().size());
+ assertEquals(1, relList3.getRelationship().size());
}
@@ -752,6 +752,45 @@ public class HeatBridgeImplTest {
}
@Test
+ public void testBuildAddVserverLInterfacesToAaiAction_DeviceIdNull()
+ throws HeatBridgeException, JsonParseException, JsonMappingException, IOException {
+ // Arrange
+ List<Resource> stackResources = (List<Resource>) extractTestStackResources();
+ Port port = mock(Port.class);
+ when(port.getId()).thenReturn("test-port-id");
+ when(port.getName()).thenReturn("test-port-name");
+ when(port.getvNicType()).thenReturn(HeatBridgeConstants.OS_SRIOV_PORT_TYPE);
+ when(port.getMacAddress()).thenReturn("78:4f:43:68:e2:78");
+ when(port.getNetworkId()).thenReturn("890a203a-23gg-56jh-df67-731656a8f13a");
+ when(port.getDeviceId()).thenReturn(null);
+ String pfPciId = "0000:08:00.0";
+
+ Network network = mock(Network.class);
+ when(network.getId()).thenReturn("test-network-id");
+ when(network.getNetworkType()).thenReturn(NetworkType.VLAN);
+ when(network.getProviderSegID()).thenReturn("2345");
+
+ when(osClient.getPortById("212a203a-9764-4f42-84ea-731536a8f13a")).thenReturn(port);
+ when(osClient.getPortById("387e3904-8948-43d1-8635-b6c2042b54da")).thenReturn(port);
+ when(osClient.getPortById("70a09dfd-f1c5-4bc8-bd8f-dc539b8d662a")).thenReturn(port);
+ when(osClient.getPortById("12f88b4d-c8a4-4fbd-bcb4-7e36af02430b")).thenReturn(port);
+ when(osClient.getPortById("c54b9f45-b413-4937-bbe4-3c8a5689cfc9")).thenReturn(port);
+ when(osClient.getNetworkById(anyString())).thenReturn(network);
+
+ PInterface pIf = mock(PInterface.class);
+ when(pIf.getInterfaceName()).thenReturn("test-port-id");
+ doNothing().when(heatbridge).updateSriovPfToSriovVF(any(), any());
+
+ // Act
+ heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2"), "CloudOwner");
+
+ // Assert
+ verify(transaction, times(0)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ verify(osClient, times(5)).getPortById(anyString());
+ verify(osClient, times(5)).getNetworkById(anyString());
+ }
+
+ @Test
public void testExtractOpenstackImagesFromServers() throws HeatBridgeException {
// Arrange
List<Server> serverList = new ArrayList<>();
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy
index 146889351a..522aec7931 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy
@@ -204,6 +204,7 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{
if(inventoryType.equalsIgnoreCase("service")){
VnfResource vnf = new VnfResource()
vnf.setVnfHostname(assignmentMap.get("vnfHostName"))
+ vnf.setResourceId(assignmentMap.get("vnfId"))
resource.getHomingSolution().setVnf(vnf)
resource.getHomingSolution().setServiceInstanceId(placement.getString("serviceInstanceId"))
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
index ea7de687ee..c02afc3327 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/flowmanipulator/FlowManipulatorListenerRunner.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Copyright (C) 2020 Nokia.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
@@ -26,6 +28,7 @@ import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.annotation.PostConstruct;
+import org.onap.so.bpmn.common.BBConstants;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.listener.ListenerRunner;
@@ -49,17 +52,21 @@ public class FlowManipulatorListenerRunner extends ListenerRunner {
}
public void modifyFlows(List<ExecuteBuildingBlock> flowsToExecute, BuildingBlockExecution execution) {
+ int sequenceBeforeFlowManipulator;
+ do {
+ sequenceBeforeFlowManipulator = execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ ExecuteBuildingBlock currentBB = flowsToExecute.get(execution.getCurrentSequence());
+ List<FlowManipulator> filtered = filterListeners(flowManipulators,
+ (item -> item.shouldRunFor(currentBB.getBuildingBlock().getBpmnFlowName(),
+ execution.getCurrentSequence() == 0, execution)));
- ExecuteBuildingBlock currentBB = flowsToExecute.get(execution.getCurrentSequence());
- List<FlowManipulator> filtered = filterListeners(flowManipulators,
- (item -> item.shouldRunFor(currentBB.getBuildingBlock().getBpmnFlowName(),
- execution.getCurrentSequence() == 0, execution)));
-
- logger.info("Running flow manipulators:\n{}",
- filtered.stream().map(item -> item.getClass().getName()).collect(Collectors.joining("\n")));
- filtered.forEach(item -> item.run(flowsToExecute, currentBB, execution));
-
+ logger.info("Running flow manipulators:\n{}",
+ filtered.stream().map(item -> item.getClass().getName()).collect(Collectors.joining("\n")));
+ filtered.forEach(item -> item.run(flowsToExecute, currentBB, execution));
+ } while (isBuildingBlockSkipped(sequenceBeforeFlowManipulator, execution));
}
-
+ private boolean isBuildingBlockSkipped(int sequenceBeforeFlowManipulator, BuildingBlockExecution execution) {
+ return sequenceBeforeFlowManipulator != (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index 8923051f84..2f6713dcd1 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -1622,6 +1622,7 @@ public class BBInputSetup implements JavaDelegate {
parameter.setInstanceName(vfModules.getInstanceName());
parameter.setInstanceParams(vfModules.getInstanceParams());
this.populateVfModule(parameter);
+ gBB.getRequestContext().setIsHelm(parameter.getIsHelm());
}
} else if (bbName.contains(NETWORK)) {
networks = findNetworksByKey(key, resources);
@@ -1928,7 +1929,7 @@ public class BBInputSetup implements JavaDelegate {
Optional<Relationships> relationshipsOp = aaiGenericVnfWrapper.getRelationships();
if (relationshipsOp.isPresent()) {
Relationships relationships = relationshipsOp.get();
- this.mapPlatform(relationships.getByType(Types.PLATFORM), genericVnf);
+ this.mapPlatform(relationships.getByType(Types.PLATFORM, uri -> uri.nodesOnly(true)), genericVnf);
this.mapLineOfBusiness(relationships.getByType(Types.LINE_OF_BUSINESS), genericVnf);
genericVnf.getVolumeGroups().addAll(mapVolumeGroups(relationships.getByType(Types.VOLUME_GROUP)));
genericVnf.getInstanceGroups().addAll(mapInstanceGroups(relationships.getByType(Types.INSTANCE_GROUP)));
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Resource.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Resource.java
index 57b8c1387d..2a84fccca0 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Resource.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/Resource.java
@@ -81,6 +81,7 @@ public abstract class Resource extends JsonWrapper implements Serializable {
return homingSolution;
}
+ @Deprecated
public void setHomingSolution(HomingSolution homingSolution) {
this.homingSolution = homingSolution;
}
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 67845910eb..bb6fe212b3 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
@@ -43,6 +43,7 @@ import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.db.request.beans.OperationStatus
import org.slf4j.Logger
import org.slf4j.LoggerFactory
+import org.springframework.util.StringUtils
import org.springframework.web.util.UriUtils
import static org.apache.commons.lang3.StringUtils.isBlank
@@ -317,14 +318,9 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor {
Map<String, ?> csInputMap = new HashMap<>()
for (String csInput : csInputs) {
- def value
- if (jsonUtil.getJsonValue(csInput, "type") == "integer") {
- value = jsonUtil.getJsonValue(csInput, "default")
- csInputMap.put(jsonUtil.getJsonValue(csInput, "name"), isBlank(value) ? 0 : (value as Integer))
- } else if (jsonUtil.getJsonValue(csInput, "type") == "string") {
- csInputMap.put(jsonUtil.getJsonValue(csInput, "name"),
- jsonUtil.getJsonValue(csInput, "default"))
- }
+ String key = jsonUtil.getJsonValue(csInput, "name")
+ def value = jsonUtil.getJsonValue(csInput, "default")
+ csInputMap.put(key, getDefaultPropertiesByType(value, key))
}
csInputMap.put("expDataRateDL", expDataRateDL)
csInputMap.put("expDataRateUL", expDataRateUL)
@@ -336,6 +332,7 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor {
csInputMap.put("useInterval", useInterval)
execution.setVariable("csInputMap", csInputMap)
+ logger.debug(Prefix + "csInputMap is = " + csInputMap.toString())
} catch (BpmnError e) {
throw e
} catch (Exception ex) {
@@ -365,53 +362,45 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor {
Map<String, ?> csInputMap = execution.getVariable("csInputMap") as Map
Map<String, ?> e2eInputMap = new HashMap<>()
- String key
- def value
-
for (String e2eInput in e2eInputs) {
- key = jsonUtil.getJsonValue(e2eInput, "name")
+ String key = jsonUtil.getJsonValue(e2eInput, "name")
String type = jsonUtil.getJsonValue(e2eInput, "type")
- if (type == "integer") {
- def temp
- value = csInputMap.containsKey(key) ? csInputMap.getOrDefault(key, 0) : (isBlank(temp = jsonUtil.getJsonValue(e2eInput, "default")) ? 0 : temp)
-
- e2eInputMap.put(key, value as Integer)
- } else if(type == "string") {
- e2eInputMap.put(key, csInputMap.containsKey(key)
- ? csInputMap.getOrDefault(key, null) : (jsonUtil.getJsonValue(e2eInput, "default")))
+ def value
+ if (csInputMap.containsKey(key)) {
+ value = csInputMap.get(key)
+ } else {
+ value = jsonUtil.getJsonValue(e2eInput, "default")
}
+ e2eInputMap.put(key, getDefaultPropertiesByType(value, type))
}
//TODO temp solution
e2eInputMap.put("sNSSAI", execution.getVariable("sNSSAI_id"))
e2eInputMap.put("sST", execution.getVariable("csServiceType"))
- Integer activityFactor = 60
+ Integer activityFactor = Integer.parseInt(e2eInputMap.get("activityFactor").toString())
Integer random = new Random().nextInt(5) + 2
Integer dLThptPerUE = Integer.parseInt(csInputMap.get("expDataRateDL").toString())
Integer uLThptPerUE = Integer.parseInt(csInputMap.get("expDataRateUL").toString())
- Integer maxNumberofUEs = Integer.parseInt(csInputMap.get("maxNumberofUEs").toString())
+ Integer maxNumberofUEs = Integer.parseInt(e2eInputMap.get("maxNumberofUEs").toString())
Integer dLThptPerSlice = dLThptPerUE * maxNumberofUEs * activityFactor * random
Integer uLThptPerSlice = uLThptPerUE * maxNumberofUEs * activityFactor * random
Integer maxNumberofConns = maxNumberofUEs * activityFactor * 3
e2eInputMap.put("jitter", 10)
- e2eInputMap.put("activityFactor", activityFactor)
- e2eInputMap.put("maxNumberofUEs", maxNumberofUEs)
e2eInputMap.put("dLThptPerUE", dLThptPerUE)
e2eInputMap.put("uLThptPerUE", uLThptPerUE)
e2eInputMap.put("dLThptPerSlice", dLThptPerSlice)
e2eInputMap.put("uLThptPerSlice", uLThptPerSlice)
e2eInputMap.put("maxNumberofConns", maxNumberofConns)
- e2eInputMap.put("coverageAreaTAList", csInputMap.get("coverageAreaList"))
execution.setVariable("e2eInputMap", e2eInputMap)
execution.setVariable("e2eServiceType", e2eServiceDecomposition.getServiceType())
execution.setVariable("e2eModelInvariantUuid", e2eServiceDecomposition.getModelInfo().getModelInvariantUuid())
execution.setVariable("e2eModelUuid", e2eServiceDecomposition.getModelInfo().getModelUuid())
-
+ logger.debug(Prefix + "e2eInputMap is = " + e2eInputMap.toString())
} catch (BpmnError e) {
throw e
} catch (Exception ex) {
@@ -423,6 +412,25 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor {
logger.debug(Prefix + "generateE2EServiceProfile Exit")
}
+ static def getDefaultPropertiesByType(def value, String type) {
+
+ def defaultValue
+ switch (type) {
+ case "string":
+ defaultValue = ""
+ break
+ case "integer":
+ defaultValue = 0
+ break
+ case "float":
+ defaultValue = 0.0
+ break
+ default:
+ defaultValue = null
+ break
+ }
+ return StringUtils.isEmpty(value) ? defaultValue : value
+ }
/**
* call createE2EService get operation id,
@@ -453,7 +461,7 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor {
}
"""
execution.setVariable("CSMF_NSMFRequest", payload.replaceAll("\\s+", ""))
-
+ logger.debug(Prefix + "Sent to NSMF Request = " + payload)
} catch (BpmnError e) {
throw e
} catch (Exception ex) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
index c136d52b13..e5d390e2aa 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
@@ -354,6 +354,8 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
nstInfo.setName(nstSolution.get("NSTName") as String)
sliceTaskParams.setNSTInfo(nstInfo)
+ sliceTaskParams.setNstId(nstSolution.get("UUID") as String)
+ sliceTaskParams.setNstName(nstSolution.get("NSTName") as String)
execution.setVariable("sliceTaskParams", sliceTaskParams)
@@ -399,7 +401,10 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
OrchestrationTask orchestrationTask = objectMapper.readValue(response, OrchestrationTask.class)
String paramJson = orchestrationTask.getParams()
logger.debug("paramJson: " + paramJson)
- SliceTaskParamsAdapter sliceTaskParams = new SliceTaskParamsAdapter()
+
+ SliceTaskParamsAdapter sliceTaskParams =
+ execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+
sliceTaskParams.convertFromJson(paramJson)
execution.setVariable("sliceTaskParams", sliceTaskParams)
logger.debug("Finish processUserOptions")
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 b5e1e6b82a..c5a928aaf9 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
@@ -49,7 +49,9 @@ import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
import org.onap.logging.filter.base.ONAPComponents
import org.onap.so.bpmn.core.UrnPropertiesReader
+import org.onap.aai.domain.yang.NetworkRoute
import org.onap.aai.domain.yang.v19.ServiceInstance
+import org.onap.aai.domain.yang.v20.Relationship
import org.onap.aaiclient.client.aai.AAIObjectType
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper
import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel
@@ -86,6 +88,15 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
//networkServiceModelUuid
String networkServiceModelUuid = jsonUtil.getJsonValue(execution.getVariable("networkServiceModelInfo"), "modelUuid") ?: ""
execution.setVariable("networkServiceModelUuid", networkServiceModelUuid)
+ String sliceParams = execution.getVariable("sliceParams")
+ logger.debug("sliceParams "+sliceParams)
+ List<String> bhEndPoints = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "endPoints"))
+ 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))
+ }
logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice::: preProcessRequest ****")
}
@@ -376,6 +387,8 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
if(response.getStatus()!=200 || response.getStatus()!=201 || response.getStatus()!=202) {
exceptionUtil.buildAndThrowWorkflowException(execution, response.getStatus(), "Set association of NSSI and Network service instance has failed in AAI")
} else {
+ //end point update
+ createEndPointsInAai(execution)
execution.setVariable("progress", 100)
execution.setVariable("status", "finished")
execution.setVariable("statusDescription", "DoAllocateCoreNonSharedNSSI success")
@@ -389,6 +402,63 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice ::: updateRelationship ****")
}
+ private void createEndPointsInAai(DelegateExecution execution) {
+ String type = "endpoint"
+ String function = "core_EP"
+ int prefixLength = 24
+ String addressFamily = "ipv4"
+ //BH RAN end point update
+ String bh_endpoint = execution.getVariable("bhEndPoints")
+ 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 nextHopInfo = jsonUtil.getJsonValue(bh_endpoint, "nextHopInfo")
+ NetworkRoute bh_ep = new NetworkRoute()
+ bh_ep.setRouteId(bh_routeId)
+ bh_ep.setFunction(function)
+ bh_ep.setRole(role)
+ bh_ep.setType(type)
+ bh_ep.setIpAddress(cnIpAddress)
+ bh_ep.setLogicalInterfaceId(LogicalLinkId)
+ bh_ep.setNextHop(nextHopInfo)
+ bh_ep.setPrefixLength(prefixLength)
+ bh_ep.setAddressFamily(addressFamily)
+ try {
+ AAIResourcesClient client = new AAIResourcesClient()
+ logger.debug("creating bh endpoint . ID : "+bh_routeId+" node details : "+bh_ep.toString())
+ AAIResourceUri networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), bh_routeId)
+ client.create(networkRouteUri, bh_ep)
+ //relationship b/w bh_ep and Core NSSI
+ def coreNssi = execution.getVariable("NSSIserviceInstanceId")
+ Relationship relationship = new Relationship()
+ String relatedLink = "aai/v21/network/network-routes/network-route/${bh_routeId}"
+ relationship.setRelatedLink(relatedLink)
+ relationship.setRelatedTo("network-route")
+ relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
+ try {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
+ execution.getVariable("globalSubscriberId"),
+ execution.getVariable("subscriptionServiceType"),
+ coreNssi).relationshipAPI()
+ client.create(uri, relationship)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in CreateCommunicationService.createRelationShipInAAI. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ String msg = "Exception in createEndPointsInAai " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ }
+
/**
* prepare ResourceOperation status
* @param execution
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
index 1d7acd31c1..159f4c48ef 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
@@ -20,6 +20,8 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.so.beans.nsmf.NsiInfo
+import org.onap.so.beans.nsmf.SliceProfileAdapter
import org.onap.so.beans.nsmf.oof.SubnetType
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import javax.ws.rs.NotFoundException
@@ -36,15 +38,12 @@ import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder
import org.onap.so.beans.nsmf.AllocateAnNssi
import org.onap.so.beans.nsmf.AllocateCnNssi
import org.onap.so.beans.nsmf.AllocateTnNssi
-import org.onap.so.beans.nsmf.AnSliceProfile
-import org.onap.so.beans.nsmf.CnSliceProfile
import org.onap.so.beans.nsmf.EsrInfo
import org.onap.so.beans.nsmf.NssiResponse
import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest
import org.onap.so.beans.nsmf.ServiceInfo
import org.onap.so.beans.nsmf.SliceTaskInfo
import org.onap.so.beans.nsmf.SliceTaskParamsAdapter
-import org.onap.so.beans.nsmf.TnSliceProfile
import org.onap.so.bpmn.common.scripts.ExceptionUtil
import org.onap.so.bpmn.core.json.JsonUtils
import org.slf4j.Logger
@@ -144,7 +143,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
String msg
try {
- AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceInstanceId))
+ AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(sliceInstanceId))
client.create(nsiServiceUri, nsi)
execution.setVariable("nsiServiceUri", nsiServiceUri)
@@ -152,7 +154,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
} catch (BpmnError e) {
throw e
} catch (Exception ex) {
- msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage()
+ msg = "Exception in DoAllocateNSIandNSSI.createNSIinAAI: " + ex.getMessage()
logger.info(msg)
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
@@ -168,16 +170,30 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
*/
void createRelationship(DelegateExecution execution) {
//relation ship
- String allottedResourceId = execution.getVariable("allottedResourceId")
- SliceTaskParamsAdapter sliceParams =
- execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+ logger.debug("Enter createRelationship in DoAllocateNSIandNSSI")
+ //String allottedResourceId = execution.getVariable("allottedResourceId")
+ //SliceTaskParamsAdapter sliceParams =
+ // execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+ String msg
+ try {
+
+ AAIResourceUri nsiServiceUri = execution.getVariable("nsiServiceUri") as AAIResourceUri
+ logger.debug("Creating Allotted resource relationship, nsiServiceUri: " + nsiServiceUri.toString())
- AAIResourceUri nsiServiceUri = execution.getVariable("nsiServiceUri") as AAIResourceUri
- logger.info("Creating Allotted resource relationship, nsiServiceUri: " + nsiServiceUri)
+ //AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceParams.suggestNsiId).allottedResource(allottedResourceId))
- AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceParams.suggestNsiId).allottedResource(allottedResourceId))
+ AAIResourceUri allottedResourceUri = execution.getVariable("allottedResourceUri") as AAIResourceUri
+ logger.debug("Creating Allotted resource relationship, allottedResourceUri: " + allottedResourceUri.toString())
- client.connect(allottedResourceUri, nsiServiceUri)
+ client.connect(allottedResourceUri, nsiServiceUri)
+ } catch (BpmnError e) {
+ throw e
+ } catch (Exception ex) {
+ msg = "Exception in DoAllocateNSIandNSSI.createRelationship. " + ex.getMessage()
+ logger.info(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+ }
+ logger.debug("Exit createRelationship in DoAllocateNSIandNSSI")
}
/**
@@ -196,7 +212,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
String nsiServiceInstanceID = sliceParams.getSuggestNsiId()
//sliceParams.setServiceId(nsiServiceInstanceID)
- AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(nsiServiceInstanceID))
+ AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(nsiServiceInstanceID))
try {
AAIResultWrapper wrapper = client.get(nsiServiceUri, NotFoundException.class)
@@ -207,8 +226,9 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
}
- AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceParams.suggestNsiId).allottedResource(allottedResourceId))
-
+ //AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceParams.suggestNsiId).allottedResource(allottedResourceId))
+ AAIResourceUri allottedResourceUri = execution.getVariable("allottedResourceUri") as AAIResourceUri
+ logger.debug("updateRelationship Allotted resource relationship, allottedResourceUri: " + allottedResourceUri.toString())
client.connect(allottedResourceUri, nsiServiceUri)
execution.setVariable("sliceTaskParams", sliceParams)
@@ -233,31 +253,23 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
String serviceInstanceId = UUID.randomUUID().toString()
execution.setVariable("ranSliceProfileInstanceId", serviceInstanceId) //todo:
- String serviceType = ""
- String serviceRole = "slice-profile"
String oStatus = "deactivated"
SliceTaskParamsAdapter sliceParams =
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
- SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo
+ SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.anSliceTaskInfo
sliceTaskInfo.setSliceInstanceId(serviceInstanceId)
// create slice profile
- ServiceInstance rspi = new ServiceInstance()
- rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name)
- rspi.setServiceType(serviceType)
- rspi.setServiceRole(serviceRole)
- rspi.setOrchestrationStatus(oStatus)
- rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID)
- rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID)
- rspi.setInputParameters(execution.getVariable("uuiRequest"))
- rspi.setWorkloadContext(execution.getVariable("useInterval"))
- rspi.setEnvironmentContext(execution.getVariable("sNSSAI_id"))
+ ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, oStatus)
//timestamp format YYYY-MM-DD hh:mm:ss
rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault()))
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId))
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(globalSubscriberId)
+ .serviceSubscription(subscriptionServiceType)
+ .serviceInstance(serviceInstanceId))
client.create(uri, rspi)
execution.setVariable("sliceTaskParams", sliceParams)
@@ -275,15 +287,15 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
SliceTaskParamsAdapter sliceParams =
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
- SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo
- AnSliceProfile anSliceProfile = sliceTaskInfo.sliceProfile
+ SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.anSliceTaskInfo
+ SliceProfileAdapter anSliceProfile = sliceTaskInfo.sliceProfile
String profileId = UUID.randomUUID().toString()
anSliceProfile.setSliceProfileId(profileId)
SliceProfile sliceProfile = new SliceProfile()
sliceProfile.setProfileId(profileId)
- sliceProfile.setCoverageAreaTAList(anSliceProfile.coverageAreaTAList as String)
+ sliceProfile.setCoverageAreaTAList(anSliceProfile.coverageAreaTAList)
//todo:...
AAIResourceUri uri = AAIUriFactory.createResourceUri(
AAIFluentTypeBuilder.business().customer(globalSubscriberId)
@@ -304,12 +316,18 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
//todo:
SliceTaskParamsAdapter sliceParams =
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
- SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo
+ SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.anSliceTaskInfo
NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest()
AllocateAnNssi allocateAnNssi = new AllocateAnNssi()
- allocateAnNssi.sliceProfile = sliceTaskInfo.sliceProfile
+ allocateAnNssi.sliceProfile = sliceTaskInfo.sliceProfile.trans2AnProfile()
+ allocateAnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID
+ allocateAnNssi.nssiId = sliceTaskInfo.suggestNssiId
+ allocateAnNssi.nssiName = sliceTaskInfo.NSSTInfo.name
+ NsiInfo nsiInfo = new NsiInfo()
+ nsiInfo.nsiId = sliceParams.suggestNsiId
+ allocateAnNssi.nsiInfo = nsiInfo
EsrInfo esrInfo = new EsrInfo()
//todo: vendor and network
@@ -348,33 +366,25 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
String serviceInstanceId = UUID.randomUUID().toString()
execution.setVariable("cnSliceProfileInstanceId", serviceInstanceId) //todo:
- String serviceType = ""
- String serviceRole = "slice-profile"
String oStatus = "deactivated"
SliceTaskParamsAdapter sliceParams =
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
- SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo
+ SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.cnSliceTaskInfo
sliceTaskInfo.setSliceInstanceId(serviceInstanceId)
// create slice profile
- ServiceInstance rspi = new ServiceInstance()
- rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name)
- rspi.setServiceType(serviceType)
- rspi.setServiceRole(serviceRole)
- rspi.setOrchestrationStatus(oStatus)
- rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID)
- rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID)
- rspi.setInputParameters(uuiRequest)
- rspi.setWorkloadContext(useInterval)
- rspi.setEnvironmentContext(sNSSAI_id)
+ ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, oStatus)
//timestamp format YYYY-MM-DD hh:mm:ss
rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault()))
execution.setVariable("communicationServiceInstance", rspi)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId))
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(globalSubscriberId)
+ .serviceSubscription(subscriptionServiceType)
+ .serviceInstance(serviceInstanceId))
client.create(uri, rspi)
execution.setVariable("sliceTaskParams", sliceParams)
}
@@ -392,8 +402,8 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
SliceTaskParamsAdapter sliceParams =
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
- SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo
- CnSliceProfile cnSliceProfile = sliceTaskInfo.sliceProfile
+ SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.cnSliceTaskInfo
+ SliceProfileAdapter cnSliceProfile = sliceTaskInfo.sliceProfile
String profileId = UUID.randomUUID().toString()
cnSliceProfile.setSliceProfileId(profileId)
@@ -402,7 +412,11 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
sliceProfile.setProfileId(profileId)
sliceProfile.setCoverageAreaTAList(cnSliceProfile.coverageAreaTAList as String)
//todo:...
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(sliceTaskInfo.sliceInstanceId).sliceProfile(profileId))
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(globalSubscriberId)
+ .serviceSubscription(subscriptionServiceType)
+ .serviceInstance(sliceTaskInfo.sliceInstanceId)
+ .sliceProfile(profileId))
client.create(uri, sliceProfile)
execution.setVariable("sliceTaskParams", sliceParams)
}
@@ -416,7 +430,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
//todo:
SliceTaskParamsAdapter sliceParams =
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
- SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo
+ SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.cnSliceTaskInfo
NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest()
@@ -424,8 +438,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
allocateCnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID
allocateCnNssi.nssiId = sliceTaskInfo.suggestNssiId
allocateCnNssi.nssiName = sliceTaskInfo.NSSTInfo.name
- allocateCnNssi.sliceProfile = sliceTaskInfo.sliceProfile
- allocateCnNssi.nsiInfo.nsiId = sliceParams.suggestNsiId
+ allocateCnNssi.sliceProfile = sliceTaskInfo.sliceProfile.trans2CnProfile()
+ NsiInfo nsiInfo = new NsiInfo()
+ nsiInfo.nsiId = sliceParams.suggestNsiId
+ allocateCnNssi.nsiInfo = nsiInfo
EsrInfo esrInfo = new EsrInfo()
//todo: vendor and network
@@ -462,37 +478,29 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
String globalSubscriberId = execution.getVariable("globalSubscriberId")
String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
- String serviceType = ""
- String serviceRole = "slice-profile"
String oStatus = "deactivated"
SliceTaskParamsAdapter sliceParams =
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
- SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo
+ SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo
String serviceInstanceId = UUID.randomUUID().toString()
sliceTaskInfo.setSliceInstanceId(serviceInstanceId)
//execution.setVariable("cnSliceProfileInstanceId", serviceInstanceId) //todo:
// create slice profile
- ServiceInstance rspi = new ServiceInstance()
- rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name)
- rspi.setServiceType(serviceType)
- rspi.setServiceRole(serviceRole)
- rspi.setOrchestrationStatus(oStatus)
- rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID)
- rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID)
- rspi.setInputParameters(uuiRequest)
- rspi.setWorkloadContext(useInterval)
- rspi.setEnvironmentContext(sNSSAI_id)
+ ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, oStatus)
//timestamp format YYYY-MM-DD hh:mm:ss
rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault()))
execution.setVariable("communicationServiceInstance", rspi)
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId))
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(globalSubscriberId)
+ .serviceSubscription(subscriptionServiceType)
+ .serviceInstance(serviceInstanceId))
client.create(uri, rspi)
execution.setVariable("sliceTaskParams", sliceParams)
@@ -510,16 +518,20 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
SliceTaskParamsAdapter sliceParams =
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
- SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo
+ SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo
- TnSliceProfile tnSliceProfile = sliceTaskInfo.sliceProfile
+ SliceProfileAdapter tnSliceProfile = sliceTaskInfo.sliceProfile
String profileId = UUID.randomUUID().toString()
tnSliceProfile.setSliceProfileId(profileId)
SliceProfile sliceProfile = new SliceProfile()
sliceProfile.setProfileId(profileId)
//todo:...
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(sliceTaskInfo.sliceInstanceId).sliceProfile(profileId))
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(globalSubscriberId)
+ .serviceSubscription(subscriptionServiceType)
+ .serviceInstance(sliceTaskInfo.sliceInstanceId)
+ .sliceProfile(profileId))
client.create(uri, sliceProfile)
execution.setVariable("sliceTaskParams", sliceParams)
@@ -534,7 +546,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
//todo:
SliceTaskParamsAdapter sliceParams =
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
- SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo
+ SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo
NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest()
@@ -545,6 +557,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
allocateTnNssi.setNetworkSliceInfos()
+
//allocateTnNssi.networkSliceInfos
EsrInfo esrInfo = new EsrInfo()
@@ -653,7 +666,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
//sliceParams.setServiceId(nsiServiceInstanceID)
- AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(nssiId))
+ AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(nssiId))
String endpointId = null
@@ -730,14 +746,39 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
//relation ship
Relationship relationship = new Relationship()
- AAIResourceUri targetInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(targetId))
+ AAIResourceUri targetInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(targetId))
logger.info("Creating relationship, targetInstanceUri: " + targetInstanceUri)
relationship.setRelatedLink(targetInstanceUri.build().toString())
- AAIResourceUri sourceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sourceId)).relationshipAPI()
+ AAIResourceUri sourceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business()
+ .customer(execution.getVariable("globalSubscriberId"))
+ .serviceSubscription(execution.getVariable("subscriptionServiceType"))
+ .serviceInstance(sourceId))
+ .relationshipAPI()
client.create(sourceInstanceUri, relationship)
}
+ static def createSliceProfileInstance(SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo, String oStatus) {
+ // create slice profile
+ ServiceInstance rspi = new ServiceInstance()
+ rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name)
+ rspi.setServiceType(sliceTaskInfo.sliceProfile.getSST())
+ rspi.setServiceRole("slice-profile-instance")
+ rspi.setOrchestrationStatus(oStatus)
+ rspi.setServiceInstanceLocationId(sliceTaskInfo.sliceProfile.getPLMNIdList())
+ rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID)
+ rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID)
+ rspi.setWorkloadContext(sliceTaskInfo.subnetType.subnetType)
+ rspi.setEnvironmentContext(sliceTaskInfo.sliceProfile.getSNSSAIList())
+
+ //timestamp format YYYY-MM-DD hh:mm:ss
+ rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault()))
+ return rspi
+ }
+
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy
index fc80a9f658..ec70bd3780 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy
@@ -246,6 +246,7 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{
client.create(allottedResourceUri, resource)
+ execution.setVariable("allottedResourceId", allottedResourceId)
}
}catch (Exception ex) {
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 2cce68a2b6..9450227467 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
@@ -22,13 +22,12 @@ package org.onap.so.bpmn.infrastructure.scripts
import com.fasterxml.jackson.databind.ObjectMapper
import org.camunda.bpm.engine.delegate.DelegateExecution
-import org.onap.so.beans.nsmf.AnSliceProfile
-import org.onap.so.beans.nsmf.CnSliceProfile
import org.onap.so.beans.nsmf.EsrInfo
import org.onap.so.beans.nsmf.NetworkType
import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest
+import org.onap.so.beans.nsmf.QuerySubnetCapability
+import org.onap.so.beans.nsmf.SliceProfileAdapter
import org.onap.so.beans.nsmf.SliceTaskParamsAdapter
-import org.onap.so.beans.nsmf.TnSliceProfile
import org.onap.so.beans.nsmf.oof.SubnetCapability
import org.onap.so.beans.nsmf.oof.SubnetType
import org.onap.so.beans.nsmf.oof.TemplateInfo
@@ -45,6 +44,7 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.util.StringUtils
+
class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
private static final Logger logger = LoggerFactory.getLogger(DoCreateSliceServiceOption.class)
@@ -185,6 +185,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
execution.setVariable("sliceTaskParams", sliceParams)
execution.setVariable("subnetCapabilities", subnetCapabilities)
+ execution.setVariable("queryNsiFirst", true)
logger.debug("sliceTaskParams= " + sliceParams.toString())
}
@@ -290,13 +291,12 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest()
List<String> subnetTypes = new ArrayList<>()
-
subnetTypes.add(subnetType.subnetType)
- Map<String, Object> paramMap = new HashMap<>()
- paramMap.put("subnetTypes", subnetTypes)
+ QuerySubnetCapability req = new QuerySubnetCapability()
+ req.setSubnetTypes(subnetTypes)
- request.setSubnetCapabilityQuery(paramMap)
+ request.setSubnetCapabilityQuery(req)
EsrInfo esrInfo = new EsrInfo()
esrInfo.setVendor(vendor)
@@ -362,66 +362,73 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
Map<String, Object> resMap = objectMapper.readValue(oofResponse, Map.class)
String requestStatus = resMap.get("requestStatus")
- if (StringUtils.isEmpty(requestStatus)) {
+ if (!StringUtils.isEmpty(requestStatus) && requestStatus == "error") {
exceptionUtil.buildWorkflowException(execution, 7000, "get nsi from oof error: " + oofResponse)
+ return
}
List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions")
Map<String, Object> solution = nsiSolutions.get(0)
- String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
- Boolean isSharable = resourceSharingLevel == "shared"
+ //String resourceSharingLevel = execution.getVariable("resourceSharingLevel")
+ //Boolean isSharable = resourceSharingLevel == "shared"
if (solution != null) {
- if (isSharable && solution.get("existingNSI")) {
- //sharedNSISolution
- processSharedNSI(solution, sliceTaskParams)
- execution.setVariable("needQuerySliceProfile", true)
- }
- else {
- if(execution.getVariable("needQuerySliceProfile")){
+ if (execution.getVariable("queryNsiFirst")) {
+ if (solution.get("existingNSI")) {
+ execution.setVariable("needQuerySliceProfile", true)
+ } else {
+ processNewNSI(solution, sliceTaskParams)
execution.setVariable("needQuerySliceProfile", false)
}
- processNewNSI(solution, sliceTaskParams)
+ execution.setVariable("queryNsiFirst", false)
+ } else {
+ processSharedNSI(solution, sliceTaskParams)
+ execution.setVariable("needQuerySliceProfile", false)
}
}
execution.setVariable("sliceTaskParams", sliceTaskParams)
+ logger.debug("after req to oof for nis select, sliceTaskParams = " + sliceTaskParams)
logger.debug("*** Completed options Call to OOF ***")
}
- private void processSharedNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) {
+ private static void processSharedNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) {
Map<String, Object> sharedNSISolution = solution.get("sharedNSISolution") as Map
-
String nsiId = sharedNSISolution.get("NSIId")
String nsiName = sharedNSISolution.get("NSIName")
sliceParams.setSuggestNsiId(nsiId)
sliceParams.setSuggestNsiName(nsiName)
+ List<Map> sliceProfiles = sharedNSISolution.get("sliceProfiles") as List<Map>
+ handleSliceProfiles(sliceProfiles, sliceParams)
}
- private void processNewNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) {
+ private static void processNewNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) {
Map<String, Object> newNSISolution = solution.get("newNSISolution") as Map
List<Map> sliceProfiles = newNSISolution.get("sliceProfiles") as List<Map>
+ handleSliceProfiles(sliceProfiles, sliceParams)
+ }
+
+ static def handleSliceProfiles(List<Map> sliceProfiles, SliceTaskParamsAdapter sliceParams) {
for (Map sliceProfile : sliceProfiles) {
String domainType = sliceProfile.get("domainType")
+ sliceProfile.remove("domainType")
+ SliceProfileAdapter adapter = objectMapper.readValue(objectMapper.writeValueAsString(sliceProfile), SliceProfileAdapter.class)
switch (domainType.toLowerCase()) {
case "tn-bh":
- sliceParams.tnBHSliceTaskInfo.sliceProfile = sliceProfile as TnSliceProfile
+ sliceParams.tnBHSliceTaskInfo.sliceProfile = adapter
break
case "an-nf":
case "an":
- sliceParams.anSliceTaskInfo.sliceProfile = sliceProfile as AnSliceProfile
+ sliceParams.anSliceTaskInfo.sliceProfile = adapter
break
case "cn":
- sliceParams.cnSliceTaskInfo.sliceProfile = sliceProfile as CnSliceProfile
+ sliceParams.cnSliceTaskInfo.sliceProfile = adapter
break
default:
break
}
-
- //todo
-
}
}
@@ -485,7 +492,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
String selection = resMap.get("selection")
if ("NSMF".equalsIgnoreCase(selection)) {
- execution.setVariable("NEED_CN_NSSI_SELECTION", true)
+ //execution.setVariable("NEED_CN_NSSI_SELECTION", true)
}
}
@@ -597,7 +604,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{
TemplateInfo nsstInfo = nssiNeedHandlerInfo.get("nsstInfo") as TemplateInfo
Map<String, Object> profileInfo = nssiNeedHandlerInfo.get("sliceProfile") as Map
- profileInfo.remove("profileId")
+ //profileInfo.remove("profileId")
String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution)
logger.debug( "get NSI option OOF Url: " + urlString)
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 1eddf66b86..6b15407dd0 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
@@ -58,9 +58,13 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest {
"modelInstanceName" : "5gcembb_proxy 0"
}"""
+ 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}"""
+
when(mockExecution.getVariable("serviceInstanceId")).thenReturn("123456")
when(mockExecution.getVariable("networkServiceModelInfo")).thenReturn(networkServiceModelInfo)
+ when(mockExecution.getVariable("sliceParams")).thenReturn(sliceParams)
+
DoAllocateCoreNonSharedSlice allocateNssi = new DoAllocateCoreNonSharedSlice()
allocateNssi.preProcessRequest(mockExecution)
@@ -73,7 +77,8 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest {
Mockito.verify(mockExecution, times(1)).setVariable(eq("orchestrationStatus"), captor.capture())
assertEquals("created", captor.getValue())
- Mockito.verify(mockExecution, times(4)).setVariable(captor.capture() as String, captor.capture())
+
+ Mockito.verify(mockExecution, times(5)).setVariable(captor.capture() as String, captor.capture())
}
@Test
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn
index 9656c86ae5..1a9281f7d9 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn
@@ -5,7 +5,7 @@
<bpmn:outgoing>SequenceFlow_03s744c</bpmn:outgoing>
</bpmn:startEvent>
<bpmn:intermediateCatchEvent id="IntermediateCatchEvent_0vilb24" name="Waiting for confirmation">
- <bpmn:outgoing>SequenceFlow_060j650</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0sub2c2</bpmn:outgoing>
<bpmn:linkEventDefinition id="LinkEventDefinition_197u5pe" name="WaitingForConfirmation" />
</bpmn:intermediateCatchEvent>
<bpmn:scriptTask id="ScriptTask_1tc44ge" name="PreProcess Incoming Request" scriptFormat="groovy">
@@ -44,6 +44,8 @@ css.processUserOptions(execution)</bpmn:script>
<camunda:in source="sliceTaskParams" target="sliceTaskParams" />
<camunda:in source="sliceTaskParams" target="sliceTaskParams" />
<camunda:out source="sliceTaskParams" target="sliceTaskParams" />
+ <camunda:out source="allottedResourceId" target="allottedResourceId" />
+ <camunda:out source="allottedResourceUri" target="allottedResourceUri" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_1dfon41</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0jhqtls</bpmn:outgoing>
@@ -281,6 +283,7 @@ css.prepareUpdateOrchestrationTask(execution)</bpmn:script>
<camunda:out source="rolledBack" target="rolledBack" />
<camunda:in source="allottedResourceId" target="allottedResourceId" />
<camunda:out source="sliceTaskParams" target="sliceTaskParams" />
+ <camunda:in source="allottedResourceUri" target="allottedResourceUri" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_1bevt3a</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0mlrlbv</bpmn:outgoing>
@@ -355,7 +358,6 @@ css.prepareCreateOrchestrationTask(execution)</bpmn:script>
</bpmn:intermediateCatchEvent>
<bpmn:sequenceFlow id="SequenceFlow_14c2tav" sourceRef="IntermediateCatchEvent_0gceuxu" targetRef="ScriptTask_1ayg9y8" />
<bpmn:sequenceFlow id="SequenceFlow_00kcej9" sourceRef="CallActivity_0n47zoh" targetRef="IntermediateThrowEvent_1v96asi" />
- <bpmn:sequenceFlow id="SequenceFlow_060j650" sourceRef="IntermediateCatchEvent_0vilb24" targetRef="ScriptTask_04qudo2" />
<bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0lpvnze" name="Goto Create Slice Service">
<bpmn:incoming>SequenceFlow_12wo878</bpmn:incoming>
<bpmn:linkEventDefinition id="LinkEventDefinition_1oxsvp3" name="CreateSliceService" />
@@ -369,20 +371,12 @@ def css = new CreateSliceService()
css.processNSTSolutions(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="SequenceFlow_1f6dyxo" sourceRef="ScriptTask_13roglo" targetRef="CallActivity_0v4mw2x" />
- <bpmn:receiveTask id="ReceiveTask_02qzb6i" name="Waiting for confirmation" />
<bpmn:endEvent id="EndEvent_0bz8a65">
- <bpmn:incoming>SequenceFlow_1vesvto</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1fk2cn3</bpmn:incoming>
<bpmn:errorEventDefinition id="ErrorEventDefinition_1hni1r1" errorRef="Error_0p2naox" />
</bpmn:endEvent>
- <bpmn:boundaryEvent id="BoundaryEvent_0p4swyp" attachedToRef="ReceiveTask_02qzb6i">
- <bpmn:outgoing>SequenceFlow_1vesvto</bpmn:outgoing>
- <bpmn:timerEventDefinition id="TimerEventDefinition_112p48l">
- <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT2H</bpmn:timeDuration>
- </bpmn:timerEventDefinition>
- </bpmn:boundaryEvent>
- <bpmn:sequenceFlow id="SequenceFlow_1vesvto" sourceRef="BoundaryEvent_0p4swyp" targetRef="EndEvent_0bz8a65" />
<bpmn:scriptTask id="ScriptTask_04qudo2" name="Prepare Get User Options" scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_060j650</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_031cwkd</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0ti386y</bpmn:outgoing>
<bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
def css = new CreateSliceService()
@@ -427,10 +421,36 @@ def css = new CreateSliceService()
css.prepareSelectNSTRequest(execution)</bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="SequenceFlow_02sve8o" sourceRef="ScriptTask_1ayg9y8" targetRef="CallActivity_0xf2g6c" />
+ <bpmn:subProcess id="SubProcess_1sxkpqq" name="Wait for Confim Message">
+ <bpmn:incoming>SequenceFlow_0sub2c2</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_031cwkd</bpmn:outgoing>
+ <bpmn:startEvent id="StartEvent_1hd68zf">
+ <bpmn:outgoing>SequenceFlow_0recnor</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_05npq16">
+ <bpmn:incoming>SequenceFlow_1htsa6t</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_1iti8re" name="Catch Confim Message">
+ <bpmn:incoming>SequenceFlow_0recnor</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1htsa6t</bpmn:outgoing>
+ <bpmn:messageEventDefinition id="MessageEventDefinition_1rxlviw" messageRef="Message_0c4b2r5" />
+ </bpmn:intermediateCatchEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1htsa6t" name="" sourceRef="IntermediateCatchEvent_1iti8re" targetRef="EndEvent_05npq16" />
+ <bpmn:sequenceFlow id="SequenceFlow_0recnor" name="" sourceRef="StartEvent_1hd68zf" targetRef="IntermediateCatchEvent_1iti8re" />
+ </bpmn:subProcess>
+ <bpmn:boundaryEvent id="BoundaryEvent_0xqq1ch" name="Timeout" attachedToRef="SubProcess_1sxkpqq">
+ <bpmn:outgoing>SequenceFlow_1fk2cn3</bpmn:outgoing>
+ <bpmn:timerEventDefinition id="TimerEventDefinition_0jxhpup">
+ <bpmn:timeDuration xsi:type="bpmn:tFormalExpression">PT2H</bpmn:timeDuration>
+ </bpmn:timerEventDefinition>
+ </bpmn:boundaryEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1fk2cn3" sourceRef="BoundaryEvent_0xqq1ch" targetRef="EndEvent_0bz8a65" />
+ <bpmn:sequenceFlow id="SequenceFlow_0sub2c2" sourceRef="IntermediateCatchEvent_0vilb24" targetRef="SubProcess_1sxkpqq" />
+ <bpmn:sequenceFlow id="SequenceFlow_031cwkd" sourceRef="SubProcess_1sxkpqq" targetRef="ScriptTask_04qudo2" />
</bpmn:process>
- <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
<bpmn:error id="Error_03akl5v" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmn:error id="Error_0p2naox" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmn:message id="Message_0c4b2r5" name="SliceServiceTask" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CreateSliceService">
<bpmndi:BPMNEdge id="SequenceFlow_0kixzdj_di" bpmnElement="SequenceFlow_0kixzdj">
@@ -446,20 +466,20 @@ css.prepareSelectNSTRequest(execution)</bpmn:script>
<di:waypoint x="274" y="965" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_10ng1vx_di" bpmnElement="SequenceFlow_10ng1vx">
- <di:waypoint x="1294" y="805" />
+ <di:waypoint x="1320" y="805" />
<di:waypoint x="1396" y="805" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_19lsayh_di" bpmnElement="SequenceFlow_19lsayh">
- <di:waypoint x="1124" y="805" />
- <di:waypoint x="1194" y="805" />
+ <di:waypoint x="1174" y="805" />
+ <di:waypoint x="1220" y="805" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0477975_di" bpmnElement="SequenceFlow_0477975">
- <di:waypoint x="1294" y="620" />
+ <di:waypoint x="1320" y="620" />
<di:waypoint x="1396" y="620" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0thd6ny_di" bpmnElement="SequenceFlow_0thd6ny">
- <di:waypoint x="1124" y="620" />
- <di:waypoint x="1194" y="620" />
+ <di:waypoint x="1160" y="620" />
+ <di:waypoint x="1220" y="620" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1qv8qw1_di" bpmnElement="SequenceFlow_1qv8qw1">
<di:waypoint x="1174" y="965" />
@@ -504,23 +524,23 @@ css.prepareSelectNSTRequest(execution)</bpmn:script>
<di:waypoint x="1220" y="350" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_038lb9m_di" bpmnElement="SequenceFlow_038lb9m">
- <di:waypoint x="884" y="645" />
- <di:waypoint x="884" y="805" />
- <di:waypoint x="1024" y="805" />
+ <di:waypoint x="984" y="645" />
+ <di:waypoint x="984" y="805" />
+ <di:waypoint x="1074" y="805" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="886" y="722" width="27" height="14" />
+ <dc:Bounds x="986" y="722" width="27" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_12t5exy_di" bpmnElement="SequenceFlow_12t5exy">
- <di:waypoint x="909" y="620" />
- <di:waypoint x="1024" y="620" />
+ <di:waypoint x="1009" y="620" />
+ <di:waypoint x="1060" y="620" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="911" y="602" width="42" height="14" />
+ <dc:Bounds x="998" y="602" width="42" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_197cm2e_di" bpmnElement="SequenceFlow_197cm2e">
- <di:waypoint x="804" y="620" />
- <di:waypoint x="859" y="620" />
+ <di:waypoint x="930" y="620" />
+ <di:waypoint x="959" y="620" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_07e12rt_di" bpmnElement="SequenceFlow_07e12rt">
<di:waypoint x="350" y="122" />
@@ -543,12 +563,12 @@ css.prepareSelectNSTRequest(execution)</bpmn:script>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1jgtb0y_di" bpmnElement="ScriptTask_1jgtb0y">
- <dc:Bounds x="704" y="580" width="100" height="80" />
+ <dc:Bounds x="830" y="580" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_0elbczl_di" bpmnElement="ExclusiveGateway_0elbczl" isMarkerVisible="true">
- <dc:Bounds x="859" y="595" width="50" height="50" />
+ <dc:Bounds x="959" y="595" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="846" y="577" width="78" height="14" />
+ <dc:Bounds x="946" y="577" width="78" height="14" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_139l55g_di" bpmnElement="CallActivity_139l55g">
@@ -620,16 +640,16 @@ css.prepareSelectNSTRequest(execution)</bpmn:script>
<dc:Bounds x="1220" y="310" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_12h8542_di" bpmnElement="ScriptTask_12h8542">
- <dc:Bounds x="1024" y="580" width="100" height="80" />
+ <dc:Bounds x="1060" y="580" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_0o89wmf_di" bpmnElement="CallActivity_0o89wmf">
- <dc:Bounds x="1194" y="580" width="100" height="80" />
+ <dc:Bounds x="1220" y="580" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="CallActivity_0jdzpem_di" bpmnElement="CallActivity_0jdzpem">
- <dc:Bounds x="1194" y="765" width="100" height="80" />
+ <dc:Bounds x="1220" y="765" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1mscu5w_di" bpmnElement="ScriptTask_1mscu5w">
- <dc:Bounds x="1024" y="765" width="100" height="80" />
+ <dc:Bounds x="1074" y="765" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateCatchEvent_0pkvfun_di" bpmnElement="IntermediateCatchEvent_0pkvfun">
<dc:Bounds x="177" y="947" width="36" height="36" />
@@ -700,10 +720,6 @@ css.prepareSelectNSTRequest(execution)</bpmn:script>
<di:waypoint x="1320" y="350" />
<di:waypoint x="1402" y="350" />
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_060j650_di" bpmnElement="SequenceFlow_060j650">
- <di:waypoint x="213" y="620" />
- <di:waypoint x="394" y="620" />
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="IntermediateThrowEvent_0lpvnze_di" bpmnElement="IntermediateThrowEvent_0lpvnze">
<dc:Bounds x="1402" y="106" width="36" height="36" />
<bpmndi:BPMNLabel>
@@ -721,32 +737,22 @@ css.prepareSelectNSTRequest(execution)</bpmn:script>
<di:waypoint x="810" y="350" />
<di:waypoint x="880" y="350" />
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ReceiveTask_02qzb6i_di" bpmnElement="ReceiveTask_02qzb6i">
- <dc:Bounds x="254" y="580" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0bz8a65_di" bpmnElement="EndEvent_0bz8a65">
- <dc:Bounds x="286" y="757" width="36" height="36" />
+ <dc:Bounds x="354" y="772" width="36" height="36" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="BoundaryEvent_0p4swyp_di" bpmnElement="BoundaryEvent_0p4swyp">
- <dc:Bounds x="286" y="642" width="36" height="36" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_1vesvto_di" bpmnElement="SequenceFlow_1vesvto">
- <di:waypoint x="304" y="678" />
- <di:waypoint x="304" y="757" />
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_04qudo2_di" bpmnElement="ScriptTask_04qudo2">
- <dc:Bounds x="394" y="580" width="100" height="80" />
+ <dc:Bounds x="550" y="580" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0ti386y_di" bpmnElement="SequenceFlow_0ti386y">
- <di:waypoint x="494" y="620" />
- <di:waypoint x="534" y="620" />
+ <di:waypoint x="650" y="620" />
+ <di:waypoint x="688" y="620" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_1vu3zcv_di" bpmnElement="CallActivity_1vu3zcv">
- <dc:Bounds x="534" y="580" width="100" height="80" />
+ <dc:Bounds x="688" y="580" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1whq7vc_di" bpmnElement="SequenceFlow_1whq7vc">
- <di:waypoint x="634" y="620" />
- <di:waypoint x="704" y="620" />
+ <di:waypoint x="788" y="620" />
+ <di:waypoint x="830" y="620" />
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_0xf2g6c_di" bpmnElement="CallActivity_0xf2g6c">
<dc:Bounds x="520" y="310" width="100" height="80" />
@@ -762,6 +768,47 @@ css.prepareSelectNSTRequest(execution)</bpmn:script>
<di:waypoint x="410" y="350" />
<di:waypoint x="520" y="350" />
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="SubProcess_1sxkpqq_di" bpmnElement="SubProcess_1sxkpqq" isExpanded="true">
+ <dc:Bounds x="240" y="540" width="280" height="160" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="BoundaryEvent_0xqq1ch_di" bpmnElement="BoundaryEvent_0xqq1ch">
+ <dc:Bounds x="354" y="682" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="395" y="712" width="40" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_1hd68zf_di" bpmnElement="StartEvent_1hd68zf">
+ <dc:Bounds x="272" y="602" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_05npq16_di" bpmnElement="EndEvent_05npq16">
+ <dc:Bounds x="460" y="602" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="IntermediateCatchEvent_1iti8re_di" bpmnElement="IntermediateCatchEvent_1iti8re">
+ <dc:Bounds x="367" y="602" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="353" y="644" width="67" height="27" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1htsa6t_di" bpmnElement="SequenceFlow_1htsa6t">
+ <di:waypoint x="403" y="620" />
+ <di:waypoint x="460" y="620" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0recnor_di" bpmnElement="SequenceFlow_0recnor">
+ <di:waypoint x="308" y="620" />
+ <di:waypoint x="367" y="620" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1fk2cn3_di" bpmnElement="SequenceFlow_1fk2cn3">
+ <di:waypoint x="372" y="718" />
+ <di:waypoint x="372" y="772" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0sub2c2_di" bpmnElement="SequenceFlow_0sub2c2">
+ <di:waypoint x="213" y="620" />
+ <di:waypoint x="240" y="620" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_031cwkd_di" bpmnElement="SequenceFlow_031cwkd">
+ <di:waypoint x="520" y="620" />
+ <di:waypoint x="550" y="620" />
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
index 663b097b78..685dbe2dca 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterCreateTasks.java
@@ -121,8 +121,7 @@ public class VnfAdapterCreateTasks {
try {
volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
} catch (BBObjectNotFoundException bbException) {
- logger.error("Exception occurred if bb object not found in VnfAdapterCreateTasks createVfModule ",
- bbException);
+ logger.info("Volume Group not found in GBB. ");
}
CloudRegion cloudRegion = gBBInput.getCloudRegion();
RequestContext requestContext = gBBInput.getRequestContext();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 43a85051be..217b3a848e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -102,8 +102,11 @@ public class WorkflowActionBBTasks {
List<ExecuteBuildingBlock> flowsToExecute =
(List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
execution.setVariable("MacroRollback", false);
-
- flowManipulatorListenerRunner.modifyFlows(flowsToExecute, new DelegateExecutionImpl(execution));
+ try {
+ flowManipulatorListenerRunner.modifyFlows(flowsToExecute, new DelegateExecutionImpl(execution));
+ } catch (NullPointerException ex) {
+ workflowAction.buildAndThrowException(execution, "Error in FlowManipulator Modify Flows", ex);
+ }
int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence);
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
index eef0396205..14918c7873 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/AnSliceProfile.java
@@ -31,6 +31,9 @@ import java.util.List;
@Data
@ToString
public class AnSliceProfile implements Serializable {
+ /*
+ * Reference 3GPP TS 28.541 V16.5.0, Section 6.3.4.
+ */
private static final long serialVersionUID = -3057342171549542794L;
@@ -44,7 +47,7 @@ public class AnSliceProfile implements Serializable {
private List<String> pLMNIdList;
@JsonProperty(value = "perfReq", required = true)
- private AnPerfReq perfReq;
+ private PerfReq perfReq;
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
@JsonProperty(value = "maxNumberofUEs")
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java
index 3bd155d512..1fa84eee59 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/CnSliceProfile.java
@@ -21,100 +21,40 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import java.io.Serializable;
import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class CnSliceProfile {
+@Data
+public class CnSliceProfile implements Serializable {
+ private static final long serialVersionUID = 6627071735572539536L;
+
+ @JsonProperty(value = "sNSSAIList", required = true)
private List<String> snssaiList;
private String sliceProfileId;
+ @JsonProperty(value = "pLMNIdList", required = true)
private List<String> plmnIdList;
+ @JsonProperty(value = "perfReq", required = true)
private PerfReq perfReq;
- @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ @JsonProperty(value = "maxNumberofUEs")
private int maxNumberofUEs;
+ @JsonProperty(value = "coverageAreaTAList")
private List<String> coverageAreaTAList;
- @JsonInclude(JsonInclude.Include.NON_DEFAULT)
+ @JsonProperty(value = "latency")
private int latency;
+ @JsonProperty(value = "uEMobilityLevel")
private UeMobilityLevel ueMobilityLevel;
+ @JsonProperty(value = "resourceSharingLevel")
private ResourceSharingLevel resourceSharingLevel;
-
- public String getSliceProfileId() {
- return sliceProfileId;
- }
-
- public void setSliceProfileId(String sliceProfileId) {
- this.sliceProfileId = sliceProfileId;
- }
-
- public List<String> getPlmnIdList() {
- return plmnIdList;
- }
-
- public void setPlmnIdList(List<String> plmnIdList) {
- this.plmnIdList = plmnIdList;
- }
-
- public PerfReq getPerfReq() {
- return perfReq;
- }
-
- public void setPerfReq(PerfReq perfReq) {
- this.perfReq = perfReq;
- }
-
- public int getMaxNumberofUEs() {
- return maxNumberofUEs;
- }
-
- public void setMaxNumberofUEs(int maxNumberofUEs) {
- this.maxNumberofUEs = maxNumberofUEs;
- }
-
- public List<String> getCoverageAreaTAList() {
- return coverageAreaTAList;
- }
-
- public void setCoverageAreaTAList(List<String> coverageAreaTAList) {
- this.coverageAreaTAList = coverageAreaTAList;
- }
-
- public int getLatency() {
- return latency;
- }
-
- public void setLatency(int latency) {
- this.latency = latency;
- }
-
- public UeMobilityLevel getUeMobilityLevel() {
- return ueMobilityLevel;
- }
-
- public void setUeMobilityLevel(UeMobilityLevel ueMobilityLevel) {
- this.ueMobilityLevel = ueMobilityLevel;
- }
-
- public ResourceSharingLevel getResourceSharingLevel() {
- return resourceSharingLevel;
- }
-
- public void setResourceSharingLevel(ResourceSharingLevel resourceSharingLevel) {
- this.resourceSharingLevel = resourceSharingLevel;
- }
-
- public List<String> getSnssaiList() {
- return snssaiList;
- }
-
- public void setSnssaiList(List<String> snssaiList) {
- this.snssaiList = snssaiList;
- }
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java b/common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java
index e4989059a3..8dd369181a 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/NssmfAdapterNBIRequest.java
@@ -44,7 +44,7 @@ public class NssmfAdapterNBIRequest implements Serializable {
private DeAllocateNssi deAllocateNssi;
- private Object subnetCapabilityQuery;
+ private QuerySubnetCapability subnetCapabilityQuery;
private String responseId;
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/PerfReq.java b/common/src/main/java/org/onap/so/beans/nsmf/PerfReq.java
index c67f193a02..6697c8d8a0 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/PerfReq.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/PerfReq.java
@@ -21,10 +21,13 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import java.io.Serializable;
import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class PerfReq {
+public class PerfReq implements Serializable {
+
+ private static final long serialVersionUID = 8463835350563510267L;
private List<PerfReqEmbb> perfReqEmbbList;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java b/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java
index f6e945e368..1db009cdb9 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/PerfReqEmbb.java
@@ -25,6 +25,9 @@ import java.io.Serializable;
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PerfReqEmbb implements Serializable {
+ /*
+ * Reference 3GPP TS 28.541 V16.5.0, Section 6.4.1.
+ */
private static final long serialVersionUID = 8886635511695277599L;
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/AnPerfReq.java b/common/src/main/java/org/onap/so/beans/nsmf/QuerySubnetCapability.java
index e2c2e999ec..7485b387d8 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/AnPerfReq.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/QuerySubnetCapability.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * Copyright (C) 2020 Wipro Limited.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,31 +20,30 @@
package org.onap.so.beans.nsmf;
+
import com.fasterxml.jackson.annotation.JsonInclude;
-import java.io.Serializable;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import java.util.List;
+/**
+ * Model class for slice subnet capability query
+ */
@JsonInclude(JsonInclude.Include.NON_NULL)
-public class AnPerfReq implements Serializable {
-
- private static final long serialVersionUID = -7415880702887244040L;
+public class QuerySubnetCapability {
- private PerfReqEmbb perfReqEmbb;
-
- private PerfReqUrllc perfReqUrllc;
-
- public PerfReqEmbb getPerfReqEmbb() {
- return perfReqEmbb;
- }
+ @JsonProperty("subnetTypes")
+ private List<String> subnetTypes;
- public void setPerfReqEmbb(PerfReqEmbb perfReqEmbb) {
- this.perfReqEmbb = perfReqEmbb;
+ public List<String> getSubnetTypes() {
+ return subnetTypes;
}
- public PerfReqUrllc getPerfReqUrllc() {
- return perfReqUrllc;
+ public void setSubnetTypes(List<String> subnetTypes) {
+ this.subnetTypes = subnetTypes;
}
- public void setPerfReqUrllc(PerfReqUrllc perfReqUrllc) {
- this.perfReqUrllc = perfReqUrllc;
+ @Override
+ public String toString() {
+ return "QuerySubnetCapability [subnetType=" + subnetTypes + "]";
}
}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java
new file mode 100644
index 0000000000..9b6df0fa9e
--- /dev/null
+++ b/common/src/main/java/org/onap/so/beans/nsmf/SliceProfileAdapter.java
@@ -0,0 +1,116 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.beans.nsmf;
+
+import com.fasterxml.jackson.annotation.JsonProperty;
+import lombok.Data;
+import lombok.ToString;
+import org.springframework.beans.BeanUtils;
+import java.io.Serializable;
+import java.util.Arrays;
+
+@Data
+@ToString
+public class SliceProfileAdapter implements Serializable {
+
+ private static final long serialVersionUID = -6412175980642584804L;
+
+ @JsonProperty(value = "sliceProfileId")
+ private String sliceProfileId;
+
+ @JsonProperty(value = "sNSSAI")
+ private String sNSSAIList = "";
+
+ @JsonProperty(value = "pLMNIdList")
+ private String pLMNIdList = "";
+
+ @JsonProperty(value = "maxNumberofUEs")
+ private long maxNumberofUEs;
+
+ @JsonProperty(value = "coverageAreaTAList")
+ private String coverageAreaTAList = "";
+
+ @JsonProperty(value = "latency")
+ private int latency;
+
+ @JsonProperty(value = "uEMobilityLevel")
+ private String uEMobilityLevel;
+
+ @JsonProperty(value = "resourceSharingLevel")
+ private String resourceSharingLevel;
+
+ @JsonProperty(value = "maxBandwidth")
+ private String bandwidth;
+
+ @JsonProperty(value = "sST")
+ private String sST;
+
+ @JsonProperty(value = "activityFactor")
+ private String activityFactor;
+
+ @JsonProperty(value = "survivalTime")
+ private String survivalTime;
+
+ public AnSliceProfile trans2AnProfile() {
+ AnSliceProfile anSliceProfile = new AnSliceProfile();
+ BeanUtils.copyProperties(this, anSliceProfile);
+ anSliceProfile.setSNSSAIList(Arrays.asList(this.sNSSAIList.split("\\|")));
+ anSliceProfile.setPLMNIdList(Arrays.asList(this.pLMNIdList.split("\\|")));
+
+ String[] areas = this.coverageAreaTAList.split("\\|");
+ Integer[] areasRes = new Integer[areas.length];
+ for (int i = 0; i < areas.length; i++) {
+ areasRes[i] = str2Code(areas[i]);
+ }
+ anSliceProfile.setCoverageAreaTAList(Arrays.asList(areasRes));
+ anSliceProfile.setUEMobilityLevel(UeMobilityLevel.fromString(this.uEMobilityLevel));
+ anSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(this.resourceSharingLevel));
+ PerfReq perfReq = new PerfReq();
+ // todo
+ anSliceProfile.setPerfReq(perfReq);
+ return anSliceProfile;
+ }
+
+ private Integer str2Code(String area) {
+ return area.hashCode() >> 16;
+ }
+
+ public CnSliceProfile trans2CnProfile() {
+ CnSliceProfile cnSliceProfile = new CnSliceProfile();
+ BeanUtils.copyProperties(this, cnSliceProfile);
+ cnSliceProfile.setSnssaiList(Arrays.asList(this.sNSSAIList.split("\\|")));
+ cnSliceProfile.setCoverageAreaTAList(Arrays.asList(this.coverageAreaTAList.split("\\|")));
+ cnSliceProfile.setPlmnIdList(Arrays.asList(this.pLMNIdList.split("\\|")));
+ cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(this.resourceSharingLevel));
+ PerfReq perfReq = new PerfReq();
+ // todo
+ cnSliceProfile.setPerfReq(perfReq);
+ return cnSliceProfile;
+ }
+
+ public TnSliceProfile trans2TnProfile() {
+ TnSliceProfile tnSliceProfile = new TnSliceProfile();
+ BeanUtils.copyProperties(this, tnSliceProfile);
+ tnSliceProfile.setSNSSAIList(Arrays.asList(this.sNSSAIList.split("\\|")));
+ tnSliceProfile.setPLMNIdList(Arrays.asList(this.pLMNIdList.split("\\|")));
+ return tnSliceProfile;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java
index e97aa704eb..bfd4627b47 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java
@@ -19,6 +19,7 @@
*/
package org.onap.so.beans.nsmf;
+import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.JsonObject;
import lombok.*;
@@ -56,15 +57,15 @@ public class SliceTaskParamsAdapter implements Serializable {
private TemplateInfo NSTInfo = new TemplateInfo();
- private SliceTaskInfo<TnSliceProfile> tnBHSliceTaskInfo = new SliceTaskInfo<>();
+ private SliceTaskInfo<SliceProfileAdapter> tnBHSliceTaskInfo = new SliceTaskInfo<>();
- private SliceTaskInfo<TnSliceProfile> tnMHSliceTaskInfo = new SliceTaskInfo<>();
+ private SliceTaskInfo<SliceProfileAdapter> tnMHSliceTaskInfo = new SliceTaskInfo<>();
- private SliceTaskInfo<TnSliceProfile> tnFHSliceTaskInfo = new SliceTaskInfo<>();
+ private SliceTaskInfo<SliceProfileAdapter> tnFHSliceTaskInfo = new SliceTaskInfo<>();
- private SliceTaskInfo<CnSliceProfile> cnSliceTaskInfo = new SliceTaskInfo<>();
+ private SliceTaskInfo<SliceProfileAdapter> cnSliceTaskInfo = new SliceTaskInfo<>();
- private SliceTaskInfo<AnSliceProfile> anSliceTaskInfo = new SliceTaskInfo<>();
+ private SliceTaskInfo<SliceProfileAdapter> anSliceTaskInfo = new SliceTaskInfo<>();
@SuppressWarnings("unchecked")
public void convertFromJson(String jsonString) throws IOException {
@@ -80,24 +81,24 @@ public class SliceTaskParamsAdapter implements Serializable {
this.setServiceProfile(replaceHeader(paramMap, "ServiceProfile."));
- TnSliceProfile tnBHSliceProfile = mapper.readValue(
- mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.TN.BH.")), TnSliceProfile.class);
+ SliceProfileAdapter tnBHSliceProfile = mapper.readValue(
+ mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.TN.BH.")), SliceProfileAdapter.class);
this.tnBHSliceTaskInfo.setSliceProfile(tnBHSliceProfile);
- TnSliceProfile tnMHSliceProfile = mapper.readValue(
- mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.TN.MH.")), TnSliceProfile.class);
+ SliceProfileAdapter tnMHSliceProfile = mapper.readValue(
+ mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.TN.MH.")), SliceProfileAdapter.class);
this.tnMHSliceTaskInfo.setSliceProfile(tnMHSliceProfile);
- TnSliceProfile tnFHSliceProfile = mapper.readValue(
- mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.TN.FH.")), TnSliceProfile.class);
+ SliceProfileAdapter tnFHSliceProfile = mapper.readValue(
+ mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.TN.FH.")), SliceProfileAdapter.class);
this.tnFHSliceTaskInfo.setSliceProfile(tnFHSliceProfile);
- CnSliceProfile cnSliceProfile = mapper.readValue(
- mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.CN.")), CnSliceProfile.class);
+ SliceProfileAdapter cnSliceProfile = mapper.readValue(
+ mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.CN.")), SliceProfileAdapter.class);
this.cnSliceTaskInfo.setSliceProfile(cnSliceProfile);
- AnSliceProfile anSliceProfile = mapper.readValue(
- mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.AN.")), AnSliceProfile.class);
+ SliceProfileAdapter anSliceProfile = mapper.readValue(
+ mapper.writeValueAsString(replaceHeader(paramMap, "SliceProfile.AN.")), SliceProfileAdapter.class);
this.anSliceTaskInfo.setSliceProfile(anSliceProfile);
this.tnBHSliceTaskInfo.setSuggestNssiId(paramMap.get("TN.BH.SuggestNSSIId"));
@@ -148,33 +149,31 @@ public class SliceTaskParamsAdapter implements Serializable {
for (Map.Entry<String, Object> entry : serviceProfile.entrySet()) {
jsonObject.addProperty("ServiceProfile." + entry.getKey(), entry.getValue().toString());
}
-
Map<String, Object> sliceProfileAn = bean2Map(anSliceTaskInfo.getSliceProfile());
-
for (Map.Entry<String, Object> entry : sliceProfileAn.entrySet()) {
- jsonObject.addProperty("SliceProfile.AN." + entry.getKey(), entry.getValue().toString());
+ String value = entry.getValue() == null ? "" : entry.getValue().toString();
+ jsonObject.addProperty("SliceProfile.AN." + entry.getKey(), value);
}
-
Map<String, Object> sliceProfileCn = bean2Map(cnSliceTaskInfo.getSliceProfile());
for (Map.Entry<String, Object> entry : sliceProfileCn.entrySet()) {
- jsonObject.addProperty("SliceProfile.CN." + entry.getKey(), entry.getValue().toString());
+ String value = entry.getValue() == null ? "" : entry.getValue().toString();
+ jsonObject.addProperty("SliceProfile.CN." + entry.getKey(), value);
}
-
Map<String, Object> sliceProfileTnBH = bean2Map(tnBHSliceTaskInfo.getSliceProfile());
for (Map.Entry<String, Object> entry : sliceProfileTnBH.entrySet()) {
- jsonObject.addProperty("SliceProfile.TN.BH." + entry.getKey(), entry.getValue().toString());
+ String value = entry.getValue() == null ? "" : entry.getValue().toString();
+ jsonObject.addProperty("SliceProfile.TN.BH." + entry.getKey(), value);
}
-
Map<String, Object> sliceProfileTnMH = bean2Map(tnMHSliceTaskInfo.getSliceProfile());
for (Map.Entry<String, Object> entry : sliceProfileTnMH.entrySet()) {
- jsonObject.addProperty("SliceProfile.TN.MH." + entry.getKey(), entry.getValue().toString());
+ String value = entry.getValue() == null ? "" : entry.getValue().toString();
+ jsonObject.addProperty("SliceProfile.TN.MH." + entry.getKey(), value);
}
-
Map<String, Object> sliceProfileTnFH = bean2Map(tnFHSliceTaskInfo.getSliceProfile());
for (Map.Entry<String, Object> entry : sliceProfileTnFH.entrySet()) {
- jsonObject.addProperty("SliceProfile.TN.FH." + entry.getKey(), entry.getValue().toString());
+ String value = entry.getValue() == null ? "" : entry.getValue().toString();
+ jsonObject.addProperty("SliceProfile.TN.FH." + entry.getKey(), value);
}
-
jsonObject.addProperty("TN.BH.SuggestNSSIId", tnBHSliceTaskInfo.getSuggestNssiId());
jsonObject.addProperty("TN.BH.SuggestNSSIName", tnBHSliceTaskInfo.getSuggestNssiName());
jsonObject.addProperty("TN.BH.progress", tnBHSliceTaskInfo.getProgress());
@@ -182,7 +181,6 @@ public class SliceTaskParamsAdapter implements Serializable {
jsonObject.addProperty("TN.BH.statusDescription", tnBHSliceTaskInfo.getStatusDescription());
jsonObject.addProperty("TN.BH.ScriptName", tnBHSliceTaskInfo.getScriptName());
-
jsonObject.addProperty("TN.MH.SuggestNSSIId", tnMHSliceTaskInfo.getSuggestNssiId());
jsonObject.addProperty("TN.MH.SuggestNSSIName", tnMHSliceTaskInfo.getSuggestNssiName());
jsonObject.addProperty("TN.MH.progress", tnMHSliceTaskInfo.getProgress());
@@ -190,7 +188,6 @@ public class SliceTaskParamsAdapter implements Serializable {
jsonObject.addProperty("TN.MH.statusDescription", tnMHSliceTaskInfo.getStatusDescription());
jsonObject.addProperty("TN.MH.ScriptName", tnMHSliceTaskInfo.getScriptName());
-
jsonObject.addProperty("TN.FH.SuggestNSSIId", tnFHSliceTaskInfo.getSuggestNssiId());
jsonObject.addProperty("TN.FH.SuggestNSSIName", tnFHSliceTaskInfo.getSuggestNssiName());
jsonObject.addProperty("TN.FH.progress", tnFHSliceTaskInfo.getProgress());
@@ -198,7 +195,6 @@ public class SliceTaskParamsAdapter implements Serializable {
jsonObject.addProperty("TN.FH.statusDescription", tnFHSliceTaskInfo.getStatusDescription());
jsonObject.addProperty("TN.FH.ScriptName", tnFHSliceTaskInfo.getScriptName());
-
jsonObject.addProperty("CN.SuggestNSSIId", cnSliceTaskInfo.getSuggestNssiId());
jsonObject.addProperty("CN.SuggestNSSIName", cnSliceTaskInfo.getSuggestNssiName());
jsonObject.addProperty("CN.progress", cnSliceTaskInfo.getProgress());
@@ -206,7 +202,6 @@ public class SliceTaskParamsAdapter implements Serializable {
jsonObject.addProperty("CN.statusDescription", cnSliceTaskInfo.getStatusDescription());
jsonObject.addProperty("CN.ScriptName", cnSliceTaskInfo.getScriptName());
-
jsonObject.addProperty("AN.SuggestNSSIId", anSliceTaskInfo.getSuggestNssiId());
jsonObject.addProperty("AN.SuggestNSSIName", anSliceTaskInfo.getSuggestNssiName());
jsonObject.addProperty("AN.progress", anSliceTaskInfo.getProgress());
@@ -219,7 +214,7 @@ public class SliceTaskParamsAdapter implements Serializable {
/**
* change T t to {@link Map}
- *
+ *
* @param t input
* @param <T> Object
* @return {@link Map}
@@ -234,9 +229,18 @@ public class SliceTaskParamsAdapter implements Serializable {
Field[] fields = t.getClass().getDeclaredFields();
for (Field field : fields) {
String name = field.getName();
- Method method = t.getClass().getMethod("get" + name);
+ String key = name;
+ if (name == null || "".equals(name) || "serialVersionUID".equalsIgnoreCase(name)) {
+ continue;
+ }
+ JsonProperty annotation = field.getAnnotation(JsonProperty.class);
+ if (annotation != null && !annotation.value().equals(JsonProperty.USE_DEFAULT_NAME)) {
+ key = annotation.value();
+ }
+
+ Method method = t.getClass().getMethod("get" + name.substring(0, 1).toUpperCase() + name.substring(1));
Object value = method.invoke(t);
- resMap.put(name, value);
+ resMap.put(key, value);
}
} catch (Exception e) {
@@ -247,7 +251,7 @@ public class SliceTaskParamsAdapter implements Serializable {
/**
* replace of slice profile
- *
+ *
* @param paramMap params map
* @param header starts of key
* @return Map
diff --git a/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java b/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java
index ccd6001957..3f0da1bf21 100644
--- a/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java
+++ b/common/src/main/java/org/onap/so/beans/nsmf/TnSliceProfile.java
@@ -21,16 +21,28 @@
package org.onap.so.beans.nsmf;
import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
+import java.io.Serializable;
+import java.util.List;
@JsonInclude(JsonInclude.Include.NON_NULL)
@Data
-public class TnSliceProfile {
+public class TnSliceProfile implements Serializable {
+
+ private static final long serialVersionUID = 3767943556195823439L;
private String sliceProfileId;
+ @JsonProperty(value = "maxBandwidth")
private String bandwidth;
@JsonInclude(JsonInclude.Include.NON_DEFAULT)
private int latency;
+
+ @JsonProperty(value = "sNSSAIList", required = true)
+ private List<String> sNSSAIList;
+
+ @JsonProperty(value = "pLMNIdList", required = true)
+ private List<String> pLMNIdList;
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
index 54d757ad05..3e7995417d 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
@@ -118,7 +118,7 @@ public class VnfResourceCustomization implements Serializable {
private String blueprintVersion;
@Column(name = "SKIP_POST_INSTANTIATION_CONFIGURATION")
- private Boolean skipPostInstConf;
+ private boolean skipPostInstConf;
@Column(name = "VNFCINSTANCEGROUP_ORDER")
private String vnfcInstanceGroupOrder;
@@ -327,11 +327,11 @@ public class VnfResourceCustomization implements Serializable {
this.blueprintVersion = blueprintVersion;
}
- public Boolean isSkipPostInstConf() {
+ public boolean isSkipPostInstConf() {
return skipPostInstConf;
}
- public void setSkipPostInstConf(Boolean skipPostInstConf) {
+ public void setSkipPostInstConf(boolean skipPostInstConf) {
this.skipPostInstConf = skipPostInstConf;
}
diff --git a/releases/1.7.10.yaml b/releases/1.7.10.yaml
new file mode 100644
index 0000000000..42fd852a47
--- /dev/null
+++ b/releases/1.7.10.yaml
@@ -0,0 +1,33 @@
+---
+distribution_type: 'container'
+container_release_tag: '1.7.10'
+project: 'so'
+log_dir: 'so-maven-docker-stage-master/531/'
+ref: '0543ae167581c15403f2f3d7835981d0a4e4b356'
+containers:
+ - name: 'so/vnfm-adapter'
+ version: '1.7.8-20201113T1715'
+ - name: 'so/catalog-db-adapter'
+ version: '1.7.8-20201113T1715'
+ - name: 'so/request-db-adapter'
+ version: '1.7.8-20201113T1715'
+ - name: 'so/openstack-adapter'
+ version: '1.7.8-20201113T1715'
+ - name: 'so/sdnc-adapter'
+ version: '1.7.8-20201113T1715'
+ - name: 'so/vfc-adapter'
+ version: '1.7.8-20201113T1715'
+ - name: 'so/sdc-controller'
+ version: '1.7.8-20201113T1715'
+ - name: 'so/bpmn-infra'
+ version: '1.7.8-20201113T1715'
+ - name: 'so/so-monitoring'
+ version: '1.7.8-20201113T1715'
+ - name: 'so/api-handler-infra'
+ version: '1.7.8-20201113T1715'
+ - name: 'so/nssmf-adapter'
+ version: '1.7.8-20201113T1715'
+ - name: 'so/mso-cnf-adapter'
+ version: '1.7.8-20201113T1715'
+ - name: 'so/so-oof-adapter'
+ version: '1.7.8-20201113T1715' \ No newline at end of file
diff --git a/releases/1.7.8.yaml b/releases/1.7.8.yaml
new file mode 100644
index 0000000000..8e093d770a
--- /dev/null
+++ b/releases/1.7.8.yaml
@@ -0,0 +1,33 @@
+---
+distribution_type: 'container'
+container_release_tag: '1.7.9'
+project: 'so'
+log_dir: 'so-maven-docker-stage-master/523/'
+ref: 'd9c2a8645009b7080302f01b7e13e1480060eebd'
+containers:
+ - name: 'so/vnfm-adapter'
+ version: '1.7.8-20201110T1841'
+ - name: 'so/catalog-db-adapter'
+ version: '1.7.8-20201110T1841'
+ - name: 'so/request-db-adapter'
+ version: '1.7.8-20201110T1841'
+ - name: 'so/openstack-adapter'
+ version: '1.7.8-20201110T1841'
+ - name: 'so/sdnc-adapter'
+ version: '1.7.8-20201110T1841'
+ - name: 'so/vfc-adapter'
+ version: '1.7.8-20201110T1841'
+ - name: 'so/sdc-controller'
+ version: '1.7.8-20201110T1841'
+ - name: 'so/bpmn-infra'
+ version: '1.7.8-20201110T1841'
+ - name: 'so/so-monitoring'
+ version: '1.7.8-20201110T1841'
+ - name: 'so/api-handler-infra'
+ version: '1.7.8-20201110T1841'
+ - name: 'so/nssmf-adapter'
+ version: '1.7.8-20201110T1841'
+ - name: 'so/mso-cnf-adapter'
+ version: '1.7.8-20201110T1841'
+ - name: 'so/so-oof-adapter'
+ version: '1.7.8-20201110T1841' \ No newline at end of file
diff --git a/version.properties b/version.properties
index f6e4c9033a..74801daa0f 100644
--- a/version.properties
+++ b/version.properties
@@ -4,7 +4,7 @@
major=1
minor=7
-patch=7
+patch=8
base_version=${major}.${minor}.${patch}