aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSmokowski, Steven <steve.smokowski@att.com>2020-05-14 09:54:38 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-05-14 09:54:39 -0400
commit7ae772d0115598564a5440f5400ab256252dcc2e (patch)
treec510a96f5b5e6473e2bffec43aa709e469b078b9
parentd05adceceb65ae4af74ab953609ab5d9bdab6bae (diff)
Default gateway value to NULL when not present
Default gateway value to NULL when not present Issue-ID: SO-2934 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: I7a9839817887575ec425e2ae6f1782b94f0bb907
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/l3-network-multiple-subnets.json25
3 files changed, 31 insertions, 0 deletions
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 3f81e432e1..e317822a13 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
@@ -287,6 +287,9 @@ public class NetworkAdapterObjectMapper {
for (org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet subnet : subnets) {
org.onap.so.openstack.beans.Subnet openstackSubnet =
modelMapper.map(subnet, org.onap.so.openstack.beans.Subnet.class);
+ if (StringUtils.isEmpty(openstackSubnet.getGatewayIp())) {
+ openstackSubnet.setGatewayIp("NULL");
+ }
// update cidr value
if (subnet.getNetworkStartAddress() != null && subnet.getCidrMask() != null)
openstackSubnet
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 ccd4376a10..7ff784815b 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
@@ -176,6 +176,7 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup {
public void updateNetworkRequestMapperTest() throws UnsupportedEncodingException {
org.onap.so.openstack.beans.Subnet subnet = new org.onap.so.openstack.beans.Subnet();
subnet.setSubnetId("subnetId");
+ subnet.setGatewayIp("NULL");
subnet.setHostRoutes(new ArrayList<org.onap.so.openstack.beans.HostRoute>());
List<org.onap.so.openstack.beans.Subnet> subnets = new ArrayList<>();
@@ -397,5 +398,7 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup {
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());
+
+ assertEquals("NULL", subnets.get(1).getGatewayIp());
}
}
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
index e9b25ff266..21df57108b 100644
--- 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
@@ -49,5 +49,30 @@
"next-hop": "192.168.1.1",
"next-hop-type": null
}]
+ }, {
+ "subnet-id" : "subnetId2",
+ "subnet-name" : "aSubnetName2",
+ "neutron-subnet-id" : null,
+ "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