Search in sources :

Example 16 with ModelInfoNetwork

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

the class BBInputSetupTest method test_getGBBMacroNoUserParamsCreate_shouldBeCalled_whenBBhasVirtualLink.

@Test
public void test_getGBBMacroNoUserParamsCreate_shouldBeCalled_whenBBhasVirtualLink() throws Exception {
    // given
    String resourceId = "123";
    String vnfType = "vnfType";
    String requestAction = "createInstance";
    Service service = Mockito.mock(Service.class);
    GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), GeneralBuildingBlock.class);
    Map<ResourceKey, String> lookupKeyMap = prepareLookupKeyMap();
    List<NetworkResourceCustomization> networkCustList = new ArrayList<>();
    NetworkResourceCustomization networkCust = Mockito.mock(NetworkResourceCustomization.class);
    networkCustList.add(networkCust);
    CollectionNetworkResourceCustomization collectionNetworkResourceCust = Mockito.mock(CollectionNetworkResourceCustomization.class);
    org.onap.aai.domain.yang.GenericVnf aaiVnf = new org.onap.aai.domain.yang.GenericVnf();
    aaiVnf.setModelCustomizationId("modelCustId");
    ModelInfoNetwork modelInfoNetwork = Mockito.mock(ModelInfoNetwork.class);
    NetworkResourceCustomization networkResourceCustomization = Mockito.mock(NetworkResourceCustomization.class);
    ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
    RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class);
    requestDetails.getRequestParameters().setUserParams(null);
    ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class);
    executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
    BuildingBlock buildingBlock = executeBB.getBuildingBlock();
    buildingBlock.setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()).setKey("ab153b6e-c364-44c0-bef6-1f2982117f04").setIsVirtualLink(true);
    doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
    doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
    doReturn(collectionNetworkResourceCust).when(SPY_bbInputSetupUtils).getCatalogCollectionNetworkResourceCustByID(any(String.class));
    doReturn(networkResourceCustomization).when(bbInputSetupMapperLayer).mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust);
    doReturn(modelInfoNetwork).when(bbInputSetupMapperLayer).mapCatalogNetworkToNetwork(networkResourceCustomization);
    // when
    SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
    // then
    verify(SPY_bbInputSetup, times(1)).getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, executeBB.getBuildingBlock().getBpmnFlowName(), "ab153b6e-c364-44c0-bef6-1f2982117f04", gBB, service);
}
Also used : GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) ModelInfoGenericVnf(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) BuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock) ArrayList(java.util.ArrayList) Service(org.onap.so.db.catalog.beans.Service) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) CollectionNetworkResourceCustomization(org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization) ConfigurationResourceKeys(org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys) BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys(org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys) CollectionNetworkResourceCustomization(org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization) NetworkResourceCustomization(org.onap.so.db.catalog.beans.NetworkResourceCustomization) File(java.io.File) Test(org.junit.Test)

Example 17 with ModelInfoNetwork

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

the class BBInputSetupTest method testMapCatalogNetwork.

@Test
public void testMapCatalogNetwork() {
    ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
    L3Network network = new L3Network();
    RequestDetails requestDetails = new RequestDetails();
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelCustomizationUuid("modelCustomizationUUID");
    requestDetails.setModelInfo(modelInfo);
    Service service = new Service();
    NetworkResourceCustomization resourceCust = new NetworkResourceCustomization();
    resourceCust.setModelCustomizationUUID("modelCustomizationUUID");
    service.setNetworkCustomizations(Arrays.asList(new NetworkResourceCustomization[] { resourceCust }));
    doReturn(modelInfoNetwork).when(bbInputSetupMapperLayer).mapCatalogNetworkToNetwork(resourceCust);
    SPY_bbInputSetup.mapCatalogNetwork(network, modelInfo, service);
    assertEquals(modelInfoNetwork, network.getModelInfoNetwork());
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) Service(org.onap.so.db.catalog.beans.Service) CollectionNetworkResourceCustomization(org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization) NetworkResourceCustomization(org.onap.so.db.catalog.beans.NetworkResourceCustomization) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) Test(org.junit.Test)

Example 18 with ModelInfoNetwork

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

the class BBInputSetupTest method testMapCatalogConfiguration.

@Test
public void testMapCatalogConfiguration() {
    ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
    L3Network network = new L3Network();
    RequestDetails requestDetails = new RequestDetails();
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelCustomizationUuid("modelCustomizationUUID");
    requestDetails.setModelInfo(modelInfo);
    Service service = new Service();
    NetworkResourceCustomization resourceCust = new NetworkResourceCustomization();
    resourceCust.setModelCustomizationUUID("modelCustomizationUUID");
    service.setNetworkCustomizations(Arrays.asList(new NetworkResourceCustomization[] { resourceCust }));
    doReturn(modelInfoNetwork).when(bbInputSetupMapperLayer).mapCatalogNetworkToNetwork(resourceCust);
    SPY_bbInputSetup.mapCatalogNetwork(network, modelInfo, service);
    assertEquals(modelInfoNetwork, network.getModelInfoNetwork());
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) ModelInfoNetwork(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork) Service(org.onap.so.db.catalog.beans.Service) CollectionNetworkResourceCustomization(org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization) NetworkResourceCustomization(org.onap.so.db.catalog.beans.NetworkResourceCustomization) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) 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