Search in sources :

Example 6 with Configuration

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

the class BBInputSetupPopulateMethodsTest method test_getGBBMacro_populateConfiguration_shouldBeCalled.

@Test
public void test_getGBBMacro_populateConfiguration_shouldBeCalled() throws Exception {
    // given
    String requestAction = "createInstance";
    Service service = Mockito.mock(Service.class);
    GeneralBuildingBlock gBB = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"), GeneralBuildingBlock.class);
    RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class);
    GenericVnf aaiVnf = new GenericVnf();
    aaiVnf.setModelCustomizationId("modelCustId");
    Map<ResourceKey, String> lookupKeyMap = prepareLookupKeyMap();
    ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
    ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class);
    executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
    BuildingBlock buildingBlock = executeBB.getBuildingBlock();
    buildingBlock.setBpmnFlowName("AssignFabricConfigurationBB").setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
    Configuration configuration = new Configuration();
    configuration.setConfigurationId("configurationId");
    gBB.getServiceInstance().getConfigurations().add(configuration);
    List<ConfigurationResourceCustomization> configurationCustList = new ArrayList<>();
    ConfigurationResourceCustomization configurationCust = new ConfigurationResourceCustomization();
    configurationCust.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
    configurationCustList.add(configurationCust);
    doReturn(configurationCustList).when(service).getConfigurationCustomizations();
    doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
    doReturn(service).when(bbInputSetupUtils).getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
    doNothing().when(SPY_bbInputSetup).populateConfiguration(any(BBInputSetupParameter.class));
    // when
    SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
    // then
    verify(SPY_bbInputSetup, times(1)).populateConfiguration(any(BBInputSetupParameter.class));
}
Also used : GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) GenericVnf(org.onap.aai.domain.yang.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) Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) 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) BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys(org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys) ConfigurationResourceKeys(org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys) File(java.io.File) ConfigurationResourceCustomization(org.onap.so.db.catalog.beans.ConfigurationResourceCustomization) Test(org.junit.Test)

Example 7 with Configuration

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

the class BBInputSetupTest method testPopulateFabricConfiguration.

@Test
public void testPopulateFabricConfiguration() throws JsonParseException, JsonMappingException, IOException {
    String instanceName = "configurationName";
    ModelInfo modelInfo = new ModelInfo();
    modelInfo.setModelCustomizationUuid("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
    ServiceInstance serviceInstance = new ServiceInstance();
    Configuration configuration = new Configuration();
    configuration.setConfigurationId("configurationId");
    configuration.setConfigurationName("configurationName");
    configuration.setConfigurationSubType("Fabric Config");
    serviceInstance.getConfigurations().add(configuration);
    String resourceId = "configurationId";
    String vnfcName = "vnfcName";
    // Mock service
    Service service = mapper.readValue(new File(RESOURCE_PATH + "CatalogDBService_getServiceInstanceNOAAIInput.json"), Service.class);
    Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
    lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
    String bbName = AssignFlows.FABRIC_CONFIGURATION.toString();
    ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
    configResourceKeys.setVnfcName(vnfcName);
    Vnfc vnfc = new Vnfc();
    vnfc.setVnfcName(vnfcName);
    RequestDetails requestDetails = new RequestDetails();
    ServiceModel serviceModel = new ServiceModel();
    serviceModel.setCurrentService(service);
    CvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new CvnfcConfigurationCustomization();
    ConfigurationResource configurationResource = new ConfigurationResource();
    configurationResource.setModelUUID("modelUUID");
    configurationResource.setModelInvariantUUID("modelInvariantUUID");
    vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
    doReturn(null).when(SPY_bbInputSetup).findConfigurationResourceCustomization(modelInfo, service);
    doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName);
    BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID).setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setInstanceName(instanceName).setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails).setServiceModel(serviceModel).build();
    SPY_bbInputSetup.populateConfiguration(parameter);
    verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys);
}
Also used : ModelInfo(org.onap.so.serviceinstancebeans.ModelInfo) CloudConfiguration(org.onap.so.serviceinstancebeans.CloudConfiguration) Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) HashMap(java.util.HashMap) AAIFluentTypeBuilder(org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) Service(org.onap.so.db.catalog.beans.Service) ConfigurationResource(org.onap.so.db.catalog.beans.ConfigurationResource) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) ServiceModel(org.onap.so.bpmn.servicedecomposition.entities.ServiceModel) ConfigurationResourceKeys(org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys) BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys(org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys) CvnfcConfigurationCustomization(org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization) File(java.io.File) Vnfc(org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc) Test(org.junit.Test)

