Search in sources :

Example 31 with L3Network

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

the class NetworkTopologyOperationRequestMapperTest method before.

@Before
public void before() {
    // prepare and set service instance
    serviceInstance = new ServiceInstance();
    serviceInstanceNoCollection = new ServiceInstance();
    ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
    modelInfoServiceInstance.setModelInvariantUuid("modelInvariantUuid");
    modelInfoServiceInstance.setModelName("modelName");
    modelInfoServiceInstance.setModelUuid("modelUuid");
    modelInfoServiceInstance.setModelVersion("modelVersion");
    serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
    serviceInstanceNoCollection.setModelInfoServiceInstance(modelInfoServiceInstance);
    // prepare Customer object
    customer = new Customer();
    customer.setGlobalCustomerId("globalCustomerId");
    // serviceInstance.setCustomer(customer);
    // set Customer on service instance
    ServiceSubscription serviceSubscription = new ServiceSubscription();
    serviceSubscription.setServiceType("productFamilyId");
    customer.setServiceSubscription(serviceSubscription);
    // set Customer on service instance
    customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
    customer.getServiceSubscription().getServiceInstances().add(serviceInstanceNoCollection);
    // 
    InstanceGroup networkInstanceGroup = new InstanceGroup();
    networkInstanceGroup.setId("networkInstanceGroupId");
    networkInstanceGroup.setInstanceGroupFunction("instanceGroupFunction");
    Collection networkCollection = new Collection();
    networkCollection.setInstanceGroup(networkInstanceGroup);
    serviceInstance.setCollection(networkCollection);
    // 
    requestContext = new RequestContext();
    Map<String, Object> userParams = new HashMap<>();
    userParams.put("key1", "value1");
    requestContext.setUserParams(userParams);
    requestContext.setProductFamilyId("productFamilyId");
    requestContext.setMsoRequestId("MsoRequestId");
    network = new L3Network();
    network.setNetworkId("TEST_NETWORK_ID");
    network.setNetworkName("TEST_NETWORK_NAME");
    ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
    modelInfoNetwork.setModelInvariantUUID("modelInvariantUuid");
    modelInfoNetwork.setModelName("modelName");
    modelInfoNetwork.setModelVersion("modelVersion");
    modelInfoNetwork.setModelUUID("modelUuid");
    modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUUID");
    network.setModelInfoNetwork(modelInfoNetwork);
    cloudRegion = new CloudRegion();
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) HashMap(java.util.HashMap) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup) ServiceSubscription(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) Collection(org.onap.so.bpmn.servicedecomposition.bbobjects.Collection) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Before(org.junit.Before)

Example 32 with L3Network

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

the class GeneralTopologyObjectMapperTest method buildNetworkInformationTest.

@Test
public void buildNetworkInformationTest() {
    L3Network network = new L3Network();
    ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
    modelInfoNetwork.setModelInvariantUUID("my-uuid");
    modelInfoNetwork.setModelName("my-model-name");
    modelInfoNetwork.setModelVersion("my-model-version");
    modelInfoNetwork.setModelUUID("my-model-uuid");
    modelInfoNetwork.setModelCustomizationUUID("my-customization-uuid");
    network.setModelInfoNetwork(modelInfoNetwork);
    network.setNetworkId("my-network-id");
    network.setNetworkType("my-network-type");
    network.setNetworkTechnology("my-network-technology");
    GenericResourceApiNetworkinformationNetworkInformation networkInformation = new GenericResourceApiNetworkinformationNetworkInformation();
    GenericResourceApiOnapmodelinformationOnapModelInformation onapModelInformation = new GenericResourceApiOnapmodelinformationOnapModelInformation();
    networkInformation.setNetworkId("my-network-id");
    networkInformation.setNetworkType("my-network-type");
    networkInformation.networkTechnology("my-network-technology");
    networkInformation.setFromPreload(null);
    onapModelInformation.setModelInvariantUuid("my-uuid");
    onapModelInformation.setModelName("my-model-name");
    onapModelInformation.setModelVersion("my-model-version");
    onapModelInformation.setModelUuid("my-model-uuid");
    onapModelInformation.setModelCustomizationUuid("my-customization-uuid");
    networkInformation.setOnapModelInformation(onapModelInformation);
    assertThat(networkInformation, sameBeanAs(genObjMapper.buildNetworkInformation(network)));
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) GenericResourceApiOnapmodelinformationOnapModelInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiOnapmodelinformationOnapModelInformation) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) GenericResourceApiNetworkinformationNetworkInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkinformationNetworkInformation) Test(org.junit.Test)

