Search in sources :

Example 11 with ModelInfoNetwork

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork in project so by onap.

the class TestDataSetup method buildL3Network.

public L3Network buildL3Network() {
    l3NetworkCounter++;
    L3Network network = new L3Network();
    network.setNetworkId("testNetworkId" + l3NetworkCounter);
    network.setNetworkName("testNetworkName" + l3NetworkCounter);
    network.setNetworkType("testNetworkType" + l3NetworkCounter);
    ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
    modelInfoNetwork.setModelInvariantUUID("testModelInvariantUUID" + l3NetworkCounter);
    modelInfoNetwork.setModelName("testModelName" + l3NetworkCounter);
    modelInfoNetwork.setModelVersion("testModelVersion" + l3NetworkCounter);
    modelInfoNetwork.setModelUUID("testModelUUID" + l3NetworkCounter);
    network.setModelInfoNetwork(modelInfoNetwork);
    Platform platform = new Platform();
    platform.setPlatformName(" testPlatformName, testPlatformName2   ,   testPlatformName3   , testPlatformName4");
    network.setPlatform(platform);
    return network;
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) Platform(org.onap.so.bpmn.servicedecomposition.bbobjects.Platform) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork)

Example 12 with ModelInfoNetwork

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork in project so by onap.

the class AAIObjectMapperTest method networkMap.