Example 8 with Configuration

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

the class BBInputSetupMapperLayerTest method testMapAAIConfiguration.

@Test
public void testMapAAIConfiguration() throws JsonParseException, JsonMappingException, IOException {
    org.onap.aai.domain.yang.Configuration configurationAAI = mapper.readValue(new File(RESOURCE_PATH + "ConfigurationInput.json"), org.onap.aai.domain.yang.Configuration.class);
    Configuration expectedConfiguration = mapper.readValue(new File(RESOURCE_PATH + "ConfigurationExpected.json"), Configuration.class);
    Configuration actualConfiguration = bbInputSetupMapperLayer.mapAAIConfiguration(configurationAAI);
    assertThat(actualConfiguration, sameBeanAs(expectedConfiguration));
}
Also used : CloudConfiguration(org.onap.so.serviceinstancebeans.CloudConfiguration) Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) ModelInfoConfiguration(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration) File(java.io.File) Test(org.junit.Test)

Example 9 with Configuration

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

the class TestDataSetup method setConfiguration.

public Configuration setConfiguration() {
    Configuration config = new Configuration();
    config.setConfigurationId("testConfigurationId");
    List<Configuration> configurations = new ArrayList<>();
    configurations.add(config);
    ServiceInstance serviceInstance = new ServiceInstance();
    try {
        serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
    } catch (BBObjectNotFoundException e) {
        serviceInstance = setServiceInstance();
    }
    lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "testConfigurationId");
    serviceInstance.setConfigurations(configurations);
    return config;
}
Also used : BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException) Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) ModelInfoConfiguration(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration) ArrayList(java.util.ArrayList) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)

Example 10 with Configuration

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

the class TestDataSetup method buildVpnBondingLink.

public VpnBondingLink buildVpnBondingLink() {
    vpnBondingLinkCounter++;
    VpnBondingLink vpnBondingLink = new VpnBondingLink();
    vpnBondingLink.setVpnBondingLinkId("testVpnBondingLinkId" + vpnBondingLinkCounter);
    Configuration vnrConfiguration = buildConfiguration();
    vnrConfiguration.setNetwork(buildL3Network());
    vpnBondingLink.setVnrConfiguration(vnrConfiguration);
    vpnBondingLink.setVrfConfiguration(buildConfiguration());
    vpnBondingLink.setInfrastructureServiceProxy(buildServiceProxy());
    vpnBondingLink.setTransportServiceProxy(buildServiceProxy());
    return vpnBondingLink;
}
Also used : VpnBondingLink(org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBondingLink) Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) ModelInfoConfiguration(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration)

Aggregations

Configuration (org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration)41 Test (org.junit.Test)23 CloudConfiguration (org.onap.so.serviceinstancebeans.CloudConfiguration)13 ArrayList (java.util.ArrayList)11 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)11 ModelInfoConfiguration (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration)10 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)9 ExecuteBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock)8 Service (org.onap.so.db.catalog.beans.Service)8 File (java.io.File)7 ConfigurationResourceKeys (org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys)7 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)7 Relationships (org.onap.aaiclient.client.aai.entities.Relationships)6 BaseTaskTest (org.onap.so.bpmn.BaseTaskTest)6 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)6 BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys (org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys)6 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)6 GenericVnf (org.onap.aai.domain.yang.GenericVnf)5 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)5 L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)5