10/31: merge casablanca to master 47/71547/2
authorRob Daugherty <rd472p@att.com>
Wed, 31 Oct 2018 14:21:22 +0000 (10:21 -0400)
committerRob Daugherty <rd472p@att.com>
Wed, 31 Oct 2018 14:38:00 +0000 (10:38 -0400)
Commit: 649c4e85cc991ffe9c13fd3fab4cc3a303faa656
Subject: Fix Error, Check that vimID is present
Issue: SO-1156
https://gerrit.onap.org/r/#/c/71247/

Commit: 959493d3274d2f2749586248cf31ee12b730e2af
Subject: Bug fixes October 26th
Issue: SO-1169
https://gerrit.onap.org/r/#/c/71343/

Commit: 373c057bfa82583f615ea46814ad3cdf9ea8d669
Subject: Resolve vf_module_id setting bug
Issue: SO-1165
https://gerrit.onap.org/r/#/c/71270/

Commit: 6c2c8a66fade016f74b51bdfea3ba04494530b97
Issue: SO-1102
Subject: Pnf Spring Environment correction
https://gerrit.onap.org/r/#/c/71137/

Change-Id: I22b4566050f627e1f1428aacdb52ec4d4fe75733
Issue-ID: SO-1173
Signed-off-by: Rob Daugherty <rd472p@att.com>
22 files changed:
adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockCMExpected.json
bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GeneralBuildingBlockExpected.json
bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestContextExpected.json
bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/RequestDetailsInput_mapReqContext.json
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateVfModuleVolume.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustService.groovy
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/CheckAaiForCorrelationIdDelegate.java
bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/vcpe/scripts/CreateVcpeResCustServiceTest.groovy
bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfCheckInputsTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
common/src/main/java/org/onap/so/client/aai/entities/uri/AAISimpleUri.java
common/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java
common/src/main/java/org/onap/so/client/aai/entities/uri/NodesUri.java
common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java
common/src/main/java/org/onap/so/client/graphinventory/entities/uri/SimpleUri.java
common/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
common/src/test/java/org/onap/so/client/aai/entities/uri/AAISimpleUriTest.java
common/src/test/java/org/onap/so/constants/DefaultsTest.java
common/src/test/resources/application-test.yaml

index 076e03b..8f71af4 100644 (file)
@@ -76,7 +76,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
     public static final String VF_MODULE_ID = "vf_module_id";
     public static final String TEMPLATE_TYPE = "template_type";
     public static final List<String> MULTICLOUD_INPUTS =
-            Arrays.asList(OOF_DIRECTIVES, SDNC_DIRECTIVES, GENERIC_VNF_ID, VF_MODULE_ID, TEMPLATE_TYPE);
+            Arrays.asList(OOF_DIRECTIVES, SDNC_DIRECTIVES, TEMPLATE_TYPE);
 
     private static final Logger logger = LoggerFactory.getLogger(MsoMulticloudUtils.class);
 
