Search in sources :

Example 1 with RouteTableReference

use of org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference in project so by onap.

the class BBInputSetupMapperLayerTest method testMapAAIRouteTableReferenceIntoRouteTableReference.

@Test
public void testMapAAIRouteTableReferenceIntoRouteTableReference() throws JsonParseException, JsonMappingException, IOException {
    org.onap.aai.domain.yang.RouteTableReference aaiRouteTableReference = mapper.readValue(new File(RESOURCE_PATH + "RouteTableReferenceInput.json"), org.onap.aai.domain.yang.RouteTableReference.class);
    RouteTableReference expectedRouteTableReference = mapper.readValue(new File(RESOURCE_PATH + "RouteTableReferenceExpected.json"), RouteTableReference.class);
    RouteTableReference actualRouteTableReference = bbInputSetupMapperLayer.mapAAIRouteTableReferenceIntoRouteTableReference(aaiRouteTableReference);
    assertThat(actualRouteTableReference, sameBeanAs(expectedRouteTableReference));
}
Also used : RouteTableReference(org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference) File(java.io.File) Test(org.junit.Test)

Example 2 with RouteTableReference

use of org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference 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"));
}
Also used : Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) ServiceSubscription(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription) ContrailNetwork(org.onap.so.adapters.nwrest.ContrailNetwork) MsoRequest(org.onap.so.entity.MsoRequest) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) HostRoute(org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute) UpdateNetworkRequest(org.onap.so.adapters.nwrest.UpdateNetworkRequest) ProviderVlanNetwork(org.onap.so.adapters.nwrest.ProviderVlanNetwork) NetworkPolicy(org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy) RouteTableReference(org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference) VpnBinding(org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding) RouteTarget(org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget) Subnet(org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet) Test(org.junit.Test)

Example 3 with RouteTableReference

use of org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference in project so by onap.

the class BBInputSetupTest method testMapRouteTableReferences.

@Test
public void testMapRouteTableReferences() throws JsonProcessingException {
    org.onap.aai.domain.yang.RouteTableReference expectedAAI = new org.onap.aai.domain.yang.RouteTableReference();
    RouteTableReference expected = new RouteTableReference();
    List<RouteTableReference> contrailNetworkRouteTableReferences = new ArrayList<>();
    AAIResultWrapper vnfWrapper = new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
    doReturn(expected).when(bbInputSetupMapperLayer).mapAAIRouteTableReferenceIntoRouteTableReference(isA(org.onap.aai.domain.yang.RouteTableReference.class));
    SPY_bbInputSetup.mapRouteTableReferences(Arrays.asList(new AAIResultWrapper[] { vnfWrapper }), contrailNetworkRouteTableReferences);
    assertEquals(expected, contrailNetworkRouteTableReferences.get(0));
}
Also used : ArrayList(java.util.ArrayList) RouteTableReference(org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference) AAICommonObjectMapperProvider(org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider) AAIResultWrapper(org.onap.aaiclient.client.aai.entities.AAIResultWrapper) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 RouteTableReference (org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference)3 ArrayList (java.util.ArrayList)2 File (java.io.File)1 HashMap (java.util.HashMap)1 AAICommonObjectMapperProvider (org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider)1 AAIResultWrapper (org.onap.aaiclient.client.aai.entities.AAIResultWrapper)1 ContrailNetwork (org.onap.so.adapters.nwrest.ContrailNetwork)1 ProviderVlanNetwork (org.onap.so.adapters.nwrest.ProviderVlanNetwork)1 UpdateNetworkRequest (org.onap.so.adapters.nwrest.UpdateNetworkRequest)1 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)1 HostRoute (org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute)1 NetworkPolicy (org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy)1 RouteTarget (org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget)1 ServiceSubscription (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription)1 Subnet (org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet)1 VpnBinding (org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding)1 ModelInfoNetwork (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork)1 MsoRequest (org.onap.so.entity.MsoRequest)1