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
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 3f81e43..e317822 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 @@
         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 ccd4376..7ff7848 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 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 @@
         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 e9b25ff..21df571 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