@@ -157,18 +157,29 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin{
 
         for (String key: MULTICLOUD_INPUTS) {
             if (!stackInputs.isEmpty() && stackInputs.containsKey(key)) {
-                if ( key == OOF_DIRECTIVES) {oofDirectives = (String) stackInputs.get(key);}
-                if ( key == SDNC_DIRECTIVES) {sdncDirectives = (String) stackInputs.get(key);}
-                if ( key == GENERIC_VNF_ID) {genericVnfId = (String) stackInputs.get(key);}
-                if ( key == VF_MODULE_ID) {vfModuleId = (String) stackInputs.get(key);}
-                if ( key == TEMPLATE_TYPE) {templateType = (String) stackInputs.get(key);}
-                         if (logger.isDebugEnabled()) {
+                if (key == OOF_DIRECTIVES) {
+                    oofDirectives = (String) stackInputs.get(key);
+                }
+                if (key == SDNC_DIRECTIVES) {
+                    sdncDirectives = (String) stackInputs.get(key);
+                }
+                if (key == TEMPLATE_TYPE) {
+                    templateType = (String) stackInputs.get(key);
+                }
+                if (logger.isDebugEnabled()) {
                     logger.debug(String.format("Found %s: %s", key, stackInputs.get(key)));
                 }
                 stackInputs.remove(key);
             }
         }
 
+        if (!stackInputs.isEmpty() && stackInputs.containsKey("VF_MODULE_ID")){
+            vfModuleId = (String) stackInputs.get("VF_MODULE_ID");
+        }
+        if (!stackInputs.isEmpty() && stackInputs.containsKey("GENERIC_VNF_ID")){
+            genericVnfId = (String) stackInputs.get("GENERIC_VNF_ID");
+        }
+
         // create the multicloud payload
         CreateStackParam stack = createStackParam(stackName, heatTemplate, stackInputs, timeoutMinutes, environment, files, heatFiles);
 
index d463fde..0f52c96 100644 (file)
@@ -22,6 +22,7 @@ package org.onap.so.bpmn.servicedecomposition.tasks;
 
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
@@ -84,6 +85,8 @@ import org.springframework.stereotype.Component;
 
 @Component("BBInputSetupMapperLayer")
 public class BBInputSetupMapperLayer {
+       private static final String USER_PARAM_NAME_KEY = "name";
+    private static final String USER_PARAM_VALUE_KEY = "value";
 
        private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
                        BBInputSetupMapperLayer.class);
@@ -332,6 +335,7 @@ public class BBInputSetupMapperLayer {
                if (null != requestParameters) {
                        context.setSubscriptionServiceType(requestParameters.getSubscriptionServiceType());
                        context.setRequestParameters(this.mapRequestParameters(requestDetails.getRequestParameters()));
+                       context.setUserParams(this.mapNameValueUserParams(requestDetails.getRequestParameters()));
                }
                return context;
        }
@@ -344,6 +348,20 @@ public class BBInputSetupMapperLayer {
                requestParams.setPayload(requestParameters.getPayload());
                return requestParams;
        }
+       
+       protected HashMap<String,String> mapNameValueUserParams(org.onap.so.serviceinstancebeans.RequestParameters requestParameters) {         
+               HashMap<String,String> userParamsResult = new HashMap<String,String>();
+               if (requestParameters.getUserParams() != null) {
+                       List<Map<String, Object>> userParams = requestParameters.getUserParams();
+                       for (Map<String, Object> userParamsMap : userParams) {
+                               if ( userParamsMap.containsKey(USER_PARAM_NAME_KEY) && (userParamsMap.get(USER_PARAM_NAME_KEY) instanceof String)
+                                               && userParamsMap.containsKey(USER_PARAM_VALUE_KEY) && (userParamsMap.get(USER_PARAM_VALUE_KEY) instanceof String)) {
+                                       userParamsResult.put((String) userParamsMap.get(USER_PARAM_NAME_KEY), (String) userParamsMap.get(USER_PARAM_VALUE_KEY));
+                               }
+                       }
+               }
+               return userParamsResult;
+       }
 
        protected OrchestrationContext mapOrchestrationContext(RequestDetails requestDetails) {
                OrchestrationContext context = new OrchestrationContext();
index 94dbbf4..1babac6 100644 (file)
@@ -23,6 +23,8 @@ package org.onap.so.bpmn.servicedecomposition.tasks;
 import static com.shazam.shazamcrest.MatcherAssert.assertThat;
 import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
 import static org.hamcrest.CoreMatchers.equalTo;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
 
 import java.io.File;
 import java.io.IOException;
@@ -33,7 +35,6 @@ import java.util.List;
 import java.util.Map;
 
 import org.junit.Test;
-import org.mockito.InjectMocks;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
@@ -636,4 +637,20 @@ public class BBInputSetupMapperLayerTest {
 
                assertThat(actual, sameBeanAs(expected));
        }
+       
+       @Test
+       public void testMapNameValueUserParams() throws IOException {           
+               RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_mapReqContext.json"), RequestDetails.class);
+               HashMap<String,String> actual = bbInputSetupMapperLayer.mapNameValueUserParams(requestDetails.getRequestParameters());
+
+               assertTrue(actual.containsKey("name1"));
+               assertTrue(actual.containsValue("value1"));
+               assertTrue(actual.get("name1").equals("value1"));
+               assertTrue(actual.containsKey("name2"));
+               assertTrue(actual.containsValue("value2"));
+               assertTrue(actual.get("name2").equals("value2"));               
+               assertFalse(actual.containsKey("ignore"));
+               assertFalse(actual.containsValue("ignore"));            
+       }
+       
 }
index cf65143..926bf2c 100644 (file)
@@ -5,11 +5,28 @@
                "requestor-id": "requestorId",
                "mso-request-id": "requestId",
                "subscription-service-type": "subscriptionServiceType",
-               "user-params": null,
+               "user-params": {
+                                       "name1": "value1",
+                                       "name2": "value2"
+                               },
                "action": "createInstance",
                "callback-url": "callbackURL",
                "requestParameters": {
-                       "subscriptionServiceType": "subscriptionServiceType"
+                       "subscriptionServiceType": "subscriptionServiceType",
+                       "userParams": [
+                                       {
+                                               "name": "name1",
+                                               "value": "value1"
+                                       },
+                                       {
+                                               "name": "name2",
+                                               "value": "value2"
+                                       },
+                                       {
+                                               "ignore": "false",
+                                               "skip":  "ignore"
+                                       }
+                       ]       
                }
        },
        "orchContext": {
index 6f82a9d..dfc6d4f 100644 (file)
@@ -2,11 +2,29 @@
        "product-family-id": "productFamilyId",
        "source": "source",
        "requestor-id": "requestorId",
-       "subscription-service-type": "subscriptionServiceType",
-       "user-params": null,
+       "subscription-service-type": "subscriptionServiceType", 
        "action": null,
        "callback-url": "callbackURL",
+       "user-params": {
+                                       "name1": "value1",
+                                       "name2": "value2"
+                               },
        "requestParameters": {
-               "subscriptionServiceType": "subscriptionServiceType"
+               "subscriptionServiceType": "subscriptionServiceType",
+               "userParams": [
+                                       {
+                                               "name": "name1",
+                                               "value": "value1"
+                                       },
+                                       {
+                                               "name": "name2",
+                                               "value": "value2"
+                                       },
+                                       {
+                                               "ignore": "false",
+                                               "skip":  "ignore"
+                                       }
+               ]       
        }
+       
 }
index e918751..7386828 100644 (file)
@@ -7,7 +7,22 @@
                "requestorId": "requestorId"
        },
        "requestParameters": {
-               "subscriptionServiceType": "subscriptionServiceType"
+               "subscriptionServiceType": "subscriptionServiceType",
+               "userParams": [
+                                       {
+                                               "name": "name1",
+                                               "value": "value1"
+                                       },
+                                       {
+                                               "name": "name2",
+                                               "value": "value2"
+                                       },
+                                       {
+                                               "ignore": "false",
+                                               "skip":  "ignore"
+                                       }
+               ]       
+               
        }
 }
 
