diff options
author | mojahidi <mojahidul.islam@amdocs.com> | 2017-08-29 18:20:26 +0530 |
---|---|---|
committer | Marcus Williams <marcus.williams@intel.com> | 2017-08-31 18:56:59 +0000 |
commit | 3df3182a7badeef662f743bfc8d67cea805b1ef4 (patch) | |
tree | 20e41c1f971de4c21ddd62e6c087d7a5d7ea5ae9 /appc-inbound/appc-artifact-handler/provider/src/main/java/org | |
parent | dc2344fc5754dee739f1db69cc6c16dfe0522ab8 (diff) |
Update ASDC References to SDC 1/2
This patch changes ASDC to SDC in APPC code, bundle
names and other pertinent places. This change
sanitizes SDC for Open Source. It
is the first in a two part change, the first
updates code mentions and artifacts. The second will
update database references.
Change-Id: Iffd73480cc325172b5d8969fe839728f1c88ef78
Issue-ID:APPC-179
Signed-off-by: mojahidi <mojahidul.islam@amdocs.com>
Diffstat (limited to 'appc-inbound/appc-artifact-handler/provider/src/main/java/org')
6 files changed, 299 insertions, 300 deletions
diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/ArtifactHandlerProvider.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/ArtifactHandlerProvider.java index 233984f55..d94f02a54 100644 --- a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/ArtifactHandlerProvider.java +++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/ArtifactHandlerProvider.java @@ -56,7 +56,7 @@ import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; import org.openecomp.appc.artifact.handler.node.ArtifactHandlerNode; import org.openecomp.appc.artifact.handler.utils.ArtifactHandlerProviderUtil; -import org.openecomp.appc.artifact.handler.utils.AsdcArtifactHandlerConstants; +import org.openecomp.appc.artifact.handler.utils.SdcArtifactHandlerConstants; import org.openecomp.sdnc.sli.SvcLogicContext; import com.att.eelf.configuration.EELFLogger; @@ -180,7 +180,7 @@ public class ArtifactHandlerProvider implements AutoCloseable, ArtifactHandlerSe try{ if(input.getRequestInformation().getSource() !=null){ - if(input.getRequestInformation().getSource().equalsIgnoreCase(AsdcArtifactHandlerConstants.DESIGN_TOOL)){ + if(input.getRequestInformation().getSource().equalsIgnoreCase(SdcArtifactHandlerConstants.DESIGN_TOOL)){ designUtil.processTemplate(designUtil.createDummyRequestData()); configResponseBuilder.setStatus(ArtifactHandlerProviderUtil.DistributionStatusEnum.DEPLOY_OK.toString()); } diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/AsdcArtifactHandlerActivator.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/SdcArtifactHandlerActivator.java index 4c8e1358f..6ce8af993 100644 --- a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/AsdcArtifactHandlerActivator.java +++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/SdcArtifactHandlerActivator.java @@ -26,7 +26,6 @@ package org.openecomp.appc.artifact.handler; import java.util.LinkedList; import java.util.List; -import java.util.Properties; import org.openecomp.appc.artifact.handler.node.ArtifactHandlerNode; import org.osgi.framework.BundleActivator; @@ -36,9 +35,9 @@ import org.osgi.framework.ServiceRegistration; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; -public class AsdcArtifactHandlerActivator implements BundleActivator { +public class SdcArtifactHandlerActivator implements BundleActivator { - private static final EELFLogger log = EELFManager.getInstance().getLogger(AsdcArtifactHandlerActivator.class); + private static final EELFLogger log = EELFManager.getInstance().getLogger(SdcArtifactHandlerActivator.class); private List<ServiceRegistration> registrations = new LinkedList<ServiceRegistration>(); @Override 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 4984ebf43..0116bb265 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 @@ -27,7 +27,7 @@ package org.openecomp.appc.artifact.handler.dbservices; import java.sql.SQLException; import java.util.HashMap; -import org.openecomp.appc.artifact.handler.utils.AsdcArtifactHandlerConstants; +import org.openecomp.appc.artifact.handler.utils.SdcArtifactHandlerConstants; import org.openecomp.sdnc.sli.SvcLogicContext; import org.openecomp.sdnc.sli.SvcLogicException; import org.openecomp.sdnc.sli.SvcLogicResource; @@ -84,7 +84,7 @@ public class DBService { if(status.toString().equals("FAILURE")) throw new SvcLogicException("Error - getting Artifact ID from database"); artifactID = ctx.getAttribute("id"); - log.info("ASDC_ARTIFACTS_ID received as : " + ctx.getAttribute("id")); + log.info("SDC_ARTIFACTS_ID received as : " + ctx.getAttribute("id")); } return artifactID; } @@ -112,7 +112,7 @@ public class DBService { status = serviceLogic.save("SQL", false, false, key, null, null, ctx); if(status.toString().equals("FAILURE")) - throw new SvcLogicException("Error While processing storing Artifact: " +ctx.getAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME)); + throw new SvcLogicException("Error While processing storing Artifact: " +ctx.getAttribute(SdcArtifactHandlerConstants.ARTIFACT_NAME)); } return status; @@ -134,55 +134,55 @@ public class DBService { public void processConfigureActionDg(SvcLogicContext context, boolean isUpdate) { String fn = "DBService.processConfigureActionDg"; - log.info("Update Parameter for ASDC Reference " + isUpdate ); + log.info("Update Parameter for SDC Reference " + isUpdate ); String key = ""; QueryStatus status = null; if(isUpdate); } - public void processAsdcReferences(SvcLogicContext context, boolean isUpdate) throws SvcLogicException { - String fn = "DBService.processAsdcReferences"; + public void processSdcReferences(SvcLogicContext context, boolean isUpdate) throws SvcLogicException { + String fn = "DBService.processSdcReferences"; String key = ""; QueryStatus status = null; - if (isUpdate && AsdcArtifactHandlerConstants.FILE_CATEGORY.equals(AsdcArtifactHandlerConstants.CAPABILITY)) { - key = "update " + AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE + " set ARTIFACT_NAME = $" + AsdcArtifactHandlerConstants.ARTIFACT_NAME + - " where VNFC_TYPE = $" + AsdcArtifactHandlerConstants.VNFC_TYPE + - " and FILE_CATEGORY = $" + AsdcArtifactHandlerConstants.FILE_CATEGORY + + if (isUpdate && SdcArtifactHandlerConstants.FILE_CATEGORY.equals(SdcArtifactHandlerConstants.CAPABILITY)) { + key = "update " + SdcArtifactHandlerConstants.DB_SDC_REFERENCE + " set ARTIFACT_NAME = $" + SdcArtifactHandlerConstants.ARTIFACT_NAME + + " where VNFC_TYPE = $" + SdcArtifactHandlerConstants.VNFC_TYPE + + " and FILE_CATEGORY = $" + SdcArtifactHandlerConstants.FILE_CATEGORY + " and ACTION = null"; } else if(isUpdate) - key = "update " + AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE + " set ARTIFACT_NAME = $" + AsdcArtifactHandlerConstants.ARTIFACT_NAME + - " where VNFC_TYPE = $" + AsdcArtifactHandlerConstants.VNFC_TYPE + - " and FILE_CATEGORY = $" + AsdcArtifactHandlerConstants.FILE_CATEGORY + - " and ACTION = $" + AsdcArtifactHandlerConstants.ACTION ; + key = "update " + SdcArtifactHandlerConstants.DB_SDC_REFERENCE + " set ARTIFACT_NAME = $" + SdcArtifactHandlerConstants.ARTIFACT_NAME + + " where VNFC_TYPE = $" + SdcArtifactHandlerConstants.VNFC_TYPE + + " and FILE_CATEGORY = $" + SdcArtifactHandlerConstants.FILE_CATEGORY + + " and ACTION = $" + SdcArtifactHandlerConstants.ACTION ; else { - if (AsdcArtifactHandlerConstants.FILE_CATEGORY.equals(AsdcArtifactHandlerConstants.CAPABILITY)) { - key = "insert into " + AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE + + if (SdcArtifactHandlerConstants.FILE_CATEGORY.equals(SdcArtifactHandlerConstants.CAPABILITY)) { + key = "insert into " + SdcArtifactHandlerConstants.DB_SDC_REFERENCE + " set VNFC_TYPE = null " + - " , FILE_CATEGORY = $" + AsdcArtifactHandlerConstants.FILE_CATEGORY + - " , VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE + + " , FILE_CATEGORY = $" + SdcArtifactHandlerConstants.FILE_CATEGORY + + " , VNF_TYPE = $" + SdcArtifactHandlerConstants.VNF_TYPE + " , ACTION = null " + " , ARTIFACT_TYPE = null " + - " , ARTIFACT_NAME = $" + AsdcArtifactHandlerConstants.ARTIFACT_NAME ; + " , ARTIFACT_NAME = $" + SdcArtifactHandlerConstants.ARTIFACT_NAME ; } else { - key = "insert into " + AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE + - " set VNFC_TYPE = $" + AsdcArtifactHandlerConstants.VNFC_TYPE + - " , FILE_CATEGORY = $" + AsdcArtifactHandlerConstants.FILE_CATEGORY + - " , VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE + - " , ACTION = $" + AsdcArtifactHandlerConstants.ACTION + - " , ARTIFACT_TYPE = $" + AsdcArtifactHandlerConstants.ARTIFACT_TYPE + - " , ARTIFACT_NAME = $" + AsdcArtifactHandlerConstants.ARTIFACT_NAME ; + key = "insert into " + SdcArtifactHandlerConstants.DB_SDC_REFERENCE + + " set VNFC_TYPE = $" + SdcArtifactHandlerConstants.VNFC_TYPE + + " , FILE_CATEGORY = $" + SdcArtifactHandlerConstants.FILE_CATEGORY + + " , VNF_TYPE = $" + SdcArtifactHandlerConstants.VNF_TYPE + + " , ACTION = $" + SdcArtifactHandlerConstants.ACTION + + " , ARTIFACT_TYPE = $" + SdcArtifactHandlerConstants.ARTIFACT_TYPE + + " , ARTIFACT_NAME = $" + SdcArtifactHandlerConstants.ARTIFACT_NAME ; } } if (serviceLogic != null && context != null) { log.info("Insert Key: " + key); status = serviceLogic.save("SQL", false, false, key, null, null, context); if(status.toString().equals("FAILURE")) - throw new SvcLogicException("Error While processing asdc_reference table "); + throw new SvcLogicException("Error While processing sdc_reference table "); } } @@ -191,50 +191,50 @@ public class DBService { log.info("Checking if Update required for this data" ); log.info("db" + db); - log.info("ACTION=" + context.getAttribute(AsdcArtifactHandlerConstants.ACTION)); - log.info("VNFC_TYPE=" + context.getAttribute(AsdcArtifactHandlerConstants.VNFC_TYPE)); - log.info("VNFC_INSTANCE=" + context.getAttribute(AsdcArtifactHandlerConstants.VNFC_INSTANCE)); - log.info("VM_INSTANCE=" + context.getAttribute(AsdcArtifactHandlerConstants.VM_INSTANCE)); - log.info("VNF_TYPE=" + context.getAttribute(AsdcArtifactHandlerConstants.VNF_TYPE)); + log.info("ACTION=" + context.getAttribute(SdcArtifactHandlerConstants.ACTION)); + log.info("VNFC_TYPE=" + context.getAttribute(SdcArtifactHandlerConstants.VNFC_TYPE)); + log.info("VNFC_INSTANCE=" + context.getAttribute(SdcArtifactHandlerConstants.VNFC_INSTANCE)); + log.info("VM_INSTANCE=" + context.getAttribute(SdcArtifactHandlerConstants.VM_INSTANCE)); + log.info("VNF_TYPE=" + context.getAttribute(SdcArtifactHandlerConstants.VNF_TYPE)); String whereClause = ""; QueryStatus status = null; - /* if(context.getAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME) !=null && - context.getAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME).toLowerCase().startsWith(AsdcArtifactHandlerConstants.PD)) - whereClause = " where artifact_name = $" + AsdcArtifactHandlerConstants.ARTIFACT_NAME + /* if(context.getAttribute(SdcArtifactHandlerConstants.ARTIFACT_NAME) !=null && + context.getAttribute(SdcArtifactHandlerConstants.ARTIFACT_NAME).toLowerCase().startsWith(SdcArtifactHandlerConstants.PD)) + whereClause = " where artifact_name = $" + SdcArtifactHandlerConstants.ARTIFACT_NAME + " and vnf_type = 'DummyVnf' "; else*/ - whereClause = " where VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE; + whereClause = " where VNF_TYPE = $" + SdcArtifactHandlerConstants.VNF_TYPE; - if (db !=null && db.equals(AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE) && - context.getAttribute(AsdcArtifactHandlerConstants.FILE_CATEGORY).equals(AsdcArtifactHandlerConstants.CAPABILITY) && - context.getAttribute(AsdcArtifactHandlerConstants.ACTION) ==null) { - whereClause = whereClause + " and FILE_CATEGORY = $" + AsdcArtifactHandlerConstants.FILE_CATEGORY ; + if (db !=null && db.equals(SdcArtifactHandlerConstants.DB_SDC_REFERENCE) && + context.getAttribute(SdcArtifactHandlerConstants.FILE_CATEGORY).equals(SdcArtifactHandlerConstants.CAPABILITY) && + context.getAttribute(SdcArtifactHandlerConstants.ACTION) ==null) { + whereClause = whereClause + " and FILE_CATEGORY = $" + SdcArtifactHandlerConstants.FILE_CATEGORY ; } - else if(db !=null && db.equals(AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE)) { - whereClause = whereClause + " and VNFC_TYPE = $" + AsdcArtifactHandlerConstants.VNFC_TYPE - + " and FILE_CATEGORY = $" + AsdcArtifactHandlerConstants.FILE_CATEGORY - + " and ACTION = $" + AsdcArtifactHandlerConstants.ACTION; + else if(db !=null && db.equals(SdcArtifactHandlerConstants.DB_SDC_REFERENCE)) { + whereClause = whereClause + " and VNFC_TYPE = $" + SdcArtifactHandlerConstants.VNFC_TYPE + + " and FILE_CATEGORY = $" + SdcArtifactHandlerConstants.FILE_CATEGORY + + " and ACTION = $" + SdcArtifactHandlerConstants.ACTION; } - else if(db.equals(AsdcArtifactHandlerConstants.DB_DOWNLOAD_DG_REFERENCE)) { - whereClause = " where PROTOCOL = $" + AsdcArtifactHandlerConstants.DEVICE_PROTOCOL; + else if(db.equals(SdcArtifactHandlerConstants.DB_DOWNLOAD_DG_REFERENCE)) { + whereClause = " where PROTOCOL = $" + SdcArtifactHandlerConstants.DEVICE_PROTOCOL; } - else if(db.equals(AsdcArtifactHandlerConstants.DB_CONFIG_ACTION_DG)) { - whereClause = whereClause + " and ACTION = $" + AsdcArtifactHandlerConstants.ACTION; + else if(db.equals(SdcArtifactHandlerConstants.DB_CONFIG_ACTION_DG)) { + whereClause = whereClause + " and ACTION = $" + SdcArtifactHandlerConstants.ACTION; } - else if(db.equals(AsdcArtifactHandlerConstants.DB_VNFC_REFERENCE)){ + else if(db.equals(SdcArtifactHandlerConstants.DB_VNFC_REFERENCE)){ int vm_instance = -1 ; - if(context.getAttribute(AsdcArtifactHandlerConstants.VM_INSTANCE) !=null) - vm_instance = Integer.parseInt(context.getAttribute(AsdcArtifactHandlerConstants.VM_INSTANCE)); + if(context.getAttribute(SdcArtifactHandlerConstants.VM_INSTANCE) !=null) + vm_instance = Integer.parseInt(context.getAttribute(SdcArtifactHandlerConstants.VM_INSTANCE)); int vnfc_instance = -1 ; - if(context.getAttribute(AsdcArtifactHandlerConstants.VNFC_INSTANCE) !=null) - vnfc_instance = Integer.parseInt(context.getAttribute(AsdcArtifactHandlerConstants.VNFC_INSTANCE)); - whereClause = whereClause + " and ACTION = $" + AsdcArtifactHandlerConstants.ACTION - + " and VNFC_TYPE = $" + AsdcArtifactHandlerConstants.VNFC_TYPE - + " and VNFC_INSTANCE = $" + AsdcArtifactHandlerConstants.VNFC_INSTANCE - + " and VM_INSTANCE = $" + AsdcArtifactHandlerConstants.VM_INSTANCE ; + if(context.getAttribute(SdcArtifactHandlerConstants.VNFC_INSTANCE) !=null) + vnfc_instance = Integer.parseInt(context.getAttribute(SdcArtifactHandlerConstants.VNFC_INSTANCE)); + whereClause = whereClause + " and ACTION = $" + SdcArtifactHandlerConstants.ACTION + + " and VNFC_TYPE = $" + SdcArtifactHandlerConstants.VNFC_TYPE + + " and VNFC_INSTANCE = $" + SdcArtifactHandlerConstants.VNFC_INSTANCE + + " and VM_INSTANCE = $" + SdcArtifactHandlerConstants.VM_INSTANCE ; } if (serviceLogic != null && context != null) { @@ -262,15 +262,15 @@ public class DBService { String key = ""; QueryStatus status = null; if(isUpdate) - key = "update " + AsdcArtifactHandlerConstants.DB_DEVICE_INTERFACE_PROTOCOL + - " set PROTOCOL = $" + AsdcArtifactHandlerConstants.DEVICE_PROTOCOL + + key = "update " + SdcArtifactHandlerConstants.DB_DEVICE_INTERFACE_PROTOCOL + + " set PROTOCOL = $" + SdcArtifactHandlerConstants.DEVICE_PROTOCOL + " , DG_RPC = 'getDeviceRunningConfig' " + " , MODULE = 'APPC' " + - " where VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE ; + " where VNF_TYPE = $" + SdcArtifactHandlerConstants.VNF_TYPE ; else - key = "insert into " + AsdcArtifactHandlerConstants.DB_DEVICE_INTERFACE_PROTOCOL+ - " set VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE + - " , PROTOCOL = $" + AsdcArtifactHandlerConstants.DEVICE_PROTOCOL + + key = "insert into " + SdcArtifactHandlerConstants.DB_DEVICE_INTERFACE_PROTOCOL+ + " set VNF_TYPE = $" + SdcArtifactHandlerConstants.VNF_TYPE + + " , PROTOCOL = $" + SdcArtifactHandlerConstants.DEVICE_PROTOCOL + " , DG_RPC = 'getDeviceRunningConfig' " + " , MODULE = 'APPC' " ; @@ -289,17 +289,17 @@ public class DBService { String key = ""; QueryStatus status = null; if(isUpdate) - key = "update " + AsdcArtifactHandlerConstants.DB_DEVICE_AUTHENTICATION + - " set USER_NAME = $" + AsdcArtifactHandlerConstants.USER_NAME + + key = "update " + SdcArtifactHandlerConstants.DB_DEVICE_AUTHENTICATION + + " set USER_NAME = $" + SdcArtifactHandlerConstants.USER_NAME + " , PASSWORD = 'dummy' " + - " , PORT_NUMBER = $" + AsdcArtifactHandlerConstants.PORT_NUMBER + - " where VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE ; + " , PORT_NUMBER = $" + SdcArtifactHandlerConstants.PORT_NUMBER + + " where VNF_TYPE = $" + SdcArtifactHandlerConstants.VNF_TYPE ; else - key = "insert into " + AsdcArtifactHandlerConstants.DB_DEVICE_AUTHENTICATION+ - " set VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE + - " , USER_NAME = $" + AsdcArtifactHandlerConstants.USER_NAME + + key = "insert into " + SdcArtifactHandlerConstants.DB_DEVICE_AUTHENTICATION+ + " set VNF_TYPE = $" + SdcArtifactHandlerConstants.VNF_TYPE + + " , USER_NAME = $" + SdcArtifactHandlerConstants.USER_NAME + " , PASSWORD = 'dummy' " + - " , PORT_NUMBER = $" + AsdcArtifactHandlerConstants.PORT_NUMBER; + " , PORT_NUMBER = $" + SdcArtifactHandlerConstants.PORT_NUMBER; if (serviceLogic != null && context != null) { status = serviceLogic.save("SQL", false, false, key, null, null, context); @@ -313,37 +313,37 @@ public class DBService { log.info(fn + "Starting DB operation for Vnfc Reference " + isUpdate ); String key = ""; int vm_instance = -1 ; - if(context.getAttribute(AsdcArtifactHandlerConstants.VM_INSTANCE) !=null) - vm_instance = Integer.parseInt(context.getAttribute(AsdcArtifactHandlerConstants.VM_INSTANCE)); + if(context.getAttribute(SdcArtifactHandlerConstants.VM_INSTANCE) !=null) + vm_instance = Integer.parseInt(context.getAttribute(SdcArtifactHandlerConstants.VM_INSTANCE)); int vnfc_instance = -1 ; - if(context.getAttribute(AsdcArtifactHandlerConstants.VNFC_INSTANCE) !=null) - vnfc_instance = Integer.parseInt(context.getAttribute(AsdcArtifactHandlerConstants.VNFC_INSTANCE)); + if(context.getAttribute(SdcArtifactHandlerConstants.VNFC_INSTANCE) !=null) + vnfc_instance = Integer.parseInt(context.getAttribute(SdcArtifactHandlerConstants.VNFC_INSTANCE)); QueryStatus status = null; if(isUpdate) - key = "update " + AsdcArtifactHandlerConstants.DB_VNFC_REFERENCE + + key = "update " + SdcArtifactHandlerConstants.DB_VNFC_REFERENCE + " set VM_INSTANCE = " + vm_instance + " , VNFC_INSTANCE = " + vnfc_instance + - " , VNFC_TYPE = $" + AsdcArtifactHandlerConstants.VNFC_TYPE + - " , VNFC_FUNCTION_CODE = $" + AsdcArtifactHandlerConstants.VNFC_FUNCTION_CODE + - " , GROUP_NOTATION_TYPE = $" + AsdcArtifactHandlerConstants.GROUP_NOTATION_TYPE + - " , GROUP_NOTATION_VALUE = $" + AsdcArtifactHandlerConstants.GROUP_NOTATION_VALUE + - " , IPADDRESS_V4_OAM_VIP = $" + AsdcArtifactHandlerConstants.IPADDRESS_V4_OAM_VIP + - " where VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE + - " and ACTION = $" + AsdcArtifactHandlerConstants.ACTION + - " and VNFC_TYPE = $" + AsdcArtifactHandlerConstants.VNFC_TYPE + - " and VNFC_INSTANCE = $" + AsdcArtifactHandlerConstants.VNFC_INSTANCE - + " and VM_INSTANCE = $" + AsdcArtifactHandlerConstants.VM_INSTANCE ; + " , VNFC_TYPE = $" + SdcArtifactHandlerConstants.VNFC_TYPE + + " , VNFC_FUNCTION_CODE = $" + SdcArtifactHandlerConstants.VNFC_FUNCTION_CODE + + " , GROUP_NOTATION_TYPE = $" + SdcArtifactHandlerConstants.GROUP_NOTATION_TYPE + + " , GROUP_NOTATION_VALUE = $" + SdcArtifactHandlerConstants.GROUP_NOTATION_VALUE + + " , IPADDRESS_V4_OAM_VIP = $" + SdcArtifactHandlerConstants.IPADDRESS_V4_OAM_VIP + + " where VNF_TYPE = $" + SdcArtifactHandlerConstants.VNF_TYPE + + " and ACTION = $" + SdcArtifactHandlerConstants.ACTION + + " and VNFC_TYPE = $" + SdcArtifactHandlerConstants.VNFC_TYPE + + " and VNFC_INSTANCE = $" + SdcArtifactHandlerConstants.VNFC_INSTANCE + + " and VM_INSTANCE = $" + SdcArtifactHandlerConstants.VM_INSTANCE ; else - key = "insert into " + AsdcArtifactHandlerConstants.DB_VNFC_REFERENCE+ - " set VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE + - " , ACTION = $" + AsdcArtifactHandlerConstants.ACTION + - " , VM_INSTANCE = $" + AsdcArtifactHandlerConstants.VM_INSTANCE + - " , VNFC_INSTANCE = $" + AsdcArtifactHandlerConstants.VNFC_INSTANCE + - " , VNFC_TYPE = $" + AsdcArtifactHandlerConstants.VNFC_TYPE + - " , VNFC_FUNCTION_CODE = $" + AsdcArtifactHandlerConstants.VNFC_FUNCTION_CODE + - " , GROUP_NOTATION_TYPE = $" + AsdcArtifactHandlerConstants.GROUP_NOTATION_TYPE + - " , IPADDRESS_V4_OAM_VIP = $" + AsdcArtifactHandlerConstants.IPADDRESS_V4_OAM_VIP + - " , GROUP_NOTATION_VALUE = $" + AsdcArtifactHandlerConstants.GROUP_NOTATION_VALUE ; + key = "insert into " + SdcArtifactHandlerConstants.DB_VNFC_REFERENCE+ + " set VNF_TYPE = $" + SdcArtifactHandlerConstants.VNF_TYPE + + " , ACTION = $" + SdcArtifactHandlerConstants.ACTION + + " , VM_INSTANCE = $" + SdcArtifactHandlerConstants.VM_INSTANCE + + " , VNFC_INSTANCE = $" + SdcArtifactHandlerConstants.VNFC_INSTANCE + + " , VNFC_TYPE = $" + SdcArtifactHandlerConstants.VNFC_TYPE + + " , VNFC_FUNCTION_CODE = $" + SdcArtifactHandlerConstants.VNFC_FUNCTION_CODE + + " , GROUP_NOTATION_TYPE = $" + SdcArtifactHandlerConstants.GROUP_NOTATION_TYPE + + " , IPADDRESS_V4_OAM_VIP = $" + SdcArtifactHandlerConstants.IPADDRESS_V4_OAM_VIP + + " , GROUP_NOTATION_VALUE = $" + SdcArtifactHandlerConstants.GROUP_NOTATION_VALUE ; if (serviceLogic != null && context != null) { status = serviceLogic.save("SQL", false, false, key, null, null, context); @@ -359,13 +359,13 @@ public class DBService { QueryStatus status = null; if(isUpdate) - key = "update " + AsdcArtifactHandlerConstants.DB_DOWNLOAD_DG_REFERENCE + - " set DOWNLOAD_CONFIG_DG = $" + AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE + - " where PROTOCOL = $" + AsdcArtifactHandlerConstants.DEVICE_PROTOCOL ; + key = "update " + SdcArtifactHandlerConstants.DB_DOWNLOAD_DG_REFERENCE + + " set DOWNLOAD_CONFIG_DG = $" + SdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE + + " where PROTOCOL = $" + SdcArtifactHandlerConstants.DEVICE_PROTOCOL ; else - key = "insert into " + AsdcArtifactHandlerConstants.DB_DOWNLOAD_DG_REFERENCE+ - " set DOWNLOAD_CONFIG_DG = $" + AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE + - " , PROTOCOL = $" + AsdcArtifactHandlerConstants.DEVICE_PROTOCOL ; + key = "insert into " + SdcArtifactHandlerConstants.DB_DOWNLOAD_DG_REFERENCE+ + " set DOWNLOAD_CONFIG_DG = $" + SdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE + + " , PROTOCOL = $" + SdcArtifactHandlerConstants.DEVICE_PROTOCOL ; if (serviceLogic != null && context != null) status = serviceLogic.save("SQL", false, false, key, null, null, context); @@ -379,18 +379,18 @@ public class DBService { String key = ""; QueryStatus status = null; - if(context.getAttribute(AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE) != null && - context.getAttribute(AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE).length() > 0){ + if(context.getAttribute(SdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE) != null && + context.getAttribute(SdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE).length() > 0){ if(isUpdate) - key = "update " + AsdcArtifactHandlerConstants.DB_CONFIG_ACTION_DG + - " set DOWNLOAD_CONFIG_DG = $" + AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE + - " where ACTION = $" + AsdcArtifactHandlerConstants.ACTION + - " and VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE ; + key = "update " + SdcArtifactHandlerConstants.DB_CONFIG_ACTION_DG + + " set DOWNLOAD_CONFIG_DG = $" + SdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE + + " where ACTION = $" + SdcArtifactHandlerConstants.ACTION + + " and VNF_TYPE = $" + SdcArtifactHandlerConstants.VNF_TYPE ; else - key = "insert into " + AsdcArtifactHandlerConstants.DB_CONFIG_ACTION_DG+ - " set DOWNLOAD_CONFIG_DG = $" + AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE + - " , ACTION = $" + AsdcArtifactHandlerConstants.ACTION + - " , VNF_TYPE = $" + AsdcArtifactHandlerConstants.VNF_TYPE ; + key = "insert into " + SdcArtifactHandlerConstants.DB_CONFIG_ACTION_DG+ + " set DOWNLOAD_CONFIG_DG = $" + SdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE + + " , ACTION = $" + SdcArtifactHandlerConstants.ACTION + + " , VNF_TYPE = $" + SdcArtifactHandlerConstants.VNF_TYPE ; if (serviceLogic != null && context != null) status = serviceLogic.save("SQL", false, false, key, null, null, context); 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 e4cefad48..c6d1c1c36 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 @@ -33,7 +33,7 @@ import org.json.JSONArray; import org.json.JSONObject; import org.openecomp.appc.artifact.handler.dbservices.DBService; import org.openecomp.appc.artifact.handler.utils.ArtifactHandlerProviderUtil; -import org.openecomp.appc.artifact.handler.utils.AsdcArtifactHandlerConstants; +import org.openecomp.appc.artifact.handler.utils.SdcArtifactHandlerConstants; import org.openecomp.appc.yang.YANGGenerator; import org.openecomp.appc.yang.impl.YANGGeneratorFactory; import org.openecomp.sdnc.config.params.transformer.tosca.ArtifactProcessorImpl; @@ -58,7 +58,7 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin { String postData = inParams.get("postData"); JSONObject input = new JSONObject(postData).getJSONObject("input"); responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : ""; - storeUpdateAsdcArtifacts(input); + storeUpdateSdcArtifacts(input); } } catch(Exception e){ @@ -67,26 +67,26 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin { } } - private boolean storeUpdateAsdcArtifacts(JSONObject postDataJson) throws Exception { - log.info("Starting processing of ASDC Artifacs into Handler with Data : " + postDataJson.toString()); + private boolean storeUpdateSdcArtifacts(JSONObject postDataJson) throws Exception { + log.info("Starting processing of SDC Artifacs into Handler with Data : " + postDataJson.toString()); try{ - JSONObject request_information = (JSONObject)postDataJson.get(AsdcArtifactHandlerConstants.REQUEST_INFORMATION); - JSONObject document_information =(JSONObject)postDataJson.get(AsdcArtifactHandlerConstants.DOCUMENT_PARAMETERS); - String artifact_name = document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME); + JSONObject request_information = (JSONObject)postDataJson.get(SdcArtifactHandlerConstants.REQUEST_INFORMATION); + JSONObject document_information =(JSONObject)postDataJson.get(SdcArtifactHandlerConstants.DOCUMENT_PARAMETERS); + String artifact_name = document_information.getString(SdcArtifactHandlerConstants.ARTIFACT_NAME); if(artifact_name !=null){ updateStoreArtifacts(request_information, document_information ); - if(artifact_name.toLowerCase().startsWith(AsdcArtifactHandlerConstants.REFERENCE)) + if(artifact_name.toLowerCase().startsWith(SdcArtifactHandlerConstants.REFERENCE)) return storeReferenceData(request_information, document_information ); - else if (artifact_name.toLowerCase().startsWith(AsdcArtifactHandlerConstants.PD)) + else if (artifact_name.toLowerCase().startsWith(SdcArtifactHandlerConstants.PD)) return createDataForPD(request_information, document_information ); } else - throw new Exception("Missing Artifact Name for Request : " + request_information.getString(AsdcArtifactHandlerConstants.REQUETS_ID)); + throw new Exception("Missing Artifact Name for Request : " + request_information.getString(SdcArtifactHandlerConstants.REQUETS_ID)); } catch(Exception e){ e.printStackTrace(); - throw new Exception("Error while processing Request ID : " + ((JSONObject)postDataJson.get(AsdcArtifactHandlerConstants.REQUEST_INFORMATION)).getString(AsdcArtifactHandlerConstants.REQUETS_ID) + e.getMessage()); + throw new Exception("Error while processing Request ID : " + ((JSONObject)postDataJson.get(SdcArtifactHandlerConstants.REQUEST_INFORMATION)).getString(SdcArtifactHandlerConstants.REQUETS_ID) + e.getMessage()); } return false; @@ -94,11 +94,11 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin { private boolean createDataForPD(JSONObject request_information, JSONObject document_information) throws Exception { String fn = "ArtifactHandlerNode.createReferenceDataForPD"; - String artifact_name = document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME); - log.info(fn + "Received PD File Name: " + artifact_name + " and suffix lenght " + AsdcArtifactHandlerConstants.PD.length()); + String artifact_name = document_information.getString(SdcArtifactHandlerConstants.ARTIFACT_NAME); + log.info(fn + "Received PD File Name: " + artifact_name + " and suffix lenght " + SdcArtifactHandlerConstants.PD.length()); try { - String suffix = artifact_name.substring(AsdcArtifactHandlerConstants.PD.length()); + String suffix = artifact_name.substring(SdcArtifactHandlerConstants.PD.length()); createArtifactRecords(request_information, document_information, suffix); } catch (Exception e) { e.printStackTrace(); @@ -109,10 +109,10 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin { private void createArtifactRecords(JSONObject request_information, JSONObject document_information, String suffix) throws Exception { - log.info("Creating Tosca Records and storing into ASDC Artifacs"); + log.info("Creating Tosca Records and storing into SDC Artifacs"); String [] docs = {"Tosca", "Yang"}; ArtifactHandlerProviderUtil ahpUtil = new ArtifactHandlerProviderUtil(); - String PDFileContents = document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_CONTENTS); + String PDFileContents = document_information.getString(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS); //Tosca generation OutputStream toscaStream = new ByteArrayOutputStream(); @@ -130,13 +130,13 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin { String yangName = null; for(String doc : docs){ - document_information.put(AsdcArtifactHandlerConstants.ARTIFACT_TYPE, doc.concat("Type")); - document_information.put(AsdcArtifactHandlerConstants.ARTIFACT_DESRIPTION, doc.concat("Model")); + document_information.put(SdcArtifactHandlerConstants.ARTIFACT_TYPE, doc.concat("Type")); + document_information.put(SdcArtifactHandlerConstants.ARTIFACT_DESRIPTION, doc.concat("Model")); if(doc.equals("Tosca")) - document_information.put(AsdcArtifactHandlerConstants.ARTIFACT_CONTENTS, ahpUtil.escapeSql(toscaContents)); + document_information.put(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS, ahpUtil.escapeSql(toscaContents)); else if (doc.equals("Yang")) - document_information.put(AsdcArtifactHandlerConstants.ARTIFACT_CONTENTS, ahpUtil.escapeSql(yangContents)); - document_information.put(AsdcArtifactHandlerConstants.ARTIFACT_NAME, doc.concat(suffix)); + document_information.put(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS, ahpUtil.escapeSql(yangContents)); + document_information.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, doc.concat(suffix)); yangName = doc.concat(suffix); updateStoreArtifacts(request_information, document_information); } @@ -167,40 +167,40 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin { } private boolean updateStoreArtifacts(JSONObject request_information, JSONObject document_information ) throws Exception { - log.info("UpdateStoreArtifactsStarted storing of ASDC Artifacs "); + log.info("UpdateStoreArtifactsStarted storing of SDC Artifacs "); SvcLogicContext context = new SvcLogicContext(); DBService dbservice = DBService.initialise(); ArtifactHandlerProviderUtil ahpUtil = new ArtifactHandlerProviderUtil(); int intversion = 0; - context.setAttribute("artifact_name",document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME)); - String internal_version = dbservice.getInternalVersionNumber(context, document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME), null); + context.setAttribute("artifact_name",document_information.getString(SdcArtifactHandlerConstants.ARTIFACT_NAME)); + String internal_version = dbservice.getInternalVersionNumber(context, document_information.getString(SdcArtifactHandlerConstants.ARTIFACT_NAME), null); log.info("Internal Version number received from Database : " + internal_version); if(internal_version != null){ intversion = Integer.parseInt(internal_version); intversion++ ; } - context.setAttribute(AsdcArtifactHandlerConstants.SERVICE_UUID, document_information.getString(AsdcArtifactHandlerConstants.SERVICE_UUID)); - context.setAttribute(AsdcArtifactHandlerConstants.DISTRIBUTION_ID, document_information.getString(AsdcArtifactHandlerConstants.DISTRIBUTION_ID)); - context.setAttribute(AsdcArtifactHandlerConstants.SERVICE_NAME, document_information.getString(AsdcArtifactHandlerConstants.SERVICE_NAME)); - context.setAttribute(AsdcArtifactHandlerConstants.SERVICE_DESCRIPTION, document_information.getString(AsdcArtifactHandlerConstants.SERVICE_DESCRIPTION)); - context.setAttribute(AsdcArtifactHandlerConstants.RESOURCE_UUID, document_information.getString(AsdcArtifactHandlerConstants.RESOURCE_UUID)); - context.setAttribute(AsdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME,document_information.getString(AsdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME)); - context.setAttribute(AsdcArtifactHandlerConstants.RESOURCE_VERSOIN, document_information.getString(AsdcArtifactHandlerConstants.RESOURCE_VERSOIN)); - context.setAttribute(AsdcArtifactHandlerConstants.RESOURCE_TYPE, document_information.getString(AsdcArtifactHandlerConstants.RESOURCE_TYPE)); - context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_UUID, document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_UUID)); - context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_TYPE,document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_TYPE)); - context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_VERSOIN,document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_VERSOIN)); - context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_DESRIPTION,document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_DESRIPTION)); - context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_CONTENTS,ahpUtil.escapeSql(document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_CONTENTS))); - context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME,document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME)); + context.setAttribute(SdcArtifactHandlerConstants.SERVICE_UUID, document_information.getString(SdcArtifactHandlerConstants.SERVICE_UUID)); + context.setAttribute(SdcArtifactHandlerConstants.DISTRIBUTION_ID, document_information.getString(SdcArtifactHandlerConstants.DISTRIBUTION_ID)); + context.setAttribute(SdcArtifactHandlerConstants.SERVICE_NAME, document_information.getString(SdcArtifactHandlerConstants.SERVICE_NAME)); + context.setAttribute(SdcArtifactHandlerConstants.SERVICE_DESCRIPTION, document_information.getString(SdcArtifactHandlerConstants.SERVICE_DESCRIPTION)); + context.setAttribute(SdcArtifactHandlerConstants.RESOURCE_UUID, document_information.getString(SdcArtifactHandlerConstants.RESOURCE_UUID)); + context.setAttribute(SdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME,document_information.getString(SdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME)); + context.setAttribute(SdcArtifactHandlerConstants.RESOURCE_VERSOIN, document_information.getString(SdcArtifactHandlerConstants.RESOURCE_VERSOIN)); + context.setAttribute(SdcArtifactHandlerConstants.RESOURCE_TYPE, document_information.getString(SdcArtifactHandlerConstants.RESOURCE_TYPE)); + context.setAttribute(SdcArtifactHandlerConstants.ARTIFACT_UUID, document_information.getString(SdcArtifactHandlerConstants.ARTIFACT_UUID)); + context.setAttribute(SdcArtifactHandlerConstants.ARTIFACT_TYPE,document_information.getString(SdcArtifactHandlerConstants.ARTIFACT_TYPE)); + context.setAttribute(SdcArtifactHandlerConstants.ARTIFACT_VERSOIN,document_information.getString(SdcArtifactHandlerConstants.ARTIFACT_VERSOIN)); + context.setAttribute(SdcArtifactHandlerConstants.ARTIFACT_DESRIPTION,document_information.getString(SdcArtifactHandlerConstants.ARTIFACT_DESRIPTION)); + context.setAttribute(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS,ahpUtil.escapeSql(document_information.getString(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS))); + context.setAttribute(SdcArtifactHandlerConstants.ARTIFACT_NAME,document_information.getString(SdcArtifactHandlerConstants.ARTIFACT_NAME)); dbservice.saveArtifacts(context, intversion); return true; } public boolean storeReferenceData(JSONObject request_information, JSONObject document_information) throws Exception { - log.info("Started storing of ASDC Artifacs into Handler" ); + log.info("Started storing of SDC Artifacs into Handler" ); try{ boolean updateRequired = false; boolean pdFile = false; @@ -208,9 +208,9 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin { String categorySuffix = null; DBService dbservice = DBService.initialise(); ArtifactHandlerProviderUtil ahpUtil = new ArtifactHandlerProviderUtil(); - String contentString = ahpUtil.escapeSql(document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_CONTENTS)) ; - String artifactName=ahpUtil.escapeSql(document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME)); - String capabilityArtifactName=StringUtils.replace(artifactName,AsdcArtifactHandlerConstants.ARTIFACT_NAME_REFERENCE,AsdcArtifactHandlerConstants.ARTIFACT_NAME_CAPABILITY); + String contentString = ahpUtil.escapeSql(document_information.getString(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS)) ; + String artifactName=ahpUtil.escapeSql(document_information.getString(SdcArtifactHandlerConstants.ARTIFACT_NAME)); + String capabilityArtifactName=StringUtils.replace(artifactName, SdcArtifactHandlerConstants.ARTIFACT_NAME_REFERENCE, SdcArtifactHandlerConstants.ARTIFACT_NAME_CAPABILITY); JSONObject capabilities = new JSONObject(); JSONArray vnfActionList = new JSONArray(); JSONArray vfModuleActionList = new JSONArray(); @@ -226,105 +226,105 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin { JSONObject scope = content.getJSONObject("scope"); log.info("scope :" + scope); SvcLogicContext context = new SvcLogicContext(); - vnfType=scope.getString(AsdcArtifactHandlerConstants.VNF_TYPE); - context.setAttribute(AsdcArtifactHandlerConstants.VNF_TYPE, scope.getString(AsdcArtifactHandlerConstants.VNF_TYPE)); - context.setAttribute(AsdcArtifactHandlerConstants.ACTION, content.getString(AsdcArtifactHandlerConstants.ACTION)); - String actionLevel=content.getString(AsdcArtifactHandlerConstants.ACTION_LEVEL); - context.setAttribute(AsdcArtifactHandlerConstants.ACTION_LEVEL, content.getString(AsdcArtifactHandlerConstants.ACTION_LEVEL)); - if ((null != actionLevel) && actionLevel.equalsIgnoreCase(AsdcArtifactHandlerConstants.ACTION_LEVEL_VNFC)) { - vnfcActionList.put(content.getString(AsdcArtifactHandlerConstants.ACTION)); + vnfType=scope.getString(SdcArtifactHandlerConstants.VNF_TYPE); + context.setAttribute(SdcArtifactHandlerConstants.VNF_TYPE, scope.getString(SdcArtifactHandlerConstants.VNF_TYPE)); + context.setAttribute(SdcArtifactHandlerConstants.ACTION, content.getString(SdcArtifactHandlerConstants.ACTION)); + String actionLevel=content.getString(SdcArtifactHandlerConstants.ACTION_LEVEL); + context.setAttribute(SdcArtifactHandlerConstants.ACTION_LEVEL, content.getString(SdcArtifactHandlerConstants.ACTION_LEVEL)); + if ((null != actionLevel) && actionLevel.equalsIgnoreCase(SdcArtifactHandlerConstants.ACTION_LEVEL_VNFC)) { + vnfcActionList.put(content.getString(SdcArtifactHandlerConstants.ACTION)); } - if (null != actionLevel && actionLevel.equalsIgnoreCase(AsdcArtifactHandlerConstants.ACTION_LEVEL_VF_MODULE)) { - vfModuleActionList.put(content.getString(AsdcArtifactHandlerConstants.ACTION)); + if (null != actionLevel && actionLevel.equalsIgnoreCase(SdcArtifactHandlerConstants.ACTION_LEVEL_VF_MODULE)) { + vfModuleActionList.put(content.getString(SdcArtifactHandlerConstants.ACTION)); } - if (null != actionLevel && actionLevel.equalsIgnoreCase(AsdcArtifactHandlerConstants.ACTION_LEVEL_VNF)) { - vnfActionList.put(content.getString(AsdcArtifactHandlerConstants.ACTION)); + if (null != actionLevel && actionLevel.equalsIgnoreCase(SdcArtifactHandlerConstants.ACTION_LEVEL_VNF)) { + vnfActionList.put(content.getString(SdcArtifactHandlerConstants.ACTION)); } - if (null != actionLevel && actionLevel.equalsIgnoreCase(AsdcArtifactHandlerConstants.ACTION_LEVEL_VM)) { - vmActionList.put(content.getString(AsdcArtifactHandlerConstants.ACTION)); + if (null != actionLevel && actionLevel.equalsIgnoreCase(SdcArtifactHandlerConstants.ACTION_LEVEL_VM)) { + vmActionList.put(content.getString(SdcArtifactHandlerConstants.ACTION)); } - if(scope.has(AsdcArtifactHandlerConstants.VNFC_TYPE) && !scope.isNull(AsdcArtifactHandlerConstants.VNFC_TYPE) ) - context.setAttribute(AsdcArtifactHandlerConstants.VNFC_TYPE, scope.getString(AsdcArtifactHandlerConstants.VNFC_TYPE)); + if(scope.has(SdcArtifactHandlerConstants.VNFC_TYPE) && !scope.isNull(SdcArtifactHandlerConstants.VNFC_TYPE) ) + context.setAttribute(SdcArtifactHandlerConstants.VNFC_TYPE, scope.getString(SdcArtifactHandlerConstants.VNFC_TYPE)); else - context.setAttribute(AsdcArtifactHandlerConstants.VNFC_TYPE,null); - if (content.has(AsdcArtifactHandlerConstants.DEVICE_PROTOCOL)) - context.setAttribute(AsdcArtifactHandlerConstants.DEVICE_PROTOCOL, content.getString(AsdcArtifactHandlerConstants.DEVICE_PROTOCOL)); - if (content.has(AsdcArtifactHandlerConstants.USER_NAME)) - context.setAttribute(AsdcArtifactHandlerConstants.USER_NAME, content.getString(AsdcArtifactHandlerConstants.USER_NAME)); - if (content.has(AsdcArtifactHandlerConstants.PORT_NUMBER)) - context.setAttribute(AsdcArtifactHandlerConstants.PORT_NUMBER, content.getString(AsdcArtifactHandlerConstants.PORT_NUMBER)); - context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_TYPE, ""); + context.setAttribute(SdcArtifactHandlerConstants.VNFC_TYPE,null); + if (content.has(SdcArtifactHandlerConstants.DEVICE_PROTOCOL)) + context.setAttribute(SdcArtifactHandlerConstants.DEVICE_PROTOCOL, content.getString(SdcArtifactHandlerConstants.DEVICE_PROTOCOL)); + if (content.has(SdcArtifactHandlerConstants.USER_NAME)) + context.setAttribute(SdcArtifactHandlerConstants.USER_NAME, content.getString(SdcArtifactHandlerConstants.USER_NAME)); + if (content.has(SdcArtifactHandlerConstants.PORT_NUMBER)) + context.setAttribute(SdcArtifactHandlerConstants.PORT_NUMBER, content.getString(SdcArtifactHandlerConstants.PORT_NUMBER)); + context.setAttribute(SdcArtifactHandlerConstants.ARTIFACT_TYPE, ""); if(content.has("artifact-list") && content.get("artifact-list") instanceof JSONArray){ JSONArray artifactLists = (JSONArray)content.get("artifact-list"); for(int i=0;i<artifactLists.length();i++){ JSONObject artifact=(JSONObject)artifactLists.get(i); log.info("artifact is " + artifact); - context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME, artifact.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME)); - context.setAttribute(AsdcArtifactHandlerConstants.FILE_CATEGORY, artifact.getString(AsdcArtifactHandlerConstants.ARTIFACT_TYPE)); + context.setAttribute(SdcArtifactHandlerConstants.ARTIFACT_NAME, artifact.getString(SdcArtifactHandlerConstants.ARTIFACT_NAME)); + context.setAttribute(SdcArtifactHandlerConstants.FILE_CATEGORY, artifact.getString(SdcArtifactHandlerConstants.ARTIFACT_TYPE)); - if(artifact.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME) !=null && - artifact.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME).toLowerCase().startsWith(AsdcArtifactHandlerConstants.PD)) + if(artifact.getString(SdcArtifactHandlerConstants.ARTIFACT_NAME) !=null && + artifact.getString(SdcArtifactHandlerConstants.ARTIFACT_NAME).toLowerCase().startsWith(SdcArtifactHandlerConstants.PD)) { - suffix = artifact.getString(AsdcArtifactHandlerConstants.ARTIFACT_NAME).substring(AsdcArtifactHandlerConstants.PD.length()); - categorySuffix = artifact.getString(AsdcArtifactHandlerConstants.ARTIFACT_TYPE).substring(AsdcArtifactHandlerConstants.PD.length()); + suffix = artifact.getString(SdcArtifactHandlerConstants.ARTIFACT_NAME).substring(SdcArtifactHandlerConstants.PD.length()); + categorySuffix = artifact.getString(SdcArtifactHandlerConstants.ARTIFACT_TYPE).substring(SdcArtifactHandlerConstants.PD.length()); pdFile = true; } - dbservice.processAsdcReferences(context, dbservice.isArtifactUpdateRequired(context, AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE)); + dbservice.processSdcReferences(context, dbservice.isArtifactUpdateRequired(context, SdcArtifactHandlerConstants.DB_SDC_REFERENCE)); cleanArtifactInstanceData(context); } if(pdFile) { - context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME, "Tosca".concat(suffix)); - context.setAttribute(AsdcArtifactHandlerConstants.FILE_CATEGORY, AsdcArtifactHandlerConstants.TOSCA_MODEL); - dbservice.processAsdcReferences(context, dbservice.isArtifactUpdateRequired(context, AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE)); - context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME, "Yang".concat(suffix)); - context.setAttribute(AsdcArtifactHandlerConstants.FILE_CATEGORY, AsdcArtifactHandlerConstants.PARAMETER_YANG); - dbservice.processAsdcReferences(context, dbservice.isArtifactUpdateRequired(context, AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE)); + context.setAttribute(SdcArtifactHandlerConstants.ARTIFACT_NAME, "Tosca".concat(suffix)); + context.setAttribute(SdcArtifactHandlerConstants.FILE_CATEGORY, SdcArtifactHandlerConstants.TOSCA_MODEL); + dbservice.processSdcReferences(context, dbservice.isArtifactUpdateRequired(context, SdcArtifactHandlerConstants.DB_SDC_REFERENCE)); + context.setAttribute(SdcArtifactHandlerConstants.ARTIFACT_NAME, "Yang".concat(suffix)); + context.setAttribute(SdcArtifactHandlerConstants.FILE_CATEGORY, SdcArtifactHandlerConstants.PARAMETER_YANG); + dbservice.processSdcReferences(context, dbservice.isArtifactUpdateRequired(context, SdcArtifactHandlerConstants.DB_SDC_REFERENCE)); } } - if (content.getString(AsdcArtifactHandlerConstants.ACTION).equals("Configure")) { - if(content.has(AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE) && content.getString(AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE).length() > 0){ - context.setAttribute(AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE, content.getString(AsdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE)); - dbservice.processDownloadDgReference(context, dbservice.isArtifactUpdateRequired(context,AsdcArtifactHandlerConstants.DB_DOWNLOAD_DG_REFERENCE)); + if (content.getString(SdcArtifactHandlerConstants.ACTION).equals("Configure")) { + if(content.has(SdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE) && content.getString(SdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE).length() > 0){ + context.setAttribute(SdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE, content.getString(SdcArtifactHandlerConstants.DOWNLOAD_DG_REFERENCE)); + dbservice.processDownloadDgReference(context, dbservice.isArtifactUpdateRequired(context, SdcArtifactHandlerConstants.DB_DOWNLOAD_DG_REFERENCE)); } - dbservice.processConfigActionDg(context, dbservice.isArtifactUpdateRequired(context, AsdcArtifactHandlerConstants.DB_CONFIG_ACTION_DG)); - dbservice.processDeviceInterfaceProtocol(context, dbservice.isArtifactUpdateRequired(context, AsdcArtifactHandlerConstants.DB_DEVICE_INTERFACE_PROTOCOL)); - dbservice.processDeviceAuthentication(context, dbservice.isArtifactUpdateRequired(context, AsdcArtifactHandlerConstants.DB_DEVICE_AUTHENTICATION)); + dbservice.processConfigActionDg(context, dbservice.isArtifactUpdateRequired(context, SdcArtifactHandlerConstants.DB_CONFIG_ACTION_DG)); + dbservice.processDeviceInterfaceProtocol(context, dbservice.isArtifactUpdateRequired(context, SdcArtifactHandlerConstants.DB_DEVICE_INTERFACE_PROTOCOL)); + dbservice.processDeviceAuthentication(context, dbservice.isArtifactUpdateRequired(context, SdcArtifactHandlerConstants.DB_DEVICE_AUTHENTICATION)); } populateProtocolReference(dbservice, content); - context.setAttribute(AsdcArtifactHandlerConstants.VNFC_TYPE, null); + context.setAttribute(SdcArtifactHandlerConstants.VNFC_TYPE, null); - if( content.has(AsdcArtifactHandlerConstants.VM) && content.get(AsdcArtifactHandlerConstants.VM) instanceof JSONArray){ - JSONArray vmList = (JSONArray)content.get(AsdcArtifactHandlerConstants.VM); + if( content.has(SdcArtifactHandlerConstants.VM) && content.get(SdcArtifactHandlerConstants.VM) instanceof JSONArray){ + JSONArray vmList = (JSONArray)content.get(SdcArtifactHandlerConstants.VM); for(int i=0;i<vmList.length();i++){ JSONObject vmInstance=(JSONObject)vmList.get(i); - context.setAttribute(AsdcArtifactHandlerConstants.VM_INSTANCE, String.valueOf(vmInstance.getInt(AsdcArtifactHandlerConstants.VM_INSTANCE))); - log.info("VALUE = " + context.getAttribute(AsdcArtifactHandlerConstants.VM_INSTANCE)); - if(vmInstance.get(AsdcArtifactHandlerConstants.VNFC) instanceof JSONArray){ - JSONArray vnfcInstanceList = (JSONArray)vmInstance.get(AsdcArtifactHandlerConstants.VNFC); + context.setAttribute(SdcArtifactHandlerConstants.VM_INSTANCE, String.valueOf(vmInstance.getInt(SdcArtifactHandlerConstants.VM_INSTANCE))); + log.info("VALUE = " + context.getAttribute(SdcArtifactHandlerConstants.VM_INSTANCE)); + if(vmInstance.get(SdcArtifactHandlerConstants.VNFC) instanceof JSONArray){ + JSONArray vnfcInstanceList = (JSONArray)vmInstance.get(SdcArtifactHandlerConstants.VNFC); for(int k=0;k<vnfcInstanceList.length();k++){ JSONObject vnfcInstance = (JSONObject)vnfcInstanceList.get(k); - context.setAttribute(AsdcArtifactHandlerConstants.VNFC_INSTANCE, String.valueOf(vnfcInstance.getInt(AsdcArtifactHandlerConstants.VNFC_INSTANCE))); - context.setAttribute(AsdcArtifactHandlerConstants.VNFC_TYPE, vnfcInstance.getString(AsdcArtifactHandlerConstants.VNFC_TYPE)); - context.setAttribute(AsdcArtifactHandlerConstants.VNFC_FUNCTION_CODE, vnfcInstance.getString(AsdcArtifactHandlerConstants.VNFC_FUNCTION_CODE)); - if(vnfcInstance.has(AsdcArtifactHandlerConstants.IPADDRESS_V4_OAM_VIP)) - context.setAttribute(AsdcArtifactHandlerConstants.IPADDRESS_V4_OAM_VIP, vnfcInstance.getString(AsdcArtifactHandlerConstants.IPADDRESS_V4_OAM_VIP)); - if(vnfcInstance.has(AsdcArtifactHandlerConstants.GROUP_NOTATION_TYPE)) - context.setAttribute(AsdcArtifactHandlerConstants.GROUP_NOTATION_TYPE, vnfcInstance.getString(AsdcArtifactHandlerConstants.GROUP_NOTATION_TYPE)); - if(vnfcInstance.has(AsdcArtifactHandlerConstants.GROUP_NOTATION_VALUE)) - context.setAttribute(AsdcArtifactHandlerConstants.GROUP_NOTATION_VALUE, vnfcInstance.getString(AsdcArtifactHandlerConstants.GROUP_NOTATION_VALUE)); - dbservice.processVnfcReference(context, dbservice.isArtifactUpdateRequired(context, AsdcArtifactHandlerConstants.DB_VNFC_REFERENCE)); + context.setAttribute(SdcArtifactHandlerConstants.VNFC_INSTANCE, String.valueOf(vnfcInstance.getInt(SdcArtifactHandlerConstants.VNFC_INSTANCE))); + context.setAttribute(SdcArtifactHandlerConstants.VNFC_TYPE, vnfcInstance.getString(SdcArtifactHandlerConstants.VNFC_TYPE)); + context.setAttribute(SdcArtifactHandlerConstants.VNFC_FUNCTION_CODE, vnfcInstance.getString(SdcArtifactHandlerConstants.VNFC_FUNCTION_CODE)); + if(vnfcInstance.has(SdcArtifactHandlerConstants.IPADDRESS_V4_OAM_VIP)) + context.setAttribute(SdcArtifactHandlerConstants.IPADDRESS_V4_OAM_VIP, vnfcInstance.getString(SdcArtifactHandlerConstants.IPADDRESS_V4_OAM_VIP)); + if(vnfcInstance.has(SdcArtifactHandlerConstants.GROUP_NOTATION_TYPE)) + context.setAttribute(SdcArtifactHandlerConstants.GROUP_NOTATION_TYPE, vnfcInstance.getString(SdcArtifactHandlerConstants.GROUP_NOTATION_TYPE)); + 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)); cleanVnfcInstance(context); } - context.setAttribute(AsdcArtifactHandlerConstants.VM_INSTANCE,null); + context.setAttribute(SdcArtifactHandlerConstants.VM_INSTANCE,null); } } } @@ -353,18 +353,18 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin { private void cleanArtifactInstanceData(SvcLogicContext context) { - context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME, null); - context.setAttribute(AsdcArtifactHandlerConstants.FILE_CATEGORY, null); + context.setAttribute(SdcArtifactHandlerConstants.ARTIFACT_NAME, null); + context.setAttribute(SdcArtifactHandlerConstants.FILE_CATEGORY, null); } private void cleanVnfcInstance(SvcLogicContext context) { - context.setAttribute(AsdcArtifactHandlerConstants.VNFC_INSTANCE, null); - context.setAttribute(AsdcArtifactHandlerConstants.VNFC_TYPE, null); - context.setAttribute(AsdcArtifactHandlerConstants.VNFC_FUNCTION_CODE, null); - context.setAttribute(AsdcArtifactHandlerConstants.IPADDRESS_V4_OAM_VIP, null); - context.setAttribute(AsdcArtifactHandlerConstants.GROUP_NOTATION_TYPE, null); - context.setAttribute(AsdcArtifactHandlerConstants.GROUP_NOTATION_VALUE, null); + context.setAttribute(SdcArtifactHandlerConstants.VNFC_INSTANCE, null); + context.setAttribute(SdcArtifactHandlerConstants.VNFC_TYPE, null); + context.setAttribute(SdcArtifactHandlerConstants.VNFC_FUNCTION_CODE, null); + context.setAttribute(SdcArtifactHandlerConstants.IPADDRESS_V4_OAM_VIP, null); + context.setAttribute(SdcArtifactHandlerConstants.GROUP_NOTATION_TYPE, null); + context.setAttribute(SdcArtifactHandlerConstants.GROUP_NOTATION_VALUE, null); } @@ -377,33 +377,33 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin { JSONObject newCapabilitiesObject=new JSONObject(); newCapabilitiesObject.put("capabilities", capabilities); SvcLogicContext context = new SvcLogicContext(); - context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME,capabilityArtifactName); - context.setAttribute(AsdcArtifactHandlerConstants.FILE_CATEGORY, AsdcArtifactHandlerConstants.CAPABILITY); - context.setAttribute(AsdcArtifactHandlerConstants.ACTION, null); - context.setAttribute(AsdcArtifactHandlerConstants.VNFC_TYPE, null); - context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_TYPE, null); - context.setAttribute(AsdcArtifactHandlerConstants.VNF_TYPE,vnfType); - context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_CONTENTS,newCapabilitiesObject.toString()); - dbservice.processAsdcReferences(context, dbservice.isArtifactUpdateRequired(context, AsdcArtifactHandlerConstants.DB_ASDC_REFERENCE)); + context.setAttribute(SdcArtifactHandlerConstants.ARTIFACT_NAME,capabilityArtifactName); + context.setAttribute(SdcArtifactHandlerConstants.FILE_CATEGORY, SdcArtifactHandlerConstants.CAPABILITY); + context.setAttribute(SdcArtifactHandlerConstants.ACTION, null); + context.setAttribute(SdcArtifactHandlerConstants.VNFC_TYPE, null); + context.setAttribute(SdcArtifactHandlerConstants.ARTIFACT_TYPE, null); + context.setAttribute(SdcArtifactHandlerConstants.VNF_TYPE,vnfType); + context.setAttribute(SdcArtifactHandlerConstants.ARTIFACT_CONTENTS,newCapabilitiesObject.toString()); + dbservice.processSdcReferences(context, dbservice.isArtifactUpdateRequired(context, SdcArtifactHandlerConstants.DB_SDC_REFERENCE)); int intversion = 0; - String internal_version = dbservice.getInternalVersionNumber(context, context.getAttribute(AsdcArtifactHandlerConstants.ARTIFACT_NAME), null); + String internal_version = dbservice.getInternalVersionNumber(context, context.getAttribute(SdcArtifactHandlerConstants.ARTIFACT_NAME), null); log.info("Internal Version number received from Database : " + internal_version); if(internal_version != null){ intversion = Integer.parseInt(internal_version); intversion++ ; } - context.setAttribute(AsdcArtifactHandlerConstants.SERVICE_UUID, document_information.getString(AsdcArtifactHandlerConstants.SERVICE_UUID)); - context.setAttribute(AsdcArtifactHandlerConstants.DISTRIBUTION_ID, document_information.getString(AsdcArtifactHandlerConstants.DISTRIBUTION_ID)); - context.setAttribute(AsdcArtifactHandlerConstants.SERVICE_NAME, document_information.getString(AsdcArtifactHandlerConstants.SERVICE_NAME)); - context.setAttribute(AsdcArtifactHandlerConstants.SERVICE_DESCRIPTION, document_information.getString(AsdcArtifactHandlerConstants.SERVICE_DESCRIPTION)); - context.setAttribute(AsdcArtifactHandlerConstants.RESOURCE_UUID, document_information.getString(AsdcArtifactHandlerConstants.RESOURCE_UUID)); - context.setAttribute(AsdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME,document_information.getString(AsdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME)); - context.setAttribute(AsdcArtifactHandlerConstants.RESOURCE_VERSOIN, document_information.getString(AsdcArtifactHandlerConstants.RESOURCE_VERSOIN)); - context.setAttribute(AsdcArtifactHandlerConstants.RESOURCE_TYPE, document_information.getString(AsdcArtifactHandlerConstants.RESOURCE_TYPE)); - context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_UUID, document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_UUID)); - context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_VERSOIN,document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_VERSOIN)); - context.setAttribute(AsdcArtifactHandlerConstants.ARTIFACT_DESRIPTION,document_information.getString(AsdcArtifactHandlerConstants.ARTIFACT_DESRIPTION)); + context.setAttribute(SdcArtifactHandlerConstants.SERVICE_UUID, document_information.getString(SdcArtifactHandlerConstants.SERVICE_UUID)); + context.setAttribute(SdcArtifactHandlerConstants.DISTRIBUTION_ID, document_information.getString(SdcArtifactHandlerConstants.DISTRIBUTION_ID)); + context.setAttribute(SdcArtifactHandlerConstants.SERVICE_NAME, document_information.getString(SdcArtifactHandlerConstants.SERVICE_NAME)); + context.setAttribute(SdcArtifactHandlerConstants.SERVICE_DESCRIPTION, document_information.getString(SdcArtifactHandlerConstants.SERVICE_DESCRIPTION)); + context.setAttribute(SdcArtifactHandlerConstants.RESOURCE_UUID, document_information.getString(SdcArtifactHandlerConstants.RESOURCE_UUID)); + context.setAttribute(SdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME,document_information.getString(SdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME)); + context.setAttribute(SdcArtifactHandlerConstants.RESOURCE_VERSOIN, document_information.getString(SdcArtifactHandlerConstants.RESOURCE_VERSOIN)); + context.setAttribute(SdcArtifactHandlerConstants.RESOURCE_TYPE, document_information.getString(SdcArtifactHandlerConstants.RESOURCE_TYPE)); + context.setAttribute(SdcArtifactHandlerConstants.ARTIFACT_UUID, document_information.getString(SdcArtifactHandlerConstants.ARTIFACT_UUID)); + context.setAttribute(SdcArtifactHandlerConstants.ARTIFACT_VERSOIN,document_information.getString(SdcArtifactHandlerConstants.ARTIFACT_VERSOIN)); + context.setAttribute(SdcArtifactHandlerConstants.ARTIFACT_DESRIPTION,document_information.getString(SdcArtifactHandlerConstants.ARTIFACT_DESRIPTION)); dbservice.saveArtifacts(context, intversion); @@ -426,16 +426,16 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin { SvcLogicContext context = new SvcLogicContext(); JSONObject scope = content.getJSONObject("scope"); String vnfType=null,protocol=null,action=null,actionLevel=null,template=null; - if(scope.has(AsdcArtifactHandlerConstants.VNF_TYPE) && !scope.isNull(AsdcArtifactHandlerConstants.VNF_TYPE)) - vnfType=scope.getString(AsdcArtifactHandlerConstants.VNF_TYPE); - if (content.has(AsdcArtifactHandlerConstants.DEVICE_PROTOCOL)) - protocol=content.getString(AsdcArtifactHandlerConstants.DEVICE_PROTOCOL); - if (content.has(AsdcArtifactHandlerConstants.ACTION)) - action= content.getString(AsdcArtifactHandlerConstants.ACTION); - if (content.has(AsdcArtifactHandlerConstants.ACTION_LEVEL)) - actionLevel=content.getString(AsdcArtifactHandlerConstants.ACTION_LEVEL); - if (content.has(AsdcArtifactHandlerConstants.TEMPLATE) && !content.isNull(AsdcArtifactHandlerConstants.TEMPLATE)) - template=content.getString(AsdcArtifactHandlerConstants.TEMPLATE); + if(scope.has(SdcArtifactHandlerConstants.VNF_TYPE) && !scope.isNull(SdcArtifactHandlerConstants.VNF_TYPE)) + vnfType=scope.getString(SdcArtifactHandlerConstants.VNF_TYPE); + if (content.has(SdcArtifactHandlerConstants.DEVICE_PROTOCOL)) + protocol=content.getString(SdcArtifactHandlerConstants.DEVICE_PROTOCOL); + if (content.has(SdcArtifactHandlerConstants.ACTION)) + action= content.getString(SdcArtifactHandlerConstants.ACTION); + if (content.has(SdcArtifactHandlerConstants.ACTION_LEVEL)) + actionLevel=content.getString(SdcArtifactHandlerConstants.ACTION_LEVEL); + if (content.has(SdcArtifactHandlerConstants.TEMPLATE) && !content.isNull(SdcArtifactHandlerConstants.TEMPLATE)) + template=content.getString(SdcArtifactHandlerConstants.TEMPLATE); dbservice.insertProtocolReference(context, vnfType,protocol,action,actionLevel,template); } catch (Exception e) { diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/ArtifactHandlerProviderUtil.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/ArtifactHandlerProviderUtil.java index 91b6e88b0..96c7c0661 100644 --- a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/ArtifactHandlerProviderUtil.java +++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/ArtifactHandlerProviderUtil.java @@ -94,34 +94,34 @@ public class ArtifactHandlerProviderUtil { JSONObject requestInfo = new JSONObject(); String random = getRandom(); - requestInfo.put(AsdcArtifactHandlerConstants.REQUETS_ID, "TLRID-" + random); - requestInfo.put(AsdcArtifactHandlerConstants.REQUEST_ACTION, "StoreAsdcDocumentRequest"); - requestInfo.put(AsdcArtifactHandlerConstants.SOURCE, "TemplateLoader"); + requestInfo.put(SdcArtifactHandlerConstants.REQUETS_ID, "TLRID-" + random); + requestInfo.put(SdcArtifactHandlerConstants.REQUEST_ACTION, "StoreSdcDocumentRequest"); + requestInfo.put(SdcArtifactHandlerConstants.SOURCE, "TemplateLoader"); JSONObject docParams = new JSONObject(); - docParams.put(AsdcArtifactHandlerConstants.SERVICE_UUID, "TLSUUID" + templateData.getRequestInformation().getRequestId()); - docParams.put(AsdcArtifactHandlerConstants.DISTRIBUTION_ID, "TLDID" + random); - docParams.put(AsdcArtifactHandlerConstants.SERVICE_NAME, "TLServiceName"); - docParams.put(AsdcArtifactHandlerConstants.SERVICE_DESCRIPTION, "Template Loader Test"); - docParams.put(AsdcArtifactHandlerConstants.SERVICE_ARTIFACTS, "[]"); - docParams.put(AsdcArtifactHandlerConstants.RESOURCE_UUID, "TLRUID" + random); - docParams.put(AsdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME, "TLRIName"); - docParams.put(AsdcArtifactHandlerConstants.REOURCE_NAME, "TLResourceName"); - docParams.put(AsdcArtifactHandlerConstants.RESOURCE_VERSOIN, "TLResourceVersion"); - docParams.put(AsdcArtifactHandlerConstants.RESOURCE_TYPE, "TLResourceType"); - docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_UUID, "TLAUUID" + random); - docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_NAME, templateData.getDocumentParameters().getArtifactName()); - docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_TYPE, "APPC-CONFIG"); - docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_VERSOIN, templateData.getDocumentParameters().getArtifactVersion()); - docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_DESRIPTION, "AsdcTestDescription"); + docParams.put(SdcArtifactHandlerConstants.SERVICE_UUID, "TLSUUID" + templateData.getRequestInformation().getRequestId()); + docParams.put(SdcArtifactHandlerConstants.DISTRIBUTION_ID, "TLDID" + random); + docParams.put(SdcArtifactHandlerConstants.SERVICE_NAME, "TLServiceName"); + docParams.put(SdcArtifactHandlerConstants.SERVICE_DESCRIPTION, "Template Loader Test"); + docParams.put(SdcArtifactHandlerConstants.SERVICE_ARTIFACTS, "[]"); + docParams.put(SdcArtifactHandlerConstants.RESOURCE_UUID, "TLRUID" + random); + docParams.put(SdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME, "TLRIName"); + docParams.put(SdcArtifactHandlerConstants.REOURCE_NAME, "TLResourceName"); + docParams.put(SdcArtifactHandlerConstants.RESOURCE_VERSOIN, "TLResourceVersion"); + docParams.put(SdcArtifactHandlerConstants.RESOURCE_TYPE, "TLResourceType"); + docParams.put(SdcArtifactHandlerConstants.ARTIFACT_UUID, "TLAUUID" + random); + docParams.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, templateData.getDocumentParameters().getArtifactName()); + docParams.put(SdcArtifactHandlerConstants.ARTIFACT_TYPE, "APPC-CONFIG"); + docParams.put(SdcArtifactHandlerConstants.ARTIFACT_VERSOIN, templateData.getDocumentParameters().getArtifactVersion()); + docParams.put(SdcArtifactHandlerConstants.ARTIFACT_DESRIPTION, "SdcTestDescription"); // String data = IOUtils.toString(TestartifactHandlerNode.class.getClassLoader().getResourceAsStream("template_msrp_msc_a_template.json"), "utf-8"); // String data = IOUtils.toString(TemplateProcessor.class.getClassLoader().getResourceAsStream("referenceData.json"), "utf-8"); // this.templateData = this.templateData.substring(this.templateData.indexOf("}") + 1); docParams.put("artifact-contents", templateData.getDocumentParameters().getArtifactContents()); - json.put(AsdcArtifactHandlerConstants.REQUEST_INFORMATION, requestInfo); - json.put(AsdcArtifactHandlerConstants.DOCUMENT_PARAMETERS, docParams); + json.put(SdcArtifactHandlerConstants.REQUEST_INFORMATION, requestInfo); + json.put(SdcArtifactHandlerConstants.DOCUMENT_PARAMETERS, docParams); System.out.println("Final data =" + this.templateData); return String.format("{\"input\": %s}", json.toString()); } @@ -151,31 +151,31 @@ public class ArtifactHandlerProviderUtil { JSONObject requestInfo = new JSONObject(); String random = getRandom(); - requestInfo.put(AsdcArtifactHandlerConstants.REQUETS_ID, templateData.getRequestInformation().getRequestId()); - requestInfo.put(AsdcArtifactHandlerConstants.REQUEST_ACTION, "StoreAsdcDocumentRequest"); - requestInfo.put(AsdcArtifactHandlerConstants.SOURCE, templateData.getRequestInformation().getSource()); + requestInfo.put(SdcArtifactHandlerConstants.REQUETS_ID, templateData.getRequestInformation().getRequestId()); + requestInfo.put(SdcArtifactHandlerConstants.REQUEST_ACTION, "StoreSdcDocumentRequest"); + requestInfo.put(SdcArtifactHandlerConstants.SOURCE, templateData.getRequestInformation().getSource()); JSONObject docParams = new JSONObject(); - docParams.put(AsdcArtifactHandlerConstants.SERVICE_UUID, templateData.getDocumentParameters().getResourceUuid()); - docParams.put(AsdcArtifactHandlerConstants.DISTRIBUTION_ID, templateData.getDocumentParameters().getDistributionId()); - docParams.put(AsdcArtifactHandlerConstants.SERVICE_NAME, templateData.getDocumentParameters().getServiceName()); - docParams.put(AsdcArtifactHandlerConstants.SERVICE_DESCRIPTION, templateData.getDocumentParameters().getServiceDescription()); - docParams.put(AsdcArtifactHandlerConstants.SERVICE_ARTIFACTS, templateData.getDocumentParameters().getServiceArtifacts()); - docParams.put(AsdcArtifactHandlerConstants.RESOURCE_UUID, templateData.getDocumentParameters().getResourceUuid()); - docParams.put(AsdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME, templateData.getDocumentParameters().getResourceInstanceName()); - docParams.put(AsdcArtifactHandlerConstants.REOURCE_NAME, templateData.getDocumentParameters().getResourceName()); - docParams.put(AsdcArtifactHandlerConstants.RESOURCE_VERSOIN, templateData.getDocumentParameters().getResourceVersion()); - docParams.put(AsdcArtifactHandlerConstants.RESOURCE_TYPE, templateData.getDocumentParameters().getResourceType()); - docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_UUID, templateData.getDocumentParameters().getArtifactUuid()); - docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_NAME, templateData.getDocumentParameters().getArtifactName()); - docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_TYPE, templateData.getDocumentParameters().getArtifactType()); - docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_VERSOIN, templateData.getDocumentParameters().getArtifactVersion()); - docParams.put(AsdcArtifactHandlerConstants.ARTIFACT_DESRIPTION, templateData.getDocumentParameters().getArtifactDescription()); + docParams.put(SdcArtifactHandlerConstants.SERVICE_UUID, templateData.getDocumentParameters().getResourceUuid()); + docParams.put(SdcArtifactHandlerConstants.DISTRIBUTION_ID, templateData.getDocumentParameters().getDistributionId()); + docParams.put(SdcArtifactHandlerConstants.SERVICE_NAME, templateData.getDocumentParameters().getServiceName()); + docParams.put(SdcArtifactHandlerConstants.SERVICE_DESCRIPTION, templateData.getDocumentParameters().getServiceDescription()); + docParams.put(SdcArtifactHandlerConstants.SERVICE_ARTIFACTS, templateData.getDocumentParameters().getServiceArtifacts()); + docParams.put(SdcArtifactHandlerConstants.RESOURCE_UUID, templateData.getDocumentParameters().getResourceUuid()); + docParams.put(SdcArtifactHandlerConstants.RESOURCE_INSTANCE_NAME, templateData.getDocumentParameters().getResourceInstanceName()); + docParams.put(SdcArtifactHandlerConstants.REOURCE_NAME, templateData.getDocumentParameters().getResourceName()); + docParams.put(SdcArtifactHandlerConstants.RESOURCE_VERSOIN, templateData.getDocumentParameters().getResourceVersion()); + docParams.put(SdcArtifactHandlerConstants.RESOURCE_TYPE, templateData.getDocumentParameters().getResourceType()); + docParams.put(SdcArtifactHandlerConstants.ARTIFACT_UUID, templateData.getDocumentParameters().getArtifactUuid()); + docParams.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, templateData.getDocumentParameters().getArtifactName()); + docParams.put(SdcArtifactHandlerConstants.ARTIFACT_TYPE, templateData.getDocumentParameters().getArtifactType()); + docParams.put(SdcArtifactHandlerConstants.ARTIFACT_VERSOIN, templateData.getDocumentParameters().getArtifactVersion()); + docParams.put(SdcArtifactHandlerConstants.ARTIFACT_DESRIPTION, templateData.getDocumentParameters().getArtifactDescription()); docParams.put("artifact-contents", templateData.getDocumentParameters().getArtifactContents()); - json.put(AsdcArtifactHandlerConstants.REQUEST_INFORMATION, requestInfo); - json.put(AsdcArtifactHandlerConstants.DOCUMENT_PARAMETERS, docParams); + json.put(SdcArtifactHandlerConstants.REQUEST_INFORMATION, requestInfo); + json.put(SdcArtifactHandlerConstants.DOCUMENT_PARAMETERS, docParams); System.out.println("Final data =" + this.templateData); return String.format("{\"input\": %s}", json.toString()); } diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/AsdcArtifactHandlerConstants.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/SdcArtifactHandlerConstants.java index cfcb250ee..57dbb3f6f 100644 --- a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/AsdcArtifactHandlerConstants.java +++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/SdcArtifactHandlerConstants.java @@ -24,7 +24,7 @@ package org.openecomp.appc.artifact.handler.utils; -public class AsdcArtifactHandlerConstants { +public class SdcArtifactHandlerConstants { public static final String DOCUMENT_PARAMETERS = "document-parameters"; public static final String SERVICE_UUID = "service-uuid"; @@ -72,7 +72,7 @@ public class AsdcArtifactHandlerConstants { public static final String DB_DOWNLOAD_DG_REFERENCE = "DOWNLOAD_DG_REFERENCE"; - public static final String DB_ASDC_REFERENCE = "ASDC_REFERENCE"; + public static final String DB_SDC_REFERENCE = "ASDC_REFERENCE"; public static final String DB_DEVICE_INTERFACE_PROTOCOL = "DEVICE_INTERFACE_PROTOCOL"; public static final String DB_DEVICE_AUTHENTICATION = "DEVICE_AUTHENTICATION"; public static final String DB_VNFC_REFERENCE = "VNFC_REFERENCE"; |