Search in sources :

Example 6 with ModelInfoNetwork

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork 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 7 with ModelInfoNetwork

use of org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork 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 8 with ModelInfoNetwork

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

the class BBInputSetupMapperLayer method mapCatalogNetworkToNetwork.

protected ModelInfoNetwork mapCatalogNetworkToNetwork(NetworkResourceCustomization networkResourceCustomization) {
    modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STRICT);
    ModelInfoNetwork modelInfoNetwork = modelMapper.map(networkResourceCustomization, ModelInfoNetwork.class);
    modelMapper.map(networkResourceCustomization.getNetworkResource(), modelInfoNetwork);
    modelMapper.getConfiguration().setMatchingStrategy(MatchingStrategies.STANDARD);
    return modelInfoNetwork;
}
Also used : ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork)

Example 9 with ModelInfoNetwork

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

the class NetworkAdapterObjectMapperTest method deleteNetworkRequestMapperTest.

@Test
public void deleteNetworkRequestMapperTest() throws Exception {
    DeleteNetworkRequest expectedDeleteNetworkRequest = new DeleteNetworkRequest();
    String messageId = "messageId";
    expectedDeleteNetworkRequest.setMessageId(messageId);
    doReturn(messageId).when(SPY_networkAdapterObjectMapper).getRandomUuid();
    ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
    l3Network.setModelInfoNetwork(modelInfoNetwork);
    modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUuid");
    expectedDeleteNetworkRequest.setModelCustomizationUuid(modelInfoNetwork.getModelCustomizationUUID());
    MsoRequest msoRequest = new MsoRequest();
    msoRequest.setRequestId(requestContext.getMsoRequestId());
    msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
    expectedDeleteNetworkRequest.setMsoRequest(msoRequest);
    expectedDeleteNetworkRequest.setNetworkId(l3Network.getNetworkId());
    l3Network.setHeatStackId("heatStackId");
    expectedDeleteNetworkRequest.setNetworkStackId(l3Network.getHeatStackId());
    expectedDeleteNetworkRequest.setNetworkType(l3Network.getNetworkType());
    expectedDeleteNetworkRequest.setSkipAAI(true);
    expectedDeleteNetworkRequest.setTenantId(cloudRegion.getTenantId());
    expectedDeleteNetworkRequest.setCloudSiteId(cloudRegion.getLcpCloudRegionId());
    expectedDeleteNetworkRequest.setNotificationUrl("endpoint/NetworkAResponse/messageId");
    doReturn("endpoint/").when(SPY_networkAdapterObjectMapper).getEndpoint();
    doReturn("messageId").when(SPY_networkAdapterObjectMapper).getRandomUuid();
    DeleteNetworkRequest deleteNetworkRequest = SPY_networkAdapterObjectMapper.deleteNetworkRequestMapper(requestContext, cloudRegion, serviceInstance, l3Network);
    assertThat(expectedDeleteNetworkRequest, sameBeanAs(deleteNetworkRequest));
}
Also used : DeleteNetworkRequest(org.onap.so.adapters.nwrest.DeleteNetworkRequest) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) MsoRequest(org.onap.so.entity.MsoRequest) Test(org.junit.Test)

Example 10 with ModelInfoNetwork

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

the class BBInputSetupMapperLayerTest method testMapCatalogNetworkToNetwork.

@Test
public void testMapCatalogNetworkToNetwork() throws JsonParseException, JsonMappingException, IOException {
    NetworkResourceCustomization networkResourceCustomization = mapper.readValue(new File(RESOURCE_PATH + "NetworkResourceCustomizationInput.json"), NetworkResourceCustomization.class);
    ModelInfoNetwork expectedModelInfoNetwork = mapper.readValue(new File(RESOURCE_PATH + "ModelInfoNetworkExpected.json"), ModelInfoNetwork.class);
    ModelInfoNetwork actualModelInfoNetwork = bbInputSetupMapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization);
    assertThat(actualModelInfoNetwork, sameBeanAs(expectedModelInfoNetwork));
}
Also used : ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) CollectionNetworkResourceCustomization(org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization) NetworkResourceCustomization(org.onap.so.db.catalog.beans.NetworkResourceCustomization) File(java.io.File) Test(org.junit.Test)

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