Search in sources :

Example 41 with L3Network

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

the class NetworkAdapterDeleteTasks method deleteNetwork.

public void deleteNetwork(BuildingBlockExecution execution) {
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        DeleteNetworkRequest deleteNetworkRequest = networkAdapterObjectMapper.deleteNetworkRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), serviceInstance, l3Network);
        execution.setVariable("networkAdapterRequest", deleteNetworkRequest.toXmlString());
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) DeleteNetworkRequest(org.onap.so.adapters.nwrest.DeleteNetworkRequest) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)

Example 42 with L3Network

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

the class NetworkAdapterCreateTasks method createNetwork.

public void createNetwork(BuildingBlockExecution execution) {
    execution.setVariable("networkAdapterCreateRollback", false);
    try {
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
        Map<String, String> userInput = gBBInput.getUserInput();
        String cloudRegionPo = execution.getVariable("cloudRegionPo");
        CreateNetworkRequest createNetworkRequest = networkAdapterObjectMapper.createNetworkRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, userInput, cloudRegionPo, gBBInput.getCustomer());
        execution.setVariable("networkAdapterRequest", createNetworkRequest.toXmlString());
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) CreateNetworkRequest(org.onap.so.adapters.nwrest.CreateNetworkRequest) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)

Example 43 with L3Network

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

the class AAICreateTasks method connectNetworkToCloudRegion.

/**
 * BPMN access method to establish relationships in AAI
 *
 * @param execution
 * @throws Exception
 */
public void connectNetworkToCloudRegion(BuildingBlockExecution execution) {
    try {
        L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
        aaiNetworkResources.connectNetworkToCloudRegion(l3network, execution.getGeneralBuildingBlock().getCloudRegion());
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException)

Example 44 with L3Network

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

the class AAICreateTasks method connectNetworkToTenant.

/**
 * BPMN access method to establish relationships in AAI
 *
 * @param execution
 * @throws Exception
 */
public void connectNetworkToTenant(BuildingBlockExecution execution) {
    try {
        L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
        aaiNetworkResources.connectNetworkToTenant(l3network, execution.getGeneralBuildingBlock().getCloudRegion());
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException)

Example 45 with L3Network

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

the class NetworkAdapterResourcesTest method createNetworTest.

@Test
public void createNetworTest() throws Exception {
    String cloudRegionPo = "cloudRegionPo";
    CreateNetworkRequest expectedCreateNetworkRequest = new CreateNetworkRequest();
    expectedCreateNetworkRequest.setCloudSiteId(cloudRegionPo);
    expectedCreateNetworkRequest.setTenantId(cloudRegion.getTenantId());
    expectedCreateNetworkRequest.setNetworkId(l3Network.getNetworkId());
    expectedCreateNetworkRequest.setNetworkName(l3Network.getNetworkName());
    expectedCreateNetworkRequest.setBackout(false);
    expectedCreateNetworkRequest.setFailIfExists(true);
    MsoRequest msoRequest = new MsoRequest();
    msoRequest.setRequestId(requestContext.getMsoRequestId());
    msoRequest.setServiceInstanceId(serviceInstance.getServiceInstanceId());
    expectedCreateNetworkRequest.setMsoRequest(msoRequest);
    expectedCreateNetworkRequest.setSkipAAI(true);
    Subnet openstackSubnet = new Subnet();
    HostRoute hostRoute = new HostRoute();
    hostRoute.setHostRouteId("hostRouteId");
    hostRoute.setNextHop("nextHop");
    hostRoute.setRoutePrefix("routePrefix");
    openstackSubnet.getHostRoutes().add(hostRoute);
    List<Subnet> subnetList = new ArrayList<Subnet>();
    subnetList.add(openstackSubnet);
    l3Network.getSubnets().add(openstackSubnet);
    l3Network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
    CreateNetworkRequest createNetworkRequest = new CreateNetworkRequest();
    createNetworkRequest.setCloudSiteId("cloudSiteId");
    CreateNetworkResponse expectedCreateNetworkResponse = new CreateNetworkResponse();
    expectedCreateNetworkResponse.setNetworkStackId("networkStackId");
    expectedCreateNetworkResponse.setNetworkCreated(true);
    doReturn(expectedCreateNetworkResponse).when(MOCK_networkAdapterClient).createNetwork(isA(CreateNetworkRequest.class));
    doReturn(createNetworkRequest).when(MOCK_networkAdapterObjectMapper).createNetworkRequestMapper(isA(RequestContext.class), isA(CloudRegion.class), isA(OrchestrationContext.class), isA(ServiceInstance.class), isA(L3Network.class), isA(Map.class), isA(String.class), isA(Customer.class));
    CreateNetworkResponse actualCreateNetwrokResponse = (networkAdapterResources.createNetwork(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer)).get();
    verify(MOCK_networkAdapterClient, times(1)).createNetwork(createNetworkRequest);
    verify(MOCK_networkAdapterObjectMapper, times(1)).createNetworkRequestMapper(requestContext, cloudRegion, orchestrationContext, serviceInstance, l3Network, userInput, cloudRegionPo, customer);
    assertThat(expectedCreateNetworkResponse, Matchers.sameBeanAs(actualCreateNetwrokResponse));
}
Also used : CloudRegion(org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion) L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) CreateNetworkRequest(org.onap.so.adapters.nwrest.CreateNetworkRequest) Customer(org.onap.so.bpmn.servicedecomposition.bbobjects.Customer) CreateNetworkResponse(org.onap.so.adapters.nwrest.CreateNetworkResponse) ArrayList(java.util.ArrayList) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) OrchestrationContext(org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext) MsoRequest(org.onap.so.entity.MsoRequest) HostRoute(org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute) RequestContext(org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext) Subnet(org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet) Map(java.util.Map) Test(org.junit.Test)

Aggregations

L3Network (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network)68 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)34 Test (org.junit.Test)29 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)18 AAIResultWrapper (org.onap.aaiclient.client.aai.entities.AAIResultWrapper)13 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)12 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)12 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)11 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)11 Service (org.onap.so.db.catalog.beans.Service)11 File (java.io.File)10 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)10 RequestDetails (org.onap.so.serviceinstancebeans.RequestDetails)10 Relationships (org.onap.aaiclient.client.aai.entities.Relationships)9 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)9 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)9 AAIResourceUri (org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri)8 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)8 ModelInfoNetwork (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork)8 ArrayList (java.util.ArrayList)7