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