CNF release name deliverd to CNF adapter 57/119857/2
authorLukasz Rajewski <lukasz.rajewski@orange.com>
Thu, 25 Mar 2021 15:54:03 +0000 (16:54 +0100)
committerLukasz Rajewski <lukasz.rajewski@orange.com>
Thu, 1 Apr 2021 17:07:42 +0000 (19:07 +0200)
CNF release name deliverd to CNF adapter from SO
request allows to provide custome name of the release
what helps to avoid problem with incorrect name
geenrated today from vf-module-id

Issue-ID: SO-3607
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com>
Change-Id: I579b4d78d409701b28306763d11c60b9e75dd0ea

bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn [deleted file]
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java [deleted file]
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java

diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn
deleted file mode 100644 (file)
index 1dc371e..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-<?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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
-  <bpmn:process id="CnfAdapterBB" name="CnfAdapterBB" isExecutable="true">
-    <bpmn:startEvent id="StartEvent_1">
-      <bpmn:outgoing>SequenceFlow_0xb4elc</bpmn:outgoing>
-    </bpmn:startEvent>
-    <bpmn:endEvent id="EndEvent_1ee5kqt">
-      <bpmn:incoming>SequenceFlow_0lc785k</bpmn:incoming>
-    </bpmn:endEvent>
-    <bpmn:sequenceFlow id="SequenceFlow_0xb4elc" sourceRef="StartEvent_1" targetRef="Task_0amo55n" />
-    <bpmn:sequenceFlow id="SequenceFlow_0lc785k" sourceRef="Task_0amo55n" targetRef="EndEvent_1ee5kqt" />
-    <bpmn:serviceTask id="Task_0amo55n" name="Call CnfAdapter" camunda:expression="${CnfAdapter.callCnfAdapter(execution)}">
-      <bpmn:incoming>SequenceFlow_0xb4elc</bpmn:incoming>
-      <bpmn:outgoing>SequenceFlow_0lc785k</bpmn:outgoing>
-    </bpmn:serviceTask>
-    <bpmn:subProcess id="SubProcess_12ghmoa" name="Java Exception Handling Sub Process" triggeredByEvent="true">
-      <bpmn:startEvent id="StartEvent_1pwqeib" name="error">
-        <bpmn:outgoing>SequenceFlow_0hqxgyk</bpmn:outgoing>
-        <bpmn:errorEventDefinition errorRef="Error_0oqb77k" camunda:errorCodeVariable="BPMN_javaExpCode" camunda:errorMessageVariable="BPMN_javaExpMsg" />
-      </bpmn:startEvent>
-      <bpmn:endEvent id="EndEvent_1ysk6aa">
-        <bpmn:incoming>SequenceFlow_0hqxgyk</bpmn:incoming>
-      </bpmn:endEvent>
-      <bpmn:sequenceFlow id="SequenceFlow_0hqxgyk" sourceRef="StartEvent_1pwqeib" targetRef="EndEvent_1ysk6aa" />
-    </bpmn:subProcess>
-  </bpmn:process>
-  <bpmn:error id="Error_0oqb77k" name="java.lang.Exception" errorCode="java.lang.Exception" />
-  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
-    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
-      <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1">
-        <dc:Bounds x="173" y="102" width="36" height="36" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="EndEvent_1ee5kqt_di" bpmnElement="EndEvent_1ee5kqt">
-        <dc:Bounds x="636" y="102" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="654" y="142" width="0" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0xb4elc_di" bpmnElement="SequenceFlow_0xb4elc">
-        <di:waypoint xsi:type="dc:Point" x="209" y="120" />
-        <di:waypoint xsi:type="dc:Point" x="377" y="120" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="293" y="99" width="0" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="SequenceFlow_0lc785k_di" bpmnElement="SequenceFlow_0lc785k">
-        <di:waypoint xsi:type="dc:Point" x="477" y="120" />
-        <di:waypoint xsi:type="dc:Point" x="636" y="120" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="556.5" y="99" width="0" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="ServiceTask_1vbkgmd_di" bpmnElement="Task_0amo55n">
-        <dc:Bounds x="377" y="80" width="100" height="80" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="SubProcess_12ghmoa_di" bpmnElement="SubProcess_12ghmoa" isExpanded="true">
-        <dc:Bounds x="225" y="284" width="404" height="165" />
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="StartEvent_1pwqeib_di" bpmnElement="StartEvent_1pwqeib">
-        <dc:Bounds x="340" y="350" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="346" y="393" width="26" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNShape id="EndEvent_1ysk6aa_di" bpmnElement="EndEvent_1ysk6aa">
-        <dc:Bounds x="472" y="350" width="36" height="36" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="-235" y="114" width="0" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNShape>
-      <bpmndi:BPMNEdge id="SequenceFlow_0hqxgyk_di" bpmnElement="SequenceFlow_0hqxgyk">
-        <di:waypoint xsi:type="dc:Point" x="376" y="368" />
-        <di:waypoint xsi:type="dc:Point" x="472" y="368" />
-        <bpmndi:BPMNLabel>
-          <dc:Bounds x="424" y="347" width="0" height="12" />
-        </bpmndi:BPMNLabel>
-      </bpmndi:BPMNEdge>
-    </bpmndi:BPMNPlane>
-  </bpmndi:BPMNDiagram>
-</bpmn:definitions>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java
deleted file mode 100644 (file)
index a556d30..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.onap.so.bpmn.infrastructure.adapter.cnf.tasks;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.onap.so.client.adapter.cnf.CnfAdapterClient;
-import org.onap.so.client.adapter.cnf.entities.InstanceRequest;
-import org.onap.so.client.adapter.cnf.entities.InstanceResponse;
-import org.onap.so.client.adapter.cnf.entities.Labels;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Component
-public class CnfAdapter {
-
-    @Autowired
-    private CnfAdapterClient cnfAdapterClient;
-
-    private static final Logger logger = LoggerFactory.getLogger(CnfAdapter.class);
-
-    public void callCnfAdapter(DelegateExecution execution) throws Exception {
-        try {
-            InstanceRequest request = new InstanceRequest();
-            request.setRbName("test-rbdef");
-            request.setRbVersion("v1");
-            request.setCloudRegion("krd");
-            request.setVfModuleUUID("VF module UUID");
-            request.setProfileName("p1");
-            Map<String, String> overrideValues = new HashMap<>();
-            overrideValues.put("image.tag", "latest");
-            overrideValues.put("dcae_collector_ip", "1.2.3.4");
-            Map<String, String> labels = new HashMap<String, String>();
-            labels.put("custom-label-1", "abcdef");
-            request.setLabels(labels);
-            request.setOverrideValues(overrideValues);
-            InstanceResponse response = cnfAdapterClient.createVfModule(request);
-        } catch (Exception ex) {
-            logger.error("Exception in callCnfAdapter", ex);
-            throw ex;
-        }
-    }
-}
index 7624bcb..1220dc0 100644 (file)
@@ -114,6 +114,7 @@ public class CnfAdapterCreateTasks {
         request.setCloudRegion(cloudRegion.getLcpCloudRegionId());
         request.setVfModuleUUID(vfModule.getVfModuleId());
         request.setProfileName(sdncDirectives.get("k8s-rb-profile-name"));
+        request.setReleaseName(sdncDirectives.get("k8s-rb-instance-release-name"));
         request.setOverrideValues(sdncDirectives);
         return request;
     }
index 37d4e41..f4b2a8b 100644 (file)
@@ -17,6 +17,8 @@ public class InstanceRequest {
     private String rbVersion;
     @JsonProperty("k8sRBProfileName")
     private String profileName;
+    @JsonProperty("k8sRBInstanceReleaseName")
+    private String releaseName;
     @JsonProperty("vfModuleUUID")
     private String vfModuleUUID;
     @JsonProperty("cloudRegionId")
@@ -56,6 +58,16 @@ public class InstanceRequest {
         this.profileName = profileName;
     }
 
+    @JsonProperty("release-name")
+    public String getReleaseName() {
+        return releaseName;
+    }
+
+    @JsonProperty("release-name")
+    public void setReleaseName(String releaseName) {
+        this.releaseName = releaseName;
+    }
+
     @JsonProperty("cloud-region")
     public String getCloudRegion() {
         return cloudRegion;