import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.UPDATE_INSTANCE;
import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.HEALTH_CHECK;
import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.WORKFLOW_ACTION_ERROR_MESSAGE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.UPGRADE_CNF;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader.NetworkSliceSubnetEBBLoader;
import org.onap.so.bpmn.common.BBConstants;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader.PnfEBBLoader;
import org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader.ServiceEBBLoader;
import org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader.VnfEBBLoader;
import org.onap.so.bpmn.infrastructure.workflow.tasks.excpetion.VnfcMultipleRelationshipException;
private static final String VNF_TYPE = "vnfType";
private static final String CONFIGURATION = "Configuration";
private static final String SUPPORTEDTYPES =
- "vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances|instanceGroups";
+ "vnfs|pnfs|cnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances|instanceGroups|NetworkSliceSubnet";
private static final String HOMINGSOLUTION = "Homing_Solution";
private static final String SERVICE_TYPE_TRANSPORT = "TRANSPORT";
private static final String SERVICE_TYPE_BONDING = "BONDING";
@Autowired
private VnfEBBLoader vnfEBBLoader;
@Autowired
+ private PnfEBBLoader pnfEBBLoader;
+ @Autowired
private ServiceEBBLoader serviceEBBLoader;
+ @Autowired
+ private NetworkSliceSubnetEBBLoader networkSliceSubnetEBBLoader;
public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) {
this.bbInputSetupUtils = bbInputSetupUtils;
List<Resource> resourceList = new ArrayList<>();
List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
- if (resourceType == WorkflowType.SERVICE || isVNFCreate(resourceType, requestAction)) {
+ if (resourceType == WorkflowType.SERVICE || isVNFCreate(resourceType, requestAction)
+ || isPNFCreate(resourceType, requestAction)) {
resourceList = serviceEBBLoader.getResourceListForService(sIRequest, requestAction, execution,
serviceInstanceId, resourceId, aaiResourceIds);
+ } else if (resourceType == WorkflowType.NETWORK_SLICE_SUBNET) {
+ resourceList = networkSliceSubnetEBBLoader.setNetworkSliceSubnetResource(resourceId);
+ } else if (isPNFDelete(resourceType, requestAction)) {
+ pnfEBBLoader.traverseAAIPnf(execution, resourceList, workflowResourceIds.getServiceInstanceId(), resourceId,
+ aaiResourceIds);
+ } else if (isPNFUpdate(resourceType, requestAction)) {
+ pnfEBBLoader.traverseAAIPnf(execution, resourceList, workflowResourceIds.getServiceInstanceId(), resourceId,
+ aaiResourceIds);
} else if (resourceType == WorkflowType.VNF
&& (DELETE_INSTANCE.equalsIgnoreCase(requestAction) || REPLACEINSTANCE.equalsIgnoreCase(requestAction)
|| (RECREATE_INSTANCE.equalsIgnoreCase(requestAction)))) {
} else if (resourceType == WorkflowType.VNF && HEALTH_CHECK.equalsIgnoreCase(requestAction)) {
vnfEBBLoader.customTraverseAAIVnf(execution, resourceList, workflowResourceIds.getServiceInstanceId(),
workflowResourceIds.getVnfId(), aaiResourceIds);
+ } else if (resourceType == WorkflowType.VNF && UPGRADE_CNF.equalsIgnoreCase(requestAction)) {
+ vnfEBBLoader.customTraverseAAIVnf(execution, resourceList, workflowResourceIds.getServiceInstanceId(),
+ workflowResourceIds.getVnfId(), aaiResourceIds);
} else {
buildAndThrowException(execution, "Current Macro Request is not supported");
}
return resourceType == WorkflowType.VNF && CREATE_INSTANCE.equalsIgnoreCase(requestAction);
}
+
+ private boolean isPNFCreate(WorkflowType resourceType, String requestAction) {
+ return resourceType == WorkflowType.PNF && CREATE_INSTANCE.equalsIgnoreCase(requestAction);
+ }
+
+
+ private boolean isPNFDelete(WorkflowType resourceType, String requestAction) {
+ return resourceType == WorkflowType.PNF && DELETE_INSTANCE.equalsIgnoreCase(requestAction);
+ }
+
+ private boolean isPNFUpdate(WorkflowType resourceType, String requestAction) {
+ return resourceType == WorkflowType.PNF && UPDATE_INSTANCE.equalsIgnoreCase(requestAction);
+ }
+
private void setExecutionVariables(DelegateExecution execution, List<ExecuteBuildingBlock> flowsToExecute,
List<String> flowNames) {
execution.setVariable("flowNames", flowNames);
}
protected String convertTypeFromPlural(String type) {
- if (!type.matches(SUPPORTEDTYPES)) {
+ if (!type.matches(SUPPORTEDTYPES) || type.equals("NetworkSliceSubnet")) {
return type;
} else {
if (type.equals(SERVICE_INSTANCES)) {