diff options
author | Lukasz Rajewski <lukasz.rajewski@orange.com> | 2021-03-24 21:59:41 +0100 |
---|---|---|
committer | Lukasz Rajewski <lukasz.rajewski@orange.com> | 2021-03-24 22:08:39 +0100 |
commit | d51e9c1c6f2a2c792113a041561c46a836026ce8 (patch) | |
tree | 1d5b90cbfb08203f7cfd21ec96be2037262a1399 /so-cnf-adapter-application/src | |
parent | 7c813eb513eb2ee853bab3d0c85b6250186d9fc0 (diff) |
Fix for invalid CNF release name
Fix for invalid CNF release name. When CNF is created
with Release.Name as a base for name today it receives
vfMouleId which may be invalid. Fix changes way of
release name generation.
Issue-ID: SO-3607
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com>
Change-Id: If5413d48d51917a622fe840fb94d50d40992990a
Diffstat (limited to 'so-cnf-adapter-application/src')
3 files changed, 23 insertions, 7 deletions
diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/BpmnInstanceRequest.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/BpmnInstanceRequest.java index 2e76d51..842ef8b 100644 --- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/BpmnInstanceRequest.java +++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/BpmnInstanceRequest.java @@ -13,6 +13,9 @@ public class BpmnInstanceRequest { @JsonProperty(value = "modelVersionId") private String modelVersionId; + @JsonProperty(value = "k8sRBInstanceReleaseName") + private String k8sRBInstanceReleaseName; + @JsonProperty(value = "k8sRBProfileName") private String k8sRBProfileName; @@ -52,6 +55,14 @@ public class BpmnInstanceRequest { this.k8sRBProfileName = k8sRBProfileName; } + public String getK8sRBInstanceReleaseName() { + return k8sRBInstanceReleaseName; + } + + public void setK8sRBInstanceReleaseName(String k8sRBInstanceReleaseName) { + this.k8sRBInstanceReleaseName = k8sRBInstanceReleaseName; + } + public String getCloudRegionId() { return cloudRegionId; } diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/MulticloudInstanceRequest.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/MulticloudInstanceRequest.java index b1719cb..20af63e 100644 --- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/MulticloudInstanceRequest.java +++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/model/MulticloudInstanceRequest.java @@ -26,7 +26,7 @@ public class MulticloudInstanceRequest { private Map<String, String> overrideValues; @JsonProperty(value = "release-name") - private String vfModuleUuid; + private String releaseName; public String getCloudRegion() { return cloudRegion; @@ -76,12 +76,12 @@ public class MulticloudInstanceRequest { this.overrideValues = overrideValues; } - public String getVfModuleUuid() { - return vfModuleUuid; + public String getReleaseName() { + return releaseName; } - public void setVfModuleUuid(String vfModuleUuid) { - this.vfModuleUuid = vfModuleUuid; + public void setReleaseName(String releaseName) { + this.releaseName = releaseName; } } diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java index a134bac..d1314dd 100644 --- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java +++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/service/CnfAdapterService.java @@ -83,14 +83,19 @@ public class CnfAdapterService { logger.info("CnfAdapterService createInstance called"); MulticloudInstanceRequest multicloudInstanceRequest = new MulticloudInstanceRequest(); ResponseEntity<String> instanceResponse = null; - if (bpmnInstanceRequest.getK8sRBProfileName() != null) { + if (bpmnInstanceRequest.getK8sRBProfileName() != null) { multicloudInstanceRequest.setCloudRegion(bpmnInstanceRequest.getCloudRegionId()); multicloudInstanceRequest.setLabels(bpmnInstanceRequest.getLabels()); multicloudInstanceRequest.setOverrideValues(bpmnInstanceRequest.getOverrideValues()); multicloudInstanceRequest.setProfileName(bpmnInstanceRequest.getK8sRBProfileName()); multicloudInstanceRequest.setRbName(bpmnInstanceRequest.getModelInvariantId()); multicloudInstanceRequest.setRbVersion(bpmnInstanceRequest.getModelVersionId()); - multicloudInstanceRequest.setVfModuleUuid(bpmnInstanceRequest.getVfModuleUUID()); + + if (bpmnInstanceRequest.getK8sRBInstanceReleaseName() != null) + multicloudInstanceRequest.setReleaseName(bpmnInstanceRequest.getK8sRBInstanceReleaseName()); + else + multicloudInstanceRequest.setReleaseName( + bpmnInstanceRequest.getK8sRBProfileName() + "-" + bpmnInstanceRequest.getVfModuleUUID()); } else { logger.error("k8sProfileName should not be null"); // return instanceResponse; |