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));
}
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);
}
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));
}
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;
}
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;
}
Aggregations