summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorBenjamin, Max (mb388a) <mb388a@us.att.com>2018-11-10 11:46:40 -0500
committerBenjamin, Max (mb388a) <mb388a@us.att.com>2018-11-10 11:52:22 -0500
commita21c5617e3b278a1bd179708b0345381632cef2b (patch)
treee326e4e56aa3a0cab994e3cab64594d22df1ffd6 /bpmn
parent47ef22e3f9c0261835f1b07a4768e87a3d0fe71b (diff)
Bug fixes November 10th
use network name on delete when heat id not present compare mod count index as Integers Change-Id: I76e567378fed83fb857d4d16b88f7a199d0df475 Issue-ID: SO-1204 Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy10
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/vfModuleCount.xml44
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java36
5 files changed, 98 insertions, 3 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
index f9ddd0d430..9a3e1b7349 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/MsoUtils.groovy
@@ -939,7 +939,8 @@ class MsoUtils {
if (moduleIndexList == null || moduleIndexList.size() == 0) {
return "0"
}
- def sortedModuleIndexList = moduleIndexList.sort { a, b -> a.compareTo b }
+
+ def sortedModuleIndexList = moduleIndexList.sort{ a, b -> a as Integer <=> b as Integer}
for (i in 0..sortedModuleIndexList.size()-1) {
if (Integer.parseInt(sortedModuleIndexList[i]) != i) {
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy
index dfcf69a931..968a694e11 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/MsoUtilsTest.groovy
@@ -287,5 +287,13 @@ class MsoUtilsTest {
}
}
-
+ @Test
+ public void testGetLowestUnusedIndex() {
+ def responseAsString = getFile("vfModuleCount.xml")
+ def index = utils.getLowestUnusedIndex(responseAsString)
+ println " lowest module count test: "
+ println " actual - " + index
+ println " expected - " + "14"
+ assertEquals("expected vs actual", "14", index)
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/vfModuleCount.xml b/bpmn/MSOCommonBPMN/src/test/resources/vfModuleCount.xml
new file mode 100644
index 0000000000..b7dee68a77
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/vfModuleCount.xml
@@ -0,0 +1,44 @@
+<vfModules>
+ <vf-module>
+ <module-index>0</module-index>
+ </vf-module>
+ <vf-module>
+ <module-index>1</module-index>
+ </vf-module>
+ <vf-module>
+ <module-index>2</module-index>
+ </vf-module>
+ <vf-module>
+ <module-index>3</module-index>
+ </vf-module>
+ <vf-module>
+ <module-index>4</module-index>
+ </vf-module>
+ <vf-module>
+ <module-index>5</module-index>
+ </vf-module>
+ <vf-module>
+ <module-index>6</module-index>
+ </vf-module>
+ <vf-module>
+ <module-index>7</module-index>
+ </vf-module>
+ <vf-module>
+ <module-index>8</module-index>
+ </vf-module>
+ <vf-module>
+ <module-index>9</module-index>
+ </vf-module>
+ <vf-module>
+ <module-index>10</module-index>
+ </vf-module>
+ <vf-module>
+ <module-index>11</module-index>
+ </vf-module>
+ <vf-module>
+ <module-index>12</module-index>
+ </vf-module>
+ <vf-module>
+ <module-index>13</module-index>
+ </vf-module>
+</vfModules> \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
index 57c760b01f..79a75c532a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
@@ -27,6 +27,7 @@ import java.util.Map;
import java.util.Optional;
import java.util.UUID;
+import org.apache.commons.lang3.StringUtils;
import org.modelmapper.ModelMapper;
import org.modelmapper.PropertyMap;
import org.onap.so.adapters.nwrest.ContrailNetwork;
@@ -129,7 +130,12 @@ public class NetworkAdapterObjectMapper {
deleteNetworkRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
deleteNetworkRequest.setNetworkId(l3Network.getNetworkId());
- deleteNetworkRequest.setNetworkStackId(l3Network.getHeatStackId());
+ if (!StringUtils.isEmpty(l3Network.getHeatStackId())){
+ deleteNetworkRequest.setNetworkStackId(l3Network.getHeatStackId());
+ }
+ else {
+ deleteNetworkRequest.setNetworkStackId(l3Network.getNetworkName());
+ }
deleteNetworkRequest.setNetworkType(l3Network.getNetworkType());
deleteNetworkRequest.setSkipAAI(true);
deleteNetworkRequest.setTenantId(cloudRegion.getTenantId());
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
index 8f0d00ff86..1283d3ab1a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
@@ -301,6 +301,42 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{
}
@Test
+ public void deleteNetworkRequestNoHeatIdMapperTest() throws Exception {
+ DeleteNetworkRequest expectedDeleteNetworkRequest = new DeleteNetworkRequest();
+
+ String messageId = "messageId";
+ expectedDeleteNetworkRequest.setMessageId(messageId);
+ doReturn(messageId).when(SPY_networkAdapterObjectMapper).getRandomUuid();
+
+ ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
+ l3Network.setModelInfoNetwork(modelInfoNetwork);
+ modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUuid");
+ expectedDeleteNetworkRequest.setModelCustomizationUuid(modelInfoNetwork.getModelCustomizationUUID());
+
+ MsoRequest msoRequest = new MsoRequest();
+ msoRequest.setRequestId(requestContext.getMsoRequestId());
+ msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
+ expectedDeleteNetworkRequest.setMsoRequest(msoRequest);
+
+ expectedDeleteNetworkRequest.setNetworkId(l3Network.getNetworkId());
+
+ l3Network.setNetworkName("heatStackId");
+ expectedDeleteNetworkRequest.setNetworkStackId("heatStackId");
+
+ expectedDeleteNetworkRequest.setNetworkType(l3Network.getNetworkType());
+
+ expectedDeleteNetworkRequest.setSkipAAI(true);
+
+ expectedDeleteNetworkRequest.setTenantId(cloudRegion.getTenantId());
+
+ expectedDeleteNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
+
+ DeleteNetworkRequest deleteNetworkRequest = SPY_networkAdapterObjectMapper.deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network);
+
+ assertThat(expectedDeleteNetworkRequest, sameBeanAs(deleteNetworkRequest));
+ }
+
+ @Test
public void buildOpenstackSubnetListTest() throws Exception {
ObjectMapper omapper = new ObjectMapper();