index 82e27ec..0f9a0ad 100644 (file)
@@ -29,10 +29,13 @@ import org.onap.so.bpmn.common.scripts.MsoUtils
 import org.onap.so.bpmn.common.scripts.VfModuleBase
 import org.onap.so.bpmn.core.UrnPropertiesReader;
 import org.onap.so.bpmn.core.WorkflowException
+import org.onap.so.client.aai.AAIObjectType
+import org.onap.so.client.aai.entities.uri.AAIResourceUri
+import org.onap.so.client.aai.entities.uri.AAIUriFactory
+import org.onap.so.constants.Defaults
 import org.onap.so.logger.MessageEnum
 import org.onap.so.logger.MsoLogger
 import org.onap.so.rest.APIResponse
-import org.springframework.web.util.UriUtils
 
 class UpdateVfModuleVolume extends VfModuleBase {
        private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, UpdateVfModuleVolume.class);
@@ -172,14 +175,15 @@ class UpdateVfModuleVolume extends VfModuleBase {
                try {
                        def volumeGroupId = execution.getVariable('UPDVfModVol_volumeGroupId')
                        def aicCloudRegion = execution.getVariable('UPDVfModVol_aicCloudRegion')
-                       def endPoint = UrnPropertiesReader.getVariable("aai.endpoint", execution) +
-                               '/aai/v7/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/' + UriUtils.encode(aicCloudRegion, "UTF-8") +
-                               '/volume-groups/volume-group/' + UriUtils.encode(volumeGroupId, "UTF-8")
+                       
+                       AaiUtil aaiUtil = new AaiUtil(this)
+                       AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, Defaults.CLOUD_OWNER.toString(), aicCloudRegion, volumeGroupId)
+                       String endPoint = aaiUtil.createAaiUri(uri)
+                       
 
                        msoLogger.debug('Sending GET to AAI endpoint \'' + endPoint + '\'')
                        msoLogger.debug("UpdateVfModuleVolume sending GET for quering AAI endpoint: " + endPoint)
 
-                       AaiUtil aaiUtil = new AaiUtil(this)
                        APIResponse response = aaiUtil.executeAAIGetCall(execution, endPoint)
                        def int statusCode = response.getStatusCode()
                        def responseData = response.getResponseBodyAsString()
index beac679..1a47ef8 100644 (file)
@@ -176,17 +176,30 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
             execution.setVariable("subscriberInfo", subscriberInfo)
             msoLogger.debug("Incoming subscriberInfo is: " + subscriberInfo)
 
-            // extract cloud configuration, split vid_ID into cloudOwner and cloudRegionId
+            // extract cloud configuration - if underscore "_" is present treat as vimId else it's a cloudRegion
             String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest,
                     "requestDetails.cloudConfiguration.lcpCloudRegionId")
