aboutsummaryrefslogtreecommitdiffstats
path: root/appc-inbound
diff options
context:
space:
mode:
authorRamya Balaji <rb111y@att.com>2017-10-27 11:49:49 -0400
committerSkip Wonnell <skip@att.com>2017-10-27 19:10:28 +0000
commit3d240ddc16752cde986a30f53e809d305b34aedc (patch)
tree797b3054e5e747ebcd157dc5fe588c962e78d9b7 /appc-inbound
parent869b83b66f3ca2fb15114bcb20994ad3060d3521 (diff)
Changes to vnfc reference processing
Logic changed to delete existing records for vnf then insert new records per incoming reference artifact. Issue-ID: APPC-297 Change-Id: Iaec59463a41113923cb330c922e83a6061050dd2 Signed-off-by: Ramya Balaji <rb111y@att.com>
Diffstat (limited to 'appc-inbound')
-rw-r--r--appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/dbservices/DBService.java16
-rw-r--r--appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/node/ArtifactHandlerNode.java6
2 files changed, 20 insertions, 2 deletions
diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/dbservices/DBService.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/dbservices/DBService.java
index 41ff4a2f3..b915fd9dc 100644
--- a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/dbservices/DBService.java
+++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/dbservices/DBService.java
@@ -512,4 +512,20 @@ public class DBService {
log.info(fn + "download_config_dg::" + downloadConfigDg);
return downloadConfigDg;
}
+
+ public void cleanUpVnfcReferencesForVnf(SvcLogicContext context) throws SvcLogicException {
+ String key1 = "delete from " + SdcArtifactHandlerConstants.DB_VNFC_REFERENCE
+ + " where action = 'Configure' and vnf_type = $" + SdcArtifactHandlerConstants.VNF_TYPE;
+ QueryStatus status = null;
+ log.info("cleanUpVnfcReferencesForVnf()::Query:" + key1);
+ if (serviceLogic != null && context != null) {
+ status = serviceLogic.save("SQL", false, false, key1, null, null, context);
+ if (status.toString().equals("FAILURE")) {
+ log.debug("Error deleting from VNFC_REFERENCE table");
+ throw new SvcLogicException("Error While processing VNFC_REFERENCE table ");
+ }
+ }
+ }
+
+
}
diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/node/ArtifactHandlerNode.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/node/ArtifactHandlerNode.java
index d945769f4..920476b23 100644
--- a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/node/ArtifactHandlerNode.java
+++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/node/ArtifactHandlerNode.java
@@ -368,6 +368,7 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin {
if (content.has(SdcArtifactHandlerConstants.VM)
&& content.get(SdcArtifactHandlerConstants.VM) instanceof JSONArray) {
JSONArray vmList = (JSONArray) content.get(SdcArtifactHandlerConstants.VM);
+ dbservice.cleanUpVnfcReferencesForVnf(context);
for (int i = 0; i < vmList.length(); i++) {
JSONObject vmInstance = (JSONObject) vmList.get(i);
context.setAttribute(SdcArtifactHandlerConstants.VM_INSTANCE,
@@ -392,8 +393,9 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin {
if (vnfcInstance.has(SdcArtifactHandlerConstants.GROUP_NOTATION_VALUE))
context.setAttribute(SdcArtifactHandlerConstants.GROUP_NOTATION_VALUE,
vnfcInstance.getString(SdcArtifactHandlerConstants.GROUP_NOTATION_VALUE));
- dbservice.processVnfcReference(context, dbservice.isArtifactUpdateRequired(context,
- SdcArtifactHandlerConstants.DB_VNFC_REFERENCE));
+ if (content.getString(SdcArtifactHandlerConstants.ACTION).equals("Configure")) {
+ dbservice.processVnfcReference(context,false);
+ }
cleanVnfcInstance(context);
}
context.setAttribute(SdcArtifactHandlerConstants.VM_INSTANCE, null);