@Test
public void networkMap() throws Exception {
    L3Network l3Network = new L3Network();
    l3Network.setNetworkId("networkId");
    l3Network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
    l3Network.setNetworkName("networkName");
    l3Network.setNetworkRole("networkRole");
    l3Network.setNetworkTechnology("networkTechnology");
    l3Network.setNeutronNetworkId("neutronNetworkId");
    l3Network.setNetworkRoleInstance(0L);
    l3Network.setContrailNetworkFqdn("contrailNetworkFqdn");
    l3Network.setIsBoundToVpn(false);
    l3Network.setIsCascaded(false);
    l3Network.setIsSharedNetwork(false);
    l3Network.setHeatStackId("heatStackId");
    l3Network.setOperationalStatus("operationalStatus");
    l3Network.setPhysicalNetworkName("physicalNetworkName");
    l3Network.setIsProviderNetwork(false);
    l3Network.setSelflink("selflink");
    l3Network.setServiceId("serviceId");
    ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
    modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUUID");
    modelInfoNetwork.setModelInvariantUUID("modelInvariantUUID");
    modelInfoNetwork.setModelUUID("modelUUID");
    l3Network.setModelInfoNetwork(modelInfoNetwork);
    org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(l3Network);
    ObjectMapper omapper = new ObjectMapper();
    org.onap.aai.domain.yang.L3Network network = omapper.readValue(getJson("aaiL3NetworkMapped.json"), org.onap.aai.domain.yang.L3Network.class);
    com.shazam.shazamcrest.MatcherAssert.assertThat(aaiL3Network, sameBeanAs(network));
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Test(org.junit.Test)

Example 13 with ModelInfoNetwork

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork in project so by onap.

the class AAIObjectMapperTest method mapNetworkTest.

@Test
public void mapNetworkTest() throws Exception {
    L3Network l3Network = new L3Network();
    ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
    modelInfoNetwork.setModelCustomizationUUID("modelCustomization_id");
    modelInfoNetwork.setModelInvariantUUID("modelInvariant_id");
    modelInfoNetwork.setModelUUID("modelCustomization_id");
    modelInfoNetwork.setNetworkType("CONTRAIL_EXTERNAL");
    modelInfoNetwork.setNetworkRole("dmz_direct");
    modelInfoNetwork.setNetworkTechnology("contrail");
    l3Network.setModelInfoNetwork(modelInfoNetwork);
    l3Network.setNetworkId("TESTING_ID");
    l3Network.setNetworkName("TESTING_NAME");
    l3Network.setIsBoundToVpn(true);
    l3Network.setServiceId("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb");
    l3Network.setNetworkRoleInstance(1L);
    l3Network.setOrchestrationStatus(OrchestrationStatus.CREATED);
    l3Network.setHeatStackId("heatStack_id");
    l3Network.setContrailNetworkFqdn("contrailNetwork_fqdn");
    l3Network.setWidgetModelId("widgetModel_id");
    l3Network.setWidgetModelVersion("widgetModel_version");
    l3Network.setPhysicalNetworkName("physicalNetwork_name");
    l3Network.setIsProviderNetwork(true);
    l3Network.setIsSharedNetwork(false);
    l3Network.setIsExternalNetwork(true);
    l3Network.setSelflink("self_link");
    l3Network.setOperationalStatus("operationalStatus");
    List<Subnet> subnets = new ArrayList<Subnet>();
    Subnet subnet1 = new Subnet();
    subnet1.setSubnetId("57e9a1ff-d14f-4071-a828-b19ae98eb2fc");
    subnet1.setSubnetName("subnetName");
    subnet1.setGatewayAddress("192.168.52.1");
    subnet1.setNetworkStartAddress("192.168.52.0");
    subnet1.setCidrMask("24");
    subnet1.setIpVersion("4");
    subnet1.setOrchestrationStatus(OrchestrationStatus.CREATED);
    subnet1.setIpAssignmentDirection("true");
    subnet1.setDhcpEnabled(true);
    subnet1.setDhcpStart("dhcpStart");
    subnet1.setDhcpEnd("dhcpEnd");
    subnet1.setSubnetRole("subnetRole");
    subnet1.setIpAssignmentDirection("true");
    subnet1.setSubnetSequence(new Integer(3));
    List<HostRoute> hostRoutes = new ArrayList<HostRoute>();
    HostRoute hostRoute1 = new HostRoute();
    hostRoute1.setHostRouteId("string");
    hostRoute1.setRoutePrefix("192.10.16.0/24");
    hostRoute1.setNextHop("192.10.16.100/24");
    hostRoute1.setNextHopType("ip-address");
    HostRoute hostRoute2 = new HostRoute();
    hostRoute2.setHostRouteId("string");
    hostRoute2.setRoutePrefix("192.110.17.0/24");
    hostRoute2.setNextHop("192.110.17.110/24");
    hostRoute2.setNextHopType("ip-address");
    hostRoutes.add(hostRoute1);
    hostRoutes.add(hostRoute2);
    subnet1.getHostRoutes().addAll(hostRoutes);
    subnets.add(subnet1);
    subnets.add(subnet1);
    l3Network.getSubnets().addAll(subnets);
    List<CtagAssignment> ctagAssignments = new ArrayList<CtagAssignment>();
    CtagAssignment ctagAssignment1 = new CtagAssignment();
    ctagAssignment1.setVlanIdInner(1L);
    ctagAssignments.add(ctagAssignment1);
    l3Network.getCtagAssignments().addAll(ctagAssignments);
    List<SegmentationAssignment> segmentationAssignments = new ArrayList<SegmentationAssignment>();
    SegmentationAssignment segmentationAssignment1 = new SegmentationAssignment();
    segmentationAssignment1.setSegmentationId("segmentationId1");
    SegmentationAssignment segmentationAssignment2 = new SegmentationAssignment();
    segmentationAssignment2.setSegmentationId("segmentationId2");
    segmentationAssignments.add(segmentationAssignment1);
    segmentationAssignments.add(segmentationAssignment2);
    l3Network.getSegmentationAssignments().addAll(segmentationAssignments);
    AAIObjectMapper l3NetworkMapper = new AAIObjectMapper();
    org.onap.aai.domain.yang.L3Network v12L3Network = l3NetworkMapper.mapNetwork(l3Network);
    String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiL3NetworkMapped_to_aai.json")));
    ObjectMapper omapper = new ObjectMapper();
    org.onap.aai.domain.yang.L3Network network = omapper.readValue(jsonToCompare, org.onap.aai.domain.yang.L3Network.class);
    ObjectWriter ow = new ObjectMapper().writer().withDefaultPrettyPrinter();
    String jsonGenerated = ow.writeValueAsString(v12L3Network);
    String jsonExpected = ow.writeValueAsString(network);
    assertEquals(jsonExpected, jsonGenerated);
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) SegmentationAssignment(org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment) ArrayList(java.util.ArrayList) ObjectWriter(com.fasterxml.jackson.databind.ObjectWriter) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) HostRoute(org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute) Subnet(org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) CtagAssignment(org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment) Test(org.junit.Test)

Example 14 with ModelInfoNetwork

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork in project so by onap.

the class NetworkAdapterObjectMapper method buildNetworkRollback.

private NetworkRollback buildNetworkRollback(L3Network l3Network, CloudRegion cloudRegion, String cloudRegionPo, CreateNetworkResponse createNetworkResponse) {
    NetworkRollback networkRollback = new NetworkRollback();
    networkRollback.setNetworkId(l3Network.getNetworkId());
    networkRollback.setNeutronNetworkId(createNetworkResponse.getMessageId());
    networkRollback.setNetworkStackId(createNetworkResponse.getNetworkStackId());
    networkRollback.setTenantId(cloudRegion.getTenantId());
    networkRollback.setCloudId(cloudRegionPo);
    networkRollback.setNetworkType(l3Network.getNetworkType());
    ModelInfoNetwork modelInfoNetwork = l3Network.getModelInfoNetwork();
    if (modelInfoNetwork != null) {
        networkRollback.setModelCustomizationUuid(modelInfoNetwork.getModelCustomizationUUID());
    }
    // rollback will only be called when network was actually created
    networkRollback.setNetworkCreated(createNetworkResponse.getNetworkCreated());
    // msoRequest
    return networkRollback;
}
Also used : NetworkRollback(org.onap.so.openstack.beans.NetworkRollback) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork)