-            def cloudRegion = vimId.split("_")
-            def cloudOwner = cloudRegion[0].toString()
-            def cloudRegionId = cloudRegion[1].toString()
-            execution.setVariable("cloudOwner", cloudOwner)
-            utils.log("DEBUG","cloudOwner: " + cloudOwner, isDebugEnabled)
-            execution.setVariable("cloudRegionId", cloudRegionId)
-            utils.log("DEBUG","cloudRegionId: " + cloudRegionId, isDebugEnabled)
-
+            if (vimId.contains("_") && vimId.split("_").length == 2 ) {
+                def cloudRegion = vimId.split("_")
+                def cloudOwner = cloudRegion[0]
+                def cloudRegionId = cloudRegion[1]
+                execution.setVariable("cloudOwner", cloudOwner)
+                msoLogger.debug("cloudOwner: " + cloudOwner)
+                execution.setVariable("cloudRegionId", cloudRegionId)
+                msoLogger.debug("cloudRegionId: " + cloudRegionId)
+            } else {
+                msoLogger.debug("vimId is not present - setting  cloudRegion/cloudOwner from request.")
+                String cloudOwner = jsonUtil.getJsonValue(createVcpeServiceRequest,
+                        "requestDetails.cloudConfiguration.cloudOwner")
+                if (!cloudOwner?.empty && cloudOwner != "")
+                {
+                    execution.setVariable("cloudOwner", cloudOwner)
+                    msoLogger.debug("cloudOwner: " + cloudOwner)
+                }
+                def cloudRegionId = vimId
+                execution.setVariable("cloudRegionId", cloudRegionId)
+                msoLogger.debug("cloudRegionId: " + cloudRegionId)
+            }
             /*
             * Extracting User Parameters from incoming Request and converting into a Map
             */
