use of org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup in project so by onap.
the class UnassignVnf method deleteInstanceGroups.
/**
* BPMN access method to deleting instanceGroup in AAI.
*
* It will extract the vnf from BBobject ,It will get the instance group from the vnf and add it into a list.
*
* Then iterate that list and check the ModelInfoInstanceGroup type.
*
* Then it will delete that.
*
* @param execution
*/
public void deleteInstanceGroups(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
List<InstanceGroup> instanceGroups = vnf.getInstanceGroups();
for (InstanceGroup instanceGroup : instanceGroups) {
if (ModelInfoInstanceGroup.TYPE_VNFC.equalsIgnoreCase(instanceGroup.getModelInfoInstanceGroup().getType())) {
aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup);
}
}
} catch (Exception ex) {
logger.error("Exception occurred in UnassignVnf deleteInstanceGroups", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup in project so by onap.
the class NamingServiceCreateTasks method createInstanceGroupName.
public void createInstanceGroupName(BuildingBlockExecution execution) throws BBObjectNotFoundException {
InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
String policyInstanceName = execution.getVariable("policyInstanceName");
String nfNamingCode = execution.getVariable("nfNamingCode");
String generatedInstanceGroupName = "";
try {
generatedInstanceGroupName = namingServiceResources.generateInstanceGroupName(instanceGroup, policyInstanceName, nfNamingCode);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
instanceGroup.setInstanceGroupName(generatedInstanceGroupName);
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup in project so by onap.
the class CreateNetworkCollection method buildNetworkCollectionName.
/**
* BPMN access method to build Network Collection Name
*
* @param execution
* @throws Exception
*/
public void buildNetworkCollectionName(BuildingBlockExecution execution) throws Exception {
try {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
InstanceGroup instanceGroup = serviceInstance.getCollection().getInstanceGroup();
if (instanceGroup.getModelInfoInstanceGroup() != null) {
// Build collection name assembling SI name and IG function
if (serviceInstance.getServiceInstanceName() != null && instanceGroup.getModelInfoInstanceGroup().getFunction() != null) {
String networkCollectionName = serviceInstance.getServiceInstanceName().concat(UNDERSCORE).concat(instanceGroup.getModelInfoInstanceGroup().getFunction());
// set networkCollectionName object on execution to be re-used within current BB
execution.setVariable(NETWORK_COLLECTION_NAME, networkCollectionName);
} else {
throw new IllegalArgumentException("Cannot generate collection name because either one or both fields are null: " + " Service Instance Name: " + serviceInstance.getServiceInstanceName() + ", Instance Group Function: " + instanceGroup.getModelInfoInstanceGroup().getFunction());
}
} else {
throw new IllegalArgumentException("Instance group model info is null");
}
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup in project so by onap.
the class AAICreateTasks method createInstanceGroupVnf.
/**
* This method is used for creating vnf instance group in A&AI.
*
* @param execution @throws
*/
public void createInstanceGroupVnf(BuildingBlockExecution execution) {
try {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
aaiInstanceGroupResources.createInstanceGroupandConnectServiceInstance(instanceGroup, serviceInstance);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup in project so by onap.
the class AAIDeleteTasks method deleteInstanceGroupVnf.
/**
* BPMN access method to delete the InstanceGroupVnf from A&AI.
*
* It will extract the instanceGroup from the BBObject.
*
* Then it will delete from A&AI.
*
* @param execution
*/
public void deleteInstanceGroupVnf(BuildingBlockExecution execution) {
try {
InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup);
} catch (Exception ex) {
logger.error("Exception occurred in AAIDeleteTasks deleteInstanceGroupVnf process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
Aggregations