From dade3b0456315cebda3ac655060f80d2e43a2a1d Mon Sep 17 00:00:00 2001 From: sanket12345 Date: Wed, 15 Sep 2021 20:20:00 +0530 Subject: Cnf-adapter is not able to update relationship in AAI Passing 2 more parameters vnfId and vfmoduleId from bpmn-infra to cnf-adapter Issue-ID: SO-3761 Signed-off-by: sanket12345 Change-Id: I79f12f115d112d713f32f0a400aeb6532d7c6ade --- .../adapter/cnf/tasks/CnfAdapterCreateTasks.java | 17 +++++++++++--- .../adapter/cnf/entities/CnfAaiUpdateRequest.java | 26 +++++++++++++++++++++- 2 files changed, 39 insertions(+), 4 deletions(-) (limited to 'bpmn/so-bpmn-tasks/src') 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 2dda26718f..ed01f2271f 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 @@ -130,6 +130,14 @@ public class CnfAdapterCreateTasks { public void prepareForCnfUpdateOrDelete(BuildingBlockExecution execution) { GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + GenericVnf genericVnfId = null; + VfModule vfModuleId = null; + try { + genericVnfId = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + vfModuleId = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + } catch (Exception ex) { + logger.error("Exception occurred", ex); + } String heatStackId = execution.getVariable("heatStackId"); @@ -140,7 +148,9 @@ public class CnfAdapterCreateTasks { String callbackUrl = "http://so-bpmn-infra.onap:8081/mso/WorkflowMessage/" + CNF_ADAPTER_MESSAGE_TYPE + "/" + requestId; - CnfAaiUpdateRequest aaiRequest = createCnfAaiUpdateRequest(heatStackId, cloudRegion, callbackUrl); + CnfAaiUpdateRequest aaiRequest = + createCnfAaiUpdateRequest(heatStackId, cloudRegion, callbackUrl, genericVnfId, vfModuleId); + logger.debug("aaiRequest: {}", aaiRequest); String cnfRequestPayload = ""; @@ -192,14 +202,15 @@ public class CnfAdapterCreateTasks { } protected CnfAaiUpdateRequest createCnfAaiUpdateRequest(String heatStackId, CloudRegion cloudRegion, - String callbackUrl) { + String callbackUrl, GenericVnf genericVnfId, VfModule vfModuleId) { CnfAaiUpdateRequest request = new CnfAaiUpdateRequest(); request.setCallbackUrl(callbackUrl); request.setCloudOwner(cloudRegion.getCloudOwner()); request.setCloudRegion(cloudRegion.getLcpCloudRegionId()); request.setTenantId(cloudRegion.getTenantId()); request.setInstanceId(heatStackId); - + request.setGenericVnfId(genericVnfId.getVnfId()); + request.setVfModuleId(vfModuleId.getVfModuleId()); return request; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/CnfAaiUpdateRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/CnfAaiUpdateRequest.java index 4cc675f4e9..2847074e66 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/CnfAaiUpdateRequest.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/cnf/entities/CnfAaiUpdateRequest.java @@ -23,6 +23,13 @@ public class CnfAaiUpdateRequest { @JsonProperty("callbackUrl") private String callbackUrl; + @JsonProperty("genericVnfId") + private String genericVnfId; + + @JsonProperty("vfModuleId") + private String vfModuleId; + + public String getInstanceId() { return instanceId; } @@ -63,10 +70,27 @@ public class CnfAaiUpdateRequest { this.callbackUrl = callbackUrl; } + public String getGenericVnfId() { + return genericVnfId; + } + + public void setGenericVnfId(String genericVnfId) { + this.genericVnfId = genericVnfId; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(String vfModuleId) { + this.vfModuleId = vfModuleId; + } + @Override public String toString() { return "CnfAaiUpdateRequest [instanceId=" + instanceId + ", cloudRegion=" + cloudRegion + ", cloudOwner=" - + cloudOwner + ", tenantId=" + tenantId + ", callbackUrl=" + callbackUrl + "]"; + + cloudOwner + ", tenantId=" + tenantId + ", callbackUrl=" + callbackUrl + ", genericVnfId=" + + genericVnfId + ", vfModuleId=" + vfModuleId + " ]"; } } -- cgit 1.2.3-korg