From 7bddcdd0f01b31e3b0f724654578d186b8023c98 Mon Sep 17 00:00:00 2001 From: Lukasz Rajewski Date: Thu, 25 Mar 2021 16:54:03 +0100 Subject: 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 Change-Id: I579b4d78d409701b28306763d11c60b9e75dd0ea (cherry picked from commit 241119566c555d589483af9e9cd44f4dbe55d69a) --- .../subprocess/BuildingBlock/CnfAdapterBB.bpmn | 80 ---------------------- .../adapter/cnf/tasks/CnfAdapter.java | 44 ------------ .../adapter/cnf/tasks/CnfAdapterCreateTasks.java | 1 + .../adapter/cnf/entities/InstanceRequest.java | 12 ++++ 4 files changed, 13 insertions(+), 124 deletions(-) delete mode 100644 bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn delete mode 100644 bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/cnf/tasks/CnfAdapter.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 index 1dc371e054..0000000000 --- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CnfAdapterBB.bpmn +++ /dev/null @@ -1,80 +0,0 @@ - - - - - SequenceFlow_0xb4elc - - - SequenceFlow_0lc785k - - - - - SequenceFlow_0xb4elc - SequenceFlow_0lc785k - - - - SequenceFlow_0hqxgyk - - - - SequenceFlow_0hqxgyk - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 overrideValues = new HashMap<>(); - overrideValues.put("image.tag", "latest"); - overrideValues.put("dcae_collector_ip", "1.2.3.4"); - Map labels = new HashMap(); - 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; -- cgit 1.2.3-korg