summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukasz Rajewski <lukasz.rajewski@orange.com>2021-03-25 16:54:03 +0100
committerLukasz Rajewski <lukasz.rajewski@orange.com>2021-04-07 13:39:57 +0000
commit639b74f5296941127ffc7b4cbfa8453d1b87e97c (patch)
treef6b384095a75572fa81bd751663ea5647d6e8d3c
parent4855a220b07a6199516beb3bc406fa52c98eea10 (diff)
CNF release name deliverd to CNF adapter
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 (cherry picked from commit 241119566c555d589483af9e9cd44f4dbe55d69a)
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn80
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java44
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java12
4 files changed, 13 insertions, 124 deletions
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
index 1dc371e054..0000000000
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn
+++ /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
index a556d3088c..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.java
+++ /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;
- }
- }
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java
index 7624bcb811..1220dc05c1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapterCreateTasks.java
@@ -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;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java
index 37d4e41553..f4b2a8b4b1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/InstanceRequest.java
@@ -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;