Example 33 with L3Network

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

the class BBInputSetupMapperLayer method mapAAIL3Network.

protected L3Network mapAAIL3Network(org.onap.aai.domain.yang.L3Network aaiL3Network) {
    L3Network network = modelMapper.map(aaiL3Network, L3Network.class);
    mapAllSubnetsIntoL3Network(aaiL3Network, network);
    mapAllCtagAssignmentsIntoL3Network(aaiL3Network, network);
    mapAllSegmentationAssignmentsIntoL3Network(aaiL3Network, network);
    mapAllAggregateRoutesIntoL3Network(aaiL3Network, network);
    network.setOrchestrationStatus(this.mapOrchestrationStatusFromAAI(aaiL3Network.getOrchestrationStatus()));
    return network;
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)

Example 34 with L3Network

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

the class BBInputSetup method mapL3Network.

protected L3Network mapL3Network(AAIResourceUri aaiResourceUri) {
    AAIResultWrapper aaiNetworkWrapper = this.bbInputSetupUtils.getAAIResourceDepthTwo(aaiResourceUri);
    Optional<org.onap.aai.domain.yang.L3Network> aaiL3NetworkOp = aaiNetworkWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
    org.onap.aai.domain.yang.L3Network aaiL3Network = null;
    if (!aaiL3NetworkOp.isPresent()) {
        return null;
    }
    aaiL3Network = aaiL3NetworkOp.get();
    L3Network network = this.mapperLayer.mapAAIL3Network(aaiL3Network);
    Optional<Relationships> relationshipsOp = aaiNetworkWrapper.getRelationships();
    if (relationshipsOp.isPresent()) {
        Relationships relationships = relationshipsOp.get();
        this.mapNetworkPolicies(relationships.getByType(Types.NETWORK_POLICY), network.getNetworkPolicies());
        mapRouteTableReferences(relationships.getByType(Types.ROUTE_TABLE_REFERENCE), network.getContrailNetworkRouteTableReferences());
    }
    return network;
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) Relationships(org.onap.aaiclient.client.aai.entities.Relationships) AAIResultWrapper(org.onap.aaiclient.client.aai.entities.AAIResultWrapper)

Example 35 with L3Network

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

the class BBInputSetup method getGBBMacroNoUserParamsCreate.

