aboutsummaryrefslogtreecommitdiffstats
path: root/appc-asdc-listener/appc-asdc-listener-bundle/src/main
diff options
context:
space:
mode:
authormojahidi <mojahidul.islam@amdocs.com>2017-08-29 18:20:26 +0530
committerMarcus Williams <marcus.williams@intel.com>2017-08-31 18:56:59 +0000
commit3df3182a7badeef662f743bfc8d67cea805b1ef4 (patch)
tree20e41c1f971de4c21ddd62e6c087d7a5d7ea5ae9 /appc-asdc-listener/appc-asdc-listener-bundle/src/main
parentdc2344fc5754dee739f1db69cc6c16dfe0522ab8 (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-asdc-listener/appc-asdc-listener-bundle/src/main')
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/ArtifactProcessor.java41
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/helper/ArtifactStorageService.java329
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/helper/Constants.java72
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/helper/DependencyModelGenerator.java97
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/AbstractArtifactProcessor.java196
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/ArtifactProcessorFactory.java89
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/ConfigArtifactProcessor.java76
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/LicenseArtifactProcessor.java92
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/ToscaCsarArtifactProcessor.java241
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/ArtifactType.java46
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/Resource.java87
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/SDCArtifact.java215
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/SDCReference.java94
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/Vnfc.java78
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcCallback.java148
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcConfig.java197
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcListener.java219
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/ProviderOperations.java211
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/ProviderResponse.java45
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/Util.java126
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/tlv/sdc/security/Passwords.java170
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml43
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/conf/attsdc-packages.yaml10
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/conf/attsdc.yaml35
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/conf/log4j.properties58
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/conf/titan.properties29
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/scripts/startTest.sh112
-rw-r--r--appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/org/openecomp/appc/default.properties40
28 files changed, 0 insertions, 3196 deletions
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/ArtifactProcessor.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/ArtifactProcessor.java
deleted file mode 100644
index c0f52206f..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/ArtifactProcessor.java
+++ /dev/null
@@ -1,41 +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.sdc.artifacts;
-
-import org.openecomp.appc.exceptions.APPCException;
-import org.openecomp.sdc.api.results.IDistributionClientDownloadResult;
-
-/**
- * This interface provides api processArtifact which cab have multiple implementation
- * for type of artifact app-c receives from sdc
- */
-public interface ArtifactProcessor extends Runnable {
- /**
- * Processes the artifact received from sdc
- * @param result an instance of IDistributionClientDownloadResult
- * @throws APPCException
- */
- void processArtifact(IDistributionClientDownloadResult result) throws APPCException;
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/helper/ArtifactStorageService.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/helper/ArtifactStorageService.java
deleted file mode 100644
index 160ed03d0..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/helper/ArtifactStorageService.java
+++ /dev/null
@@ -1,329 +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.sdc.artifacts.helper;
-
-import org.apache.commons.lang.StringUtils;
-import org.openecomp.appc.exceptions.APPCException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.openecomp.appc.sdc.artifacts.object.SDCReference;
-import org.openecomp.sdnc.sli.resource.dblib.DbLibService;
-import org.openecomp.appc.sdc.artifacts.object.SDCArtifact;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
-
-import javax.sql.rowset.CachedRowSet;
-import java.sql.SQLException;
-import java.util.ArrayList;
-
-import static org.openecomp.appc.sdc.artifacts.helper.Constants.COMMA;
-import static org.openecomp.appc.sdc.artifacts.helper.Constants.AND;
-
-/**
- * Provides methods for storing sdc artifacts into app-c database
- */
-public class ArtifactStorageService {
-
- private DbLibService dbLibService;
-
- private static final String SCHEMA = "sdnctl";
-
- private static final String SELECT_QUERY = Constants.SELECT_FROM + Constants.ASDC_ARTIFACTS +
- Constants.WHERE + Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_NAME + Constants.QUERY_PLACEHOLDER +
- AND + Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_VERSION + Constants.QUERY_PLACEHOLDER +
- AND + Constants.ARTIFACT_TYPE + Constants.QUERY_PLACEHOLDER;
-
- private static final String SELECT_QUERY_SDC_REFERENCE = Constants.SELECT_FROM + Constants.ASDC_REFERENCE +
- Constants.WHERE + Constants.ASDC_REFERENCE_FIELDS.VNF_TYPE + Constants.QUERY_PLACEHOLDER +
- AND + Constants.ASDC_REFERENCE_FIELDS.FILE_CATEGORY + Constants.QUERY_PLACEHOLDER ;
-
- private static final String INSERT_QUERY = Constants.INSERT + Constants.ASDC_ARTIFACTS +
- " ( " + Constants.ASDC_ARTIFACTS_FIELDS.SERVICE_UUID + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.DISTRIBUTION_ID + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.SERVICE_NAME + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.SERVICE_DESCRIPTION + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_UUID + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_INSTANCE_NAME + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_NAME + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_VERSION + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_TYPE + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.ARTIFACT_UUID + COMMA +
- Constants.ARTIFACT_TYPE + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.ARTIFACT_VERSION + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.ARTIFACT_DESCRIPTION + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.CREATION_DATE + COMMA +
- Constants.ARTIFACT_NAME +COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.ARTIFACT_CONTENT + " ) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
-
- private static final String INSERT_QUERY_WITH_INT_VER = Constants.INSERT + Constants.ASDC_ARTIFACTS +
- " ( " + Constants.ASDC_ARTIFACTS_FIELDS.SERVICE_UUID + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.DISTRIBUTION_ID + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.SERVICE_NAME + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.SERVICE_DESCRIPTION + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_UUID + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_INSTANCE_NAME + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_NAME + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_VERSION + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_TYPE + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.ARTIFACT_UUID + COMMA +
- Constants.ARTIFACT_TYPE + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.ARTIFACT_VERSION + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.ARTIFACT_DESCRIPTION + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.CREATION_DATE + COMMA +
- Constants.ARTIFACT_NAME + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.ARTIFACT_CONTENT + COMMA +
- Constants.ASDC_ARTIFACTS_FIELDS.INTERNAL_VERSION + " ) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
-
- private static final String ASDC_REF_INSERT_QUERY = Constants.INSERT + Constants.ASDC_REFERENCE +
- "( "+ Constants.ASDC_REFERENCE_FIELDS.VNF_TYPE + COMMA +
- Constants.ASDC_REFERENCE_FIELDS.VNFC_TYPE+ COMMA +
- Constants.ASDC_REFERENCE_FIELDS.FILE_CATEGORY +COMMA +
- Constants.ASDC_REFERENCE_FIELDS.ACTION +COMMA +
- Constants.ARTIFACT_TYPE + COMMA +
- Constants.ARTIFACT_NAME + " ) values (?,?,?,?,?,?)";
-
- private static final String SELECT_MAX_INT_VERSION = "SELECT coalesce(max(" + Constants.ASDC_ARTIFACTS_FIELDS.INTERNAL_VERSION + ")+1,1) as " + Constants.ASDC_ARTIFACTS_FIELDS.INTERNAL_VERSION +
- " FROM " + Constants.ASDC_ARTIFACTS + Constants.WHERE + Constants.ARTIFACT_NAME + Constants.QUERY_PLACEHOLDER;
-
-
- private final EELFLogger logger = EELFManager.getInstance().getLogger(ArtifactStorageService.class);
-
- /**
- * Stores Artifact received from SDC into APP-C database
- * @param artifact - SDC Artifact object
- * @throws APPCException
- */
- public void storeASDCArtifact(SDCArtifact artifact) throws APPCException {
- if(logger.isDebugEnabled()){
- logger.debug("Entering storeASDCArtifact with : " + artifact.toString());
- }
- try {
- initializeDBLibService();
- ArrayList<String> arguments = prepareArguments(artifact);
- dbLibService.writeData(INSERT_QUERY,arguments,SCHEMA);
- } catch (SQLException e) {
- logger.error("Error storing artifact in database : " +artifact.toString(),e);
- throw new APPCException(e.getMessage(),e);
- }
- if(logger.isDebugEnabled()){
- logger.debug("Exiting storeASDCArtifact");
- }
- }
-
- /**
- * Stores Artifact received from SDC and its Reference into APP-C database if it does not exist
- * @param artifact - SDC Artifact object
- * @param reference - SDC reference object
- * @throws APPCException
- */
- public void storeASDCArtifactWithReference(SDCArtifact artifact , SDCReference reference) throws APPCException {
- if(logger.isDebugEnabled()){
- logger.debug("Entering storeASDCArtifactWithReference with : " + artifact.toString());
- }
- try {
- initializeDBLibService();
- SDCArtifact existingArtifact = retrieveSDCArtifact(artifact.getResourceName(), artifact.getResourceVersion(),artifact.getArtifactType());
- if (existingArtifact ==null) { // new resource
- logger.debug(String.format("Artifact not found for vnfType = %s, version = %s and artifactType = %s. Inserting data." ,
- artifact.getResourceName(),artifact.getResourceVersion() ,artifact.getArtifactType()));
- ArrayList<String> arguments = prepareArguments(artifact);
- Integer version = getNextInternalVersion(artifact.getArtifactName());
- arguments.add(version.toString());
- dbLibService.writeData(INSERT_QUERY_WITH_INT_VER,arguments,SCHEMA);
- } else { // duplicate
- logger.debug(String.format("Artifact of type '%s' already deployed for resource_type='%s' and resource_version='%s'",
- artifact.getArtifactType() , artifact.getResourceName() , artifact.getResourceVersion()));
- }
-
- SDCReference existingReference = retrieveSDCReference(reference.getVnfType(),reference.getFileCategory());
- if(existingReference == null){
- logger.debug("Inserting SDC Reference data: " +reference.toString());
- ArrayList<String> arguments = prepareReferenceArguments(reference);
- dbLibService.writeData(ASDC_REF_INSERT_QUERY,arguments,SCHEMA);
- }else{
- logger.debug("Artifact reference already exists for: " +reference.toString());
- }
- } catch (SQLException e) {
- logger.error("Error storing artifact to database: " + artifact.toString(),e);
- throw new APPCException(e.getMessage(),e);
- }
- if(logger.isDebugEnabled()){
- logger.debug("Exiting storeASDCArtifactWithReference");
- }
- }
-
- private Integer getNextInternalVersion(String artifactName) throws APPCException {
- if (logger.isDebugEnabled()) {
- logger.debug("Entering getNextInternalVersion with artifactName:" + artifactName);
- }
- Integer version = 1;
- try {
- initializeDBLibService();
- ArrayList<String> arguments = new ArrayList<>();
- arguments.add(artifactName);
- CachedRowSet rowSet = dbLibService.getData(SELECT_MAX_INT_VERSION, arguments, SCHEMA);
- if (rowSet.first()) {
- version = rowSet.getInt(Constants.ASDC_ARTIFACTS_FIELDS.INTERNAL_VERSION .toString());
- }
- }catch (SQLException e) {
- logger.error("Error getting internal version for artifact name " + artifactName , e);
- throw new APPCException(e);
- }
- if (logger.isDebugEnabled()) {
- logger.debug("Exiting getNextInternalVersion with retrieved version:" + version.toString());
- }
- return version;
- }
-
- private void initializeDBLibService() {
- if(dbLibService == null){
- BundleContext context = FrameworkUtil.getBundle(DbLibService.class).getBundleContext();
- ServiceReference serviceReference = context.getServiceReference(DbLibService.class.getName());
- dbLibService = (DbLibService)context.getService(serviceReference);
- }
- }
-
- private ArrayList<String> prepareReferenceArguments(SDCReference reference) {
- ArrayList<String> arguments = new ArrayList<>();
- arguments.add(reference.getVnfType());
- arguments.add(reference.getVnfcType());
- arguments.add(reference.getFileCategory());
- arguments.add(reference.getAction());
- arguments.add(reference.getArtifactType());
- arguments.add(reference.getArtifactName());
- return arguments;
- }
-
- private ArrayList<String> prepareArguments(SDCArtifact artifact) {
- ArrayList<String> arguments = new ArrayList<>();
- arguments.add(artifact.getServiceUUID());
- arguments.add(artifact.getDistributionId());
- arguments.add(artifact.getServiceName());
- arguments.add(truncateServiceDescription(artifact.getServiceDescription()));
- arguments.add(artifact.getResourceUUID());
- arguments.add(artifact.getResourceInstanceName());
- arguments.add(artifact.getResourceName());
- arguments.add(artifact.getResourceVersion());
- arguments.add(artifact.getResourceType());
- arguments.add(artifact.getArtifactUUID());
- arguments.add(artifact.getArtifactType());
- arguments.add(artifact.getArtifactVersion());
- arguments.add(artifact.getArtifactDescription());
- arguments.add(artifact.getCreationDate());
- arguments.add(artifact.getArtifactName());
- arguments.add(artifact.getArtifactContent());
- return arguments;
- }
-
- private String truncateServiceDescription(String serviceDescription){
- if (!StringUtils.isBlank(serviceDescription) && serviceDescription.length()>255){
- logger.info("Truncating the SERVICE_DESCRIPTION to 255 characters");
- serviceDescription=serviceDescription.substring(0,255);
- }
- return serviceDescription;
- }
-
- /**
- * Reads the SDC artifact from APP-C database
- * @param resourceName - resource Name from ASDC Artifact
- * @param resourceVersion - resource version from ASDC Artifact
- * @param artifactType artifact type from ASDC Artifact
- * @return - ASDC_ARTIFACT record if data exists
- * @throws APPCException
- */
- public SDCArtifact retrieveSDCArtifact(String resourceName, String resourceVersion, String artifactType) throws APPCException {
- SDCArtifact artifact = null;
- try {
- initializeDBLibService();
- ArrayList<String> arguments = new ArrayList<>();
- arguments.add(resourceName);
- arguments.add(resourceVersion);
- arguments.add(artifactType);
- CachedRowSet rowSet = dbLibService.getData(SELECT_QUERY, arguments, SCHEMA);
- if (rowSet.first()) {
- artifact = new SDCArtifact();
- artifact.setArtifactUUID(rowSet.getString(Constants.ASDC_ARTIFACTS_FIELDS.ARTIFACT_UUID.toString()));
- artifact.setArtifactName(rowSet.getString(Constants.ARTIFACT_NAME));
- artifact.setArtifactType(rowSet.getString(Constants.ARTIFACT_TYPE));
- artifact.setArtifactVersion(rowSet.getString(Constants.ASDC_ARTIFACTS_FIELDS.ARTIFACT_VERSION.toString()));
- artifact.setArtifactDescription(rowSet.getString(Constants.ASDC_ARTIFACTS_FIELDS.ARTIFACT_DESCRIPTION.toString()));
- artifact.setArtifactContent(rowSet.getString(Constants.ASDC_ARTIFACTS_FIELDS.ARTIFACT_CONTENT.toString()));
-
- artifact.setResourceUUID(rowSet.getString(Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_UUID.toString()));
- artifact.setResourceName(rowSet.getString(Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_NAME.toString()));
- artifact.setResourceType(rowSet.getString(Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_TYPE.toString()));
- artifact.setResourceVersion(rowSet.getString(Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_VERSION.toString()));
- artifact.setResourceInstanceName(rowSet.getString(Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_INSTANCE_NAME.toString()));
-
- artifact.setServiceUUID(rowSet.getString(Constants.ASDC_ARTIFACTS_FIELDS.SERVICE_UUID.toString()));
- artifact.setServiceName(rowSet.getString(Constants.ASDC_ARTIFACTS_FIELDS.SERVICE_NAME.toString()));
- artifact.setServiceDescription(rowSet.getString(Constants.ASDC_ARTIFACTS_FIELDS.SERVICE_DESCRIPTION.toString()));
-
- artifact.setCreationDate(rowSet.getString(Constants.ASDC_ARTIFACTS_FIELDS.CREATION_DATE.toString()));
- artifact.setDistributionId(rowSet.getString(Constants.ASDC_ARTIFACTS_FIELDS.DISTRIBUTION_ID.toString()));
- }
-
- } catch (SQLException e) {
- logger.error("Error query artifact for " + Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_NAME + " = " + resourceName +
- Constants.ASDC_ARTIFACTS_FIELDS.RESOURCE_VERSION + " = " + resourceVersion +
- Constants.ARTIFACT_TYPE + " = " + artifactType, e);
- throw new APPCException(e);
- }
- return artifact;
- }
-
- /**
- * Reads the SDC reference from APP-C database
- * @param vnfType - vnf Type from ASDC reference
- * @param fileCategory - file category from ASDC reference
- * @return - ASDC_ARTIFACT record if data exists
- * @throws APPCException
- */
- public SDCReference retrieveSDCReference(String vnfType, String fileCategory) throws APPCException {
- SDCReference reference = null;
- try {
- initializeDBLibService();
- ArrayList<String> arguments = new ArrayList<>();
- arguments.add(vnfType);
- arguments.add(fileCategory);
- CachedRowSet rowSet = dbLibService.getData(SELECT_QUERY_SDC_REFERENCE, arguments, SCHEMA);
- if (rowSet.first()) {
- reference = new SDCReference();
- reference.setVnfType(rowSet.getString(Constants.ASDC_REFERENCE_FIELDS.VNF_TYPE.toString()));
- reference.setVnfcType(rowSet.getString(Constants.ASDC_REFERENCE_FIELDS.VNFC_TYPE.toString()));
- reference.setFileCategory(rowSet.getString(Constants.ASDC_REFERENCE_FIELDS.FILE_CATEGORY.toString()));
- reference.setAction(rowSet.getString(Constants.ASDC_REFERENCE_FIELDS.ACTION.toString()));
- reference.setArtifactType(rowSet.getString(Constants.ARTIFACT_TYPE));
- reference.setArtifactName(rowSet.getString(Constants.ARTIFACT_NAME));
- }
- } catch (SQLException e) {
- logger.error("Error querying ASDC_REFERENCE for " + Constants.ASDC_REFERENCE_FIELDS.VNF_TYPE + " = " + vnfType +
- Constants.ASDC_REFERENCE_FIELDS.FILE_CATEGORY + " = " + fileCategory , e);
- throw new APPCException(e);
- }
- return reference;
- }
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/helper/Constants.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/helper/Constants.java
deleted file mode 100644
index 67f8025d2..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/helper/Constants.java
+++ /dev/null
@@ -1,72 +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.sdc.artifacts.helper;
-
-/**
- * Constants required in ASDC listener module
- */
-public class Constants {
- static final String ASDC_ARTIFACTS = "ASDC_ARTIFACTS";
- static final String ASDC_REFERENCE = "ASDC_REFERENCE";
-
- static final String AND = " AND ";
-
- static final String ARTIFACT_TYPE = "ARTIFACT_TYPE";
- static final String ARTIFACT_NAME = "ARTIFACT_NAME";
-
- static final String VF_LICENSE = "VF_LICENSE";
-
- public enum ASDC_ARTIFACTS_FIELDS {
- SERVICE_UUID,
- DISTRIBUTION_ID,
- SERVICE_NAME,
- SERVICE_DESCRIPTION,
- RESOURCE_UUID,
- RESOURCE_INSTANCE_NAME,
- RESOURCE_NAME,
- RESOURCE_VERSION,
- RESOURCE_TYPE,
- ARTIFACT_UUID,
- ARTIFACT_VERSION,
- ARTIFACT_DESCRIPTION,
- INTERNAL_VERSION,
- CREATION_DATE,
- ARTIFACT_CONTENT
- }
-
- public enum ASDC_REFERENCE_FIELDS{
- ASDC_REFERENCE_ID,
- VNF_TYPE,
- VNFC_TYPE,
- FILE_CATEGORY,
- ACTION
- }
-
- static final String COMMA = " , ";
- static final String QUERY_PLACEHOLDER = " = ? ";
- static final String SELECT_FROM = "SELECT * FROM " ;
- static final String WHERE = " WHERE ";
- static final String INSERT = "INSERT INTO ";
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/helper/DependencyModelGenerator.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/helper/DependencyModelGenerator.java
deleted file mode 100644
index 0f8065a30..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/helper/DependencyModelGenerator.java
+++ /dev/null
@@ -1,97 +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.sdc.artifacts.helper;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.MapperFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.ObjectWriter;
-import org.openecomp.appc.dg.dependencymanager.helper.DependencyModelParser;
-import org.openecomp.appc.dg.objects.Node;
-import org.openecomp.appc.dg.objects.VnfcDependencyModel;
-import org.openecomp.appc.domainmodel.Vnfc;
-import org.openecomp.appc.exceptions.APPCException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Provides method for genrating Dependency JSON from Tosca model
- */
-public class DependencyModelGenerator {
-
- private final EELFLogger logger = EELFManager.getInstance().getLogger(DependencyModelGenerator.class);
-
- /**
- *
- * @param tosca - tosca string from SDC
- * @param vnfType - Vnf Type from tosca
- * @return - Dependency JSON in String format
- * @throws APPCException is thrown if error occurs
- */
- public String getDependencyModel(String tosca, String vnfType) throws APPCException {
- logger.debug(String.format("Generating dependency model for vnfType : %s , TOSCA: %s ", vnfType ,tosca));
- String dependencyJson;
- DependencyModelParser dependencyModelParser = new DependencyModelParser();
- VnfcDependencyModel vnfcDependencyModel = dependencyModelParser.generateDependencyModel(tosca, vnfType);
-
- if (vnfcDependencyModel != null && !vnfcDependencyModel.getDependencies().isEmpty()) {
- logger.debug(String.format("Dependency Model generated : %s ", vnfcDependencyModel.toString()));
- List<org.openecomp.appc.sdc.artifacts.object.Vnfc> vnfcs = new ArrayList<>();
-
- for (Node<Vnfc> node : vnfcDependencyModel.getDependencies()) {
- org.openecomp.appc.sdc.artifacts.object.Vnfc vnfc = new org.openecomp.appc.sdc.artifacts.object.Vnfc();
- vnfc.setVnfcType(node.getChild().getVnfcType());
- vnfc.setMandatory(node.getChild().isMandatory());
- vnfc.setResilienceType(node.getChild().getResilienceType());
- if (node.getParents() != null && !node.getParents().isEmpty()) {
- List<String> parents = new ArrayList<>();
- for (Vnfc parentNode : node.getParents()) {
- parents.add(parentNode.getVnfcType());
- }
- vnfc.setParents(parents);
- }
- vnfcs.add(vnfc);
- }
- ObjectMapper objectMapper = new ObjectMapper();
-
- ObjectWriter writer = objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL).configure
- (MapperFeature.SORT_PROPERTIES_ALPHABETICALLY, true).writer().withRootName("vnfcs");
- try {
- dependencyJson = writer.writeValueAsString(vnfcs);
- } catch (JsonProcessingException e) {
- logger.error("Error converting dependency model to JSON");
- throw new APPCException("Error converting dependency model to JSON",e);
- }
- } else {
- logger.error("Error generating dependency model from tosca. Empty dependency model");
- throw new APPCException("Error generating dependency model from tosca. Empty dependency model");
- }
- return dependencyJson;
- }
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/AbstractArtifactProcessor.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/AbstractArtifactProcessor.java
deleted file mode 100644
index 12fd260d0..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/AbstractArtifactProcessor.java
+++ /dev/null
@@ -1,196 +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.sdc.artifacts.impl;
-
-import org.openecomp.appc.adapter.message.EventSender;
-import org.openecomp.appc.adapter.message.MessageDestination;
-import org.openecomp.appc.adapter.message.event.EventHeader;
-import org.openecomp.appc.adapter.message.event.EventMessage;
-import org.openecomp.appc.adapter.message.event.EventStatus;
-import org.openecomp.appc.sdc.listener.Util;
-import org.openecomp.appc.exceptions.APPCException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.openecomp.appc.sdc.artifacts.ArtifactProcessor;
-import org.openecomp.appc.sdc.artifacts.helper.ArtifactStorageService;
-import org.openecomp.appc.sdc.artifacts.object.SDCArtifact;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.api.notification.IResourceInstance;
-import org.openecomp.sdc.api.results.IDistributionClientDownloadResult;
-import org.openecomp.sdc.utils.DistributionActionResultEnum;
-import org.openecomp.sdc.utils.DistributionStatusEnum;
-
-import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-/**
- * Provides abstrace implementation for SDC artifact processor
- */
-public abstract class AbstractArtifactProcessor implements ArtifactProcessor {
-
- public static final String PAYLOAD_CHARSET = "UTF-8";
- private static final String DATE_FORMAT = "yyyy/MM/dd HH:mm:ss";
-
- protected IDistributionClient client;
- protected EventSender eventSender;
-
- protected INotificationData notification;
- protected IResourceInstance resource;
- protected IArtifactInfo artifact;
- protected URI storeUri;
-
- private final EELFLogger logger = EELFManager.getInstance().getLogger(AbstractArtifactProcessor.class);
-
- protected ArtifactStorageService artifactStorageService;
-
- private AbstractArtifactProcessor(){
- artifactStorageService = new ArtifactStorageService();
- }
-
- AbstractArtifactProcessor(IDistributionClient client, EventSender eventSender, INotificationData notification, IResourceInstance resource,
- IArtifactInfo artifact, URI storeUri){
-
- this();
- this.client = client;
- this.eventSender = eventSender;
- this.notification = notification;
- this.resource = resource;
- this.artifact = artifact;
- this.storeUri = storeUri;
- }
-
- @Override
- public void run(){
-
- try{
- logger.info(String.format("Attempting to download artifact %s", artifact));
- // Download artifact
- IDistributionClientDownloadResult download = client.download(artifact);
-
- logger.info(String.format("Download of artifact %s completed with status %s", artifact.getArtifactUUID(), download));
-
- // Notify of download status
- if (download.getDistributionActionResult() != DistributionActionResultEnum.SUCCESS) {
- client.sendDownloadStatus(Util.buildDistributionStatusMessage(client, notification, artifact,
- DistributionStatusEnum.DOWNLOAD_ERROR), download.getDistributionMessageResult());
- sendDCAEEvent(notification.getDistributionID(), notification.getServiceName(), notification.getServiceVersion(), "Download is failed.");
- return;
- }
-
- client.sendDownloadStatus(Util.buildDistributionStatusMessage(client, notification, artifact, DistributionStatusEnum.DOWNLOAD_OK));
-
- processArtifact(download);
-
- client.sendDeploymentStatus(
- Util.buildDistributionStatusMessage(client, notification, this.artifact, DistributionStatusEnum.DEPLOY_OK));
- }
- catch (Exception e){
- logger.error("Error processing artifact " + this.artifact.toString() ,e);
-
- client.sendDeploymentStatus(Util.buildDistributionStatusMessage(client, notification, artifact,
- DistributionStatusEnum.DEPLOY_ERROR), e.getMessage());
- sendDCAEEvent(notification.getDistributionID(), notification.getServiceName(), notification.getServiceVersion(), e.getMessage());
- }
- }
-
-
- @Override
- public void processArtifact(IDistributionClientDownloadResult download) throws APPCException {
- String data = null;
- if(logger.isDebugEnabled()){
- logger.debug("Entry processArtifact in AbstractArtifactProcessor");
- }
- try {
- if (download.getArtifactPayload() != null) {
- data = new String(download.getArtifactPayload(), PAYLOAD_CHARSET);
- }
- } catch (UnsupportedEncodingException e) {
- logger.error("Error reading artifact with " + PAYLOAD_CHARSET + " encoding" + new String(download.getArtifactPayload()) ,e);
- throw new APPCException(e);
- }
-
- SDCArtifact sdcArtifact = getArtifactObject(data);
- logger.debug("Constructed SDCArtifact = " + sdcArtifact);
- processArtifact(sdcArtifact);
-
- if(logger.isDebugEnabled()){
- logger.debug("Exit processArtifact in AbstractArtifactProcessor");
- }
- }
-
- protected abstract void processArtifact(SDCArtifact artifact) throws APPCException;
-
- protected SDCArtifact getArtifactObject(String data){
-
- SDCArtifact sdcArtifact = new SDCArtifact();
-
- sdcArtifact.setArtifactUUID(this.artifact.getArtifactUUID());
- sdcArtifact.setArtifactName(this.artifact.getArtifactName());
- sdcArtifact.setArtifactType(this.artifact.getArtifactType());
- sdcArtifact.setArtifactVersion(this.artifact.getArtifactVersion());
- sdcArtifact.setArtifactDescription(this.artifact.getArtifactDescription());
- sdcArtifact.setArtifactContent(data);
- sdcArtifact.setCreationDate(getCurrentDateTime());
-
- sdcArtifact.setDistributionId(this.notification.getDistributionID());
- sdcArtifact.setServiceUUID(this.notification.getServiceUUID());
- sdcArtifact.setServiceName(this.notification.getServiceName());
- sdcArtifact.setServiceDescription(this.notification.getServiceDescription());
-
- sdcArtifact.setResourceName(this.resource.getResourceName());
- sdcArtifact.setResourceType(this.resource.getResourceType());
- sdcArtifact.setResourceVersion(this.resource.getResourceVersion());
- sdcArtifact.setResourceUUID(this.resource.getResourceUUID());
- sdcArtifact.setResourceInstanceName(this.resource.getResourceInstanceName());
-
- return sdcArtifact;
- }
-
- protected String getCurrentDateTime() {
- DateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
- Date date = new Date();
- return dateFormat.format(date);
- }
-
- private void sendDCAEEvent(String distributionID, String serviceName, String serviceVersion, String errorMessage) {
- if (null == eventSender){
- return;
- }
- String errorDescription = String.format("ASDC distribution of service '%s', version '%s' is failed with reason: '%s'",
- serviceName, serviceVersion, errorMessage);
-
- EventMessage eventMessage = new EventMessage(
- new EventHeader((new Date()).toString(), serviceVersion, distributionID),
- new EventStatus(401, errorDescription));
-
- eventSender.sendEvent(MessageDestination.DCAE, eventMessage);
- }
-
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/ArtifactProcessorFactory.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/ArtifactProcessorFactory.java
deleted file mode 100644
index aa9d0e04b..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/ArtifactProcessorFactory.java
+++ /dev/null
@@ -1,89 +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.sdc.artifacts.impl;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.openecomp.appc.adapter.message.EventSender;
-import org.openecomp.appc.sdc.artifacts.ArtifactProcessor;
-import org.openecomp.appc.sdc.artifacts.object.ArtifactType;
-import org.openecomp.appc.sdc.listener.AsdcListener;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.api.notification.IResourceInstance;
-
-import java.net.URI;
-
-/**
- * Factory class for creating instance of Artifact Processor
- */
-public class ArtifactProcessorFactory {
-
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(ArtifactProcessorFactory.class);
-
- private ArtifactProcessorFactory (){
-
- }
-
- /**
- * Provides and instance of Artifact Processor
- * @param client an instance of IDistributionClient
- * @param eventSender an instance of EventSender
- * @param notification an instance of INotificationData
- * @param resource an instance of IResourceInstance
- * @param artifact an instance of IArtifactInfo
- * @param storeUri
- * @return
- */
- public static ArtifactProcessor getArtifactProcessor(IDistributionClient client, EventSender eventSender,
- INotificationData notification, IResourceInstance resource,
- IArtifactInfo artifact, URI storeUri) {
-
- logger.debug("Creating artifact processor for artifact type = " + artifact.getArtifactType());
- ArtifactType artifactType = ArtifactType.getArtifactType(artifact.getArtifactType());
- if(artifactType == null){
- return null;
- }
- ArtifactProcessor artifactProcessor = null;
- switch (artifactType){
- case APPC_CONFIG :
- artifactProcessor = new ConfigArtifactProcessor(client, eventSender, notification, resource,
- artifact, storeUri);
- break;
- case VF_LICENSE:
- artifactProcessor = new LicenseArtifactProcessor(client,eventSender,notification,resource,
- artifact,storeUri);
- break;
- case TOSCA_CSAR:
- artifactProcessor = new ToscaCsarArtifactProcessor(client,eventSender,notification,resource,
- artifact,storeUri);
- default:
- break;
- }
- return artifactProcessor;
- }
-
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/ConfigArtifactProcessor.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/ConfigArtifactProcessor.java
deleted file mode 100644
index 3667b6b2a..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/ConfigArtifactProcessor.java
+++ /dev/null
@@ -1,76 +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.sdc.artifacts.impl;
-
-import org.openecomp.appc.adapter.message.EventSender;
-import org.openecomp.appc.sdc.listener.ProviderOperations;
-import org.openecomp.appc.sdc.listener.ProviderResponse;
-import org.openecomp.appc.sdc.listener.Util;
-import org.openecomp.appc.exceptions.APPCException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.openecomp.appc.sdc.artifacts.object.SDCArtifact;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.api.notification.IResourceInstance;
-
-import java.net.MalformedURLException;
-import java.net.URI;
-
-/**
- * Artifact processor for config artifact type
- */
-public class ConfigArtifactProcessor extends AbstractArtifactProcessor {
-
- private final EELFLogger logger = EELFManager.getInstance().getLogger(ConfigArtifactProcessor.class);
-
- /**
- * returns an instance of ConfigArtifactProcessor
- * @param client an instance of IDistributionClient
- * @param eventSender an instance of EventSender
- * @param notification an instance of INotificationData
- * @param resource an instance of IResourceInstance
- * @param artifact an instance of IArtifactInfo
- * @param storeUri an instance of URI
- */
- public ConfigArtifactProcessor(IDistributionClient client, EventSender eventSender, INotificationData notification, IResourceInstance resource, IArtifactInfo artifact, URI storeUri) {
- super(client,eventSender,notification,resource,artifact,storeUri);
- }
-
- @Override
- public void processArtifact(SDCArtifact artifact) throws APPCException {
- String postData = Util.toAsdcStoreDocumentInput(notification, resource, super.artifact, artifact.getArtifactContent());
- try {
- ProviderResponse result = ProviderOperations.post(storeUri.toURL(), postData, null);
- if (result.getStatus() == 200) {
- Util.parseResponse(result.getBody());
- }
- } catch (MalformedURLException | APPCException e) {
- logger.error("Error processing artifact : " + this.artifact.toString(),e);
- throw new APPCException(e.getMessage(),e);
- }
- }
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/LicenseArtifactProcessor.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/LicenseArtifactProcessor.java
deleted file mode 100644
index 9cbc56276..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/LicenseArtifactProcessor.java
+++ /dev/null
@@ -1,92 +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.sdc.artifacts.impl;
-
-import org.openecomp.appc.adapter.message.EventSender;
-import org.openecomp.appc.exceptions.APPCException;
-import org.openecomp.appc.licmgr.Constants;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.apache.commons.lang.StringUtils;
-import org.openecomp.appc.sdc.artifacts.object.SDCArtifact;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.api.notification.IResourceInstance;
-
-import java.net.URI;
-
-/**
- * Artifact processor for VNF license artifact type
- */
-public class LicenseArtifactProcessor extends AbstractArtifactProcessor {
-
- private final EELFLogger logger = EELFManager.getInstance().getLogger(LicenseArtifactProcessor.class);
-
- /**
- * returns an instance of ConfigArtifactProcessor
- * @param client an instance of IDistributionClient
- * @param eventSender an instance of EventSender
- * @param notification an instance of INotificationData
- * @param resource an instance of IResourceInstance
- * @param artifact an instance of IArtifactInfo
- * @param storeUri an instance of URI
- */
- public LicenseArtifactProcessor(IDistributionClient client, EventSender eventSender, INotificationData notification, IResourceInstance resource, IArtifactInfo artifact, URI storeUri) {
- super(client,eventSender,notification,resource,artifact,storeUri);
- }
-
- @Override
- public void processArtifact(SDCArtifact artifact) throws APPCException {
-
- String vnfType = artifact.getResourceName();
- String version = artifact.getResourceVersion();
- String packageArtifactID = artifact.getArtifactUUID();
-
- if (StringUtils.isEmpty(vnfType) ||
- StringUtils.isEmpty(version) ||
- StringUtils.isEmpty(packageArtifactID)) {
- String errStr = String.format("Missing information in ASDC request. Details: resource_type='%s', resource_version='%s', artifactID='%s'", vnfType, version, packageArtifactID);
- logger.error(errStr);
- throw new APPCException(errStr);
- }
-
- try {
- SDCArtifact existingArtifact = artifactStorageService.retrieveSDCArtifact(vnfType, version,artifact.getArtifactType());
-
- if (existingArtifact ==null) { // new resource
- logger.debug("Artifact not found from database for vnfType = " + vnfType + " , version = " + version + " , artifactType = " + artifact.getArtifactType());
- artifactStorageService.storeASDCArtifact(artifact);
- } else { // duplicate
- logger.debug("Artifact retrieved from database = " + existingArtifact);
- logger.warn(String.format("Artifact of type '%s' already deployed for resource_type='%s' and resource_version='%s'", Constants.VF_LICENSE, vnfType, version));
- }
-
- } catch (Exception e) {
- logger.error("Error processing artifact : " + artifact.toString(),e);
- throw new APPCException(e.getMessage(),e);
- }
- }
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/ToscaCsarArtifactProcessor.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/ToscaCsarArtifactProcessor.java
deleted file mode 100644
index 085902187..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/impl/ToscaCsarArtifactProcessor.java
+++ /dev/null
@@ -1,241 +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.sdc.artifacts.impl;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
-import org.apache.commons.lang.StringUtils;
-import org.openecomp.appc.adapter.message.EventSender;
-import org.openecomp.appc.exceptions.APPCException;
-import org.openecomp.appc.licmgr.Constants;
-import org.openecomp.appc.sdc.artifacts.helper.DependencyModelGenerator;
-import org.openecomp.appc.sdc.artifacts.object.Resource;
-import org.openecomp.appc.sdc.artifacts.object.SDCArtifact;
-import org.openecomp.appc.sdc.artifacts.object.SDCReference;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.api.notification.IResourceInstance;
-import org.openecomp.sdc.api.results.IDistributionClientDownloadResult;
-
-import javax.json.Json;
-import java.io.*;
-import java.net.URI;
-import java.util.*;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
-public class ToscaCsarArtifactProcessor extends AbstractArtifactProcessor{
-
- private final EELFLogger logger = EELFManager.getInstance().getLogger(ToscaCsarArtifactProcessor.class);
-
- private DependencyModelGenerator dependencyModelGenerator;
-
- public ToscaCsarArtifactProcessor(IDistributionClient client, EventSender eventSender, INotificationData notification, IResourceInstance resource,
- IArtifactInfo artifact, URI storeUri){
- super(client,eventSender,notification,resource,artifact,storeUri);
- dependencyModelGenerator = new DependencyModelGenerator();
- }
-
- @Override
- public void processArtifact(IDistributionClientDownloadResult download) throws APPCException {
- logger.debug("processing artifact " + super.artifact.getArtifactType());
- byte[] byteArray = download.getArtifactPayload();
- String serviceFileName = "";
- String serviceTemplateContent = "";
- List<Resource> resources = null;
- Map<String,String> csarFiles = new HashMap<>();
- try (ZipInputStream inputStream = new ZipInputStream(new ByteArrayInputStream(byteArray))) {
- ZipEntry entry = inputStream.getNextEntry();
- logger.debug("First Entry = " +entry);
- while(entry!= null){
- String filename = entry.getName();
- logger.debug("Next Entry = "+ filename);
-
- BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(inputStream));
- String str = null;
- StringBuilder sb = new StringBuilder();
- while((str = bufferedReader.readLine()) != null){
- sb.append(new String(str)).append(System.getProperty("line.separator"));
- }
- csarFiles.put(filename,sb.toString());
- entry = inputStream.getNextEntry();
- }
-
- } catch (IOException e) {
- logger.error("Error Reading TOSCA.meta from CSAR",e);
- throw new APPCException(e);
- }
- serviceFileName = readServiceFileName(csarFiles.get("TOSCA-Metadata/TOSCA.meta"));
- logger.debug("Service File Name = " + serviceFileName);
- serviceTemplateContent = csarFiles.get(serviceFileName);
-
- try {
- resources = readResources (serviceTemplateContent);
- } catch (Exception e) {
- logger.error("Error reading resources from " + ", serviceFileName = " + serviceFileName
- + ", TOSCA Metadata = " + csarFiles.get("TOSCA-Metadata/TOSCA.meta"),e);
- throw new APPCException(e);
- }
-
- for(Resource resource:resources){
- String resourceTemplate = csarFiles.get("Definitions/resource-" + resource.getFileNameTag() + "-template.yml");
- SDCArtifact artifact = this.getArtifactObject(resource,resourceTemplate);
- processArtifact(artifact);
- }
- }
-
- private String readServiceFileName(String toscaMetadata) {
- toscaMetadata = toscaMetadata.substring(toscaMetadata.indexOf("Entry-Definitions"), toscaMetadata.indexOf(System.getProperty("line.separator"),toscaMetadata.indexOf("Entry-Definitions")));
- toscaMetadata =toscaMetadata.split(":")[1].trim();
- return toscaMetadata;
- }
-
- protected SDCArtifact getArtifactObject(Resource resource, String data){
-
- SDCArtifact sdcArtifact = new SDCArtifact();
-
- sdcArtifact.setArtifactUUID(this.artifact.getArtifactUUID());
- sdcArtifact.setArtifactName(this.artifact.getArtifactName());
- sdcArtifact.setArtifactType(this.artifact.getArtifactType());
- sdcArtifact.setArtifactVersion(this.artifact.getArtifactVersion());
- sdcArtifact.setArtifactDescription(this.artifact.getArtifactDescription());
- sdcArtifact.setArtifactContent(data);
- sdcArtifact.setCreationDate(super.getCurrentDateTime());
-
- sdcArtifact.setDistributionId(this.notification.getDistributionID());
- sdcArtifact.setServiceUUID(this.notification.getServiceUUID());
- sdcArtifact.setServiceName(this.notification.getServiceName());
- sdcArtifact.setServiceDescription(this.notification.getServiceDescription());
-
- sdcArtifact.setResourceName(resource.getName());
- sdcArtifact.setResourceType(resource.getType());
- sdcArtifact.setResourceVersion(resource.getVersion());
- sdcArtifact.setResourceUUID(resource.getUuid());
- sdcArtifact.setResourceInstanceName(resource.getInstanceName());
-
- return sdcArtifact;
- }
-
- private List<Resource> readResources(String serviceTemplateContent) throws IOException {
- List<Resource> resources = new LinkedList<>();
- ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
- JsonNode root = mapper.readTree(serviceTemplateContent);
- JsonNode topologyTemplate = root.get("topology_template");
- JsonNode nodeTemplates = topologyTemplate.get("node_templates");
- Iterator<Map.Entry<String, JsonNode>> itr = nodeTemplates.fields();
- while(itr.hasNext()){
- Map.Entry<String, JsonNode> entry = itr.next();
- String instanceName = entry.getKey();
- JsonNode nodeTemplate = entry.getValue();
-
- String fileNameTag = nodeTemplate.get("type").asText();
- logger.debug("Resource type in Service Template = " + fileNameTag);
- fileNameTag = fileNameTag.substring(fileNameTag.lastIndexOf(".")+1,fileNameTag.length());
- String version = nodeTemplate.get("metadata").get("version").asText();
- String uuid = nodeTemplate.get("metadata").get("UUID").asText();
- String name = nodeTemplate.get("metadata").get("name").asText();
- String type = nodeTemplate.get("metadata").get("type").asText();
-
- if(!"VF".equalsIgnoreCase(type)){
- continue;
- }
-
- Resource resource = new Resource();
- resource.setFileNameTag(fileNameTag);
- resource.setVersion(version);
- resource.setUuid(uuid);
- resource.setInstanceName(instanceName);
- resource.setName(name);
- resource.setType(type);
-
- resources.add(resource);
- }
- return resources;
- }
-
-
- @Override
- protected void processArtifact(SDCArtifact artifact) throws APPCException {
- String vnfType = artifact.getResourceName();
- String version = artifact.getResourceVersion();
- String packageArtifactID = artifact.getArtifactUUID();
-
- if (StringUtils.isEmpty(vnfType) ||
- StringUtils.isEmpty(version) ||
- StringUtils.isEmpty(packageArtifactID)) {
- String errStr = String.format("Missing information in SDC request. Details: resource_type='%s', resource_version='%s', artifactID='%s'", vnfType, version, packageArtifactID);
- logger.error(errStr);
- throw new APPCException(errStr);
- }
- try {
- SDCReference reference = new SDCReference();
- reference.setVnfType(vnfType);
- reference.setFileCategory("tosca_model");
- reference.setArtifactName(artifact.getArtifactName());
- logger.debug("Storing TOSCA to ASDC Artifact");
- artifactStorageService.storeASDCArtifactWithReference(artifact,reference);
-
- SDCArtifact dependencyArtifact = getDependencyArtifact(artifact);
- SDCReference dependencyReference = new SDCReference();
- dependencyReference.setVnfType(vnfType);
- dependencyReference.setFileCategory("tosca_dependency_model");
- dependencyReference.setArtifactName(dependencyArtifact.getArtifactName());
- logger.debug("Storing Dependency to ASDC Artifact");
- artifactStorageService.storeASDCArtifactWithReference(dependencyArtifact,dependencyReference);
- } catch (Exception e) {
- logger.error("Error processing artifact : " + artifact.toString() );
- throw new APPCException(e.getMessage(),e);
- }
- }
-
- private SDCArtifact getDependencyArtifact(SDCArtifact toscaArtifact) throws APPCException {
- SDCArtifact artifact = new SDCArtifact();
- artifact.setArtifactName("dependency_"+toscaArtifact.getArtifactName());
- String dependencyModel = dependencyModelGenerator.getDependencyModel(toscaArtifact.getArtifactContent(),toscaArtifact.getResourceName());
- artifact.setArtifactContent(dependencyModel);
- artifact.setArtifactType("DEPENDENCY_MODEL");
-
- artifact.setArtifactUUID(toscaArtifact.getArtifactUUID());
- artifact.setArtifactVersion(toscaArtifact.getArtifactVersion());
- artifact.setArtifactDescription(toscaArtifact.getArtifactDescription());
- artifact.setCreationDate(super.getCurrentDateTime());
- artifact.setDistributionId(toscaArtifact.getDistributionId());
- artifact.setServiceUUID(toscaArtifact.getServiceUUID());
- artifact.setServiceName(toscaArtifact.getServiceName());
- artifact.setServiceDescription(toscaArtifact.getServiceDescription());
- artifact.setResourceName(toscaArtifact.getResourceName());
- artifact.setResourceType(toscaArtifact.getResourceType());
- artifact.setResourceVersion(toscaArtifact.getResourceVersion());
- artifact.setResourceUUID(toscaArtifact.getResourceUUID());
- artifact.setResourceInstanceName(toscaArtifact.getResourceInstanceName());
- return artifact;
- }
-
-
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/ArtifactType.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/ArtifactType.java
deleted file mode 100644
index 1ff62385d..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/ArtifactType.java
+++ /dev/null
@@ -1,46 +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.sdc.artifacts.object;
-
-/**
- * Enummration listing SDC artifact types
- */
-public enum ArtifactType {
- APPC_CONFIG,VF_LICENSE,TOSCA_CSAR;
-
- /**
- * returns ArtifactType for the input string type
- * @param artifactTypeStr
- * @return
- */
- public static ArtifactType getArtifactType(String artifactTypeStr){
- for(ArtifactType artifactType: ArtifactType.values()){
- if(artifactType.name().equals(artifactTypeStr)){
- return artifactType;
- }
- }
- return null;
- }
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/Resource.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/Resource.java
deleted file mode 100644
index 42716dc47..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/Resource.java
+++ /dev/null
@@ -1,87 +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.sdc.artifacts.object;
-
-public class Resource {
- private String name;
- private String type;
- private String version;
- private String uuid;
- private String instanceName;
- private String fileNameTag;
-
- public Resource(){
-
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getUuid() {
- return uuid;
- }
-
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- public String getInstanceName() {
- return instanceName;
- }
-
- public void setInstanceName(String instanceName) {
- this.instanceName = instanceName;
- }
-
-
- public String getFileNameTag() {
- return fileNameTag;
- }
-
- public void setFileNameTag(String fileNameTag) {
- this.fileNameTag = fileNameTag;
- }
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/SDCArtifact.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/SDCArtifact.java
deleted file mode 100644
index 6cba5b2a2..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/SDCArtifact.java
+++ /dev/null
@@ -1,215 +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.sdc.artifacts.object;
-
-/**
- * POJO containing metadata about SDC artifact
- */
-public class SDCArtifact {
-
- private String artifactUUID;
-
- private String artifactName;
-
- private String artifactType;
-
- private String artifactVersion;
-
- private String artifactContent;
-
- private String artifactDescription;
-
- private String creationDate;
-
- private String distributionId;
-
-
-
- private String resourceUUID;
-
- private String resourceName;
-
- private String resourceType;
-
- private String resourceVersion;
-
- private String resourceInstanceName;
-
-
- private String serviceUUID;
-
- private String serviceName;
-
- private String serviceDescription;
-
- public String getArtifactUUID() {
- return artifactUUID;
- }
-
- public void setArtifactUUID(String artifactUUID) {
- this.artifactUUID = artifactUUID;
- }
-
- public String getArtifactContent() {
- return artifactContent;
- }
-
- public void setArtifactContent(String artifactContent) {
- this.artifactContent = artifactContent;
- }
-
- public String getArtifactDescription() {
- return artifactDescription;
- }
-
- public void setArtifactDescription(String artifactDescription) {
- this.artifactDescription = artifactDescription;
- }
-
- public String getArtifactName() {
- return artifactName;
- }
-
- public void setArtifactName(String artifactName) {
- this.artifactName = artifactName;
- }
-
- public String getArtifactType() {
- return artifactType;
- }
-
- public void setArtifactType(String artifactType) {
- this.artifactType = artifactType;
- }
-
- public String getArtifactVersion() {
- return artifactVersion;
- }
-
- public void setArtifactVersion(String artifactVersion) {
- this.artifactVersion = artifactVersion;
- }
-
- public String getCreationDate() {
- return creationDate;
- }
-
- public void setCreationDate(String creationDate) {
- this.creationDate = creationDate;
- }
-
- public String getDistributionId() {
- return distributionId;
- }
-
- public void setDistributionId(String distributionId) {
- this.distributionId = distributionId;
- }
-
- public String getResourceInstanceName() {
- return resourceInstanceName;
- }
-
- public void setResourceInstanceName(String resourceInstanceName) {
- this.resourceInstanceName = resourceInstanceName;
- }
-
- public String getResourceName() {
- return resourceName;
- }
-
- public void setResourceName(String resourceName) {
- this.resourceName = resourceName;
- }
-
- public String getResourceType() {
- return resourceType;
- }
-
- public void setResourceType(String resourceType) {
- this.resourceType = resourceType;
- }
-
- public String getResourceUUID() {
- return resourceUUID;
- }
-
- public void setResourceUUID(String resourceUUID) {
- this.resourceUUID = resourceUUID;
- }
-
- public String getResourceVersion() {
- return resourceVersion;
- }
-
- public void setResourceVersion(String resourceVersion) {
- this.resourceVersion = resourceVersion;
- }
-
- public String getServiceDescription() {
- return serviceDescription;
- }
-
- public void setServiceDescription(String serviceDescription) {
- this.serviceDescription = serviceDescription;
- }
-
- public String getServiceName() {
- return serviceName;
- }
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
- public String getServiceUUID() {
- return serviceUUID;
- }
-
- public void setServiceUUID(String serviceUUID) {
- this.serviceUUID = serviceUUID;
- }
-
-
- @Override
- public String toString() {
- return "artifactUUID = " + artifactUUID +
- " , artifactName = " + artifactName +
- " , artifactType = " + artifactType +
- " , artifactVersion = " + artifactVersion +
- " , artifactContent = " + artifactContent +
- " , artifactDescription = " + artifactDescription +
- " , creationDate = " + creationDate +
- " , distributionId = " +distributionId +
- " , resourceUUID = " + resourceUUID +
- " , resourceName = " + resourceName +
- " , resourceType = " + resourceType +
- " , resourceVersion = " + resourceVersion +
- " , resourceInstanceName = " + resourceInstanceName +
- " , serviceUUID = " + serviceUUID +
- " , serviceName = " + serviceName +
- " , serviceDescription = " + serviceDescription;
- }
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/SDCReference.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/SDCReference.java
deleted file mode 100644
index b9d630026..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/SDCReference.java
+++ /dev/null
@@ -1,94 +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.sdc.artifacts.object;
-
-public class SDCReference {
-
- private String vnfType;
- private String vnfcType;
- private String fileCategory;
- private String action;
- private String artifactType;
- private String artifactName;
-
- public String getVnfType() {
- return vnfType;
- }
-
- public void setVnfType(String vnfType) {
- this.vnfType = vnfType;
- }
-
- public String getVnfcType() {
- return vnfcType;
- }
-
- public void setVnfcType(String vnfcType) {
- this.vnfcType = vnfcType;
- }
-
- public String getFileCategory() {
- return fileCategory;
- }
-
- public void setFileCategory(String fileCategory) {
- this.fileCategory = fileCategory;
- }
-
- public String getAction() {
- return action;
- }
-
- public void setAction(String action) {
- this.action = action;
- }
-
- public String getArtifactType() {
- return artifactType;
- }
-
- public void setArtifactType(String artifactType) {
- this.artifactType = artifactType;
- }
-
- public String getArtifactName() {
- return artifactName;
- }
-
- public void setArtifactName(String artifactName) {
- this.artifactName = artifactName;
- }
- @Override
- public String toString() {
- return "vnfType = " + vnfType+
- ", vnfType = " + vnfType+
- ", fileCategory = " + fileCategory+
- ", action = " + action+
- ", artifactType = " + artifactType+
- ", artifactName = " + artifactName+
- ", vnfType = " + vnfType;
- }
-
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/Vnfc.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/Vnfc.java
deleted file mode 100644
index 47d5f4516..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/artifacts/object/Vnfc.java
+++ /dev/null
@@ -1,78 +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.sdc.artifacts.object;
-
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-
-import java.util.List;
-
-@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
-@JsonIgnoreProperties(ignoreUnknown = true)
-@JsonPropertyOrder({"vnfc-type","mandatory","resilience","parents"})
-public class Vnfc {
-
- @JsonProperty("vnfc-type")
- private String vnfcType;
- @JsonProperty("mandatory")
- private boolean mandatory;
- @JsonProperty("resilience")
- private String resilienceType;
- @JsonProperty("parents")
- private List<String> parents;
-
- public String getVnfcType() {
- return vnfcType;
- }
-
- public void setVnfcType(String vnfcType) {
- this.vnfcType = vnfcType;
- }
- public boolean isMandatory() {
- return mandatory;
- }
-
- public void setMandatory(boolean mandatory) {
- this.mandatory = mandatory;
- }
-
- public String getResilienceType() {
- return resilienceType;
- }
-
- public void setResilienceType(String resilienceType) {
- this.resilienceType = resilienceType;
- }
-
- public List<String> getParents() {
- return parents;
- }
-
- public void setParents(List<String> parents) {
- this.parents = parents;
- }
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcCallback.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcCallback.java
deleted file mode 100644
index b5307d697..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcCallback.java
+++ /dev/null
@@ -1,148 +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.sdc.listener;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.openecomp.appc.adapter.message.EventSender;
-import org.openecomp.appc.sdc.artifacts.ArtifactProcessor;
-import org.openecomp.appc.sdc.artifacts.impl.ArtifactProcessorFactory;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.consumer.INotificationCallback;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.api.notification.IResourceInstance;
-import org.apache.commons.lang3.concurrent.BasicThreadFactory;
-import org.openecomp.sdc.utils.DistributionStatusEnum;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
-
-import java.net.URI;
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-public class AsdcCallback implements INotificationCallback {
-
- private final EELFLogger logger = EELFManager.getInstance().getLogger(AsdcCallback.class);
-
- private URI storeUri;
- private IDistributionClient client;
-
- private EventSender eventSender = null;
-
- private ThreadPoolExecutor executor;
- private int threadCount = 10;
-
- private AtomicBoolean isRunning = new AtomicBoolean(false);
-
-
- public AsdcCallback(URI storeUri, IDistributionClient client) {
- this.storeUri = storeUri;
- this.client = client;
-
- // Create the thread pool
- executor = new ThreadPoolExecutor(threadCount, threadCount, 1, TimeUnit.SECONDS,
- new ArrayBlockingQueue<Runnable>(threadCount * 2));
-
- // Custom Named thread factory
- BasicThreadFactory threadFactory = new BasicThreadFactory.Builder().namingPattern("Appc-Listener-%d").build();
- executor.setThreadFactory(threadFactory);
-
- isRunning.set(true);
- }
-
- @Override
- public void activateCallback(INotificationData data) {
- if (null == eventSender) {
- try {
- BundleContext bctx = FrameworkUtil.getBundle(EventSender.class).getBundleContext();
- ServiceReference sref = bctx.getServiceReference(EventSender.class);
- eventSender = (EventSender) bctx.getService(sref);
- } catch (Exception e) {
- logger.error("AsdcCallback failed on initializing EventSender", e);
- }
- }
-
- if (isRunning.get()) {
-
- for(IArtifactInfo artifact:data.getServiceArtifacts()){
- ArtifactProcessor artifactProcessor = ArtifactProcessorFactory.getArtifactProcessor(
- client, eventSender, data, null, artifact, storeUri);
- if(artifactProcessor!=null){
- executor.submit(artifactProcessor);
- }
- }
-
- for (IResourceInstance resource : data.getResources()) {
- for (IArtifactInfo artifact : resource.getArtifacts()) {
- logger.info(Util.toAsdcStoreDocumentInput(data, resource, artifact, "abc"));
- if (executor.getQueue().size() >= threadCount) {
- // log warning about job backlog
- }
- ArtifactProcessor artifactProcessor = ArtifactProcessorFactory.getArtifactProcessor(client, eventSender, data, resource, artifact, storeUri);
- if(artifactProcessor != null){
- executor.submit(artifactProcessor);
- }
- else{
- /* Before refactoring of the DownloadAndStoreOp class, the approach was to download all the
- artifacts, send the download status, and then perform the processing of artifact if it is
- required. Now that we are downloading the artifacts only when its processing is required,
- we are sending the download status as positive just to have the same behaviour as before
- refactoring.
- */
- client.sendDownloadStatus(Util.buildDistributionStatusMessage(client, data, artifact, DistributionStatusEnum.DOWNLOAD_OK));
- logger.error("Artifact type not supported : " + artifact.getArtifactType());
- }
- }
- }
- } else {
- // TODO - return a failed result so asdc knows we are shut down
- }
- }
-
- public void stop() {
- stop(10);
- }
-
- public void stop(int waitSec) {
- isRunning.set(false);
- logger.info(String.format("Stopping the ASDC listener and waiting up to %ds for %d pending jobs", waitSec,
- executor.getQueue().size()));
- boolean cleanShutdown = false;
- executor.shutdown();
- try {
- cleanShutdown = executor.awaitTermination(waitSec, TimeUnit.SECONDS);
- executor.shutdownNow(); // In case of timeout
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- logger.info(String.format("Attempting to shutdown cleanly: %s", cleanShutdown ? "SUCCESS" : "FAILURE"));
- logger.info("Shutdown complete.");
- }
-
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcConfig.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcConfig.java
deleted file mode 100644
index d0d5319f9..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcConfig.java
+++ /dev/null
@@ -1,197 +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.sdc.listener;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.openecomp.sdc.api.consumer.IConfiguration;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-public class AsdcConfig implements IConfiguration {
-
- private String host;
- private String consumer;
- private String consumerId;
- private String env;
- private String keystorePath;
- private String keystorePass;
- /** Polling internal is time between listening sessions */
- private int pollingInterval;
- /** Polling timeout is the time to listen for (dmaap timeout url param)/1000 */
- private int pollingTimeout;
- private List<String> types = new ArrayList<>();
- private String user;
- private String pass;
-
- private URI storeOp;
-
- private Properties props;
-
- private final EELFLogger logger = EELFManager.getInstance().getLogger(AsdcConfig.class);
-
- AsdcConfig(Properties props) throws Exception {
- this.props = props;
- init();
- }
-
- private void init() throws Exception {
- if (props == null) {
- logger.error("SdcConfig init is skipped due to properties is null");
- return;
- }
-
- // Keystore for ca cert
- keystorePath = props.getProperty("appc.asdc.keystore.path");
- keystorePass = props.getProperty("appc.asdc.keystore.pass");
-
- // ASDC host
- host = props.getProperty("appc.asdc.host");
- env = props.getProperty("appc.asdc.env");
- user = props.getProperty("appc.asdc.user");
- pass = props.getProperty("appc.asdc.pass");
-
- // DMaaP properties
- consumer = props.getProperty("appc.asdc.consumer");
- consumerId = props.getProperty("appc.asdc.consumer.id");
-
- pollingInterval = Integer.valueOf(props.getProperty("interval", "60"));
-
- // Client uses cambriaClient-0.2.4 which throws non relevant (wrong)
- // exceptions with times > 30s
- pollingTimeout = Integer.valueOf(props.getProperty("timeout", "25"));
-
- // Anything less than 60 and we risk 429 Too Many Requests
- if (pollingInterval < 60) {
- pollingInterval = 60;
- }
-
- if (pollingInterval > pollingTimeout) {
- logger.warn(String.format(
- "Message acknowledgement may be delayed by %ds in the ADSC listener. [Listening Time: %s, Poll Period: %s]",
- pollingInterval - pollingTimeout, pollingTimeout, pollingInterval));
- }
-
- logParams();
-
- // Download type
- /*
- This types seems redundant, as it looks from the code that they are not being used anywhere
- */
- types.add("APPC_CONFIG");
- types.add("VF_LICENSE");
- types.add("TOSCA_CSAR");
-
- storeOp = new URI(props.getProperty("appc.asdc.provider.url"));
- }
-
- @Override
- public boolean activateServerTLSAuth() {
- return false;
- }
-
- public boolean isFilterInEmptyResources() {
- return false;
- }
-
- @Override
- public String getAsdcAddress() {
- return host;
- }
-
- @Override
- public String getConsumerGroup() {
- return consumer;
- }
-
- @Override
- public String getConsumerID() {
- return consumerId;
- }
-
- @Override
- public String getEnvironmentName() {
- return env;
- }
-
- @Override
- public String getKeyStorePassword() {
- return keystorePass;
- }
-
- @Override
- public String getKeyStorePath() {
- return keystorePath;
- }
-
- @Override
- public String getPassword() {
- return pass;
- }
-
- @Override
- public int getPollingInterval() {
- return pollingInterval;
- }
-
- @Override
- public int getPollingTimeout() {
- return pollingTimeout;
- }
-
- @Override
- public List<String> getRelevantArtifactTypes() {
- return types;
- }
-
- @Override
- public String getUser() {
- return user;
- }
-
- URI getStoreOpURI() {
- return storeOp;
- }
-
- /**
- * Logs the relevant parameters
- */
- private void logParams() {
- Map<String, String> params = new HashMap<>();
- params.put("ASDC Host", getAsdcAddress());
- params.put("ASDC Environment", getEnvironmentName());
- params.put("Consumer Name", getConsumerGroup());
- params.put("Consumer ID", getConsumerID());
- params.put("Poll Active Wait", String.valueOf(getPollingInterval()));
- params.put("Poll Timeout", String.valueOf(getPollingTimeout()));
-
- logger.info(String.format("ASDC Params: %s", params));
- }
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcListener.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcListener.java
deleted file mode 100644
index a580e4077..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/AsdcListener.java
+++ /dev/null
@@ -1,219 +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.sdc.listener;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.openecomp.appc.configuration.Configuration;
-import org.openecomp.appc.configuration.ConfigurationFactory;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.results.IDistributionClientResult;
-import org.openecomp.sdc.impl.DistributionClientFactory;
-import org.openecomp.sdc.utils.DistributionActionResultEnum;
-
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-/**
- * SDC listener handles bundle start and stop through start and stop method. <p>
- * Register connection with SDC server based on properties file configuration when start,
- * and disconnect with SDC server when stop.
- */
-public class AsdcListener {
- private final EELFLogger logger = EELFManager.getInstance().getLogger(AsdcListener.class);
-
- /**
- * The bundle context
- */
- private IDistributionClient client;
- private AsdcCallback callback;
- private AsdcConfig config;
- private CountDownLatch latch;
-
- private Thread startThread = null;
-
- @SuppressWarnings("unused")
- public void start() throws Exception {
- // Add timestamp to the log to differentiate the jmeter run testing calls.
- final long timeStamp = System.currentTimeMillis();
- logger.info(String.format("[%d] Starting SDC Listener", timeStamp));
-
- Configuration configuration = ConfigurationFactory.getConfiguration();
- Properties props = configuration.getProperties();
- config = new AsdcConfig(props);
- logger.debug(String.format("[%d] created SDC config", timeStamp));
-
- client = DistributionClientFactory.createDistributionClient();
- logger.debug(String.format("[%d] created SDC client", timeStamp));
-
- callback = new AsdcCallback(config.getStoreOpURI(), client);
- logger.debug(String.format("[%d] created SDC callback", timeStamp));
-
- latch = new CountDownLatch(1);
-
- startThread = new Thread(new StartRunnable(timeStamp));
- startThread.setName(String.format("[%d] sdcListener start", timeStamp));
- logger.debug(String.format("[%d] created SDC initialization thread", timeStamp));
- startThread.start();
- }
-
- @SuppressWarnings("unused")
- public void stop() throws InterruptedException {
- // Add timestamp to the log to differentiate the jmeter run testing calls.
- final long timeStamp = System.currentTimeMillis();
- logger.info(String.format("[%d] Stopping ASDC Listener", timeStamp));
-
- stopStartThread(timeStamp);
-
- if (latch != null) {
- logger.debug(String.format("[%d] waiting ASDC latch count to 0 for 10 seconds", timeStamp));
- latch.await(10, TimeUnit.SECONDS);
- latch = null;
- }
-
- if (callback != null) {
- logger.debug(String.format("[%d] stopping ASDC callback", timeStamp));
- callback.stop();
- callback = null;
- }
- if (client != null) {
- logger.debug(String.format("[%d] stopping ASDC client", timeStamp));
- client.stop();
- client = null;
-
- }
- logger.info(String.format("[%d] ASDC Listener stopped successfully", timeStamp));
- }
-
- void stopStartThread(long timeStamp) throws InterruptedException {
- if (startThread == null) {
- return;
- }
-
- if (startThread.getState() == Thread.State.TERMINATED) {
- logger.debug(String.format("[%d] ASDC thread(%s) is already terminated.",
- timeStamp, startThread.getName()));
- } else {
- logger.debug(String.format("[%d] ASDC thread(%s) is to be interrupted with state(%s)",
- timeStamp, startThread.getName(), startThread.getState().toString()));
-
- startThread.interrupt();
-
- logger.debug(String.format("[%d] ASDC thread(%s) has been interrupted(%s) with state(%s)",
- timeStamp, startThread.getName(), startThread.isInterrupted(),
- startThread.getState().toString()));
- }
- startThread = null;
- }
-
- /**
- * Runnable implementation for actual initialization during ASDC listener start
- */
- class StartRunnable implements Runnable {
- private final long timeStamp;
-
- StartRunnable(long theTimeStamp) {
- timeStamp = theTimeStamp;
- }
-
- /**
- * This run method calls ASDC client for init and start which are synchronized calls along with stop.
- * To interrupt this thread at stop time, we added thread interrupted checking in each step
- * for earlier interruption.
- */
- @Override
- public void run() {
- if (!initialRegistration()) {
- logger.warn(String.format("[%d] ASDC thread initial registration failed.", timeStamp));
- }
-
- if (isThreadInterrupted("after initial registration")) {
- return;
- }
-
- IDistributionClientResult result = client.init(config, callback);
-
- if (isThreadInterrupted("after client init")) {
- return;
- }
-
- if (result.getDistributionActionResult() == DistributionActionResultEnum.SUCCESS) {
- client.start();
- } else {
- logger.error(String.format("[%d] Could not register ASDC client. %s - %s",
- timeStamp, result.getDistributionActionResult(), result.getDistributionMessageResult()));
- }
-
- latch.countDown();
- }
-
- private boolean initialRegistration() {
- try {
- final String jsonTemplate =
- "{\"consumerName\": \"%s\",\"consumerSalt\": \"%s\",\"consumerPassword\":\"%s\"}";
- String saltedPassStr = org.openecomp.tlv.sdc.security.Passwords.hashPassword(config.getPassword());
- if (saltedPassStr == null || !saltedPassStr.contains(":")) {
- return false;
- }
-
- String[] saltedPass = saltedPassStr.split(":");
- String json = String.format(jsonTemplate, config.getUser(), saltedPass[0], saltedPass[1]);
-
- Map<String, String> headers = new HashMap<>();
- // TODO - Replace the header below to sdc's requirements. What should the new value be
- headers.put("USER_ID", "test");
-
- // TODO - How to format the url. Always same endpoint or ports?
- String host = config.getAsdcAddress();
- URL url = new URL(String.format("http%s://%s/sdc2/rest/v1/consumers",
- host.contains("443") ? "s" : "", host));
-
- logger.info(String.format("Attempting to register user %s on %s with salted pass of %s",
- config.getUser(), url, saltedPass[1]));
-
- ProviderOperations providerOperations = new ProviderOperations();
- ProviderResponse result = providerOperations.post(url, json, headers);
- return result.getStatus() == 200;
- } catch (Exception e) {
- logger.error(
- "Error performing initial registration with ASDC server. User may not be able to connect",
- e);
- return false;
- }
- }
-
- private boolean isThreadInterrupted(String details) {
- if (Thread.currentThread().isInterrupted()) {
- logger.info(String.format("[%d] ASDC thread interrupted %s.", timeStamp, details));
- return true;
- }
- return false;
- }
- }
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/ProviderOperations.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/ProviderOperations.java
deleted file mode 100644
index c644930e4..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/ProviderOperations.java
+++ /dev/null
@@ -1,211 +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.sdc.listener;
-
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.Socket;
-import java.net.URL;
-import java.net.UnknownHostException;
-import java.security.KeyManagementException;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.UnrecoverableKeyException;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-
-import org.apache.commons.codec.binary.Base64;
-import org.apache.commons.io.IOUtils;
-import org.apache.http.HttpResponse;
-import org.apache.http.HttpVersion;
-import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpPost;
-import org.apache.http.conn.ClientConnectionManager;
-import org.apache.http.conn.scheme.PlainSocketFactory;
-import org.apache.http.conn.scheme.Scheme;
-import org.apache.http.conn.scheme.SchemeRegistry;
-import org.apache.http.conn.ssl.SSLSocketFactory;
-import org.apache.http.entity.StringEntity;
-import org.apache.http.impl.client.DefaultHttpClient;
-import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;
-import org.apache.http.params.BasicHttpParams;
-import org.apache.http.params.HttpParams;
-import org.apache.http.params.HttpProtocolParams;
-import org.apache.http.protocol.HTTP;
-import org.openecomp.appc.exceptions.APPCException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-public class ProviderOperations {
-
- private static final EELFLogger LOG = EELFManager.getInstance().getLogger(ProviderOperations.class);
-
- private static String basic_auth;
-
- public static ProviderResponse post(URL url, String json, Map<String, String> adtl_headers) throws APPCException {
- if (json == null) {
- throw new APPCException("Provided message was null");
- }
-
- HttpPost post = null;
- try {
- post = new HttpPost(url.toExternalForm());
- post.setHeader("Content-Type", "application/json");
- post.setHeader("Accept", "application/json");
-
- // Set Auth
- if (basic_auth != null) {
- post.setHeader("Authorization", "Basic " + basic_auth);
- }
-
- if (adtl_headers != null) {
- for (Entry<String, String> header : adtl_headers.entrySet()) {
- post.setHeader(header.getKey(), header.getValue());
- }
- }
-
- StringEntity entity = new StringEntity(json);
- entity.setContentType("application/json");
- post.setEntity(new StringEntity(json));
- } catch (UnsupportedEncodingException e) {
- throw new APPCException(e);
- }
-
- HttpClient client = getHttpClient(url);
-
- int httpCode = 0;
- String respBody = null;
- try {
- HttpResponse response = client.execute(post);
- httpCode = response.getStatusLine().getStatusCode();
- respBody = IOUtils.toString(response.getEntity().getContent());
- return new ProviderResponse(httpCode, respBody);
- } catch (IOException e) {
- throw new APPCException(e);
- }
- }
-
- /**
- * Sets the basic authentication header for the given user and password. If either entry is null then set basic auth
- * to null
- *
- * @param user
- * The user with optional domain name (for AAF)
- * @param password
- * The password for the user
- * @return The new value of the basic auth string that will be used in the request headers
- */
- public static String setAuthentication(String user, String password) {
- if (user != null && password != null) {
- String authStr = user + ":" + password;
- basic_auth = new String(Base64.encodeBase64(authStr.getBytes()));
- } else {
- basic_auth = null;
- }
- return basic_auth;
- }
-
- @SuppressWarnings("deprecation")
- private static HttpClient getHttpClient(URL url) throws APPCException {
- HttpClient client;
- if (url.getProtocol().equals("https")) {
- try {
- KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
- trustStore.load(null, null);
- MySSLSocketFactory sf = new MySSLSocketFactory(trustStore);
- sf.setHostnameVerifier(MySSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
-
- HttpParams params = new BasicHttpParams();
- HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1);
- HttpProtocolParams.setContentCharset(params, HTTP.UTF_8);
-
- SchemeRegistry registry = new SchemeRegistry();
- registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
- registry.register(new Scheme("https", sf, 443));
- registry.register(new Scheme("https", sf, 8443));
- registry.register(new Scheme("http", sf, 8181));
-
- ClientConnectionManager ccm = new ThreadSafeClientConnManager(params, registry);
- client = new DefaultHttpClient(ccm, params);
- } catch (Exception e) {
- client = new DefaultHttpClient();
- }
- } else if (url.getProtocol().equals("http")) {
- client = new DefaultHttpClient();
- } else {
- throw new APPCException(
- "The provider.topology.url property is invalid. The url did not start with http[s]");
- }
- return client;
- }
-
- @SuppressWarnings("deprecation")
- public static class MySSLSocketFactory extends SSLSocketFactory {
- private SSLContext sslContext = SSLContext.getInstance("TLSv1.2");
-
- public MySSLSocketFactory(KeyStore truststore) throws NoSuchAlgorithmException, KeyManagementException,
- KeyStoreException, UnrecoverableKeyException {
- super(truststore);
-
- TrustManager tm = new X509TrustManager() {
- @Override
- public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
- }
-
- @Override
- public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
- }
-
- @Override
- public X509Certificate[] getAcceptedIssuers() {
- return null;
- }
- };
-
- sslContext.init(null, new TrustManager[] {
- tm
- }, null);
- }
-
- @Override
- public Socket createSocket(Socket socket, String host, int port, boolean autoClose)
- throws IOException, UnknownHostException {
- return sslContext.getSocketFactory().createSocket(socket, host, port, autoClose);
- }
-
- @Override
- public Socket createSocket() throws IOException {
- return sslContext.getSocketFactory().createSocket();
- }
- }
-
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/ProviderResponse.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/ProviderResponse.java
deleted file mode 100644
index cc21cea0c..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/ProviderResponse.java
+++ /dev/null
@@ -1,45 +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.sdc.listener;
-
-public class ProviderResponse {
-
- private int status;
- private String body;
-
- public ProviderResponse(int status, String body) {
- this.status = status;
- this.body = body;
- }
-
- public String getBody() {
- return body;
- }
-
- public int getStatus() {
- return status;
- }
-
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/Util.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/Util.java
deleted file mode 100644
index 2729d1dcb..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/appc/sdc/listener/Util.java
+++ /dev/null
@@ -1,126 +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.sdc.listener;
-import org.openecomp.sdc.utils.DistributionStatusEnum;
-
-import org.json.JSONException;
-import org.json.JSONObject;
-import org.openecomp.appc.exceptions.APPCException;
-import org.openecomp.sdc.api.IDistributionClient;
-import org.openecomp.sdc.api.consumer.IDistributionStatusMessage;
-import org.openecomp.sdc.api.notification.IArtifactInfo;
-import org.openecomp.sdc.api.notification.INotificationData;
-import org.openecomp.sdc.api.notification.IResourceInstance;
-import org.openecomp.sdc.utils.DistributionStatusEnum;
-
-public class Util {
-
- // TODO - Use the yang builder instead
- public static String toAsdcStoreDocumentInput(INotificationData notification, IResourceInstance resource,
- IArtifactInfo artifact, String data) {
- JSONObject json = new JSONObject();
-
- JSONObject requestInfo = new JSONObject();
- requestInfo.put("request-id", notification.getServiceUUID());
- requestInfo.put("request-action", "StoreAsdcDocumentRequest");
- requestInfo.put("source", "ASDC");
-
- JSONObject docParams = new JSONObject();
- docParams.put("service-uuid", notification.getServiceUUID());
- docParams.put("distribution-id", notification.getDistributionID());
- docParams.put("service-name", notification.getServiceName());
- docParams.put("service-description", notification.getServiceDescription());
- docParams.put("service-artifacts", "[]");
- docParams.put("resource-uuid", resource.getResourceUUID());
- docParams.put("resource-instance-name", resource.getResourceInstanceName());
- docParams.put("resource-name", resource.getResourceName());
- docParams.put("resource-version", resource.getResourceVersion());
- docParams.put("resource-type", resource.getResourceType());
- docParams.put("artifact-uuid", artifact.getArtifactUUID());
- docParams.put("artifact-name", artifact.getArtifactName());
- docParams.put("artifact-type", artifact.getArtifactType());
- docParams.put("artifact-version", artifact.getArtifactVersion());
- docParams.put("artifact-description", artifact.getArtifactDescription());
- docParams.put("artifact-contents", data);
-
- json.put("request-information", requestInfo);
- json.put("document-parameters", docParams);
-
- return String.format("{\"input\": %s}", json.toString());
- }
-
- public static boolean parseResponse(String input) throws APPCException {
- JSONObject result, output, response;
- try {
- result = new JSONObject(input);
- output = result.getJSONObject("output");
- response = output.getJSONObject("config-document-response");
- String id = response.getString("request-id");
- String status = response.getString("status");
- if (status.equals(DistributionStatusEnum.DEPLOY_OK.toString())) {
- return true;
- } else {
- String error = response.optString("error-reason");
- String msg = error.isEmpty() ? "No Reason Provided" : error;
- throw new APPCException(msg);
- }
- } catch (JSONException jse) {
- throw new APPCException("Did not get valid json from provider.", jse);
- }
- }
-
- public static IDistributionStatusMessage buildDistributionStatusMessage(final IDistributionClient client,
- final INotificationData data, final IArtifactInfo relevantArtifact, final DistributionStatusEnum status) {
- IDistributionStatusMessage statusMessage = new IDistributionStatusMessage() {
-
- @Override
- public long getTimestamp() {
- long currentTimeMillis = System.currentTimeMillis();
- return currentTimeMillis;
- }
-
- @Override
- public DistributionStatusEnum getStatus() {
- return status;
- }
-
- @Override
- public String getDistributionID() {
- return data.getDistributionID();
- }
-
- @Override
- public String getConsumerID() {
- return client.getConfiguration().getConsumerID();
- }
-
- @Override
- public String getArtifactURL() {
- return relevantArtifact.getArtifactURL();
- }
- };
- return statusMessage;
- }
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/tlv/sdc/security/Passwords.java b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/tlv/sdc/security/Passwords.java
deleted file mode 100644
index 30b275a51..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/java/org/openecomp/tlv/sdc/security/Passwords.java
+++ /dev/null
@@ -1,170 +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.tlv.sdc.security;
-
-import java.math.BigInteger;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-import java.security.SecureRandom;
-import java.util.Arrays;
-import java.util.Random;
-
-/**
- * A copy from the org.openecomp.sdc:security-utils artifact that works with java 7.
- */
-public class Passwords {
-
- private static final Random RANDOM = new SecureRandom();
- private static final int SALT = 0;
- private static final int HASH = 1;
- private static final String HASH_ALGORITHM = "SHA-256";
-
- /**
- * static utility class
- */
- private Passwords() {
- }
-
- /**
- * the method calculates a hash with a generated salt for the given password
- *
- * @param password
- * @return a "salt:hash" value
- */
- public static String hashPassword(String password) {
- byte[] salt = getNextSalt();
- byte byteData[] = hash(salt, password.getBytes());
- if (byteData != null) {
- return toHex(salt) + ":" + toHex(byteData);
- }
- return null;
-
- }
-
- /**
- * the method checks if the given password matches the calculated hash
- *
- * @param password
- * @param expectedHash
- * @return
- */
- public static boolean isExpectedPassword(String password, String expectedHash) {
- String[] params = expectedHash.split(":");
- return isExpectedPassword(password, params[SALT], params[HASH]);
- }
-
- /**
- * the method checks if the given password matches the calculated hash
- *
- * @param password
- * @param salt
- * @param hash
- * the hash generated using the salt
- * @return true if the password matched the hash
- */
- public static boolean isExpectedPassword(String password, String salt, String hash) {
- byte[] saltBytes = fromHex(salt);
- byte[] hashBytes = fromHex(hash);
-
- byte byteData[] = hash(saltBytes, password.getBytes());
- if (byteData != null) {
- return Arrays.equals(byteData, hashBytes);
- }
- return false;
- }
-
- public static void main(String[] args) {
- if (args.length > 1 || args.length > 0) {
- System.out.println("[" + hashPassword(args[0]) + "]");
- } else {
- System.out.println("no passward passed.");
- }
-
- }
-
- /**
- * Returns a random salt to be used to hash a password.
- *
- * @return a 16 bytes random salt
- */
- private static byte[] getNextSalt() {
- byte[] salt = new byte[16];
- RANDOM.nextBytes(salt);
- return salt;
- }
-
- /**
- * hase's the salt and value using the chosen algorithm
- *
- * @param salt
- * @param password
- * @return an array of bytes resulting from the hash
- */
- private static byte[] hash(byte[] salt, byte[] password) {
- MessageDigest md;
- byte[] byteData = null;
- try {
- md = MessageDigest.getInstance(HASH_ALGORITHM);
- md.update(salt);
- md.update(password);
- byteData = md.digest();
- } catch (NoSuchAlgorithmException e) {
- System.out.println("in vlide algorithem name");
- }
- return byteData;
- }
-
- /**
- * Converts a string of hexadecimal characters into a byte array.
- *
- * @param hex
- * the hex string
- * @return the hex string decoded into a byte array
- */
- private static byte[] fromHex(String hex) {
- byte[] binary = new byte[hex.length() / 2];
- for (int i = 0; i < binary.length; i++) {
- binary[i] = (byte) Integer.parseInt(hex.substring(2 * i, 2 * i + 2), 16);
- }
- return binary;
- }
-
- /**
- * Converts a byte array into a hexadecimal string.
- *
- * @param array
- * the byte array to convert
- * @return a length*2 character string encoding the byte array
- */
- private static String toHex(byte[] array) {
- BigInteger bi = new BigInteger(1, array);
- String hex = bi.toString(16);
- int paddingLength = (array.length * 2) - hex.length();
- if (paddingLength > 0)
- return String.format("%0" + paddingLength + "d", 0) + hex;
- else
- return hex;
- }
-}
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml
deleted file mode 100644
index 4dc493c95..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/OSGI-INF/blueprint/blueprint.xml
+++ /dev/null
@@ -1,43 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============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=========================================================
- -->
-
-<!--
- Starter Blueprint Camel Definition appc-aai-adapter-blueprint
--->
-<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
-
-
- <bean id="AsdcListener" class="org.openecomp.appc.sdc.listener.AsdcListener" init-method="start" destroy-method="stop" scope="singleton" activation="eager">
- </bean>
-
- <!--
- <bean id="AsdcListenerBean" class="org.openecomp.appc.sdc.listener.impl.AsdcListenerBean" init-method="start" destroy-method="stop" activation="eager" scope="singleton" />
- <service id="AsdcListener" interface="org.openecomp.appc.sdc.listener.AsdcListener" ref="AsdcListenerBean"/>
- -->
-
-</blueprint>
-
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/conf/attsdc-packages.yaml b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/conf/attsdc-packages.yaml
deleted file mode 100644
index 8385dc988..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/conf/attsdc-packages.yaml
+++ /dev/null
@@ -1,10 +0,0 @@
-packages:
- - org.openecomp.tlv.sdc.ci.tests.execute.general
- - org.openecomp.tlv.sdc.ci.tests.execute.user
- - org.openecomp.tlv.sdc.ci.tests.execute.property
- - org.openecomp.tlv.sdc.ci.tests.execute.lifecycle
- - org.openecomp.tlv.sdc.ci.tests.execute.resource
- - org.openecomp.tlv.sdc.ci.tests.execute.service
- - org.openecomp.tlv.sdc.ci.tests.execute.artifacts
- - org.openecomp.tlv.sdc.ci.tests.execute.imports
- - org.openecomp.tlv.sdc.ci.tests.execute.category \ No newline at end of file
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/conf/attsdc.yaml b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/conf/attsdc.yaml
deleted file mode 100644
index 7e612fe9b..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/conf/attsdc.yaml
+++ /dev/null
@@ -1,35 +0,0 @@
-outputFolder: target
-reportName: index.html
-catalogBeHost: localhost
-catalogFeHost: localhost
-esHost: localhost
-disributionClientHost: localhost
-catalogFePort: 8181
-catalogBePort: 8080
-disributionClientPort: 8181
-esPort: 9200
-neoHost: localhost
-neoPort: 7474
-neoDBusername: neo4j
-neoDBpassword: 123456
-
-resourceConfigDir: src/test/resources/CI/tests
-componentsConfigDir: src/test/resources/CI/components
-importResourceConfigDir: src/test/resources/CI/importResource
-importResourceTestsConfigDir: src/test/resources/CI/importResourceTests
-errorConfigurationFile: ../catalog-be/src/main/resources/config/error-configuration.yaml
-
-titanPropertiesFile: src/main/resources/ci/conf/titan.properties
-
-stopOnClassFailure: false
-
-#List of non-abstract resources to keep during titan cleanup between tests
-#Only 1.0 version will be kept
-resourcesNotToDelete:
- - tosca.nodes.Compute
- - tosca.nodes.Database
- - tosca.nodes.ObjectStorage
- - tosca.nodes.BlockStorage
- - tosca.nodes.LoadBalancer
- - org.openecomp.d2.resource.cp.Port
- - org.openecomp.d2.resource.vl.Network \ No newline at end of file
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/conf/log4j.properties b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/conf/log4j.properties
deleted file mode 100644
index cc8c97a6a..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/conf/log4j.properties
+++ /dev/null
@@ -1,58 +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=========================================================
-###
-
-# Define the root logger with appender file
-log4j.rootLogger = DEBUG, FILE, stdout
-
-# Define the file appender
-log4j.appender.FILE=org.apache.log4j.RollingFileAppender
-log4j.appender.FILE.File=${targetlog}logs/ci-log.out
-
-# Define the layout for file appender
-log4j.appender.FILE.layout=org.apache.log4j.PatternLayout
-log4j.appender.FILE.layout.conversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p [%10c] : %m%n
-
-# Set the maximum file size before rollover
-log4j.appender.FILE.maxFileSize=5MB
-
-# Set the the backup index
-log4j.appender.FILE.maxBackupIndex=10
-
-
-#############################################################
-
-# Direct log messages to stdout
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.Target=System.out
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-#log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
-log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %5p %10c:%L - %m%n
-
-log4j.logger.org.apache.cassandra.service.StorageProxy=DEBUG
-log4j.logger.com.thinkaurelius.titan.diskstorage.cassandra.CassandraTransaction=INFO, FILE, stdout
-
-log4j.logger.org.openecomp.tlv.sdc.ci.tests.utils=TRACE, FILE, stdout
-log4j.additivity.org.openecomp.tlv.sdc.ci.tests.utils=false
-
-
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/conf/titan.properties b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/conf/titan.properties
deleted file mode 100644
index e4bcb4bea..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/conf/titan.properties
+++ /dev/null
@@ -1,29 +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=========================================================
-###
-
-storage.backend=cassandra
-storage.hostname=locahost
-storage.port=9160
-
-cache.db-cache = false
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/scripts/startTest.sh b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/scripts/startTest.sh
deleted file mode 100644
index 28e81ca2b..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/ci/scripts/startTest.sh
+++ /dev/null
@@ -1,112 +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=========================================================
-###
-
-#!/bin/bash
-
-function usage {
- echo "Usage: $0 <jar file>"
-}
-
-function exitOnError() {
- if [ $1 -ne 0 ]
- then
- echo "Failed running task $2"
- exit 2
- fi
-}
-
-if [ $# -lt 1 ]
-then
- usage
- exit 2
-fi
-
-CURRENT_DIR=`pwd`
-BASEDIR=$(dirname $0)
-
-if [ ${BASEDIR:0:1} = "/" ]
-then
- FULL_PATH=$BASEDIR
-else
- FULL_PATH=$CURRENT_DIR/$BASEDIR
-fi
-
-LOGS_PROP_FILE=file:${FULL_PATH}/conf/log4j.properties
-#############################################
-TARGET_DIR=${FULL_PATH}/target
-CONF_FILE=${FULL_PATH}/conf/attsdc.yaml
-DEBUG=true
-#MainClass=org.openecomp.tlv.sdc.ci.tests.run.StartTest
-MainClass=org.openecomp.test.ClientTest
-
-JAR_FILE=$1
-
-#TARGET_DIR=`echo ${TARGET_DIR} | sed 's/\//\//g'`
-#echo $TARGET_DIR
-
-TESTS_DIR=/opt/app/sdc/ci/resources/tests
-COMPONENTS_DIR=/opt/app/sdc/ci/resources/components
-
-#sed -i 's#\(outputFolder:\).*#\1 '${TARGET_DIR}'#g' $CONF_FILE
-#sed -i 's#\(resourceConfigDir:\).*#\1 '${TESTS_DIR}'#g' $CONF_FILE
-#sed -i 's#\(componentsConfigDir:\).*#\1 '${COMPONENTS_DIR}'#g' $CONF_FILE
-TARGET_LOG_DIR="${TARGET_DIR}/"
-
-mkdir -p ${TARGET_DIR}
-if [ -d ${TARGET_DIR} ]
-then
- rm -rf ${TARGET_DIR}/*
- exitOnError $? "Failed_to_delete_target_dir"
-fi
-
-debug_port=8800
-#JAVA_OPTION="-javaagent:/var/tmp/jacoco/lib/jacocoagent.jar=destfile=jacoco-it.exec"
-JAVA_OPTION=""
-case "$2" in
- -debug) echo "Debug mode, Listen on port $debug_port"; JAVA_OPTION="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=${debug_port}" ;;
- "") echo "Standard mode";;
- *) echo "USAGE: startTest.sh [-debug]";;
-esac
-
-cmd="java $JAVA_OPTION -DdisplayException=true -Dtargetlog=${TARGET_LOG_DIR} -Dconfig.resource=${CONF_FILE} -Ddebug=${DEBUG} -Dlog4j.configuration=${LOGS_PROP_FILE} -cp $JAR_FILE ${MainClass}"
-
-#echo $cmd
-#console=`$cmd`
-
-if [ $DEBUG == "true" ]
-then
- $cmd
-else
- $cmd >> /dev/null
-fi
-status=`echo $?`
-
-
-
-echo "##################################################"
-echo "################# status is ${status} #################"
-echo "##################################################"
-
-exit $status
-
diff --git a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/org/openecomp/appc/default.properties b/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/org/openecomp/appc/default.properties
deleted file mode 100644
index 55acec1fe..000000000
--- a/appc-asdc-listener/appc-asdc-listener-bundle/src/main/resources/org/openecomp/appc/default.properties
+++ /dev/null
@@ -1,40 +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=========================================================
-###
-
-org.openecomp.appc.bootstrap.file=appc.properties
-org.openecomp.appc.bootstrap.path=/opt/openecomp/appc/data/properties,${user.home},.
-
-# These ASDC properties were provided by the ASDC Op-So team
-appc.asdc.keystore.path=etc/asdc-client.jks
-appc.asdc.keystore.pass=Aa123456
-
-appc.asdc.host=192.168.1.2:8443
-appc.asdc.env=TEST
-appc.asdc.user=appc
-appc.asdc.pass=appc
-
-appc.asdc.consumer=TEST
-appc.asdc.consumer.id=TEST
-appc.asdc.provider.url=http://localhost:8181/restconf/operations/AsdcMessage:configuration-document-request
-