diff options
Diffstat (limited to 'bpmn/MSOCommonBPMN/src')
4 files changed, 150 insertions, 4 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java index 177c918305..86f7eeb2cd 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java @@ -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) { diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java index e7afa9ec8b..37f8b8b2fd 100644 --- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java +++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java @@ -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 index 0000000000..418396f290 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiL3NetworkInputWithSubnets.json @@ -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 index 0000000000..ccefe195c9 --- /dev/null +++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/l3NetworkExpectedWithSubnet.json @@ -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 +} |