aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common
diff options
context:
space:
mode:
authorEric Multanen <eric.w.multanen@intel.com>2019-04-30 01:20:09 -0700
committerEric Multanen <eric.w.multanen@intel.com>2019-05-01 09:01:30 -0700
commit6c009875e53796b0b79a7bd8010590651d2af028 (patch)
tree4500caf4139f6b8807c3667958e0abbe621b301f /bpmn/so-bpmn-infrastructure-common
parent54b6e6ac185b55d89248cd3c55b1d7766ecaf294 (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')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModuleTest.groovy17
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/resources/__files/DoCreateVfModule/createVnfARequest.xml22
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>{ &quot;attributes&quot;: [{&quot;attribute_name&quot;:&quot;vrr_image_name&quot;,&quot;attribute_value&quot;:&quot;MDT17&quot;},{&quot;attribute_name&quot;:&quot;availability_zone_0&quot;,&quot;attribute_value&quot;:&quot;nova&quot;},{&quot;attribute_name&quot;:&quot;vrr_flavor_name&quot;,&quot;attribute_value&quot;:&quot;ns.c16r32d128.v1&quot;}]}</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>{ &quot;attributes&quot;: [{&quot;attribute_name&quot;:&quot;vf_module_id&quot;,&quot;attribute_value&quot;:&quot;cb510af0-5b21-4bc7-86d9-323cb396ce32&quot;},{&quot;attribute_name&quot;:&quot;vrra_Internal-Network1_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_2_subnet_id&quot;,&quot;attribute_value&quot;:&quot;&quot;},{&quot;attribute_name&quot;:&quot;vrra_ADIGOam.OAM_v6_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;vnf_name&quot;,&quot;attribute_value&quot;:&quot;skask-test&quot;},{&quot;attribute_name&quot;:&quot;ADIGOam.OAM_v6_subnet_id&quot;,&quot;attribute_value&quot;:&quot;&quot;},{&quot;attribute_name&quot;:&quot;workload_context&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;vf_module_name&quot;,&quot;attribute_value&quot;:&quot;PCRF::module-0-2&quot;},{&quot;attribute_name&quot;:&quot;vnf_id&quot;,&quot;attribute_value&quot;:&quot;skask&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_2_v6_subnet_id&quot;,&quot;attribute_value&quot;:&quot;&quot;},{&quot;attribute_name&quot;:&quot;vrra_ADIG_SRIOV_1_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_1_v6_subnet_id&quot;,&quot;attribute_value&quot;:&quot;&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_1_subnet_id&quot;,&quot;attribute_value&quot;:&quot;&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_2_net_name&quot;,&quot;attribute_value&quot;:&quot;ADIG_SRIOV_2&quot;},{&quot;attribute_name&quot;:&quot;ADIGOam.OAM_subnet_id&quot;,&quot;attribute_value&quot;:&quot;&quot;},{&quot;attribute_name&quot;:&quot;ADIGOam.OAM_net_id&quot;,&quot;attribute_value&quot;:&quot;491c7cef-a3f4-4990-883e-b0af397466d0&quot;},{&quot;attribute_name&quot;:&quot;environment_context&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_1_net_fqdn&quot;,&quot;attribute_value&quot;:&quot;&quot;},{&quot;attribute_name&quot;:&quot;ADIGOam.OAM_net_name&quot;,&quot;attribute_value&quot;:&quot;ADIGOAM.OAM&quot;},{&quot;attribute_name&quot;:&quot;vrra_name_0&quot;,&quot;attribute_value&quot;:&quot;frkdevRvrra24&quot;},{&quot;attribute_name&quot;:&quot;vrra_ADIG_SRIOV_2_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_2_net_fqdn&quot;,&quot;attribute_value&quot;:&quot;&quot;},{&quot;attribute_name&quot;:&quot;vrra_Internal-Network2_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_1_net_name&quot;,&quot;attribute_value&quot;:&quot;ADIG_SRIOV_1&quot;},{&quot;attribute_name&quot;:&quot;vrra_ADIG_SRIOV_1_v6_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;vrra_ADIGOam.OAM_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;vrra_Internal-Network1_v6_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;ADIGOam.OAM_net_fqdn&quot;,&quot;attribute_value&quot;:&quot;&quot;},{&quot;attribute_name&quot;:&quot;vrra_names&quot;,&quot;attribute_value&quot;:&quot;frkdevRvrra24&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_1_net_id&quot;,&quot;attribute_value&quot;:&quot;491c7cef-a3f4-4990-883e-b0af397466d0&quot;},{&quot;attribute_name&quot;:&quot;vrra_Internal-Network2_v6_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;vrra_ADIG_SRIOV_2_v6_ips&quot;,&quot;attribute_value&quot;:&quot;null&quot;},{&quot;attribute_name&quot;:&quot;ADIG_SRIOV_2_net_id&quot;,&quot;attribute_value&quot;:&quot;491c7cef-a3f4-4990-883e-b0af397466d0&quot;},{&quot;attribute_name&quot;:&quot;vf_module_index&quot;,&quot;attribute_value&quot;:&quot;index&quot;},{&quot;attribute_name&quot;:&quot;availability_zone_0&quot;,&quot;attribute_value&quot;:&quot;frkde-esx-az01&quot;}]}</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>