@@ -592,16 +605,32 @@ public class CreateVcpeResCustService extends AbstractServiceTaskProcessor {
 
             msoLogger.debug(" vnfModelInfoString :" + vnfModelInfoString)
 
-            // extract cloud configuration
+            // extract cloud configuration - if underscore "_" is present treat as vimId else it's a cloudRegion
             String vimId = jsonUtil.getJsonValue(createVcpeServiceRequest,
                     "requestDetails.cloudConfiguration.lcpCloudRegionId")
-            def cloudRegion = vimId.split("_")
-            execution.setVariable("cloudOwner", cloudRegion[0])
-            msoLogger.debug("cloudOwner: "+ cloudRegion[0])
-            execution.setVariable("cloudRegionId", cloudRegion[1])
-            msoLogger.debug("cloudRegionId: "+ cloudRegion[1])
-            execution.setVariable("lcpCloudRegionId", cloudRegion[1])
-            msoLogger.debug("lcpCloudRegionId: "+ cloudRegion[1])
+            if (vimId.contains("_") && vimId.split("_").length == 2 )  {
+                def cloudRegion = vimId.split("_")
+                execution.setVariable("cloudOwner", cloudRegion[0])
+                msoLogger.debug("cloudOwner: " + cloudRegion[0])
+                execution.setVariable("cloudRegionId", cloudRegion[1])
+                msoLogger.debug("cloudRegionId: " + cloudRegion[1])
+                execution.setVariable("lcpCloudRegionId", cloudRegion[1])
+                msoLogger.debug("lcpCloudRegionId: " + cloudRegion[1])
+            } else {
+                msoLogger.debug("vimId is not present - setting cloudRegion/cloudOwner from request.")
+                String cloudOwner = jsonUtil.getJsonValue(createVcpeServiceRequest,
+                        "requestDetails.cloudConfiguration.cloudOwner")
+                if (!cloudOwner?.empty && cloudOwner != "")
+                {
+                    execution.setVariable("cloudOwner", cloudOwner)
+                    msoLogger.debug("cloudOwner: " + cloudOwner)
+                }
+                execution.setVariable("cloudRegionId", vimId)
+                msoLogger.debug("cloudRegionId: " + vimId)
+                execution.setVariable("lcpCloudRegionId", vimId)
+                msoLogger.debug("lcpCloudRegionId: " + vimId)
+            }
+
             String tenantId = jsonUtil.getJsonValue(createVcpeServiceRequest,
                     "requestDetails.cloudConfiguration.tenantId")
             execution.setVariable("tenantId", tenantId)
index 9cd28a2..8e57121 100644 (file)
@@ -20,7 +20,6 @@
 
 package org.onap.so.bpmn.infrastructure.pnf.delegate;
 
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_IP;
 import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF;
 import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.CORRELATION_ID;
 
index 84da045..d0ded39 100644 (file)
@@ -31,6 +31,7 @@ import org.junit.Test
 import org.junit.Ignore
 import org.mockito.MockitoAnnotations
 import org.camunda.bpm.engine.delegate.BpmnError
+import org.onap.so.bpmn.core.UrnPropertiesReader
 import org.onap.so.bpmn.core.WorkflowException
 import org.onap.so.bpmn.core.domain.HomingSolution
 import org.onap.so.bpmn.mock.FileUtil
@@ -195,7 +196,53 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
                
                assertTrue(doBpmnError( { _ -> CreateVcpeResCustService.preProcessRequest(mex) }))
        }
