aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/test')
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/l3-network-multiple-subnets.json53
2 files changed, 69 insertions, 3 deletions
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 ccd677c80e..d6485bd57f 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
@@ -21,8 +21,7 @@ package org.onap.so.client.adapter.network.mapper;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.junit.Assert.*;
-import static org.mockito.ArgumentMatchers.isA;
+import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doReturn;
import java.io.UnsupportedEncodingException;
import java.nio.file.Files;
@@ -39,7 +38,6 @@ import org.onap.so.adapters.nwrest.ContrailNetwork;
import org.onap.so.adapters.nwrest.CreateNetworkRequest;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.adapters.nwrest.DeleteNetworkRequest;
-import org.onap.so.adapters.nwrest.NetworkTechnology;
import org.onap.so.adapters.nwrest.ProviderVlanNetwork;
import org.onap.so.adapters.nwrest.RollbackNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
@@ -385,4 +383,19 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup {
assertThat(createNetworkRequest, sameBeanAs(expectedCreateNetworkRequest).ignoring("messageId")
.ignoring("msoRequest.requestId").ignoring("networkParams"));
}
+
+ @Test
+ public void buildOpenstackSubnetListMultipleHostRoutesTest() throws Exception {
+
+ ObjectMapper omapper = new ObjectMapper();
+ String l3NetworkJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "l3-network-multiple-subnets.json")));
+ L3Network l3Network = omapper.readValue(l3NetworkJson, L3Network.class);
+
+ List<org.onap.so.openstack.beans.Subnet> subnets =
+ SPY_networkAdapterObjectMapper.buildOpenstackSubnetList(l3Network);
+ assertEquals("192.168.0.0/16", subnets.get(0).getHostRoutes().get(0).getPrefix());
+ assertEquals("192.168.1.5/16", subnets.get(0).getHostRoutes().get(1).getPrefix());
+
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/l3-network-multiple-subnets.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/l3-network-multiple-subnets.json
new file mode 100644
index 0000000000..e9b25ff266
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/l3-network-multiple-subnets.json
@@ -0,0 +1,53 @@
+{
+ "network-id" : "aNetworkId",
+ "cascaded" : false,
+ "cloud-params" : { },
+ "network-name" : "aNetworkName",
+ "neutron-network-id" : null,
+ "network-type" : "aNetworkType",
+ "network-technology" : "aNetworkTechnology",
+ "network-role" : "",
+ "is-bound-to-vpn" : false,
+ "service-id" : "aServiceId",
+ "network-role-instance" : 0,
+ "orchestration-status" : "ACTIVE",
+ "heat-stack-id" : null,
+ "contrail-network-fqdn" : null,
+ "network-policies" : [ ],
+ "contrail-network-route-table-references" : [ ],
+ "widget-model-id" : null,
+ "widget-model-version" : null,
+ "physical-network-name" : "pNetworkName",
+ "is-provider-network" : false,
+ "is-shared-network" : false,
+ "is-external-network" : false,
+ "self-link" : "/",
+ "operational-status" : null,
+ "subnets" : [ {
+ "subnet-id" : "subnetId1",
+ "subnet-name" : "aSubnetName1",
+ "neutron-subnet-id" : null,
+ "gateway-address" : "192.168.1.1",
+ "network-start-address" : "192.168.1.2",
+ "cidr-mask" : "10",
+ "ip-version" : "4",
+ "orchestration-status" : "ACTIVE",
+ "dhcp-enabled" : true,
+ "dhcp-start" : "192.168.1.2",
+ "dhcp-end" : "192.168.1.16",
+ "subnet-role" : "",
+ "ip-assignment-direction" : "true",
+ "subnet-sequence" : null,
+ "host-routes": [{
+ "host-route-id": "hrId1",
+ "route-prefix": "192.168.0.0/16",
+ "next-hop": "192.168.1.1",
+ "next-hop-type": null
+ }, {
+ "host-route-id": "hrId2",
+ "route-prefix": "192.168.1.5/16",
+ "next-hop": "192.168.1.1",
+ "next-hop-type": null
+ }]
+ }]
+} \ No newline at end of file