protected GeneralBuildingBlock getGBBMacroNoUserParamsCreate(ExecuteBuildingBlock executeBB, Map<ResourceKey, String> lookupKeyMap, String bbName, String key, GeneralBuildingBlock gBB, Service service) throws Exception {
    ServiceInstance serviceInstance = gBB.getServiceInstance();
    BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setExecuteBB(executeBB).setRequestId(executeBB.getRequestId()).setServiceInstance(serviceInstance).setService(service).setBbName(bbName).setLookupKeyMap(lookupKeyMap).setKey(key).build();
    if (bbName.contains(NETWORK) && !bbName.contains(NETWORK_COLLECTION)) {
        String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID);
        parameter.setResourceId(networkId);
        parameter.setModelInfo(new ModelInfo());
        if ((!Boolean.TRUE.equals(executeBB.getBuildingBlock().isVirtualLink()))) {
            NetworkResourceCustomization networkCust = getNetworkCustomizationByKey(key, service);
            if (networkCust != null) {
                parameter.getModelInfo().setModelCustomizationUuid(networkCust.getModelCustomizationUUID());
                this.populateL3Network(parameter);
            } else {
                logger.debug("Could not find a network customization with key: {}", key);
            }
        } else {
            logger.debug("Orchestrating on Collection Network Resource Customization");
            CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key);
            L3Network l3Network = getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId, collectionNetworkResourceCust, serviceInstance);
            NetworkResourceCustomization networkResourceCustomization = mapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust);
            if (l3Network != null) {
                l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization));
            }
        }
    } else if (bbName.contains("Configuration")) {
        parameter.setResourceId(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID));
        parameter.setModelInfo(new ModelInfo());
        parameter.getModelInfo().setModelCustomizationUuid(key);
        parameter.setConfigurationResourceKeys(executeBB.getConfigurationResourceKeys());
        parameter.setRequestDetails(executeBB.getRequestDetails());
        this.populateConfiguration(parameter);
    }
    if (executeBB.getWorkflowResourceIds() != null) {
        parameter.setResourceId(executeBB.getWorkflowResourceIds().getNetworkCollectionId());
        this.populateNetworkCollectionAndInstanceGroupAssign(parameter);
    }
    RelatedInstance relatedVpnBinding = bbInputSetupUtils.getRelatedInstanceByType(executeBB.getRequestDetails(), ModelType.vpnBinding);
    RelatedInstance relatedLocalNetwork = bbInputSetupUtils.getRelatedInstanceByType(executeBB.getRequestDetails(), ModelType.network);
    if (relatedVpnBinding != null && relatedLocalNetwork != null) {
        org.onap.aai.domain.yang.VpnBinding aaiVpnBinding = bbInputSetupUtils.getAAIVpnBinding(relatedVpnBinding.getInstanceId());
        org.onap.aai.domain.yang.L3Network aaiLocalNetwork = bbInputSetupUtils.getAAIL3Network(relatedLocalNetwork.getInstanceId());
        VpnBinding vpnBinding = mapperLayer.mapAAIVpnBinding(aaiVpnBinding);
        L3Network localNetwork = mapperLayer.mapAAIL3Network(aaiLocalNetwork);
        Optional<org.onap.aai.domain.yang.VpnBinding> aaiAICVpnBindingOp = bbInputSetupUtils.getAICVpnBindingFromNetwork(aaiLocalNetwork);
        if (aaiAICVpnBindingOp.isPresent()) {
            localNetwork.getVpnBindings().add(mapperLayer.mapAAIVpnBinding(aaiAICVpnBindingOp.get()));
        }
        ServiceProxy serviceProxy = getServiceProxy(service);
        gBB.getServiceInstance().getServiceProxies().add(serviceProxy);
        gBB.getCustomer().getVpnBindings().add(vpnBinding);
        lookupKeyMap.put(ResourceKey.VPN_ID, vpnBinding.getVpnId());
        gBB.getServiceInstance().getNetworks().add(localNetwork);
        lookupKeyMap.put(ResourceKey.NETWORK_ID, localNetwork.getNetworkId());
    }
    return gBB;
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) RelatedInstance(org.onap.so.serviceinstancebeans.RelatedInstance) ExceptionBuilder(org.onap.so.client.exception.ExceptionBuilder) AAIFluentTypeBuilder(org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) VpnBinding(org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding) ServiceProxy(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy) CollectionNetworkResourceCustomization(org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization) CollectionNetworkResourceCustomization(org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization) NetworkResourceCustomization(org.onap.so.db.catalog.beans.NetworkResourceCustomization)

Aggregations

L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)68 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)34 Test (org.junit.Test)29 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)18 AAIResultWrapper (org.onap.aaiclient.client.aai.entities.AAIResultWrapper)13 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)12 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)12 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)11 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)11 Service (org.onap.so.db.catalog.beans.Service)11 File (java.io.File)10 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)10 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)10 Relationships (org.onap.aaiclient.client.aai.entities.Relationships)9 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)9 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)9 AAIResourceUri (org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri)8 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)8 ModelInfoNetwork (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork)8 ArrayList (java.util.ArrayList)7