Search in sources :

Example 21 with InstanceGroup

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

the class UnassignVnfTest method deleteInstanceGroupsSunnyDayTest.

@Test
public void deleteInstanceGroupsSunnyDayTest() throws Exception {
    GenericVnf genericVnf = setGenericVnf();
    ModelInfoInstanceGroup modelVnfc = new ModelInfoInstanceGroup();
    modelVnfc.setType("VNFC");
    InstanceGroup instanceGroup1 = new InstanceGroup();
    instanceGroup1.setId("test-001");
    instanceGroup1.setModelInfoInstanceGroup(modelVnfc);
    genericVnf.getInstanceGroups().add(instanceGroup1);
    InstanceGroup instanceGroup2 = new InstanceGroup();
    instanceGroup2.setId("test-002");
    instanceGroup2.setModelInfoInstanceGroup(modelVnfc);
    genericVnf.getInstanceGroups().add(instanceGroup2);
    when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
    unassignVnf.deleteInstanceGroups(execution);
    verify(aaiInstanceGroupResources, times(1)).deleteInstanceGroup(eq(instanceGroup1));
    verify(aaiInstanceGroupResources, times(1)).deleteInstanceGroup(eq(instanceGroup2));
}
Also used : ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup) ModelInfoInstanceGroup(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup) BaseTaskTest(org.onap.so.bpmn.BaseTaskTest) Test(org.junit.Test)

Example 22 with InstanceGroup

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

the class AAICreateTasks method createNetworkCollectionInstanceGroup.

/**
 * BPMN access method to execute NetworkCollectionInstanceGroup operation (PUT) in AAI
 *
 * @param execution
 * @throws Exception
 */
public void createNetworkCollectionInstanceGroup(BuildingBlockExecution execution) {
    try {
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        InstanceGroup instanceGroup = serviceInstance.getCollection().getInstanceGroup();
        // set name generated for NetworkCollection/NetworkCollectionInstanceGroup in previous step of the BB flow
        instanceGroup.setInstanceGroupName(execution.getVariable(NETWORK_COLLECTION_NAME));
        // put shell in AAI
        aaiNetworkResources.createNetworkInstanceGroup(instanceGroup);
    } catch (Exception ex) {
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
    }
}
Also used : ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup)

Example 23 with InstanceGroup

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

the class TestDataSetup method setInstanceGroup.

public InstanceGroup setInstanceGroup() {
    InstanceGroup instanceGroup = new InstanceGroup();
    instanceGroup.setId("testId");
    instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction");
    Collection collection = null;
    try {
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        collection = serviceInstance.getCollection();
        if (collection == null) {
            collection = setCollection();
        }
    } catch (BBObjectNotFoundException e) {
        collection = setCollection();
    }
    collection.setInstanceGroup(instanceGroup);
    return instanceGroup;
}
Also used : BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException) Collection(org.onap.so.bpmn.servicedecomposition.bbobjects.Collection) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup)

Example 24 with InstanceGroup

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

the class TestDataSetup method setInstanceGroupVnf.

public InstanceGroup setInstanceGroupVnf() {
    InstanceGroup instanceGroup = buildInstanceGroup();
    ServiceInstance serviceInstance = null;
    try {
        serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
    } catch (BBObjectNotFoundException e) {
        serviceInstance = setServiceInstance();
    }
    serviceInstance.getInstanceGroups().add(instanceGroup);
    lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroup.getId());
    return instanceGroup;
}
Also used : BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup)

Example 25 with InstanceGroup

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

the class BuildingBlockTestDataSetup method setInstanceGroup.

public InstanceGroup setInstanceGroup() {
    InstanceGroup instanceGroup = new InstanceGroup();
    instanceGroup.setId("testId");
    instanceGroup.setInstanceGroupFunction("testInstanceGroupFunction");
    Collection collection = null;
    try {
        ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
        collection = serviceInstance.getCollection();
        if (collection == null) {
            collection = setCollection();
        }
    } catch (BBObjectNotFoundException e) {
        collection = setCollection();
    }
    collection.setInstanceGroup(instanceGroup);
    return instanceGroup;
}
Also used : BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException) Collection(org.onap.so.bpmn.servicedecomposition.bbobjects.Collection) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) ModelInfoServiceInstance(org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup)

Aggregations

InstanceGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup)32 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)14 ModelInfoInstanceGroup (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup)13 Test (org.junit.Test)9 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)9 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)9 Collection (org.onap.so.bpmn.servicedecomposition.bbobjects.Collection)8 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)7 ArrayList (java.util.ArrayList)6 Service (org.onap.so.db.catalog.beans.Service)4 AAIFluentTypeBuilder (org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder)3 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)3 ServiceSubscription (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription)3 ModelInfoCollection (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoCollection)3 CollectionResource (org.onap.so.db.catalog.beans.CollectionResource)3 NetworkCollectionResourceCustomization (org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization)3 HashMap (java.util.HashMap)2 Before (org.junit.Before)2 GenericResourceApiVnfOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation)2 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)2