diff options
author | Eric Multanen <eric.w.multanen@intel.com> | 2019-04-30 01:20:09 -0700 |
---|---|---|
committer | Eric Multanen <eric.w.multanen@intel.com> | 2019-05-01 09:01:30 -0700 |
commit | 6c009875e53796b0b79a7bd8010590651d2af028 (patch) | |
tree | 4500caf4139f6b8807c3667958e0abbe621b301f /bpmn/so-bpmn-infrastructure-common | |
parent | 54b6e6ac185b55d89248cd3c55b1d7766ecaf294 (diff) |
build sndc and user directives in groovy
Fill out the sdnc_directives and user_directives
used by the multicloud vnf plugin adapter when
invoked via the groovy path.
Change-Id: Ia11680be682b38756f188c71e3e000bc21c15aa9
Issue-ID: SO-1822
Signed-off-by: Eric Multanen <eric.w.multanen@intel.com>
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common')
3 files changed, 32 insertions, 11 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy index 6b4fc840f7..ea9987e2ec 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy @@ -270,11 +270,11 @@ public class DoCreateVfModule extends VfModuleBase { Map<String,String> vfModuleInputParams = execution.getVariable("vfModuleInputParams") if (oofDirectives != null && vfModuleInputParams != null) { vfModuleInputParams.put("oof_directives", oofDirectives) - vfModuleInputParams.put("sdnc_directives", "{}") + //vfModuleInputParams.put("sdnc_directives", "{}") logger.debug("OofDirectives are: " + oofDirectives) } else if (vfModuleInputParams != null) { vfModuleInputParams.put("oof_directives", "{}") - vfModuleInputParams.put("sdnc_directives", "{}") + //vfModuleInputParams.put("sdnc_directives", "{}") } if (vfModuleInputParams != null) { execution.setVariable("DCVFM_vnfParamsMap", vfModuleInputParams) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy index faa6a0e395..5a6ad4291e 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy @@ -7,9 +7,9 @@ * 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. @@ -47,6 +47,9 @@ import static org.mockito.Mockito.* class DoCreateVfModuleTest { def prefix = "DCVFM_" + @Rule + public WireMockRule wireMockRule = new WireMockRule(8090); + @Captor static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) @@ -54,7 +57,7 @@ class DoCreateVfModuleTest { void init() throws IOException { MockitoAnnotations.initMocks(this); } - + @Test void testQueryAAIVfModule() { ExecutionEntity mockExecution = setupMock() @@ -90,7 +93,7 @@ class DoCreateVfModuleTest { Mockito.verify(mockExecution).setVariable("DCVFM_queryAAIVfModuleForStatusResponseCode", 200) } - + @Test void testPreProcessVNFAdapterRequest() { @@ -122,7 +125,7 @@ class DoCreateVfModuleTest { map.put("vrr_image_name", "MDT17"); map.put("availability_zone_0", "nova"); map.put("vrr_flavor_name", "ns.c16r32d128.v1"); - when(mockExecution.getVariable("vnfParamsMap")).thenReturn(map) + when(mockExecution.getVariable(prefix + "vnfParamsMap")).thenReturn(map) when(mockExecution.getVariable("mso-request-id")).thenReturn("testRequestId-1503410089303") when(mockExecution.getVariable("mso.use.qualified.host")).thenReturn("true") when(mockExecution.getVariable("mso.workflow.message.endpoint")).thenReturn("http://localhost:28080/mso/WorkflowMesssage") @@ -155,7 +158,7 @@ class DoCreateVfModuleTest { Mockito.verify(mockExecution).setVariable(prefix + "queryCloudRegionReturnCode", "200") } - + @Test void testCreateNetworkPoliciesInAAI() { @@ -181,7 +184,7 @@ class DoCreateVfModuleTest { Mockito.verify(mockExecution).setVariable(prefix + "aaiQqueryNetworkPolicyByFqdnReturnCode", 200) } - + private static ExecutionEntity setupMock() { ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml index f78d38f802..782936c382 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml +++ b/bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml @@ -1,5 +1,6 @@ <createVfModuleRequest> <cloudSiteId>RDM2WAGPLCP</cloudSiteId> + <cloudOwner>null</cloudOwner> <tenantId>fba1bd1e195a404cacb9ce17a9b2b421</tenantId> <vnfId>skask</vnfId> <vnfName>skask-test</vnfName> @@ -47,6 +48,10 @@ <value>null</value> </entry> <entry> + <key>user_directives</key> + <value>{ "attributes": [{"attribute_name":"vrr_image_name","attribute_value":"MDT17"},{"attribute_name":"availability_zone_0","attribute_value":"nova"},{"attribute_name":"vrr_flavor_name","attribute_value":"ns.c16r32d128.v1"}]}</value> + </entry> + <entry> <key>vf_module_name</key> <value>PCRF::module-0-2</value> </entry> @@ -71,6 +76,10 @@ <value></value> </entry> <entry> + <key>vrr_flavor_name</key> + <value>ns.c16r32d128.v1</value> + </entry> + <entry> <key>ADIG_SRIOV_2_net_name</key> <value>ADIG_SRIOV_2</value> </entry> @@ -103,6 +112,10 @@ <value>null</value> </entry> <entry> + <key>sdnc_directives</key> + <value>{ "attributes": [{"attribute_name":"vf_module_id","attribute_value":"cb510af0-5b21-4bc7-86d9-323cb396ce32"},{"attribute_name":"vrra_Internal-Network1_ips","attribute_value":"null"},{"attribute_name":"ADIG_SRIOV_2_subnet_id","attribute_value":""},{"attribute_name":"vrra_ADIGOam.OAM_v6_ips","attribute_value":"null"},{"attribute_name":"vnf_name","attribute_value":"skask-test"},{"attribute_name":"ADIGOam.OAM_v6_subnet_id","attribute_value":""},{"attribute_name":"workload_context","attribute_value":"null"},{"attribute_name":"vf_module_name","attribute_value":"PCRF::module-0-2"},{"attribute_name":"vnf_id","attribute_value":"skask"},{"attribute_name":"ADIG_SRIOV_2_v6_subnet_id","attribute_value":""},{"attribute_name":"vrra_ADIG_SRIOV_1_ips","attribute_value":"null"},{"attribute_name":"ADIG_SRIOV_1_v6_subnet_id","attribute_value":""},{"attribute_name":"ADIG_SRIOV_1_subnet_id","attribute_value":""},{"attribute_name":"ADIG_SRIOV_2_net_name","attribute_value":"ADIG_SRIOV_2"},{"attribute_name":"ADIGOam.OAM_subnet_id","attribute_value":""},{"attribute_name":"ADIGOam.OAM_net_id","attribute_value":"491c7cef-a3f4-4990-883e-b0af397466d0"},{"attribute_name":"environment_context","attribute_value":"null"},{"attribute_name":"ADIG_SRIOV_1_net_fqdn","attribute_value":""},{"attribute_name":"ADIGOam.OAM_net_name","attribute_value":"ADIGOAM.OAM"},{"attribute_name":"vrra_name_0","attribute_value":"frkdevRvrra24"},{"attribute_name":"vrra_ADIG_SRIOV_2_ips","attribute_value":"null"},{"attribute_name":"ADIG_SRIOV_2_net_fqdn","attribute_value":""},{"attribute_name":"vrra_Internal-Network2_ips","attribute_value":"null"},{"attribute_name":"ADIG_SRIOV_1_net_name","attribute_value":"ADIG_SRIOV_1"},{"attribute_name":"vrra_ADIG_SRIOV_1_v6_ips","attribute_value":"null"},{"attribute_name":"vrra_ADIGOam.OAM_ips","attribute_value":"null"},{"attribute_name":"vrra_Internal-Network1_v6_ips","attribute_value":"null"},{"attribute_name":"ADIGOam.OAM_net_fqdn","attribute_value":""},{"attribute_name":"vrra_names","attribute_value":"frkdevRvrra24"},{"attribute_name":"ADIG_SRIOV_1_net_id","attribute_value":"491c7cef-a3f4-4990-883e-b0af397466d0"},{"attribute_name":"vrra_Internal-Network2_v6_ips","attribute_value":"null"},{"attribute_name":"vrra_ADIG_SRIOV_2_v6_ips","attribute_value":"null"},{"attribute_name":"ADIG_SRIOV_2_net_id","attribute_value":"491c7cef-a3f4-4990-883e-b0af397466d0"},{"attribute_name":"vf_module_index","attribute_value":"index"},{"attribute_name":"availability_zone_0","attribute_value":"frkde-esx-az01"}]}</value> + </entry> + <entry> <key>ADIG_SRIOV_2_net_fqdn</key> <value></value> </entry> @@ -127,6 +140,10 @@ <value>null</value> </entry> <entry> + <key>vrr_image_name</key> + <value>MDT17</value> + </entry> + <entry> <key>ADIGOam.OAM_net_fqdn</key> <value></value> </entry> @@ -156,9 +173,10 @@ </entry> <entry> <key>availability_zone_0</key> - <value>frkde-esx-az01</value> + <value>nova</value> </entry> + </vfModuleParams> <msoRequest> <requestId>testRequestId</requestId> @@ -166,4 +184,4 @@ </msoRequest> <messageId>testRequestId-1503410089303-1513204371234</messageId> <notificationUrl>http://localhost:28080/mso/WorkflowMesssage/VNFAResponse/testRequestId-1503410089303-1513204371234</notificationUrl> -</createVfModuleRequest>
\ No newline at end of file +</createVfModuleRequest> |