diff options
author | Lukasz Rajewski <lukasz.rajewski@orange.com> | 2021-07-28 17:27:45 +0200 |
---|---|---|
committer | Lukasz Rajewski <lukasz.rajewski@orange.com> | 2021-07-28 18:02:37 +0200 |
commit | abf840bdbe771bdb71efa09e0edf0726d324a274 (patch) | |
tree | cfca7f19580bb0905e233e7c7e2cf388507999a3 /so-cnf-adapter-application/src/main/java/org/onap | |
parent | 8ee120e21f2c894a18e0585504cc1f95c08a8f4b (diff) |
Change rb-definition-version identifier
Change rb-definition-version identifier. As a consequnece
the vf-module-model-customization-uuid will be used to
identify the version of the rb definition. Also cleaned
property setup for CNFAdapter create instance request
Issue-ID: MULTICLOUD-1377
Signed-off-by: Lukasz Rajewski <lukasz.rajewski@orange.com>
Change-Id: Ifd0f41b2491c62670d8b6af4c1144d718bbab4c2
Diffstat (limited to 'so-cnf-adapter-application/src/main/java/org/onap')
2 files changed, 45 insertions, 4 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 f6691a4..a77d6bb 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,12 +13,18 @@ public class BpmnInstanceRequest { @JsonProperty(value = "modelVersionId") private String modelVersionId; + @JsonProperty(value = "modelCustomizationId") + private String modelCustomizationId; + @JsonProperty(value = "k8sRBInstanceReleaseName") private String k8sRBInstanceReleaseName; @JsonProperty(value = "k8sRBProfileName") private String k8sRBProfileName; + @JsonProperty("k8sRBInstanceStatusCheck") + private Boolean k8sRBInstanceStatusCheck = false; + @JsonProperty(value = "cloudRegionId") private String cloudRegionId; @@ -47,6 +53,14 @@ public class BpmnInstanceRequest { this.modelVersionId = modelVersionId; } + public String getModelCustomizationId() { + return modelCustomizationId; + } + + public void setModelCustomizationId(String modelCustomizationId) { + this.modelCustomizationId = modelCustomizationId; + } + public String getK8sRBProfileName() { return k8sRBProfileName; } @@ -63,6 +77,12 @@ public class BpmnInstanceRequest { this.k8sRBInstanceReleaseName = k8sRBInstanceReleaseName; } + public Boolean getK8sRBInstanceStatusCheck() { return k8sRBInstanceStatusCheck; } + + public void setK8sRBInstanceStatusCheck(Boolean k8sRBInstanceStatusCheck) { + this.k8sRBInstanceStatusCheck = k8sRBInstanceStatusCheck; + } + public String getCloudRegionId() { return cloudRegionId; } 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 b50658f..faef1d0 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 @@ -71,7 +71,9 @@ public class CnfAdapterService { // for configuration String endpoint = UriBuilder.fromUri(uri).path(HEALTH_CHECK).build().toString(); HttpEntity<?> requestEntity = new HttpEntity<>(getHttpHeaders()); + logger.info("request: " + requestEntity); result = restTemplate.exchange(endpoint, HttpMethod.GET, requestEntity, String.class); + logger.info("response: " + result); return result.getBody(); } catch (HttpClientErrorException e) { logger.error("Error Calling Multicloud, e"); @@ -97,13 +99,22 @@ public class CnfAdapterService { multicloudInstanceRequest.setOverrideValues(bpmnInstanceRequest.getOverrideValues()); multicloudInstanceRequest.setProfileName(bpmnInstanceRequest.getK8sRBProfileName()); multicloudInstanceRequest.setRbName(bpmnInstanceRequest.getModelInvariantId()); - multicloudInstanceRequest.setRbVersion(bpmnInstanceRequest.getModelVersionId()); + if (bpmnInstanceRequest.getModelCustomizationId() != null) { + multicloudInstanceRequest.setRbVersion(bpmnInstanceRequest.getModelCustomizationId()); + logger.info("vfModuleModelCustomizationId used for rb-version: " + multicloudInstanceRequest.getRbVersion()); + } else { + multicloudInstanceRequest.setRbVersion(bpmnInstanceRequest.getModelVersionId()); + logger.info("vfModuleModelUUID used for rb-version: " + multicloudInstanceRequest.getRbVersion()); + } - if (bpmnInstanceRequest.getK8sRBInstanceReleaseName() != null) + if (bpmnInstanceRequest.getK8sRBInstanceReleaseName() != null) { multicloudInstanceRequest.setReleaseName(bpmnInstanceRequest.getK8sRBInstanceReleaseName()); - else + logger.info("Specified release name used: " + multicloudInstanceRequest.getReleaseName()); + } else { multicloudInstanceRequest.setReleaseName( - bpmnInstanceRequest.getK8sRBProfileName() + "-" + bpmnInstanceRequest.getVfModuleUUID()); + bpmnInstanceRequest.getK8sRBProfileName() + "-" + bpmnInstanceRequest.getVfModuleUUID()); + logger.info("Generated release name used: " + multicloudInstanceRequest.getReleaseName()); + } } else { logger.error("k8sProfileName should not be null"); // return instanceResponse; @@ -113,7 +124,9 @@ public class CnfAdapterService { // for configuration String endpoint = UriBuilder.fromUri(uri).path(INSTANCE_CREATE_PATH).build().toString(); HttpEntity<?> entity = getHttpEntity(multicloudInstanceRequest); + logger.info("request: " + entity); instanceResponse = restTemplate.exchange(endpoint, HttpMethod.POST, entity, String.class); + logger.info("response: " + instanceResponse); return instanceResponse.getBody(); } catch (HttpClientErrorException e) { logger.error("Error Calling Multicloud, e"); @@ -140,7 +153,9 @@ public class CnfAdapterService { String path = "/v1/instance/" + instanceId; String endpoint = UriBuilder.fromUri(uri).path(path).build().toString(); HttpEntity<?> requestEntity = new HttpEntity<>(getHttpHeaders()); + logger.info("request: " + requestEntity); instanceResponse = restTemplate.exchange(endpoint, HttpMethod.GET, requestEntity, String.class); + logger.info("response: " + instanceResponse); return instanceResponse.getBody(); } catch (HttpClientErrorException e) { logger.error("Error Calling Multicloud, e"); @@ -167,7 +182,9 @@ public class CnfAdapterService { String path = "/v1/instance/" + instanceId + "/status"; String endpoint = UriBuilder.fromUri(uri).path(path).build().toString(); HttpEntity<?> requestEntity = new HttpEntity<>(getHttpHeaders()); + logger.info("request: " + requestEntity); instanceResponse = restTemplate.exchange(endpoint, HttpMethod.GET, requestEntity, String.class); + logger.info("response: " + instanceResponse); return instanceResponse.getBody(); } catch (HttpClientErrorException e) { logger.error("Error Calling Multicloud, e"); @@ -189,7 +206,9 @@ public class CnfAdapterService { String path = "/v1/instance/" + instanceId + "/query"; String endpoint = UriBuilder.fromUri(uri).path(path).build().toString(); HttpEntity<?> requestEntity = new HttpEntity<>(getHttpHeaders()); + logger.info("request: " + requestEntity); instanceResponse = restTemplate.exchange(endpoint, HttpMethod.GET, requestEntity, String.class); + logger.info("response: " + instanceResponse); return instanceResponse.getBody(); } catch (HttpClientErrorException e) { if (HttpStatus.SC_NOT_FOUND == e.getStatusCode().value()) { @@ -240,7 +259,9 @@ public class CnfAdapterService { String path = "/v1/instance/" + instanceId; String endpoint = UriBuilder.fromUri(uri).path(path).build().toString(); HttpEntity<?> requestEntity = new HttpEntity<>(getHttpHeaders()); + logger.info("request: " + requestEntity); result = restTemplate.exchange(endpoint, HttpMethod.DELETE, requestEntity, String.class); + logger.info("response: " + result); return result.getBody(); } catch (HttpClientErrorException e) { logger.error("Error Calling Multicloud, e"); |