From 3df3182a7badeef662f743bfc8d67cea805b1ef4 Mon Sep 17 00:00:00 2001 From: mojahidi Date: Tue, 29 Aug 2017 18:20:26 +0530 Subject: 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 --- .../artifact/handler/ArtifactHandlerProvider.java | 4 +- .../handler/AsdcArtifactHandlerActivator.java | 59 ----- .../handler/SdcArtifactHandlerActivator.java | 58 +++++ .../artifact/handler/dbservices/DBService.java | 224 ++++++++-------- .../artifact/handler/node/ArtifactHandlerNode.java | 282 ++++++++++----------- .../handler/utils/ArtifactHandlerProviderUtil.java | 80 +++--- .../utils/AsdcArtifactHandlerConstants.java | 93 ------- .../handler/utils/SdcArtifactHandlerConstants.java | 93 +++++++ 8 files changed, 446 insertions(+), 447 deletions(-) delete mode 100644 appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/AsdcArtifactHandlerActivator.java create mode 100644 appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/SdcArtifactHandlerActivator.java delete mode 100644 appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/AsdcArtifactHandlerConstants.java create mode 100644 appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/utils/SdcArtifactHandlerConstants.java (limited to 'appc-inbound/appc-artifact-handler/provider/src') 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/AsdcArtifactHandlerActivator.java deleted file mode 100644 index 4c8e1358f..000000000 --- a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/AsdcArtifactHandlerActivator.java +++ /dev/null @@ -1,59 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP : APPC - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * ================================================================================ - * Copyright (C) 2017 Amdocs - * ============================================================================= - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - * ECOMP is a trademark and service mark of AT&T Intellectual Property. - * ============LICENSE_END========================================================= - */ - -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; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; - -import com.att.eelf.configuration.EELFLogger; -import com.att.eelf.configuration.EELFManager; - -public class AsdcArtifactHandlerActivator implements BundleActivator { - - private static final EELFLogger log = EELFManager.getInstance().getLogger(AsdcArtifactHandlerActivator.class); - private List registrations = new LinkedList(); - - @Override - public void start(BundleContext ctx) throws Exception { - ArtifactHandlerNode artifactHandlerNode = new ArtifactHandlerNode(); - log.info("Registering service-- " + artifactHandlerNode.getClass().getName()); - registrations.add(ctx.registerService(artifactHandlerNode.getClass().getName(), artifactHandlerNode, null)); - - } - - @Override - public void stop(BundleContext arg0) throws Exception { - for (ServiceRegistration registration : registrations) { - registration.unregister(); - registration = null; - } - } -} diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/SdcArtifactHandlerActivator.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/SdcArtifactHandlerActivator.java new file mode 100644 index 000000000..6ce8af993 --- /dev/null +++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/openecomp/appc/artifact/handler/SdcArtifactHandlerActivator.java @@ -0,0 +1,58 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP : APPC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Copyright (C) 2017 Amdocs + * ============================================================================= + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.appc.artifact.handler; + +import java.util.LinkedList; +import java.util.List; + +import org.openecomp.appc.artifact.handler.node.ArtifactHandlerNode; +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + +import com.att.eelf.configuration.EELFLogger; +import com.att.eelf.configuration.EELFManager; + +public class SdcArtifactHandlerActivator implements BundleActivator { + + private static final EELFLogger log = EELFManager.getInstance().getLogger(SdcArtifactHandlerActivator.class); + private List registrations = new LinkedList(); + + @Override + public void start(BundleContext ctx) throws Exception { + ArtifactHandlerNode artifactHandlerNode = new ArtifactHandlerNode(); + log.info("Registering service-- " + artifactHandlerNode.getClass().getName()); + registrations.add(ctx.registerService(artifactHandlerNode.getClass().getName(), artifactHandlerNode, null)); + + } + + @Override + public void stop(BundleContext arg0) throws Exception { + for (ServiceRegistration registration : registrations) { + registration.unregister(); + registration = null; + } + } +} 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 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