-                       
+
+       @Test
+       @Ignore
+       public void preProcessRequest_vimId() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPreProcess(mex)
+               UrnPropertiesReader
+
+               def req = request
+                               .replace('"mdt1"', '"CloudOwner_CloudRegion1"')
+
+               when(mex.getVariable("bpmnRequest")).thenReturn(req)
+               when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn("PT5S")
+               when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S")
+
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.preProcessRequest(mex)
+
+               verify(mex).setVariable("cloudRegionId", "CloudRegion1")
+               verify(mex).setVariable("cloudOwner", "CloudOwner")
+       }
+
+       @Test
+       @Ignore
+       public void preProcessRequest_noVimId() {
+               ExecutionEntity mex = setupMock()
+               def map = setupMap(mex)
+               initPreProcess(mex)
+
+               def req = request
+                               .replace('"mdt1"', '"CloudRegion1_"')
+
+               when(mex.getVariable("bpmnRequest")).thenReturn(req)
+               when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn(60)
+               when(mex.getVariable("URN_mso_workflow_aai_distribution_delay")).thenReturn("PT5S")
+               when(mex.getVariable("aai.workflowAaiDistributionDelay")).thenReturn("PT5S")
+
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.preProcessRequest(mex)
+
+               verify(mex).setVariable("cloudRegionId", "CloudRegion1_")
+               verify(mex).setVariable("cloudOwner", "my-cloud-owner")
+
+       }
+
+
        @Test
        // @Ignore  
        public void preProcessRequest_BpmnError() {
@@ -579,6 +626,45 @@ class CreateVcpeResCustServiceTest extends GroovyTestBase {
                verify(mex).setVariable("cloudOwner", "my-cloud-owner")
                verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
        }
+
+       @Test
+       public void prepareVnfAndModulesCreate_noVimId() {
+               ExecutionEntity mex = setupMock()
+               initPrepareVnfAndModulesCreate(mex)
+
+               def req = request
+                               .replace('"mdt1"', '"CloudRegion1_"')
+
+               when(mex.getVariable("createVcpeServiceRequest")).thenReturn(req)
+
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.prepareVnfAndModulesCreate(mex)
+
+               verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
+               verify(mex).setVariable("cloudRegionId", "CloudRegion1_")
+               verify(mex).setVariable("lcpCloudRegionId", "CloudRegion1_")
+               verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
+       }
+
+       @Test
+       public void prepareVnfAndModulesCreate_vimId() {
+               ExecutionEntity mex = setupMock()
+               initPrepareVnfAndModulesCreate(mex)
+
+               def req = request
+                               .replace('"mdt1"', '"CloudOwner_CloudRegion1"')
+
+               when(mex.getVariable("createVcpeServiceRequest")).thenReturn(req)
+
+               CreateVcpeResCustService CreateVcpeResCustService = new CreateVcpeResCustService()
+               CreateVcpeResCustService.prepareVnfAndModulesCreate(mex)
+
+               verify(mex).setVariable("productFamilyId", "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
+               verify(mex).setVariable("cloudOwner", "CloudOwner")
+               verify(mex).setVariable("cloudRegionId", "CloudRegion1")
+               verify(mex).setVariable("lcpCloudRegionId", "CloudRegion1")
+               verify(mex).setVariable("tenantId", "8b1df54faa3b49078e3416e21370a3ba")
+       }
                        
        @Test
        // @Ignore  
index 9794a59..1f3ecce 100644 (file)
@@ -37,6 +37,7 @@ public class PnfCheckInputsTest {
     private static final String DEFAULT_TIMEOUT = "P1D";
 
     private DelegateExecution mockDelegateExecution() {
+        new PnfCheckInputs(DEFAULT_TIMEOUT);
         DelegateExecution delegateExecution = mock(DelegateExecution.class);
         when(delegateExecution.getVariable("testProcessKey")).thenReturn("testProcessKeyValue");
         return delegateExecution;
@@ -62,6 +63,7 @@ public class PnfCheckInputsTest {
     }
 
     private DelegateExecution mockDelegateExecutionWithCorrelationId() {
+        new PnfCheckInputs(DEFAULT_TIMEOUT);
         DelegateExecution delegateExecution = mockDelegateExecution();
         when(delegateExecution.getVariable(CORRELATION_ID)).thenReturn("testCorrelationId");
         return delegateExecution;
@@ -96,4 +98,4 @@ public class PnfCheckInputsTest {
         // then
         verify(delegateExecution).setVariable(eq(TIMEOUT_FOR_NOTIFICATION), eq(DEFAULT_TIMEOUT));
     }
-}
\ No newline at end of file
+}
index 04397c4..f492ba3 100644 (file)
@@ -27,7 +27,10 @@ import static org.junit.Assert.assertNull;
 
 import java.nio.file.Files;
 import java.nio.file.Paths;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 import org.junit.Rule;
 import org.junit.Test;
@@ -40,6 +43,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
 import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
 import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
@@ -80,8 +84,8 @@ public class VfModuleTopologyOperationRequestMapperTest {
                customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
                //
                RequestContext requestContext = new RequestContext();
-               HashMap<String, String> userParams = new HashMap<String, String>();
-               userParams.put("key1", "value1");
+               HashMap<String,String> userParams = new HashMap<String,String>();
+               userParams.put("key1", "value1");               
                requestContext.setUserParams(userParams);
                requestContext.setProductFamilyId("productFamilyId");
 
@@ -108,7 +112,7 @@ public class VfModuleTopologyOperationRequestMapperTest {
                modelInfoVfModule.setModelCustomizationUUID("vfModuleModelCustomizationUuid");
                vfModule.setModelInfoVfModule(modelInfoVfModule);
                HashMap<String, String> cloudParams = new HashMap<String, String>();
-               userParams.put("key2", "value2");
+               cloudParams.put("key2", "value2");
                vfModule.setCloudParams(cloudParams);
 
                VolumeGroup volumeGroup = new VolumeGroup();
@@ -189,9 +193,14 @@ public class VfModuleTopologyOperationRequestMapperTest {
                customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
                //
                RequestContext requestContext = new RequestContext();
-               HashMap<String, String> userParams = new HashMap<String, String>();
-               userParams.put("key1", "value1");
-               requestContext.setUserParams(userParams);
+               RequestParameters requestParameters = new RequestParameters();
+               HashMap<String,Object> userParams1 = new HashMap<String,Object>();
+               userParams1.put("key1", "value1");
+               List<Map<String,Object>> userParams = new ArrayList<Map<String,Object>>();
+               userParams.add(userParams1);
+               
+               requestParameters.setUserParams(userParams);
+               requestContext.setRequestParameters(requestParameters);
                requestContext.setProductFamilyId("productFamilyId");
 
                GenericVnf vnf = new GenericVnf();
@@ -225,7 +234,7 @@ public class VfModuleTopologyOperationRequestMapperTest {
 
                assertNull(vfModuleSDNCrequest.getServiceInformation().getOnapModelInformation().getModelCustomizationUuid());
                assertEquals("vnfModelCustomizationUuid", vfModuleSDNCrequest.getVnfInformation().getOnapModelInformation().getModelCustomizationUuid());
-               assertEquals("vfModuleModelCustomizationUuid", vfModuleSDNCrequest.getVfModuleInformation().getOnapModelInformation().getModelCustomizationUuid());
+               assertEquals("vfModuleModelCustomizationUuid", vfModuleSDNCrequest.getVfModuleInformation().getOnapModelInformation().getModelCustomizationUuid());     
        }
        
        @Test
index 9b5acc5..76413c2 100644 (file)
@@ -34,6 +34,8 @@ import org.onap.so.client.graphinventory.entities.uri.SimpleUri;
 
 public class AAISimpleUri extends SimpleUri implements AAIResourceUri {
        
+       private static final long serialVersionUID = -6397024057188453229L;
+
        protected AAISimpleUri(AAIObjectType type, Object... values) {
                super(type, values);
                
index 091d0c9..3294712 100644 (file)
@@ -30,6 +30,7 @@ import org.onap.so.client.aai.AAIResourcesClient;
 
 public class AllottedResourceLookupUri extends HttpLookupUri {
 
+       private static final long serialVersionUID = -9212594383876793188L;
        protected AllottedResourceLookupUri(Object... values) {
                super(AAIObjectType.ALLOTTED_RESOURCE, values);
        }
index 3c9ca0e..6ffc6ec 100644 (file)
@@ -29,6 +29,8 @@ import org.onap.so.client.graphinventory.GraphInventoryObjectType;
 
 public class NodesUri extends AAISimpleUri {
 
+       private static final long serialVersionUID = 8818689895730182042L;
+
        protected NodesUri(AAIObjectType type, Object... values) {
                super(type, values);
        }
index 00a213b..324193d 100644 (file)
@@ -30,6 +30,7 @@ import org.onap.so.client.aai.AAIResourcesClient;
 
 public class ServiceInstanceUri extends HttpLookupUri {
 
+       private static final long serialVersionUID = 2248914170527514548L;
        protected ServiceInstanceUri(Object... values) {
                super(AAIObjectType.SERVICE_INSTANCE, values);
        }
index 026f1c3..874b06e 100644 (file)
 
 package org.onap.so.client.graphinventory.entities.uri;
 
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
 import java.io.UnsupportedEncodingException;
 import java.net.URI;
 import java.nio.charset.StandardCharsets;
@@ -29,18 +33,19 @@ import java.util.Map;
 import javax.ws.rs.core.UriBuilder;
 
 import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.onap.so.client.graphinventory.Format;
 import org.onap.so.client.aai.entities.uri.AAIUri;
-import org.onap.so.client.graphinventory.entities.uri.Depth;
-import org.onap.so.client.graphinventory.entities.uri.parsers.UriParser;
-import org.onap.so.client.graphinventory.entities.uri.parsers.UriParserSpringImpl;
+import org.onap.so.client.graphinventory.Format;
 import org.onap.so.client.graphinventory.GraphInventoryObjectPlurals;
 import org.onap.so.client.graphinventory.GraphInventoryObjectType;
+import org.onap.so.client.graphinventory.entities.uri.parsers.UriParser;
+import org.onap.so.client.graphinventory.entities.uri.parsers.UriParserSpringImpl;
 import org.springframework.web.util.UriUtils;
 
-public class SimpleUri implements GraphInventoryResourceUri {
+public class SimpleUri implements GraphInventoryResourceUri, Serializable {
 
-       protected UriBuilder internalURI;
+       private static final long serialVersionUID = -337701171277616439L;
+       
+       protected transient UriBuilder internalURI;
        protected final static String relationshipAPI = "/relationship-list/relationship";
        protected final static String relatedTo = "/related-to";
        protected final Object[] values;
@@ -89,6 +94,9 @@ public class SimpleUri implements GraphInventoryResourceUri {
                this.values = childValues;
        }
        
+       protected void setInternalURI(UriBuilder builder) {
+               this.internalURI = builder;
+       }
        @Override
        public SimpleUri relationshipAPI() {
                this.internalURI = internalURI.path(relationshipAPI);
@@ -236,4 +244,14 @@ public class SimpleUri implements GraphInventoryResourceUri {
                return type.uriTemplate();
        }
        
+       private void writeObject(ObjectOutputStream oos) throws IOException {
+               oos.defaultWriteObject();
+               oos.writeUTF(this.internalURI.toTemplate());
+       }
+       
+       private void readObject(ObjectInputStream ois) throws ClassNotFoundException, IOException {
+                ois.defaultReadObject();
+                String uri = ois.readUTF();
+                this.setInternalURI(UriBuilder.fromUri(uri));
+       }
 }
index be79c8b..b11003e 100644 (file)
@@ -47,6 +47,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
 public class SDNOValidatorImpl implements SDNOValidator {
 
        private final static String clientName = "MSO";
+       private final static String HEALTH_DIAGNOSTIC_CODE_DEFAULT = "default";
 
        @Override
        public boolean healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception {
@@ -99,6 +100,7 @@ public class SDNOValidatorImpl implements SDNOValidator {
                request.setRequestNodeIp(vnf.getIpv4OamAddress()); //generic-vnf oam ip
                request.setRequestUserId(requestingUserId); //mech id?
                request.setRequestId(uuid.toString()); //something to identify this request by for polling
+               request.setHealthDiagnosticCode(HEALTH_DIAGNOSTIC_CODE_DEFAULT);
                
                input.setRequestHealthDiagnostic(request);
                
index fcf054f..2a0e9df 100644 (file)
 package org.onap.so.client.aai.entities.uri;
 
 import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
 import static org.hamcrest.collection.IsEmptyCollection.empty;
+import static org.hamcrest.collection.IsIterableContainingInOrder.contains;
 import static org.junit.Assert.assertEquals;
 
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
 import java.util.Map;
 
 import org.junit.Test;
 import org.onap.so.client.aai.AAIObjectPlurals;
 import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.graphinventory.entities.uri.Depth;
+import org.onap.so.client.graphinventory.entities.uri.SimpleUri;
 
 public class AAISimpleUriTest {
 
@@ -83,4 +92,31 @@ public class AAISimpleUriTest {
                
                assertEquals("my value", keys.get("service-type"));
        }
+       
+       @Test
+       public void serializeTest() throws IOException, ClassNotFoundException {
+               AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, "test1");
+               
+               uri.depth(Depth.ONE);
+               uri.limit(1);
+               ByteArrayOutputStream bos = new ByteArrayOutputStream();
+
+           ObjectOutputStream objectOutputStream 
+             = new ObjectOutputStream(bos);
+           objectOutputStream.writeObject(uri);
+           objectOutputStream.flush();
+           objectOutputStream.close();
+           
+           ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray());
+          
+           ObjectInputStream objectInputStream 
+             = new ObjectInputStream(bis);
+           AAIResourceUri e2 = (AAIResourceUri) objectInputStream.readObject();
+           objectInputStream.close();
+           
+           uri.queryParam("test", "value");
+           e2.queryParam("test", "value");
+
+           assertEquals(e2.build().toString(), uri.build().toString());
+       }
 }
index 1bcee07..6383d0e 100644 (file)
@@ -41,6 +41,6 @@ public class DefaultsTest {
        @Test
        public void checkValue() {
                
-               assertEquals("CloudOwner", Defaults.CLOUD_OWNER.toString());
+               assertEquals("my-custom-owner", Defaults.CLOUD_OWNER.toString());
        }
 }
index cf386cb..1a3e97c 100644 (file)
@@ -1,4 +1,4 @@
 org:
   onap:
     so:
-      cloud-owner: CloudOwner
\ No newline at end of file
+      cloud-owner: my-custom-owner
\ No newline at end of file