use of org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget in project so by onap.
the class AAIObjectMapper method mapRouteTargetToVpnBinding.
private void mapRouteTargetToVpnBinding(org.onap.aai.domain.yang.VpnBinding aaiVpnBinding, VpnBinding vpnBinding) {
if (vpnBinding.getRouteTargets() != null && !vpnBinding.getRouteTargets().isEmpty()) {
RouteTargets routeTargets = new RouteTargets();
for (RouteTarget routeTarget : vpnBinding.getRouteTargets()) {
routeTargets.getRouteTarget().add(mapRouteTarget(routeTarget));
}
aaiVpnBinding.setRouteTargets(routeTargets);
}
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget in project so by onap.
the class NetworkAdapterObjectMapperTest method updateNetworkRequestMapperTest.
@Test
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<>();
subnets.add(subnet);
ProviderVlanNetwork providerVlanNetwork = new ProviderVlanNetwork("physicalNetworkName", new ArrayList<Integer>());
List<String> policyFqdns = Arrays.asList("networkPolicyFqdn");
org.onap.so.openstack.beans.RouteTarget expectedRouteTarget = new org.onap.so.openstack.beans.RouteTarget();
expectedRouteTarget.setRouteTarget("globalRouteTarget");
ContrailNetwork contrailNetwork = new ContrailNetwork();
contrailNetwork.setPolicyFqdns(policyFqdns);
contrailNetwork.setRouteTableFqdns(new ArrayList<String>());
contrailNetwork.setRouteTargets(new ArrayList<org.onap.so.openstack.beans.RouteTarget>());
contrailNetwork.getRouteTargets().add(expectedRouteTarget);
contrailNetwork.getRouteTableFqdns().add("routeTableReferenceFqdn");
MsoRequest msoRequest = new MsoRequest();
msoRequest.setServiceInstanceId("testServiceInstanceId1");
ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
modelInfoNetwork.setNetworkType("networkType");
modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUuid");
modelInfoNetwork.setModelVersion("modelVersion");
Subnet actualSubnet = new Subnet();
actualSubnet.setSubnetId("subnetId");
actualSubnet.setDhcpEnabled(false);
actualSubnet.setIpVersion("4");
RouteTarget routeTarget = new RouteTarget();
routeTarget.setGlobalRouteTarget("globalRouteTarget");
VpnBinding vpnBinding = new VpnBinding();
vpnBinding.setVpnId("vpnId");
vpnBinding.getRouteTargets().add(routeTarget);
Customer customer = new Customer();
customer.getVpnBindings().add(vpnBinding);
ServiceSubscription serviceSubscription = new ServiceSubscription();
customer.setServiceSubscription(serviceSubscription);
// set Customer on service instance
customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
NetworkPolicy networkPolicy = new NetworkPolicy();
networkPolicy.setNetworkPolicyId("networkPolicyId");
networkPolicy.setNetworkPolicyFqdn("networkPolicyFqdn");
RouteTableReference routeTableReference = new RouteTableReference();
routeTableReference.setRouteTableReferenceFqdn("routeTableReferenceFqdn");
l3Network.setModelInfoNetwork(modelInfoNetwork);
l3Network.setPhysicalNetworkName("physicalNetworkName");
l3Network.getSubnets().add(actualSubnet);
l3Network.getNetworkPolicies().add(networkPolicy);
l3Network.getContrailNetworkRouteTableReferences().add(routeTableReference);
l3Network.setIsSharedNetwork(false);
l3Network.setIsExternalNetwork(false);
HashMap<String, String> networkParams = new HashMap<String, String>();
networkParams.put("shared", "false");
networkParams.put("external", "false");
networkParams.put("testUserInputKey", "testUserInputValue");
UpdateNetworkRequest expectedUpdateNetworkRequest = new UpdateNetworkRequest();
expectedUpdateNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
expectedUpdateNetworkRequest.setTenantId(cloudRegion.getTenantId());
expectedUpdateNetworkRequest.setNetworkId(l3Network.getNetworkId());
expectedUpdateNetworkRequest.setNetworkStackId(l3Network.getHeatStackId());
expectedUpdateNetworkRequest.setNetworkName(l3Network.getNetworkName());
expectedUpdateNetworkRequest.setNetworkType(l3Network.getModelInfoNetwork().getNetworkType());
expectedUpdateNetworkRequest.setNetworkTypeVersion(l3Network.getModelInfoNetwork().getModelVersion());
expectedUpdateNetworkRequest.setModelCustomizationUuid(l3Network.getModelInfoNetwork().getModelCustomizationUUID());
expectedUpdateNetworkRequest.setSubnets(subnets);
expectedUpdateNetworkRequest.setProviderVlanNetwork(providerVlanNetwork);
expectedUpdateNetworkRequest.setContrailNetwork(contrailNetwork);
expectedUpdateNetworkRequest.setNetworkParams(networkParams);
expectedUpdateNetworkRequest.setMsoRequest(msoRequest);
expectedUpdateNetworkRequest.setSkipAAI(true);
expectedUpdateNetworkRequest.setBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled()));
expectedUpdateNetworkRequest.setMessageId("messageId");
expectedUpdateNetworkRequest.setNotificationUrl("http://localhost:28080/mso/WorkflowMesssage/NetworkAResponse/messageId");
doReturn("messageId").when(SPY_networkAdapterObjectMapper).getRandomUuid();
doReturn("http://localhost:28080/mso/WorkflowMesssage").when(SPY_networkAdapterObjectMapper).getEndpoint();
UpdateNetworkRequest actualUpdateNetworkRequest = SPY_networkAdapterObjectMapper.createNetworkUpdateRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, customer);
assertThat(actualUpdateNetworkRequest, sameBeanAs(expectedUpdateNetworkRequest).ignoring("msoRequest.requestId"));
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget in project so by onap.
the class AAIObjectMapperTest method mapRouteTargetTest.
@Test
public void mapRouteTargetTest() {
RouteTarget routeTarget = new RouteTarget();
routeTarget.setRouteTargetRole("testRtRole");
routeTarget.setGlobalRouteTarget("testGrt");
org.onap.aai.domain.yang.RouteTarget expectedRouteTarget = new org.onap.aai.domain.yang.RouteTarget();
expectedRouteTarget.setRouteTargetRole("testRtRole");
expectedRouteTarget.setGlobalRouteTarget("testGrt");
org.onap.aai.domain.yang.RouteTarget actualRouteTarget = aaiObjectMapper.mapRouteTarget(routeTarget);
assertThat(actualRouteTarget, sameBeanAs(expectedRouteTarget));
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget in project so by onap.
the class AAIObjectMapperTest method mapVpnBindingTest.
@Test
public void mapVpnBindingTest() {
VpnBinding vpnBinding = new VpnBinding();
vpnBinding.setVpnId("testVpnId");
vpnBinding.setVpnName("testVpn");
vpnBinding.setVpnPlatform("AVPN");
vpnBinding.setCustomerVpnId("testCustomerVpnId");
vpnBinding.setVpnType("testVpnType");
vpnBinding.setVpnRegion("testVpnRegion");
vpnBinding.setRouteDistinguisher("testRD");
RouteTarget routeTarget = new RouteTarget();
routeTarget.setRouteTargetRole("testRtRole");
routeTarget.setGlobalRouteTarget("testGrt");
vpnBinding.getRouteTargets().add(routeTarget);
org.onap.aai.domain.yang.VpnBinding expectedVpnBinding = new org.onap.aai.domain.yang.VpnBinding();
expectedVpnBinding.setVpnId("testVpnId");
expectedVpnBinding.setVpnName("testVpn");
expectedVpnBinding.setVpnPlatform("AVPN");
expectedVpnBinding.setCustomerVpnId("testCustomerVpnId");
expectedVpnBinding.setVpnType("testVpnType");
expectedVpnBinding.setVpnRegion("testVpnRegion");
expectedVpnBinding.setRouteDistinguisher("testRD");
org.onap.aai.domain.yang.RouteTarget expectedRouteTarget = new org.onap.aai.domain.yang.RouteTarget();
expectedRouteTarget.setRouteTargetRole("testRtRole");
expectedRouteTarget.setGlobalRouteTarget("testGrt");
RouteTargets expectedRouteTargets = new RouteTargets();
expectedRouteTargets.getRouteTarget().add(expectedRouteTarget);
expectedVpnBinding.setRouteTargets(expectedRouteTargets);
org.onap.aai.domain.yang.VpnBinding actualVpnBinding = aaiObjectMapper.mapVpnBinding(vpnBinding);
assertThat(actualVpnBinding, sameBeanAs(expectedVpnBinding));
}
Aggregations