diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks/src')
6 files changed, 165 insertions, 4 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java index f2f3b5da08..12723b8183 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java @@ -94,6 +94,14 @@ public class ControllerExecution { ModelInfoServiceInstance modelInfoServiceInstance = gbb.getServiceInstance().getModelInfoServiceInstance(); controllerActor = Optional.ofNullable(modelInfoServiceInstance.getControllerActor()).orElse("CDS"); + } else if ("nssi".equalsIgnoreCase(scope)) { + GeneralBuildingBlock gbb = execution.getGeneralBuildingBlock(); + ModelInfoServiceInstance modelInfoServiceInstance = + gbb.getServiceInstance().getModelInfoServiceInstance(); + logger.info(">>>> modelInfoServiceInstance: {}", modelInfoServiceInstance); + ModelInfoServiceInstance modelInfoServiceInstance1 = execution.getVariable("nssiModelInfo"); + logger.info(">>>> ex1: {}", modelInfoServiceInstance1); + controllerActor = Optional.ofNullable(modelInfoServiceInstance.getControllerActor()).orElse("CDS"); } else { GenericVnf genericVnf = getGenericVnf(execution); String modelUuid = genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid(); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NssiCDSProcessingBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NssiCDSProcessingBB.java new file mode 100644 index 0000000000..df9a0f60b1 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/NssiCDSProcessingBB.java @@ -0,0 +1,87 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (c) 2022 Deutsche telekom + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + + +package org.onap.so.bpmn.infrastructure.flowspecific.tasks; + +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext; +import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable; +import org.onap.so.client.cds.AbstractCDSProcessingBBUtils; +import org.onap.so.client.cds.GeneratePayloadForCds; +import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean; +import org.onap.so.client.exception.ExceptionBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * This class is used in context of Building Block flow for configuration of vnf/vfmodule/service. + * + * @param - BuildingBlockExecution + */ +@Component +public class NssiCDSProcessingBB implements ControllerRunnable<BuildingBlockExecution> { + private static final Logger logger = LoggerFactory.getLogger(NssiCDSProcessingBB.class); + private static final String EXECUTION_OBJECT = "executionObject"; + public static final String CDS_ACTOR = "cds"; + public static final String NSSI_SCOPE = "nssi"; + + @Autowired + private ExceptionBuilder exceptionBuilder; + + @Autowired + private AbstractCDSProcessingBBUtils cdsDispather; + + @Autowired + private GeneratePayloadForCds generatePayloadForCds; + + @Override + public Boolean understand(ControllerContext<BuildingBlockExecution> context) { + String scope = context.getControllerScope(); + return CDS_ACTOR.equalsIgnoreCase(context.getControllerActor()) && NSSI_SCOPE.equalsIgnoreCase(scope); + } + + @Override + public Boolean ready(ControllerContext<BuildingBlockExecution> context) { + return true; + } + + @Override + public void prepare(ControllerContext<BuildingBlockExecution> context) { + BuildingBlockExecution buildingBlockExecution = context.getExecution(); + try { + AbstractCDSPropertiesBean abstractCDSPropertiesBean = + generatePayloadForCds.buildCdsPropertiesBean(buildingBlockExecution); + buildingBlockExecution.setVariable(EXECUTION_OBJECT, abstractCDSPropertiesBean); + } catch (Exception ex) { + logger.error("An exception occurred when creating payload for CDS request", ex); + exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, ex); + } + } + + @Override + public void run(ControllerContext<BuildingBlockExecution> context) { + BuildingBlockExecution obj = context.getExecution(); + cdsDispather.constructExecutionServiceInputObjectBB(obj); + cdsDispather.sendRequestToCDSClientBB(obj); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index 64ae9cb5e0..82f44bc802 100755 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -70,6 +70,7 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; 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; @@ -112,7 +113,7 @@ public class WorkflowAction { private static final String VNF_TYPE = "vnfType"; private static final String CONFIGURATION = "Configuration"; private static final String SUPPORTEDTYPES = - "vnfs|pnfs|cnfs|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"; @@ -144,6 +145,8 @@ public class WorkflowAction { private PnfEBBLoader pnfEBBLoader; @Autowired private ServiceEBBLoader serviceEBBLoader; + @Autowired + private NetworkSliceSubnetEBBLoader networkSliceSubnetEBBLoader; public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) { this.bbInputSetupUtils = bbInputSetupUtils; @@ -300,6 +303,8 @@ public class WorkflowAction { || 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); @@ -840,7 +845,7 @@ public class WorkflowAction { } protected String convertTypeFromPlural(String type) { - if (!type.matches(SUPPORTEDTYPES)) { + if (!type.matches(SUPPORTEDTYPES) || type.equals("NetworkSliceSubnet")) { return type; } else { if (type.equals(SERVICE_INSTANCES)) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java index 7ffd066de5..06afe9a20c 100755 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java @@ -36,6 +36,7 @@ public final class WorkflowActionConstants { public static final String ASSIGN_INSTANCE = "assignInstance"; public static final String CHILD_SERVICE = "ChildService"; public static final String CONFIGURATION = "Configuration"; + public static final String NSSI = "Nssi"; public static final String CONTROLLER = "Controller"; public static final String CREATE_INSTANCE = "createInstance"; public static final String DEACTIVATE_INSTANCE = "deactivateInstance"; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/NetworkSliceSubnetEBBLoader.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/NetworkSliceSubnetEBBLoader.java new file mode 100644 index 0000000000..1d58a16fa2 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/NetworkSliceSubnetEBBLoader.java @@ -0,0 +1,60 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2022 DTAG + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader; + +import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource; +import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup; +import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils; +import org.onap.so.client.exception.ExceptionBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +import java.util.ArrayList; +import java.util.List; + +@Component +public class NetworkSliceSubnetEBBLoader { + + private static final Logger logger = LoggerFactory.getLogger(VnfEBBLoader.class); + + private final BBInputSetupUtils bbInputSetupUtils; + private final BBInputSetup bbInputSetup; + private final WorkflowActionExtractResourcesAAI workflowActionUtils; + private final ExceptionBuilder exceptionBuilder; + + NetworkSliceSubnetEBBLoader(BBInputSetupUtils bbInputSetupUtils, BBInputSetup bbInputSetup, + WorkflowActionExtractResourcesAAI workflowActionUtils, ExceptionBuilder exceptionBuilder) { + this.bbInputSetupUtils = bbInputSetupUtils; + this.bbInputSetup = bbInputSetup; + this.workflowActionUtils = workflowActionUtils; + this.exceptionBuilder = exceptionBuilder; + } + + + public List<Resource> setNetworkSliceSubnetResource(String serviceId) { + Resource networkSliceSubnetResource = new Resource(WorkflowType.NETWORK_SLICE_SUBNET, serviceId, false, null); + List<Resource> resourceList = new ArrayList<>(); + resourceList.add(networkSliceSubnetResource); + return resourceList; + } +} + diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/ApiHandlerClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/ApiHandlerClient.java index 132e618ba5..e92f68f5ff 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/ApiHandlerClient.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/ApiHandlerClient.java @@ -19,9 +19,9 @@ public class ApiHandlerClient { @Value("${mso.adapters.apihandler.serviceInstantiationEndpoint:/onap/so/infra/serviceInstantiation/v7/serviceInstances}") private String serviceInstantiationEndpoint; - @Value("${mso.adapters.apihandler.endpoint}") + @Value("${mso.adapters.apihandler.endpoint:http://localhost:8080}") private String baseUri; - @Value("${mso.adapters.apihandler.auth}") + @Value("${mso.adapters.apihandler.auth:Basic dGVzdDp0ZXN0Cg==}") private String auth; private RestTemplate restTemplate; |