Example 15 with ModelInfoNetwork

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork in project so by onap.

the class NetworkAdapterObjectMapper method createNetworkRequestMapper.

public CreateNetworkRequest createNetworkRequestMapper(RequestContext requestContext, CloudRegion cloudRegion, OrchestrationContext orchestrationContext, ServiceInstance serviceInstance, L3Network l3Network, Map<String, String> userInput, String cloudRegionPo, Customer customer) {
    CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest();
    // set cloudSiteId as determined for cloud region PO instead of cloudRegion.getLcpCloudRegionId()
    createNetworkRequest.setCloudSiteId(cloudRegionPo);
    createNetworkRequest.setTenantId(cloudRegion.getTenantId());
    createNetworkRequest.setNetworkId(l3Network.getNetworkId());
    createNetworkRequest.setNetworkName(l3Network.getNetworkName());
    // TODO fields not available
    createNetworkRequest.setNetworkType(l3Network.getNetworkType());
    // createNetworkRequest.setNetworkTypeVersion(serviceInstance.getModelInfoServiceInstance().getModelVersion());
    ModelInfoNetwork modelInfoNetwork = l3Network.getModelInfoNetwork();
    if (modelInfoNetwork != null) {
        createNetworkRequest.setModelCustomizationUuid(modelInfoNetwork.getModelCustomizationUUID());
    }
    // build and set Subnet list
    createNetworkRequest.setSubnets(buildOpenstackSubnetList(l3Network));
    // build and set provider Vlan Network
    ProviderVlanNetwork providerVlanNetwork = buildProviderVlanNetwork(l3Network);
    createNetworkRequest.setProviderVlanNetwork(providerVlanNetwork);
    String networkTechnology = l3Network.getModelInfoNetwork().getNetworkTechnology();
    if (networkTechnology == null) {
        networkTechnology = l3Network.getNetworkTechnology();
        logger.warn("NetworkTechnology was null in CatalogDB. Using field from AAI: " + networkTechnology);
    }
    if (networkTechnology != null) {
        createNetworkRequest.setNetworkTechnology(networkTechnology.toUpperCase());
        if (createNetworkRequest.getNetworkTechnology().contains("CONTRAIL")) {
            createNetworkRequest.setContrailRequest(true);
        }
    }
    // build and set Contrail Network
    ContrailNetwork contrailNetwork = buildContrailNetwork(l3Network, customer);
    createNetworkRequest.setContrailNetwork(contrailNetwork);
    // set Network Parameters from VID request, add "shared" and "external" to this map
    createNetworkRequest.setNetworkParams(addSharedAndExternal(userInput, l3Network));
    createNetworkRequest = setFlowFlags(createNetworkRequest, orchestrationContext);
    createNetworkRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
    String messageId = getRandomUuid();
    createNetworkRequest.setMessageId(messageId);
    createNetworkRequest.setNotificationUrl(createCallbackUrl("NetworkAResponse", messageId));
    return createNetworkRequest;
}
Also used : ContrailNetwork(org.onap.so.adapters.nwrest.ContrailNetwork) CreateNetworkRequest(org.onap.so.adapters.nwrest.CreateNetworkRequest) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) ProviderVlanNetwork(org.onap.so.adapters.nwrest.ProviderVlanNetwork)

Aggregations

ModelInfoNetwork (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork)18 Test (org.junit.Test)10 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)8 CollectionNetworkResourceCustomization (org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization)4 NetworkResourceCustomization (org.onap.so.db.catalog.beans.NetworkResourceCustomization)4 ArrayList (java.util.ArrayList)3 DeleteNetworkRequest (org.onap.so.adapters.nwrest.DeleteNetworkRequest)3 Service (org.onap.so.db.catalog.beans.Service)3 MsoRequest (org.onap.so.entity.MsoRequest)3 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)3 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)2 File (java.io.File)2 HashMap (java.util.HashMap)2 ContrailNetwork (org.onap.so.adapters.nwrest.ContrailNetwork)2 ProviderVlanNetwork (org.onap.so.adapters.nwrest.ProviderVlanNetwork)2 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)2 HostRoute (org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute)2 ServiceSubscription (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription)2 Subnet (org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet)2 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)2