('VNF-InPlaceUpdate', 'inPlaceSoftwareUpdate', 'Vnf', true, true, '7','7', 'DEFAULT', '*'),
('VNF-Config-Update', 'applyUpdatedConfig', 'Vnf', true, true, '7','7', 'DEFAULT', '*'),
('CNF-Macro-Upgrade', 'upgradeCnf', 'Vnf', false,true, '7', '7','DEFAULT', '*'),
-('Cnf-Create', 'createInstance', 'Cnf', true, true, '7','7','DEFAULT', '*');
+('Cnf-Create', 'createInstance', 'Cnf', true, true, '7','7','DEFAULT', '*'),
+('Cnf-Delete', 'deleteInstance', 'Cnf', true, true, '7','7','DEFAULT', '*');
INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, SCOPE, ACTION, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID) VALUES
('CNF-Macro-Upgrade', '10', 'ChangeModelVnfBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
('CNF-Macro-Upgrade', '11', 'ActivateVnfBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
('CNF-Macro-Upgrade', '12', 'AAIUnsetVnfInMaintBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'CNF-Macro-Upgrade' and CLOUD_OWNER = 'DEFAULT')),
-('CNF-Create', '1', 'CnfInstantiateBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Cnf-Create' and CLOUD_OWNER = 'DEFAULT'));
+('CNF-Create', '1', 'CnfInstantiateBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Cnf-Create' and CLOUD_OWNER = 'DEFAULT')),
+('CNF-Delete', '1', 'CnfDeleteBB', NULL, NULL, 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Cnf-Delete' and CLOUD_OWNER = 'DEFAULT'));
INSERT INTO rainy_day_handler_macro (FLOW_NAME, SERVICE_TYPE, VNF_TYPE, ERROR_CODE, WORK_STEP, POLICY, SECONDARY_POLICY, REG_EX_ERROR_MESSAGE, SERVICE_ROLE)
VALUES
('VNFHealthCheckActivity','*','*','*','*','Manual','Abort','*', '*'),
('VNFConfigModifyActivity','*','*','*','*','Manual','Abort','*', '*'),
('VNFUnsetInMaintFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
-('VNFUnsetClosedLoopDisabledActivity','*','*','*','*','Manual','Abort','*', '*');
+('VNFUnsetClosedLoopDisabledActivity','*','*','*','*','Manual','Abort','*', '*'),
+('CnfDeleteBB', '*', '*', '*', '*' , 'Abort', 'Abort', '*', '*');
INSERT INTO building_block_detail (building_block_name, resource_type, target_action)
VALUES
('StatusCheckBB', 'NO_VALIDATE', 'CUSTOM'),
('HealthCheckBB', 'NO_VALIDATE', 'CUSTOM'),
('UpgradeVfModuleBB', 'NO_VALIDATE', 'CUSTOM'),
-('CnfInstantiateBB', 'CNF', 'ACTIVATE');
+('CnfInstantiateBB', 'CNF', 'ACTIVATE'),
+('CnfDeleteBB', 'CNF', 'DEACTIVATE');
INSERT INTO orchestration_status_state_transition_directive (resource_type, orchestration_status, target_action, flow_directive)
('CONFIGURATION', 'PENDING ACTIVATION', 'DEACTIVATE', 'FAIL'),
('CONFIGURATION', 'PENDING', 'DEACTIVATE', 'FAIL'),
('VNF','CONFIGDEPLOYED','ACTIVATE','CONTINUE'),
-('CNF','PRECREATED','ACTIVATE','CONTINUE');
+('CNF','PRECREATED','ACTIVATE','CONTINUE'),
+('CNF','PRECREATED','DEACTIVATE','CONTINUE');
INSERT INTO vnf_components_recipe (VNF_TYPE, VNF_COMPONENT_TYPE, ACTION, VERSION, ORCHESTRATION_URI, RECIPE_TIMEOUT)
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:modeler="http://camunda.org/schema/modeler/1.0" id="Definitions_0lxlukw" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.12.0" modeler:executionPlatform="Camunda Platform" modeler:executionPlatformVersion="7.15.0">
+ <bpmn:process id="CnfDeleteBB" name="Invoke CNFM to Delete ASInstance" isExecutable="true">
+ <bpmn:startEvent id="StartEvent_0ru3x55">
+ <bpmn:outgoing>SequenceFlow_016sgof</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:endEvent id="EndEvent_001k15i">
+ <bpmn:incoming>Flow_1s7gtbc</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="invokeCnfmToDeleteAsInstnace" name="invoke CNFM to DeleteASInstance" camunda:asyncAfter="true" camunda:expression="${CnfDeleteTask.invokeCnfmToDeleteAsInstnace(InjectExecution.execute(execution, execution.getVariable("gBuildingBlockExecution")))}">
+ <bpmn:incoming>SequenceFlow_016sgof</bpmn:incoming>
+ <bpmn:outgoing>Flow_1s7gtbc</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_016sgof" sourceRef="StartEvent_0ru3x55" targetRef="invokeCnfmToDeleteAsInstnace" />
+ <bpmn:sequenceFlow id="Flow_1s7gtbc" sourceRef="invokeCnfmToDeleteAsInstnace" targetRef="EndEvent_001k15i" />
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="CnfDeleteBB">
+ <bpmndi:BPMNEdge id="Flow_1s7gtbc_di" bpmnElement="Flow_1s7gtbc">
+ <di:waypoint x="390" y="120" />
+ <di:waypoint x="492" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_016sgof_di" bpmnElement="SequenceFlow_016sgof">
+ <di:waypoint x="208" y="120" />
+ <di:waypoint x="290" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_0ru3x55_di" bpmnElement="StartEvent_0ru3x55">
+ <dc:Bounds x="172" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_001k15i_di" bpmnElement="EndEvent_001k15i">
+ <dc:Bounds x="492" y="102" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_11_di" bpmnElement="invokeCnfmToDeleteAsInstnace">
+ <dc:Bounds x="290" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
--- /dev/null
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2022 Ericsson. All rights reserved.
+ * ================================================================================
+ * 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.so.bpmn.infrastructure.adapter.cnfm.tasks;
+
+import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import static java.util.Objects.isNull;
+
+
+/**
+ * This class performs CNF Delete
+ *
+ * @author raviteja.karumuri@est.tech
+ */
+@Component
+public class CnfDeleteTask {
+
+ private static final String AS_INSTANCE_ID = "asInstanceid";
+ private static final Logger LOGGER = LoggerFactory.getLogger(CnfInstantiateTask.class);
+ private final ExceptionBuilder exceptionUtil;
+ private final CnfmHttpServiceProvider cnfmHttpServiceProvider;
+
+ @Autowired
+ public CnfDeleteTask(final CnfmHttpServiceProvider cnfmHttpServiceProvider, final ExceptionBuilder exceptionUtil) {
+ this.cnfmHttpServiceProvider = cnfmHttpServiceProvider;
+ this.exceptionUtil = exceptionUtil;
+ }
+
+ public void invokeCnfmToDeleteAsInstnace(final BuildingBlockExecution execution) {
+ try {
+ LOGGER.debug("Executing DelteAsInstance task ...");
+ final ExecuteBuildingBlock executeBuildingBlock =
+ (ExecuteBuildingBlock) execution.getVariable("buildingBlock");
+
+ final GeneralBuildingBlock generalBuildingBlock = execution.getGeneralBuildingBlock();
+
+ final RequestDetails requestDetails = executeBuildingBlock.getRequestDetails();
+ LOGGER.debug("RequestDetails of DeleteAsInstance: {}", requestDetails);
+
+ if (isNull(requestDetails) && isNull(requestDetails.getModelInfo())
+ && isNull(requestDetails.getRequestInfo()) && isNull(requestDetails.getCloudConfiguration())
+ && isNull(generalBuildingBlock)) {
+ LOGGER.error("Missing Mandatory attribute from RequestDetails: {} or GeneralBuildingBlock: {}",
+ requestDetails, generalBuildingBlock);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000,
+ "Missing Mandatory attribute from RequestDetails or GeneralBuildingBlock", ONAPComponents.SO);
+ }
+
+ LOGGER.debug("Finished executing DeleteAsInstance task ...");
+
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to invoke DeleteAsInstance", exception);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2001, exception);
+ }
+ }
+}
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
- * ================================================================================
+ * ================================================================================
* Modifications Copyright (c) 2022 Ericsson. All rights reserved.
* ================================================================================
* 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.
}
}
+ @DELETE
+ @Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/cnfs/{asInstanceId}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Delete provided for CNF instance",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ @Transactional
+ public Response deleteCnfInstance(String request, @PathParam("version") String version,
+ @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("asInstanceId") String asInstanceId,
+ @Context ContainerRequestContext requestContext) throws ApiException {
+ logger.debug("Inside API Handler to perform delete CNF Instance");
+ String requestId = requestHandlerUtils.getRequestId(requestContext);
+ HashMap<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("asInstanceId", asInstanceId);
+ return serviceInstances(request, Action.deleteInstance, instanceIdMap, version, requestId,
+ requestHandlerUtils.getRequestUri(requestContext, uriPrefix));
+ }
+
@POST
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/upgrade")
@Consumes(MediaType.APPLICATION_JSON)