Search in sources :

Example 26 with Configuration

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

the class AAIConfigurationResourcesTest method connectVrfConfigurationToVnrConfigurationTest.

@Test
public void connectVrfConfigurationToVnrConfigurationTest() throws Exception {
    Configuration vrfConfiguration = buildConfiguration();
    Configuration vnrConfiguration = buildConfiguration();
    doNothing().when(MOCK_aaiResourcesClient).connect(isA(AAIResourceUri.class), isA(AAIResourceUri.class));
    aaiConfigurationResources.connectVrfConfigurationToVnrConfiguration(vrfConfiguration.getConfigurationId(), vnrConfiguration.getConfigurationId());
    verify(MOCK_aaiResourcesClient, times(1)).connect(any(AAIResourceUri.class), any(AAIResourceUri.class));
}
Also used : Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) AAIResourceUri(org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri) Test(org.junit.Test)

Example 27 with Configuration

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

the class AAIConfigurationResourcesTest method getConfigurationTest.

@Test
public void getConfigurationTest() {
    AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().configuration("configurationId"));
    doReturn(Optional.of(new org.onap.aai.domain.yang.Configuration())).when(MOCK_aaiResourcesClient).get(org.onap.aai.domain.yang.Configuration.class, aaiResourceUri);
    aaiConfigurationResources.getConfiguration("configurationId");
    verify(MOCK_aaiResourcesClient, times(1)).get(org.onap.aai.domain.yang.Configuration.class, aaiResourceUri);
}
Also used : Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) AAIResourceUri(org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri) Test(org.junit.Test)

Example 28 with Configuration

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

the class BBInputSetupTest method testGBBMacroNoUserParamsVrfConfiguration.

@Test
public void testGBBMacroNoUserParamsVrfConfiguration() throws Exception {
    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);
    ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"), ExecuteBuildingBlock.class);
    RequestDetails requestDetails = mapper.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacroVrf.json"), RequestDetails.class);
    Map<ResourceKey, String> lookupKeyMap = prepareLookupKeyMap();
    ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
    executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
    BuildingBlock buildingBlock = executeBB.getBuildingBlock();
    buildingBlock.setBpmnFlowName("AssignVrfConfigurationBB");
    buildingBlock.setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
    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());
    RelatedInstance relatedVpnBinding = new RelatedInstance();
    relatedVpnBinding.setInstanceId("vpnBindingInstanceId");
    RelatedInstance relatedLocalNetwork = new RelatedInstance();
    relatedLocalNetwork.setInstanceId("localNetworkInstanceId");
    org.onap.aai.domain.yang.VpnBinding aaiVpnBinding = new org.onap.aai.domain.yang.VpnBinding();
    aaiVpnBinding.setVpnId("vpnBindingId");
    org.onap.aai.domain.yang.L3Network aaiLocalNetwork = new org.onap.aai.domain.yang.L3Network();
    aaiLocalNetwork.setNetworkId("localNetworkId");
    Optional<org.onap.aai.domain.yang.VpnBinding> aaiAICVpnBindingOp = Optional.of(new org.onap.aai.domain.yang.VpnBinding());
    aaiAICVpnBindingOp.get().setVpnId("AICVpnBindingId");
    ServiceProxy proxy = new ServiceProxy();
    proxy.setType("transport");
    proxy.setServiceInstance(new ServiceInstance());
    proxy.getServiceInstance().setModelInfoServiceInstance(new ModelInfoServiceInstance());
    proxy.getServiceInstance().getModelInfoServiceInstance().setModelUuid("sourceServiceModelUUID");
    doReturn(relatedVpnBinding).when(SPY_bbInputSetupUtils).getRelatedInstanceByType(requestDetails, ModelType.vpnBinding);
    doReturn(relatedLocalNetwork).when(SPY_bbInputSetupUtils).getRelatedInstanceByType(requestDetails, ModelType.network);
    doReturn(aaiVpnBinding).when(SPY_bbInputSetupUtils).getAAIVpnBinding(relatedVpnBinding.getInstanceId());
    doReturn(aaiLocalNetwork).when(SPY_bbInputSetupUtils).getAAIL3Network(relatedLocalNetwork.getInstanceId());
    doReturn(aaiAICVpnBindingOp).when(SPY_bbInputSetupUtils).getAICVpnBindingFromNetwork(aaiLocalNetwork);
    doReturn(proxy).when(SPY_bbInputSetup).getServiceProxy(service);
    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);
    doNothing().when(SPY_bbInputSetup).populateConfiguration(any(BBInputSetupParameter.class));
    gBB = SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
    verify(SPY_bbInputSetup, times(1)).populateConfiguration(any(BBInputSetupParameter.class));
    assertEquals(gBB.getCustomer().getVpnBindings().get(0).getVpnId(), "vpnBindingId");
    assertEquals(gBB.getServiceInstance().getNetworks().get(0).getNetworkId(), "localNetworkId");
    assertEquals(gBB.getServiceInstance().getNetworks().get(0).getVpnBindings().get(0).getVpnId(), "AICVpnBindingId");
    assertEquals(gBB.getServiceInstance().getServiceProxies().get(0).getType(), "transport");
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) BuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock) CloudConfiguration(org.onap.so.serviceinstancebeans.CloudConfiguration) Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) ArrayList(java.util.ArrayList) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) ExecuteBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) RelatedInstance(org.onap.so.serviceinstancebeans.RelatedInstance) Service(org.onap.so.db.catalog.beans.Service) RequestDetails(org.onap.so.serviceinstancebeans.RequestDetails) ResourceKey(org.onap.so.bpmn.servicedecomposition.entities.ResourceKey) ModelInfoServiceProxy(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceProxy) ServiceProxy(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy) ConfigurationResourceKeys(org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys) BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys(org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys) File(java.io.File) ConfigurationResourceCustomization(org.onap.so.db.catalog.beans.ConfigurationResourceCustomization) Test(org.junit.Test)

Example 29 with Configuration

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

the class TestDataSetup method buildConfiguration.

public Configuration buildConfiguration() {
    configurationCounter++;
    Configuration configuration = new Configuration();
    configuration.setConfigurationId("testConfigurationId" + configurationCounter);
    configuration.setConfigurationName("testConfigurationName" + configurationCounter);
    ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
    modelInfoConfiguration.setModelVersionId("testModelVersionId" + configurationCounter);
    modelInfoConfiguration.setModelInvariantId("testModelInvariantId" + configurationCounter);
    modelInfoConfiguration.setModelCustomizationId("testModelCustomizationId" + configurationCounter);
    configuration.setModelInfoConfiguration(modelInfoConfiguration);
    return configuration;
}
Also used : ModelInfoConfiguration(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration) Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) ModelInfoConfiguration(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoConfiguration)

Example 30 with Configuration

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

the class BuildingBlockTestDataSetup 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