mapped host routes into gbb l3 network object 98/87798/1
authorKalkere Ramesh, Sharan <sharan.kalkere.ramesh@att.com>
Wed, 15 May 2019 18:34:33 +0000 (14:34 -0400)
committerBenjamin, Max (mb388a) <mb388a@us.att.com>
Wed, 15 May 2019 18:34:43 +0000 (14:34 -0400)
mapped host routes into gbb l3 network object

Change-Id: Ie3ab4693f7584946b1e2020d43143412bec62631
Issue-ID: SO-1885
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json [new file with mode: 0644]

index 177c918..86f7eeb 100644 (file)
@@ -40,6 +40,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Entitlement;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.Evc;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.ForwarderEvc;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.LagInterface;
 import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
@@ -131,7 +132,21 @@ public class BBInputSetupMapperLayer {
     }
 
     protected Subnet mapAAISubnet(org.onap.aai.domain.yang.Subnet aaiSubnet) {
-        return modelMapper.map(aaiSubnet, Subnet.class);
+        Subnet subnet = modelMapper.map(aaiSubnet, Subnet.class);
+        mapAllHostRoutesIntoSubnet(aaiSubnet, subnet);
+        return subnet;
+    }
+
+    protected void mapAllHostRoutesIntoSubnet(org.onap.aai.domain.yang.Subnet aaiSubnet, Subnet subnet) {
+        if (aaiSubnet.getHostRoutes() != null) {
+            for (org.onap.aai.domain.yang.HostRoute aaiHostRoute : aaiSubnet.getHostRoutes().getHostRoute()) {
+                subnet.getHostRoutes().add(mapAAIHostRoute(aaiHostRoute));
+            }
+        }
+    }
+
+    protected HostRoute mapAAIHostRoute(org.onap.aai.domain.yang.HostRoute aaiHostRoute) {
+        return modelMapper.map(aaiHostRoute, HostRoute.class);
     }
 
     protected License mapAAILicense(org.onap.aai.domain.yang.License aaiLicense) {
index e7afa9e..37f8b8b 100644 (file)
@@ -398,10 +398,12 @@ public class BBInputSetupMapperLayerTest {
 
     @Test
     public void testMapAAIL3NetworkIntoL3Network() throws IOException {
-        L3Network expected = mapper.readValue(new File(RESOURCE_PATH + "l3NetworkExpected.json"), L3Network.class);
+        L3Network expected =
+                mapper.readValue(new File(RESOURCE_PATH + "l3NetworkExpectedWithSubnet.json"), L3Network.class);
 
-        org.onap.aai.domain.yang.L3Network aaiL3Network = mapper.readValue(
-                new File(RESOURCE_PATH + "aaiL3NetworkInput.json"), org.onap.aai.domain.yang.L3Network.class);
+        org.onap.aai.domain.yang.L3Network aaiL3Network =
+                mapper.readValue(new File(RESOURCE_PATH + "aaiL3NetworkInputWithSubnets.json"),
+                        org.onap.aai.domain.yang.L3Network.class);
 
         L3Network actual = bbInputSetupMapperLayer.mapAAIL3Network(aaiL3Network);
 
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json
new file mode 100644 (file)
index 0000000..418396f
--- /dev/null
@@ -0,0 +1,73 @@
+{
+       "networkId": "networkId",
+       "networkName": "networkName",
+       "networkType": null,
+       "networkRole": null,
+       "networkTechnology": null,
+       "neutronNetworkId": null,
+       "isBoundToVpn": true,
+       "serviceId": "serviceId",
+       "networkRoleInstance": 1234,
+       "resourceVersion": null,
+       "orchestrationStatus": "Assigned",
+       "heatStackId": "heatStackId",
+       "msoCatalogKey": null,
+       "contrailNetworkFqdn": "contrailNetworkFqdn",
+       "modelInvariantId": null,
+       "modelVersionId": null,
+       "personaModelVersion": null,
+       "modelCustomizationId": null,
+       "widgetModelId": "widgetModelId",
+       "widgetModelVersion": "widgetModelVersion",
+       "physicalNetworkName": "physicalNetworkName",
+       "isProviderNetwork": true,
+       "isSharedNetwork": true,
+       "isExternalNetwork": true,
+       "selflink": "selflink",
+       "operationalStatus": "operationalStatus",
+       "subnets": {
+               "subnet": [
+                       {
+                               "subnetId": "subnetId",
+                               "subnetName": "subnetName",
+                               "neutronSubnetId": "neutronSubnetId",
+                               "gatewayAddress": "10.80.12.1",
+                               "networkStartAddress": "10.80.12.0",
+                               "cidrMask": "23",
+                               "ipVersion": "4",
+                               "orchestrationStatus": "Active",
+                               "dhcpEnabled": true,
+                               "dhcpStart": "10.80.12.3",
+                               "dhcpEnd": "10.80.13.254",
+                               "subnetRole": "s1",
+                               "ipAssignmentDirection": "true",
+                               "resourceVersion": "1557499815393",
+                               "hostRoutes": {
+                                       "hostRoute": [
+                                               {
+                                                       "hostRouteId": "91324351-01bf-43f8-a302-8c873451b4f1",
+                                                       "routePrefix": "10.0.0.0/16",
+                                                       "nextHop": "10.80.12.1",
+                                                       "resourceVersion": "1557499777501"
+                                               }
+                                       ]
+                               }
+                       }
+               ]
+       },
+       "ctagAssignments": {
+               "ctagAssignment": [
+                       {
+                               "vlanIdInner": 1234
+                       }
+               ]
+       },
+       "segmentationAssignments": {
+               "segmentationAssignment": [
+                       {
+                               "segmentationId": "segmentationId"
+                       }
+               ]
+       },
+       "relationshipList": null
+}
\ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json
new file mode 100644 (file)
index 0000000..ccefe19
--- /dev/null
@@ -0,0 +1,56 @@
+{
+       "network-id": "networkId",
+       "cascaded": null,
+       "cloud-params": {
+               
+       },
+       "network-name": "networkName",
+       "is-bound-to-vpn": true,
+       "service-id": "serviceId",
+       "network-role-instance": 1234,
+       "orchestration-status": "ASSIGNED",
+       "heat-stack-id": "heatStackId",
+       "contrail-network-fqdn": "contrailNetworkFqdn",
+       "widget-model-id": "widgetModelId",
+       "widget-model-version": "widgetModelVersion",
+       "physical-network-name": "physicalNetworkName",
+       "is-provider-network": true,
+       "is-shared-network": true,
+       "is-external-network": true,
+       "self-link": "selflink",
+       "operational-status": "operationalStatus",
+       "subnets": [
+               {
+                       "subnet-id": "subnetId",
+                       "subnet-name": "subnetName",
+                       "neutron-subnet-id": "neutronSubnetId",
+                       "gateway-address": "10.80.12.1",
+                       "network-start-address": "10.80.12.0",
+                       "cidr-mask": "23",
+                       "ip-version": "4",
+                       "dhcp-enabled": true,
+                       "dhcp-start": "10.80.12.3",
+                       "dhcp-end": "10.80.13.254",
+                       "subnet-role": "s1",
+                       "ip-assignment-direction": "true",
+                       "host-routes": [
+                               {
+                                       "host-route-id": "91324351-01bf-43f8-a302-8c873451b4f1",
+                                       "route-prefix": "10.0.0.0/16",
+                                       "next-hop": "10.80.12.1"
+                               }
+                       ]
+               }
+       ],
+       "ctag-assignments": [
+               {
+                       "vlan-id-inner": 1234
+               }
+       ],
+       "segmentation-assignments": [
+               {
+                       "segmentation-id": "segmentationId"
+               }
+       ],
+       "model-info-network": null
+}