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 <SX00562924@techmahindra.com>
Change-Id: I79f12f115d112d713f32f0a400aeb6532d7c6ade
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 2dda267..ed01f22 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 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 @@
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 @@
}
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 4cc675f..2847074 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 @@
@JsonProperty("callbackUrl")
private String callbackUrl;
+ @JsonProperty("genericVnfId")
+ private String genericVnfId;
+
+ @JsonProperty("vfModuleId")
+ private String vfModuleId;
+
+
public String getInstanceId() {
return instanceId;
}
@@ -63,10 +70,27 @@
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 + " ]";
}
}