aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2020-05-15 10:13:46 +0000
committerGerrit Code Review <gerrit@onap.org>2020-05-15 10:13:46 +0000
commit7a29a83a89c9e01c0219342f7272bbd023828eda (patch)
treebb42e01973ae9be0670d1a468d045f3978fbe535 /bpmn
parent5369c02f6f86ec64850c7a23183755b377c6f668 (diff)
parent7ae772d0115598564a5440f5400ab256252dcc2e (diff)
Merge "Default gateway value to NULL when not present"
Diffstat (limited to 'bpmn')
-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