aboutsummaryrefslogtreecommitdiffstats
path: root/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp
diff options
context:
space:
mode:
authorPatrick Brady <pb071s@att.com>2017-12-13 11:19:06 -0800
committerPatrick Brady <pb071s@att.com>2017-12-13 11:19:17 -0800
commit781b1a6df324419c846c84ea983c18fc8362bfd3 (patch)
tree580008010dd50ca32db2ef6dc2e36628cf8c2b5b /appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp
parent161df8a94bb3b0c34ed16fd4fdba078bd1eeef9a (diff)
Third part of onap rename
This part of the commit changes the folder structure on all other folders of appc. Change-Id: I8acfa11cdfcdcd36be0e137245d1dd7324f1abd3 Signed-off-by: Patrick Brady <pb071s@att.com> Issue-ID: APPC-13
Diffstat (limited to 'appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp')
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/DCAEReporterPlugin.java37
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/DgResolverPlugin.java35
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/IntermediateMessageSender.java51
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/JsonDgUtil.java54
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/LegacyUtil.java43
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/OutputMessagePlugin.java38
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/VNFCDgResolverPlugin.java37
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/VNFConfigurator.java46
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/VnfExecutionFlow.java34
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/AbstractResolver.java117
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/AbstractResolverDataReader.java130
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/Constants.java99
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImpl.java168
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DgResolverPluginImpl.java71
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/FlowKey.java62
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/IntermediateMessageSenderImpl.java172
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/JsonDgUtilImpl.java199
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/LegacyUtilImpl.java60
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/OutputMessagePluginImpl.java73
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/ResolverDataReaderFactory.java47
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/ResolverFactory.java46
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFCDgResolverPluginImpl.java39
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFCResolver.java67
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFCResolverDataReader.java40
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFConfiguratorImpl.java115
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFResolver.java63
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFResolverDataReader.java43
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VnfExecutionFlowImpl.java271
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/objects/ConnectionDetails.java68
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/utils/JAXBUtil.java53
-rw-r--r--appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/utils/JSONUtil.java83
31 files changed, 0 insertions, 2461 deletions
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/DCAEReporterPlugin.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/DCAEReporterPlugin.java
deleted file mode 100644
index 17bb56f66..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/DCAEReporterPlugin.java
+++ /dev/null
@@ -1,37 +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.onap.appc.dg.common;
-
-import java.util.Map;
-
-import org.onap.appc.exceptions.APPCException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-
-
-public interface DCAEReporterPlugin extends SvcLogicJavaPlugin {
- void report(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
- void reportSuccess(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/DgResolverPlugin.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/DgResolverPlugin.java
deleted file mode 100644
index b0ee4a5c9..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/DgResolverPlugin.java
+++ /dev/null
@@ -1,35 +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.onap.appc.dg.common;
-
-import org.onap.appc.exceptions.APPCException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-
-import java.util.Map;
-
-public interface DgResolverPlugin extends SvcLogicJavaPlugin {
- void resolveDg(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/IntermediateMessageSender.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/IntermediateMessageSender.java
deleted file mode 100644
index 3e03c2ff7..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/IntermediateMessageSender.java
+++ /dev/null
@@ -1,51 +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.onap.appc.dg.common;
-
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-
-import java.util.Map;
-
-/**
- * This interface provides api for sending intermediate messages from DG to initiator
- */
-public interface IntermediateMessageSender extends SvcLogicJavaPlugin{
-
- /**
- * DG plugin which sends intermediate messages generated from DG to the initiator
- * @param params expects 1. code, (mandatory)
- * 2. message, (mandatory)
- * 3. payload,
- * 4. prefix
- * @param context expects 1. input.common-header.timestamp,
- * 2. input.common-header.api-ver,
- * 3. input.common-header.originator-id,
- * 4. input.common-header.request-id, (mandatory)
- * 5. input.common-header.sub-request-id,
- * 6. input.action
- */
- void sendMessage(Map<String, String> params, SvcLogicContext context);
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/JsonDgUtil.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/JsonDgUtil.java
deleted file mode 100644
index 95143e145..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/JsonDgUtil.java
+++ /dev/null
@@ -1,54 +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.onap.appc.dg.common;
-
-import java.util.Map;
-
-import org.onap.appc.exceptions.APPCException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-
-
-public interface JsonDgUtil extends SvcLogicJavaPlugin {
- void flatAndAddToContext(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
-
- void generateOutputPayloadFromContext(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
-
- /**
- * Creates filename and content in Json format.
- * @param params
- * @param ctx
- * @throws APPCException
- */
- void cvaasFileNameAndFileContentToContext(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
-
- /**
- * Checks if a file is created.
- * @param params
- * @param ctx
- * @throws APPCException
- */
- void checkFileCreated(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/LegacyUtil.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/LegacyUtil.java
deleted file mode 100644
index 54456b385..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/LegacyUtil.java
+++ /dev/null
@@ -1,43 +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.onap.appc.dg.common;
-
-import java.util.Map;
-
-import org.onap.appc.exceptions.APPCException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-
-
-
-public interface LegacyUtil extends SvcLogicJavaPlugin {
-
- void prepareRequest(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
-
- void convertPositiveResponse(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
-
- void convertNegativeResponse(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
-
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/OutputMessagePlugin.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/OutputMessagePlugin.java
deleted file mode 100644
index 935aa877d..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/OutputMessagePlugin.java
+++ /dev/null
@@ -1,38 +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.onap.appc.dg.common;
-
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-
-import java.util.Map;
-
-import org.onap.appc.exceptions.APPCException;
-
-public interface OutputMessagePlugin extends SvcLogicJavaPlugin {
-
- void outputMessageBuilder(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
-
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/VNFCDgResolverPlugin.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/VNFCDgResolverPlugin.java
deleted file mode 100644
index 06036c225..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/VNFCDgResolverPlugin.java
+++ /dev/null
@@ -1,37 +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.onap.appc.dg.common;
-
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-
-import java.util.Map;
-
-import org.onap.appc.exceptions.APPCException;
-
-
-public interface VNFCDgResolverPlugin extends SvcLogicJavaPlugin {
- void resolveVNFCDg(Map<String, String> params, SvcLogicContext ctx) throws APPCException;
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/VNFConfigurator.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/VNFConfigurator.java
deleted file mode 100644
index 4ce0a9150..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/VNFConfigurator.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.onap.appc.dg.common;
-
-import org.onap.appc.exceptions.APPCException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-
-import java.util.Map;
-/**
- * DG plugin created for VNF configuration operation to store data in MD-SAL store
- **/
-public interface VNFConfigurator extends SvcLogicJavaPlugin{
- /**
- * it is invoked from the DG, and it performs following operations
- * 1. checks whether given yang module is present in the MD-SAL store
- * 2. if it is absent, loads it into MD-SAL store
- * 3. Stores the VNF configuration into MD-SAL store
- * @param params should have 1. uniqueId, 2. yang, 3.configJSON, 4.requestId
- * @param context - DG context
- * @throws APPCException
- */
- void storeConfig(Map<String, String> params, SvcLogicContext context) throws APPCException;
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/VnfExecutionFlow.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/VnfExecutionFlow.java
deleted file mode 100644
index b25eaf10f..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/VnfExecutionFlow.java
+++ /dev/null
@@ -1,34 +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.onap.appc.dg.common;
-
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.onap.ccsdk.sli.core.sli.SvcLogicJavaPlugin;
-
-import java.util.Map;
-
-public interface VnfExecutionFlow extends SvcLogicJavaPlugin {
- void getVnfExecutionFlowData(Map<String,String> params, SvcLogicContext context);
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/AbstractResolver.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/AbstractResolver.java
deleted file mode 100644
index 3c70bab84..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/AbstractResolver.java
+++ /dev/null
@@ -1,117 +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.onap.appc.dg.common.impl;
-
-import org.onap.appc.rankingframework.RankedAttributesResolver;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-
-import java.util.concurrent.locks.ReentrantLock;
-
-abstract class AbstractResolver {
-
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(AbstractResolver.class);
-
- private long interval;
-
- private volatile long lastUpdate = 0l;
- private volatile boolean isUpdateInProgress = false;
- private volatile RankedAttributesResolver<FlowKey> dgResolver;
-
- private final ReentrantLock INIT_LOCK = new ReentrantLock();
-
- AbstractResolver(int interval) {
- this.interval = interval * 1000;
- }
-
- private RankedAttributesResolver<FlowKey> createResolver(String resolverType) {
- AbstractResolverDataReader reader = ResolverDataReaderFactory.createResolverDataReader(resolverType);
- return reader.read();
- }
-
- private boolean isExpired() {
- return (System.currentTimeMillis() - lastUpdate) > interval;
- }
-
- protected RankedAttributesResolver<FlowKey> resolver(String resolverType) {
-
- /*
- * In general case, the method implementation is non-blocking. The first
- * thread that identifies data expiration will be used to refresh it. In
- * meanwhile, any other thread will get the old instance without waiting
- * for the updated one. The only exception is the very first time when
- * previous instance doesn't exist - in such a cases all the threads
- * will be waiting on INIT_LOCK while one of them initializes the
- * resolver instance. NOTE: The initialization is intentionally
- * implemented in lazy manner to make sure the bundle is initialized
- * properly on startup regardless whether or not the data is correct.
- * Afterwards, the resolver may be instantiated as many times as needed.
- */
-
- try {
-
- if (dgResolver == null) {
- INIT_LOCK.lock();
- if (dgResolver != null) {
- INIT_LOCK.unlock();
- }
- }
-
- if (!isUpdateInProgress && isExpired()) {
-
- boolean doUpgrade = false;
-
- synchronized (this) {
- if (!isUpdateInProgress) {
- isUpdateInProgress = true;
- doUpgrade = true;
- }
- }
-
- if (doUpgrade) {
-
- logger.info("DG resolver configuration data has expired - initiating refresh");
-
- try {
- RankedAttributesResolver<FlowKey> temp = createResolver(resolverType);
- dgResolver = temp;
- lastUpdate = System.currentTimeMillis();
-
- logger.info("DG resolver configuration data has been refreshed successfully");
- } finally {
- isUpdateInProgress = false;
- }
- }
- }
- } finally {
- if (INIT_LOCK.isHeldByCurrentThread()) {
- INIT_LOCK.unlock();
- }
- }
-
- return dgResolver;
- }
- protected abstract FlowKey resolve(final String...args);
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/AbstractResolverDataReader.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/AbstractResolverDataReader.java
deleted file mode 100644
index c5fe87c77..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/AbstractResolverDataReader.java
+++ /dev/null
@@ -1,130 +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.onap.appc.dg.common.impl;
-
-import org.onap.appc.dao.util.DBUtils;
-import org.onap.appc.rankingframework.AbstractRankedAttributesResolverFactory;
-import org.onap.appc.rankingframework.ConfigurationEntry;
-import org.onap.appc.rankingframework.ConfigurationSet;
-import org.onap.appc.rankingframework.RankedAttributesResolver;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Collection;
-import java.util.Iterator;
-
-abstract class AbstractResolverDataReader {
-
- private class ConfigurationSetAdaptor implements ConfigurationSet<FlowKey> {
-
- private final ResultSet resultSet;
-
- private class ResultSetIterator implements Iterator<ConfigurationEntry<FlowKey>>, ConfigurationEntry<FlowKey> {
- @Override
- public boolean hasNext() {
- try {
- return resultSet.next();
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public ConfigurationEntry<FlowKey> next() {
- return this;
- }
-
- @Override
- public void remove() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public Object getAttributeValue(String name) {
- try {
- return resultSet.getObject(name);
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
-
- @Override
- public FlowKey getResult() {
- try {
- return new FlowKey(resultSet.getString("dg_name"), resultSet.getString("dg_version"), resultSet.getString("dg_module"));
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
- }
-
- ConfigurationSetAdaptor(ResultSet resultSet) {
- this.resultSet = resultSet;
- }
-
- @Override
- public Iterable<ConfigurationEntry<FlowKey>> getEntries() {
- return new Iterable<ConfigurationEntry<FlowKey>>() {
-
- @Override
- public Iterator<ConfigurationEntry<FlowKey>> iterator() {
- return new ResultSetIterator();
- }
- };
- }
-
- @Override
- public Collection<String> getRankedAttributeNames() {
- return getAttributeNames();
- }
- }
-
- protected abstract Collection<String> getAttributeNames();
- protected abstract String getQueryStmt();
-
-
-
- RankedAttributesResolver<FlowKey> read() {
- try {
- try (Connection conn = DBUtils.getConnection("sdnctl")) {
- try (PreparedStatement stmt = conn.prepareStatement(getQueryStmt())) {
- try (ResultSet res = stmt.executeQuery()) {
- if (res.next()) {
- res.beforeFirst();
- ConfigurationSet<FlowKey> resolverConfig = new ConfigurationSetAdaptor(res);
- return AbstractRankedAttributesResolverFactory.getInstance().create(resolverConfig);
- } else {
- throw new IllegalStateException();
- }
- }
- }
- }
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/Constants.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/Constants.java
deleted file mode 100644
index 603b65a19..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/Constants.java
+++ /dev/null
@@ -1,99 +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.onap.appc.dg.common.impl;
-
-
-
-class Constants {
-
- public static final String DG_ERROR_FIELD_NAME = "org.onap.appc.dg.error";
- public static final String DG_OUTPUT_STATUS_MESSAGE = "output.status.message";
- public static final String EVENT_MESSAGE = "event-message";
- public static final String ATTRIBUTE_ERROR_MESSAGE = "error-message";
- public static final String ATTRIBUTE_SUCCESS_MESSAGE = "success-message";
- public static final String DG_ERROR_CODE = "output.status.dgerror.code";
- public static final String API_VERSION_FIELD_NAME = "org.onap.appc.apiversion";
- public static final String REQ_ID_FIELD_NAME = "org.onap.appc.reqid";
- public static final String PAYLOAD = "payload";
- public static final String OUTPUT_PAYLOAD = "output.payload";
-
- //Added for VnfExecution Flow
- public static final String FLOW_STRATEGY = "FlowStrategy" ;
- public static final String DEPENDENCY_TYPE = "DependencyType";
- public static final String VNF_TYPE = "vnfType";
- public static final String VNF_VERION = "vnfVersion";
-
-
- public static final String APPC_INSTANCE_ID= "appc-instance-id";
-
- //Added for Cvaas
- public static final String CVAAS_DIRECTORY_PATH = "cvaas-directory-path";
- public static final String CVAAS_FILE_NAME = "cvaas-file-name";
- public static final String CVAAS_FILE_CONTENT = "cvaas-file-content";
-
- enum LegacyAttributes {
- Action("org.onap.appc.action"),
- VMID("org.onap.appc.vmid"),
- IdentityURL("org.onap.appc.identity.url"),
- TenantID("org.onap.appc.tenant.id"),
- SkipHypervisorCheck("org.onap.appc.skiphypervisorcheck");
-
- private String value;
- LegacyAttributes(String value) {this.value = value;}
- String getValue() {return value;}
- };
-
- enum LCMAttributes {
- Action("input.action"),
- Payload("input.payload"),
- VMID("vm-id"),
- IdentityURL("identity-url"),
- TenantID("tenant.id"),
- SkipHypervisorCheck("skip-hypervisor-check");
-
- private String value;
- LCMAttributes(String value) {this.value = value;}
- String getValue() {return value;}
- };
-
- // DG Resolver Constants
- public static final String IN_PARAM_VNF_TYPE = "vnfType";
- public static final String IN_PARAM_VNFC_TYPE = "vnfcType";
- public static final String IN_PARAM_ACTION = "action";
- public static final String IN_PARAM_API_VERSION = "api-ver";
-
- public static final String OUT_PARAM_DG_NAME = "dg_name";
- public static final String OUT_PARAM_DG_VERSION= "dg_version";
- public static final String OUT_PARAM_DG_MODULE = "dg_module";
-
- public static final String TABLE_NAME = "VNFC_DG_MAPPING";
- public static final String TABLE_COLUMN_VNF_TYPE = "VNF_TYPE";
- public static final String TABLE_COLUMN_VNFC_TYPE = "VNFC_TYPE";
- public static final String TABLE_COLUMN_ACTION = "ACTION";
- public static final String TABLE_COLUMN_API_VERSION = "API_VERSION";
- public static final String TABLE_COLUMN_DG_NAME = "DG_NAME";
- public static final String TABLE_COLUMN_DG_VERSION= "DG_VERSION";
- public static final String TABLE_COLUMN_DG_MODULE = "DG_MODULE";
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImpl.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImpl.java
deleted file mode 100644
index 68f3cdc68..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DCAEReporterPluginImpl.java
+++ /dev/null
@@ -1,168 +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.onap.appc.dg.common.impl;
-
-import org.apache.commons.lang3.StringUtils;
-import org.onap.appc.adapter.message.EventSender;
-import org.onap.appc.adapter.message.MessageDestination;
-import org.onap.appc.adapter.message.event.EventHeader;
-import org.onap.appc.adapter.message.event.EventMessage;
-import org.onap.appc.adapter.message.event.EventStatus;
-import org.onap.appc.dg.common.DCAEReporterPlugin;
-import org.onap.appc.exceptions.APPCException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-
-import java.util.Map;
-
-public class DCAEReporterPluginImpl implements DCAEReporterPlugin {
-
- private EventSender eventSender;
-
- public DCAEReporterPluginImpl() {
- // do nothing
- }
-
- /**
- * Injected by blueprint
- *
- * @param eventSender to be set
- */
- public void setEventSender(EventSender eventSender) {
- this.eventSender = eventSender;
- }
-
- @Override
- public void report(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
- String errorDescription,apiVersion,eventId ;
-
- Integer errorCode = readErrorCode(params,ctx);
- errorDescription = params.get(Constants.EVENT_MESSAGE);
-
- if(StringUtils.isEmpty(errorDescription)) {
- reportLegacy(params , ctx);
- }else{
- apiVersion = ctx.getAttribute("input.common-header.api-ver");
- eventId = ctx.getAttribute("input.common-header.request-id");
-
- EventMessage eventMessage = new EventMessage(new EventHeader(
- (new java.util.Date()).toString(), apiVersion, eventId),
- new EventStatus(errorCode, errorDescription));
- String eventWriteTopic = params.get("event-topic-name");
- if(!StringUtils.isEmpty(eventWriteTopic) && eventWriteTopic!=null){
- eventSender.sendEvent(MessageDestination.DCAE, eventMessage,eventWriteTopic);
- }else {
- eventSender.sendEvent(MessageDestination.DCAE, eventMessage);
- }
- }
- }
-
- private Integer readErrorCode(Map<String, String> params, SvcLogicContext ctx) {
- Integer errorReportCode = 501;
- String errorCodeStr = params.get(Constants.DG_ERROR_CODE);
- errorCodeStr = StringUtils.isEmpty(errorCodeStr)?
- ctx.getAttribute(Constants.DG_ERROR_CODE):errorCodeStr;
- try{
- errorReportCode = Integer.parseInt(errorCodeStr);
- }
- catch (NumberFormatException e){
- // Ignore Exception
- }
- return errorReportCode;
- }
-
- @Override
- public void reportSuccess(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
- Integer successReportCode = 500;
- String successDescription, apiVersion, eventId;
- successDescription = params.get(Constants.EVENT_MESSAGE);
-
- if(StringUtils.isEmpty(successDescription)) {
- successDescription = params.get(Constants.DG_OUTPUT_STATUS_MESSAGE);
- }
-
- apiVersion = ctx.getAttribute("input.common-header.api-ver");
- eventId = ctx.getAttribute("input.common-header.request-id");
-
- if (null == successDescription) {
- successDescription = "Success";
- }
- EventMessage eventMessage = new EventMessage(new EventHeader(
- (new java.util.Date()).toString(), apiVersion, eventId),
- new EventStatus(successReportCode, successDescription));
- String eventWriteTopic = params.get("event-topic-name");
- if(!StringUtils.isEmpty(eventWriteTopic) && eventWriteTopic!=null){
- eventSender.sendEvent(MessageDestination.DCAE, eventMessage,eventWriteTopic);
- }else {
- eventSender.sendEvent(MessageDestination.DCAE, eventMessage);
- }
- }
-
- private void reportLegacy(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
- String errorDescription,apiVersion,eventId ;
-
- Integer errorCode = readErrorCode(params,ctx);
- errorDescription = getErrorDescriptionAndAddToCtx(params,ctx);
-
- apiVersion = ctx.getAttribute("input.common-header.api-ver");
- eventId = ctx.getAttribute("input.common-header.request-id");
-
- EventMessage eventMessage = new EventMessage(new EventHeader(
- (new java.util.Date()).toString(), apiVersion, eventId),
- new EventStatus(errorCode, errorDescription));
- String eventWriteTopic = params.get("event-topic-name");
- if(!StringUtils.isEmpty(eventWriteTopic) && eventWriteTopic!=null){
- eventSender.sendEvent(MessageDestination.DCAE, eventMessage,eventWriteTopic);
- }else {
- eventSender.sendEvent(MessageDestination.DCAE, eventMessage);
- }
- }
-
- private String getErrorDescriptionAndAddToCtx(Map<String, String> params, SvcLogicContext ctx) {
- String errorDescription;
- errorDescription = params.get(Constants.DG_OUTPUT_STATUS_MESSAGE);
- if(StringUtils.isEmpty(errorDescription)) {
- errorDescription = ctx.getAttribute(Constants.DG_OUTPUT_STATUS_MESSAGE);
- }
- if(StringUtils.isEmpty(errorDescription)) {
- errorDescription = "Unknown";
- }
- addToContextIfNotContains(errorDescription,ctx);
- return errorDescription;
- }
-
- private void addToContextIfNotContains(String errorDescription, SvcLogicContext ctx) {
- String errorDescriptionFromCtx;
- errorDescriptionFromCtx = ctx.getAttribute(Constants.DG_OUTPUT_STATUS_MESSAGE);
- if(StringUtils.isEmpty(errorDescriptionFromCtx)){
- errorDescriptionFromCtx = ctx.getAttribute(Constants.ATTRIBUTE_ERROR_MESSAGE);
- }
- if(StringUtils.isEmpty(errorDescriptionFromCtx)){
- ctx.setAttribute(Constants.DG_OUTPUT_STATUS_MESSAGE, errorDescription);
- }else if (!errorDescriptionFromCtx.contains(errorDescription)){
- ctx.setAttribute(Constants.DG_OUTPUT_STATUS_MESSAGE, errorDescriptionFromCtx+ " | "+ errorDescription);
- }
- }
-
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DgResolverPluginImpl.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DgResolverPluginImpl.java
deleted file mode 100644
index c68fde5a2..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/DgResolverPluginImpl.java
+++ /dev/null
@@ -1,71 +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.onap.appc.dg.common.impl;
-
-import org.onap.appc.exceptions.APPCException;
-import org.onap.appc.i18n.Msg;
-import com.att.eelf.i18n.EELFResourceManager;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-
-import java.util.Map;
-
-import org.onap.appc.dg.common.DgResolverPlugin;
-
-public class DgResolverPluginImpl implements DgResolverPlugin {
-
- @Override
- public void resolveDg(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
-
- String DGName, DGVersion, DGModule = null;
- String prefix = params.containsKey("prefix") ? params.get("prefix") + "." : "";
- AbstractResolver resolver = ResolverFactory.createResolver(params.get("DGResolutionType"));
- FlowKey flowKey = null;
- try {
-
- if(params.get("DGResolutionType").equalsIgnoreCase("VNFC")) {
- flowKey = resolver.resolve(params.get(Constants.IN_PARAM_ACTION), params.get(Constants.IN_PARAM_VNF_TYPE), params.get(Constants.IN_PARAM_VNFC_TYPE), params.get(Constants.IN_PARAM_API_VERSION));
- }else if(params.get("DGResolutionType").equalsIgnoreCase("VNF")){
- flowKey = resolver.resolve(params.get(Constants.IN_PARAM_ACTION), params.get(Constants.IN_PARAM_VNF_TYPE), params.get("vnfVersion"), params.get(Constants.IN_PARAM_API_VERSION));
- }
- if (flowKey != null) {
- DGName = flowKey.name();
- ctx.setAttribute(prefix + Constants.OUT_PARAM_DG_NAME, DGName);
- DGVersion = flowKey.version();
- ctx.setAttribute(prefix + Constants.OUT_PARAM_DG_VERSION, DGVersion);
- DGModule = flowKey.module();
- ctx.setAttribute(prefix + Constants.OUT_PARAM_DG_MODULE, DGModule);
- } else {
- throw new RuntimeException(params.get("DGResolutionType")+ " DG not found for vnf type :" + params.get(Constants.IN_PARAM_VNF_TYPE)
- + " vnfc type : " + params.get(Constants.IN_PARAM_VNFC_TYPE)
- + " action : " + params.get(Constants.IN_PARAM_ACTION)
- + " api version : " + params.get(Constants.IN_PARAM_API_VERSION));
- }
- } catch (Exception e) {
- String msg = EELFResourceManager.format(Msg.FAILURE_RETRIEVE_VNFC_DG,params.get(Constants.IN_PARAM_VNFC_TYPE), e.getMessage());
- ctx.setAttribute(Constants.ATTRIBUTE_ERROR_MESSAGE,msg);
- throw new RuntimeException(e);
- }
- }
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/FlowKey.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/FlowKey.java
deleted file mode 100644
index 68f596f5d..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/FlowKey.java
+++ /dev/null
@@ -1,62 +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.onap.appc.dg.common.impl;
-
-class FlowKey {
- private final String name;
- private final String version;
- private final String module;
-
- FlowKey(String name, String version, String module) {
- this.name = name;
- this.version = version;
- this.module = module;
- }
-
- String name() {
- return name;
- }
-
- String version() {
- return version;
- }
-
- String module() {
- return module;
- }
-
- @Override
- public String toString() {
- StringBuilder buff = new StringBuilder(128);
- buff.append("{");
- buff.append("module = ").append(module);
- buff.append(", ");
- buff.append("name = ").append(name);
- buff.append(", ");
- buff.append("version = ").append(version);
- buff.append("}");
- return buff.toString();
- }
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/IntermediateMessageSenderImpl.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/IntermediateMessageSenderImpl.java
deleted file mode 100644
index 026fa2841..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/IntermediateMessageSenderImpl.java
+++ /dev/null
@@ -1,172 +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.onap.appc.dg.common.impl;
-
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.appc.adapter.message.MessageAdapterFactory;
-import org.onap.appc.adapter.message.Producer;
-import org.onap.appc.configuration.Configuration;
-import org.onap.appc.configuration.ConfigurationFactory;
-import org.onap.appc.dg.common.IntermediateMessageSender;
-import org.onap.appc.exceptions.APPCException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.framework.ServiceReference;
-
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-public class IntermediateMessageSenderImpl implements IntermediateMessageSender {
-
-
- private Producer producer;
-
- private Configuration configuration;
-
- private final EELFLogger logger = EELFManager.getInstance().getLogger(IntermediateMessageSenderImpl.class);
-
- private static final String STATUS = "STATUS";
- private static final String FAILURE = "FAILURE";
- private static final String SUCCESS = "SUCCESS";
- private static final String ERROR_MESSAGE = "ERROR_MESSAGE";
-
- private static final String RESPONSE = "response";
- private static final String MSO = "MSO";
-
- public void init(){
- configuration = ConfigurationFactory.getConfiguration();
- Properties properties=configuration.getProperties();
-
- String writeTopic = properties.getProperty("appc.LCM.topic.write");
- String apiKey = properties.getProperty("appc.LCM.client.key");
- String apiSecret = properties.getProperty("appc.LCM.client.secret");
- String hostNames = properties.getProperty("appc.LCM.poolMembers");
-
- logger.debug("Configuration Read : writeTopic = " + writeTopic +", " +
- "hostNames = " + hostNames);
-
- Set<String> pool = new HashSet<>();
- if (!StringUtils.isEmpty(hostNames)) {
- for (String name : hostNames.split(",")) {
- pool.add(name);
- }
- }
-
- BundleContext ctx = FrameworkUtil.getBundle(IntermediateMessageSenderImpl.class).getBundleContext();
- if (ctx != null) {
- ServiceReference svcRef = ctx.getServiceReference(MessageAdapterFactory.class.getName());
- if (svcRef != null) {
- producer = ((MessageAdapterFactory) ctx.getService(svcRef)).createProducer(pool, writeTopic,apiKey, apiSecret);
- }
- }
- }
-
- @Override
- public void sendMessage(Map<String, String> params, SvcLogicContext context) {
- String prefix = params.get("prefix");
- prefix = StringUtils.isEmpty(prefix)? "":prefix+".";
- try{
- validateInputs(params,context);
- String jsonMessage = getJsonMessage(params, context);
- logger.debug("Constructed JSON Message : " + jsonMessage);
- producer.post("",jsonMessage);
- context.setAttribute(prefix + STATUS, SUCCESS);
- }
- catch(Exception e){
- String errorMessage = "Error sending intermediate message to initiator " + e.getMessage();
- context.setAttribute(prefix + STATUS, FAILURE);
- context.setAttribute(prefix + ERROR_MESSAGE, errorMessage);
- logger.error(errorMessage,e);
- }
- }
-
- private void validateInputs(Map<String, String> params, SvcLogicContext context) throws APPCException {
- String code = params.get("code");
- String message = params.get("message");
- if(StringUtils.isEmpty(code) || StringUtils.isEmpty(message)){
- throw new APPCException("code or message is empty");
- }
- String requestId = context.getAttribute("input.common-header.request-id");
- if(StringUtils.isEmpty(requestId)){
- throw new APPCException("requestId is empty");
- }
- }
-
- private String getJsonMessage(Map<String, String> params, SvcLogicContext context) {
- ObjectMapper objectMapper = new ObjectMapper();
-
- ObjectNode commonHeader = getCommonHeader(context);
- ObjectNode status = getStatus(params);
-
- ObjectNode output = objectMapper.createObjectNode();
- output.put("common-header",commonHeader);
- output.put("status",status);
-
- ObjectNode body = objectMapper.createObjectNode();
- body.put("output",output);
-
- ObjectNode root = objectMapper.createObjectNode();
- root.put("type", RESPONSE);
- root.put("rpc-name",context.getAttribute("input.action"));
- root.put("cambria.partition", MSO);
- root.put("correlation-id",getCorrelationId(context));
- root.put("body",body);
-
- return root.toString();
- }
-
- private String getCorrelationId(SvcLogicContext context) {
- String requestId = context.getAttribute("input.common-header.request-id");
- String subRequestId = context.getAttribute("input.common-header.sub-request-id");
- return requestId + (StringUtils.isEmpty(subRequestId)?"":("-"+subRequestId));
- }
-
- private ObjectNode getStatus(Map<String,String> params) {
- ObjectMapper objectMapper = new ObjectMapper();
- ObjectNode status = objectMapper.createObjectNode();
- status.put("code",params.get("code"));
- status.put("message",params.get("message"));
- return status;
- }
-
- private ObjectNode getCommonHeader(SvcLogicContext context) {
- ObjectMapper objectMapper = new ObjectMapper();
- ObjectNode commonHeader = objectMapper.createObjectNode();
- commonHeader.put("api-ver",context.getAttribute("input.common-header.api-ver"));
- commonHeader.put("timestamp",context.getAttribute("input.common-header.timestamp"));
- commonHeader.put("originator-id",context.getAttribute("input.common-header.originator-id"));
- commonHeader.put("request-id",context.getAttribute("input.common-header.request-id"));
- commonHeader.put("sub-request-id",context.getAttribute("input.common-header.sub-request-id"));
- return commonHeader;
- }
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/JsonDgUtilImpl.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/JsonDgUtilImpl.java
deleted file mode 100644
index fff43cbf5..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/JsonDgUtilImpl.java
+++ /dev/null
@@ -1,199 +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.onap.appc.dg.common.impl;
-
-import java.io.File;
-import java.text.SimpleDateFormat;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.lang3.ObjectUtils;
-import org.apache.commons.lang3.StringUtils;
-import org.onap.appc.dg.common.JsonDgUtil;
-import org.onap.appc.exceptions.APPCException;
-import org.onap.appc.i18n.Msg;
-import org.onap.appc.util.JsonUtil;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.att.eelf.i18n.EELFResourceManager;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.node.ArrayNode;
-import com.fasterxml.jackson.databind.node.ObjectNode;
-
-
-public class JsonDgUtilImpl implements JsonDgUtil {
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(JsonDgUtilImpl.class);
-
- private static final ThreadLocal<SimpleDateFormat> DATE_TIME_PARSER_THREAD_LOCAL = new ThreadLocal<SimpleDateFormat>() {
- protected SimpleDateFormat initialValue() {
- return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- }
- };
-
- @Override
- public void flatAndAddToContext(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
-
- if (logger.isTraceEnabled()) {
- logger.trace("Entering to flatAndAddToContext with params = "+ ObjectUtils.toString(params)+", SvcLogicContext = "+ObjectUtils.toString(ctx));
- }
- try {
- String paramName = Constants.PAYLOAD;
- String payload = params.get(paramName);
- if (payload == "")
- payload = ctx.getAttribute("input.payload");
- if (!StringUtils.isEmpty(payload)) {
- Map<String, String> flatMap = JsonUtil.convertJsonStringToFlatMap(payload);
- if (flatMap != null && flatMap.size() > 0) {
- for (Map.Entry<String, String> entry : flatMap.entrySet()) {
- ctx.setAttribute(entry.getKey(), entry.getValue());
- }
- }
- } else {
- logger.warn("input payload param value is empty (\"\") or null");
- }
- } catch (Exception e) {
- logger.error(e.toString());
- String msg = EELFResourceManager.format(Msg.INPUT_PAYLOAD_PARSING_FAILED,params.get(Constants.PAYLOAD));
- ctx.setAttribute(Constants.ATTRIBUTE_ERROR_MESSAGE, msg);
- throw new APPCException(e);
- }
- }
-
- @Override
- public void generateOutputPayloadFromContext(Map<String, String> params, SvcLogicContext ctx) throws APPCException{
- if (logger.isTraceEnabled()) {
- logger.trace("Entering to generateOutputPayloadFromContext with SvcLogicContext = "+ObjectUtils.toString(ctx));
- }
-
- try {
- Set<String> keys = ctx.getAttributeKeySet();
- ObjectMapper objectMapper = new ObjectMapper();
- ObjectNode JsonNode = objectMapper.createObjectNode();
- for (String key : keys) {
- if(key.startsWith(Constants.OUTPUT_PAYLOAD+".")){
- String objkey= key.replaceFirst(Constants.OUTPUT_PAYLOAD + ".", "");
- if(objkey.contains("[") && objkey.contains("]")){
- ArrayNode arrayNode;
- String arrayKey = objkey.substring(0,objkey.indexOf('['));
- int arrayIndex = Integer.parseInt(objkey.substring(objkey.indexOf('[')+1,objkey.indexOf(']')));
- if(JsonNode.has(arrayKey)){
- arrayNode = (ArrayNode)JsonNode.get(arrayKey);
- arrayNode.insert(arrayIndex,ctx.getAttribute(key));
- }else {
- arrayNode = objectMapper.createArrayNode();
- arrayNode.insert(arrayIndex,ctx.getAttribute(key));
- JsonNode.put(arrayKey,arrayNode);
- }
- }else {
- JsonNode.put(objkey, ctx.getAttribute(key));
- }
- }
- }
- if(JsonNode.size()>0) {
- ctx.setAttribute(Constants.OUTPUT_PAYLOAD, objectMapper.writeValueAsString(JsonNode));
- }
- } catch (Exception e) {
- logger.error(e.toString());
- ctx.setAttribute(Constants.DG_OUTPUT_STATUS_MESSAGE, e.toString());
- throw new APPCException(e);
- }
-
- }
-
- @Override
- public void cvaasFileNameAndFileContentToContext(Map<String, String> params, SvcLogicContext ctx)
- throws APPCException {
-
- if (logger.isTraceEnabled()) {
- logger.trace("Entering to caasFileNameAndFileContentToContext with SvcLogicContext = "
- + ObjectUtils.toString(ctx));
- }
-
- String vnfId = null;
- try {
- String cvassDirectoryPath = params.get(Constants.CVAAS_DIRECTORY_PATH);
- String appcInstanceId = params.get(Constants.APPC_INSTANCE_ID);
-
- /*
- * File name
- */
- vnfId = params.get("vnf-id");
- long timestampAsLongRepresentingFileCreationTime = System.currentTimeMillis();
-
- ctx.setAttribute(Constants.CVAAS_FILE_NAME, cvassDirectoryPath + File.separator + vnfId + "_"
- + timestampAsLongRepresentingFileCreationTime + "_" + appcInstanceId + ".json");
-
- /*
- * File content
- */
-
- String uploadDate = ctx.getAttribute("running-config.upload-date");
- long epochUploadTimestamp = DATE_TIME_PARSER_THREAD_LOCAL.get().parse(uploadDate).getTime();
-
- ObjectMapper objectMapper = new ObjectMapper();
- ObjectNode jsonNode = objectMapper.createObjectNode();
- jsonNode.put("UPLOAD_CONFIG_ID", ctx.getAttribute("running-config.upload-config-id"));
- jsonNode.put("REQUEST_ID", ctx.getAttribute("running-config.request-id"));
- jsonNode.put("ORIGINATOR_ID", ctx.getAttribute("running-config.originator-id"));
- jsonNode.put("SERVICE_DESCRIPTION", ctx.getAttribute("running-config.service-description"));
- jsonNode.put("ACTION", ctx.getAttribute("running-config.action"));
- jsonNode.put("UPLOAD_TIMESTAMP", epochUploadTimestamp);
- jsonNode.put("UPLOAD_DATE", uploadDate);
- jsonNode.put("VNF_ID", vnfId);
- jsonNode.put("VNF_NAME", ctx.getAttribute("running-config.vnf-name"));
- jsonNode.put("VM_NAME", ctx.getAttribute("running-config.vm-name"));
- jsonNode.put("VNF_TYPE", ctx.getAttribute("running-config.vnf-type"));
- jsonNode.put("VNFC_TYPE", ctx.getAttribute("running-config.vnfc-type"));
- jsonNode.put("HOST_IP_ADDRESS", ctx.getAttribute("running-config.host-ip-address"));
- jsonNode.put("CONFIG_INDICATOR", ctx.getAttribute("running-config.config-indicator"));
- jsonNode.put("PENDING_DELETE", ctx.getAttribute("running-config.pending-delete"));
- jsonNode.put("CONTENT", ctx.getAttribute("running-config.content"));
-
- ctx.setAttribute(Constants.CVAAS_FILE_CONTENT,
- objectMapper.writerWithDefaultPrettyPrinter().writeValueAsString(jsonNode));
-
- } catch (Exception e) {
- String errorMessage = "Failed to parse create cvass file for vnf with id : " + vnfId;
- logger.error(errorMessage, e);
- ctx.setAttribute(Constants.ATTRIBUTE_ERROR_MESSAGE, errorMessage);
- throw new APPCException(e);
- }
- }
-
- @Override
- public void checkFileCreated(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
- String filePath = ctx.getAttribute(Constants.CVAAS_FILE_NAME);
- File file = new File(filePath);
-
- if (!file.exists()) {
- String vnfId = params.get("vnf-id");
- String errorMessage = "Cvass file could not be created for vnf with id : " + vnfId;
- ctx.setAttribute(Constants.ATTRIBUTE_ERROR_MESSAGE, errorMessage);
- throw new APPCException(errorMessage);
- }
- }
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/LegacyUtilImpl.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/LegacyUtilImpl.java
deleted file mode 100644
index ad0884b94..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/LegacyUtilImpl.java
+++ /dev/null
@@ -1,60 +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.onap.appc.dg.common.impl;
-
-import java.util.Map;
-
-import org.onap.appc.dg.common.LegacyUtil;
-import org.onap.appc.dg.common.utils.JSONUtil;
-import org.onap.appc.exceptions.APPCException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-
-
-
-public class LegacyUtilImpl implements LegacyUtil {
-
- @Override public void prepareRequest(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
- ctx.setAttribute(Constants.LegacyAttributes.Action.getValue(), ctx.getAttribute(Constants.LCMAttributes.Action.getValue()).toLowerCase());
-
- String payloadStr = ctx.getAttribute(Constants.LCMAttributes.Payload.getValue());
- Map<String,String> payloads = JSONUtil.extractPlainValues(payloadStr,
- Constants.LCMAttributes.VMID.getValue(), Constants.LCMAttributes.IdentityURL.getValue(), Constants.LCMAttributes.TenantID.getValue(),
- Constants.LCMAttributes.SkipHypervisorCheck.getValue());
-
- ctx.setAttribute(Constants.LegacyAttributes.VMID.getValue(), payloads.get(Constants.LCMAttributes.VMID.getValue()));
- ctx.setAttribute(Constants.LegacyAttributes.IdentityURL.getValue(), payloads.get(Constants.LCMAttributes.IdentityURL.getValue()));
- ctx.setAttribute(Constants.LegacyAttributes.TenantID.getValue(), payloads.get(Constants.LCMAttributes.TenantID.getValue()));
- ctx.setAttribute(Constants.LegacyAttributes.SkipHypervisorCheck.getValue(), payloads.get(Constants.LCMAttributes.SkipHypervisorCheck.getValue()));
-
- }
-
- @Override
- public void convertPositiveResponse(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
- }
-
- @Override
- public void convertNegativeResponse(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
- }
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/OutputMessagePluginImpl.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/OutputMessagePluginImpl.java
deleted file mode 100644
index 66ac82fcb..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/OutputMessagePluginImpl.java
+++ /dev/null
@@ -1,73 +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.onap.appc.dg.common.impl;
-
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-
-import java.util.Map;
-
-import org.onap.appc.dg.common.OutputMessagePlugin;
-import org.onap.appc.exceptions.APPCException;
-
-import static org.apache.commons.lang3.StringUtils.isEmpty;
-
-public class OutputMessagePluginImpl implements OutputMessagePlugin {
-
- @Override
- public void outputMessageBuilder(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
- String errorDescription, eventDescription;
-
- //making output.status.message
- errorDescription = params.get(Constants.ATTRIBUTE_ERROR_MESSAGE);
- eventDescription = params.get(Constants.EVENT_MESSAGE);
-
- addToContextIfNotContains(errorDescription , eventDescription, ctx);
-
- //making event-message
-
- if (!isEmpty(eventDescription)) {
- ctx.setAttribute(Constants.EVENT_MESSAGE, eventDescription);
- } else {
- ctx.setAttribute(Constants.EVENT_MESSAGE, ctx.getAttribute(Constants.ATTRIBUTE_ERROR_MESSAGE));
- }
- }
-
- public static void addToContextIfNotContains(String errorDescription, String eventDescription, SvcLogicContext ctx) {
- if (!isEmpty(errorDescription)){
- if (isEmpty(ctx.getAttribute(Constants.DG_OUTPUT_STATUS_MESSAGE))) {
- ctx.setAttribute(Constants.DG_OUTPUT_STATUS_MESSAGE, errorDescription);
- }else if (!ctx.getAttribute(Constants.DG_OUTPUT_STATUS_MESSAGE).contains(errorDescription)) {
- ctx.setAttribute(Constants.DG_OUTPUT_STATUS_MESSAGE, ctx.getAttribute(Constants.DG_OUTPUT_STATUS_MESSAGE) + " | " + errorDescription);
- }
- }
- if (!isEmpty(eventDescription)){
- if (isEmpty(ctx.getAttribute(Constants.DG_OUTPUT_STATUS_MESSAGE))) {
- ctx.setAttribute(Constants.DG_OUTPUT_STATUS_MESSAGE, eventDescription);
- }else if (!ctx.getAttribute(Constants.DG_OUTPUT_STATUS_MESSAGE).contains(eventDescription)) {
- ctx.setAttribute(Constants.DG_OUTPUT_STATUS_MESSAGE, ctx.getAttribute(Constants.DG_OUTPUT_STATUS_MESSAGE) + " | " + eventDescription);
- }
- }
- }
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/ResolverDataReaderFactory.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/ResolverDataReaderFactory.java
deleted file mode 100644
index 790547f37..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/ResolverDataReaderFactory.java
+++ /dev/null
@@ -1,47 +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.onap.appc.dg.common.impl;
-
-import org.onap.appc.configuration.Configuration;
-import org.onap.appc.configuration.ConfigurationFactory;
-
-public class ResolverDataReaderFactory {
- private static final Configuration configuration = ConfigurationFactory.getConfiguration();
- private static class ReferenceHolder{
- private static final AbstractResolverDataReader VNFC_RESOLVER_DATA_READER = new VNFCResolverDataReader();
-
- private static final AbstractResolverDataReader VNF_RESOLVER_DATA_READER = new VNFResolverDataReader();
- }
-
- public static AbstractResolverDataReader createResolverDataReader(String resolverType){
- if(resolverType.equalsIgnoreCase("VNF")){
- return ReferenceHolder.VNF_RESOLVER_DATA_READER;
- }else if(resolverType.equalsIgnoreCase("VNFC")){
- return ReferenceHolder.VNFC_RESOLVER_DATA_READER;
- }else {
- return null;
- }
- }
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/ResolverFactory.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/ResolverFactory.java
deleted file mode 100644
index e39546846..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/ResolverFactory.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.onap.appc.dg.common.impl;
-
-import org.onap.appc.configuration.Configuration;
-import org.onap.appc.configuration.ConfigurationFactory;
-
-public class ResolverFactory {
- private static final Configuration configuration = ConfigurationFactory.getConfiguration();
- private static class ReferenceHolder{
- private static final AbstractResolver VNFC_RESOLVER = new VNFCResolver(configuration.getIntegerProperty("org.onap.appc.workflow.resolver.refresh_interval", 300));
- private static final AbstractResolver VNF_RESOLVER = new VNFResolver(configuration.getIntegerProperty("org.onap.appc.workflow.resolver.refresh_interval", 300));
- }
-
- public static AbstractResolver createResolver(String resolverType){
- if(resolverType.equalsIgnoreCase("VNF")){
- return ReferenceHolder.VNF_RESOLVER;
- }else if(resolverType.equalsIgnoreCase("VNFC")){
- return ReferenceHolder.VNFC_RESOLVER;
- }else {
- return null;
- }
- }
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFCDgResolverPluginImpl.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFCDgResolverPluginImpl.java
deleted file mode 100644
index 304bdf882..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFCDgResolverPluginImpl.java
+++ /dev/null
@@ -1,39 +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.onap.appc.dg.common.impl;
-
-import org.onap.appc.exceptions.APPCException;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-
-import java.util.Map;
-
-public class VNFCDgResolverPluginImpl implements org.onap.appc.dg.common.VNFCDgResolverPlugin {
- @Override
- public void resolveVNFCDg(Map<String, String> params, SvcLogicContext ctx) throws APPCException {
- DgResolverPluginImpl dgResolverPlugin = new DgResolverPluginImpl();
- params.put("DGResolutionType" , "VNFC");
- dgResolverPlugin.resolveDg(params,ctx);
- }
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFCResolver.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFCResolver.java
deleted file mode 100644
index e2893951b..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFCResolver.java
+++ /dev/null
@@ -1,67 +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.onap.appc.dg.common.impl;
-
-import org.onap.appc.rankingframework.RankedAttributesContext;
-
-
-public class VNFCResolver extends AbstractResolver {
- VNFCResolver(int interval) {
- super(interval);
- }
-
- @Override
- protected FlowKey resolve(String... args) {
- if(args.length !=4){
- throw new IllegalStateException(args.toString());
- }
- return resolve(args[0],args[1],args[2],args[3]);
- }
-
- protected FlowKey resolve(final String action, final String vnfType, final String vnfcType, final String apiVersion) {
- RankedAttributesContext context = new RankedAttributesContext() {
- @Override
- public Object getAttributeValue(String name) {
- switch (name) {
- case "action":
- return action;
- case "api_version":
- return apiVersion;
- case "vnf_type":
- return vnfType;
- case "vnfc_type":
- return vnfcType;
- default:
- throw new IllegalStateException(name);
- }
- }
- };
-
- FlowKey wfKey = resolver("VNFC").resolve(context);
-
- return wfKey;
- }
-}
-
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFCResolverDataReader.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFCResolverDataReader.java
deleted file mode 100644
index c78da685c..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFCResolverDataReader.java
+++ /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=========================================================
- */
-
-package org.onap.appc.dg.common.impl;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-public class VNFCResolverDataReader extends AbstractResolverDataReader {
- @Override
- protected Collection<String> getAttributeNames() {
- return Arrays.asList("action","api_version", "vnf_type", "vnfc_type");
- }
-
- @Override
- protected String getQueryStmt() {
- return "select vnf_type,vnfc_type,api_version,action,dg_name,dg_version,dg_module FROM VNFC_DG_MAPPING";
- }
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFConfiguratorImpl.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFConfiguratorImpl.java
deleted file mode 100644
index c46a9c227..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFConfiguratorImpl.java
+++ /dev/null
@@ -1,115 +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.onap.appc.dg.common.impl;
-
-import org.onap.appc.Constants;
-import org.onap.appc.dg.common.VNFConfigurator;
-import org.onap.appc.exceptions.APPCException;
-import org.onap.appc.mdsal.MDSALStore;
-import org.onap.appc.mdsal.exception.MDSALStoreException;
-import org.onap.appc.mdsal.impl.MDSALStoreFactory;
-import org.onap.appc.mdsal.objects.BundleInfo;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-import org.apache.commons.lang3.StringUtils;
-
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Map;
-
-
-public class VNFConfiguratorImpl implements VNFConfigurator {
-
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(VNFConfiguratorImpl.class);
- private static final String STATUS = "STATUS";
- private static final String FAILURE = "FAILURE";
- private static final String SUCCESS = "SUCCESS";
- private static final String ERROR_MESSAGE = "ERROR_MESSAGE";
-
- @Override
- public void storeConfig(Map<String, String> params, SvcLogicContext context) throws APPCException {
- String uniqueId = params.get("uniqueId");
- String yang = params.get("yang");
- String configJSON = params.get("configJSON");
- String requestId = params.get("requestId");
- String prefix = params.get("prefix");
- prefix = StringUtils.isEmpty(prefix)? "":prefix+".";
-
- MDSALStore store = MDSALStoreFactory.createMDSALStore();
-
- logger.debug("Inputs Received : uniqueId = " + uniqueId +
- " , yang = " + yang +
- " , configJSON = " + configJSON +
- " , requestId = " + requestId +
- " , prefix = " +prefix);
-
- try {
-
- if(StringUtils.isEmpty(uniqueId)
- ||StringUtils.isEmpty(yang)
- || StringUtils.isEmpty(configJSON)
- || StringUtils.isEmpty(requestId)){
- throw new APPCException("One or more input parameters are empty : uniqueId = " + uniqueId + " " +
- ", yang = " + yang +
- " , configJSON = " + configJSON +
- " , requestId = " + requestId);
- }
-
- Date revision = new SimpleDateFormat(Constants.YANG_REVISION_FORMAT).parse(Constants.YANG_REVISION);
-
- boolean isYangAlreadyLoaded = store.isModulePresent(uniqueId,revision);
-
- if(!isYangAlreadyLoaded){
- BundleInfo bundleInfo = getBundleInfo(uniqueId);
- store.storeYangModule(yang,bundleInfo);
- }
- store.storeJson(uniqueId, requestId , configJSON);
- context.setAttribute(prefix + STATUS, SUCCESS);
- } catch (ParseException e) {
- String errorMessage ="Error parsing the date : " + Constants.YANG_REVISION + " into format " + Constants.YANG_REVISION_FORMAT;
- logger.error(errorMessage,e);
- context.setAttribute(prefix + STATUS, FAILURE);
- context.setAttribute(prefix + ERROR_MESSAGE, errorMessage);
- throw new APPCException(e.getMessage());
- }catch (MDSALStoreException e){
- String errorMessage = "Error while adding yang to MD-SAL store." + e.getMessage();
- logger.error(errorMessage,e);
- context.setAttribute(prefix + STATUS,FAILURE);
- context.setAttribute(prefix + ERROR_MESSAGE, errorMessage);
- throw new APPCException(e.getMessage());
- }
-
- }
-
- private BundleInfo getBundleInfo(String uniqueId) {
- BundleInfo bundleInfo = new BundleInfo();
- bundleInfo.setDescription(uniqueId);
- bundleInfo.setName(uniqueId);
- bundleInfo.setLocation(uniqueId);
- return bundleInfo;
- }
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFResolver.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFResolver.java
deleted file mode 100644
index 501ad0713..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFResolver.java
+++ /dev/null
@@ -1,63 +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.onap.appc.dg.common.impl;
-
-import org.onap.appc.rankingframework.RankedAttributesContext;
-
-public class VNFResolver extends AbstractResolver {
- VNFResolver(int interval) {
- super(interval);
- }
-
- @Override
- protected FlowKey resolve(String... args) {
- return resolve(args[0],args[1],args[2],args[3]);
- }
-
-
- protected FlowKey resolve(final String action, final String vnfType, final String vnfVersion, final String apiVersion) {
- RankedAttributesContext context = new RankedAttributesContext() {
- @Override
- public Object getAttributeValue(String name) {
- switch (name) {
- case "action":
- return action;
- case "api_version":
- return apiVersion;
- case "vnf_type":
- return vnfType;
- case "vnf_version":
- return vnfVersion;
- default:
- throw new IllegalStateException(name);
- }
- }
- };
-
- FlowKey wfKey = resolver("VNF").resolve(context);
-
- return wfKey;
- }
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFResolverDataReader.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFResolverDataReader.java
deleted file mode 100644
index 3c4cf837e..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VNFResolverDataReader.java
+++ /dev/null
@@ -1,43 +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.onap.appc.dg.common.impl;
-
-import java.util.Arrays;
-import java.util.Collection;
-
-/**
- * @since January 19,2017
- */
-public class VNFResolverDataReader extends AbstractResolverDataReader {
- @Override
- protected Collection<String> getAttributeNames() {
- return Arrays.asList("action","api_version", "vnf_type", "vnf_version");
- }
-
- @Override
- protected String getQueryStmt() {
- return "select vnf_type,vnf_version,api_version,action,dg_name,dg_version,dg_module FROM VNF_DG_MAPPING";
- }
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VnfExecutionFlowImpl.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VnfExecutionFlowImpl.java
deleted file mode 100644
index 65b364f62..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/impl/VnfExecutionFlowImpl.java
+++ /dev/null
@@ -1,271 +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.onap.appc.dg.common.impl;
-
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import com.att.eelf.i18n.EELFResourceManager;
-import org.onap.ccsdk.sli.core.sli.SvcLogicContext;
-
-import java.util.*;
-
-import org.onap.appc.dg.common.VnfExecutionFlow;
-import org.onap.appc.dg.dependencymanager.DependencyManager;
-import org.onap.appc.dg.dependencymanager.exception.DependencyModelNotFound;
-import org.onap.appc.dg.dependencymanager.impl.DependencyModelFactory;
-import org.onap.appc.dg.flowbuilder.FlowBuilder;
-import org.onap.appc.dg.flowbuilder.exception.InvalidDependencyModel;
-import org.onap.appc.dg.flowbuilder.impl.FlowBuilderFactory;
-import org.onap.appc.dg.objects.*;
-import org.onap.appc.domainmodel.Vnf;
-import org.onap.appc.domainmodel.Vnfc;
-import org.onap.appc.domainmodel.Vserver;
-import org.onap.appc.i18n.Msg;
-import org.onap.appc.metadata.objects.DependencyModelIdentifier;
-
-public class VnfExecutionFlowImpl implements VnfExecutionFlow {
-
- private static final EELFLogger logger = EELFManager.getInstance().getLogger(VnfExecutionFlowImpl.class);
-
- public VnfExecutionFlowImpl(){
-
- }
-
- @Override
- public void getVnfExecutionFlowData(Map<String, String> params, SvcLogicContext context) {
- String dependencyType = params.get(Constants.DEPENDENCY_TYPE);
- String flowStrategy = params.get(Constants.FLOW_STRATEGY);
- DependencyModelIdentifier modelIdentifier = readDependencyModelIdentifier(params);
- VnfcDependencyModel dependencyModel = null;
- try {
- validateInput(dependencyType, flowStrategy, params);
-
- if (logger.isTraceEnabled()) {
- logger.trace("Input received from DG Node : dependencyType = " + dependencyType +
- " , flowStrategy = " + flowStrategy +
- ", DependencyModelIdentifier = " + modelIdentifier.toString());
- }
-
- DependencyManager dependencyManager = DependencyModelFactory.createDependencyManager();
-
-
- dependencyModel = dependencyManager.getVnfcDependencyModel(
- modelIdentifier, DependencyTypes.findByString(dependencyType));
- } catch (DependencyModelNotFound e) {
- String msg = EELFResourceManager.format(Msg.DEPENDENCY_MODEL_NOT_FOUND,params.get(Constants.VNF_TYPE), e.getMessage());
- logger.error(msg);
- context.setAttribute(Constants.ATTRIBUTE_ERROR_MESSAGE,msg);
- context.setAttribute("dependencyModelFound","false");
- return;
- } catch (InvalidDependencyModel e){
- String msg = EELFResourceManager.format(Msg.INVALID_DEPENDENCY_MODEL,params.get(Constants.VNF_TYPE), e.getMessage());
- logger.error(msg);
- context.setAttribute(Constants.ATTRIBUTE_ERROR_MESSAGE,msg);
- throw e;
- }catch (RuntimeException e){
- logger.error(e.getMessage());
- context.setAttribute(Constants.ATTRIBUTE_ERROR_MESSAGE,e.getMessage());
- throw e;
- }
-
-
- context.setAttribute("dependencyModelFound","true");
- if(logger.isDebugEnabled()){
- logger.debug("Dependency Model = " +dependencyModel);
- }
- logger.info("Building Inventory Model from DG context");
- InventoryModel inventoryModel = readInventoryModel(context);
- if(logger.isDebugEnabled()){
- logger.debug("Inventory Model = " +inventoryModel);
- }
-
- if(logger.isDebugEnabled()){
- logger.debug("Validating inventory model with dependency model");
- }
- try {
- validateInventoryModelWithDependencyModel(dependencyModel, inventoryModel);
- }catch (RuntimeException e){
- logger.error(e.getMessage());
- context.setAttribute(Constants.ATTRIBUTE_ERROR_MESSAGE,e.getMessage());
- throw e;
- }
- logger.info("Creating flow builder");
- FlowBuilder flowBuilder = FlowBuilderFactory.getInstance().getFlowBuilder(
- FlowStrategies.findByString(flowStrategy));
-
- logger.info("Building Vnf flow model");
- VnfcFlowModel flowModel = null;
- try{
- flowModel = flowBuilder.buildFlowModel(dependencyModel,inventoryModel);
- }
- catch (InvalidDependencyModel e){
- String msg = EELFResourceManager.format(Msg.INVALID_DEPENDENCY_MODEL,params.get(Constants.VNF_TYPE), e.getMessage());
- logger.error(msg);
- context.setAttribute(Constants.ATTRIBUTE_ERROR_MESSAGE,msg);
- throw e;
- }
-
- // remove VNFCs from the flow model where vserver list is empty
- reconcileFlowModel(flowModel);
- populateContext(flowModel,context);
- if(logger.isDebugEnabled()){
- logContext(context);
- }
- String msg = EELFResourceManager.format(Msg.SUCCESS_EVENT_MESSAGE, "GetVnfExecutionFlowData","VNF ID " + params.get(Constants.VNF_TYPE));
- context.setAttribute(org.onap.appc.Constants.ATTRIBUTE_SUCCESS_MESSAGE, msg);
- }
-
- private void validateInput(String dependencyType, String flowStrategy, Map<String, String> params) {
- DependencyTypes dependencyTypes = DependencyTypes.findByString(dependencyType);
- if(dependencyTypes == null){
- throw new RuntimeException("Dependency type from the input : " + dependencyType +" is invalid.");
- }
- FlowStrategies flowStrategies = FlowStrategies.findByString(flowStrategy);
- if(flowStrategies == null){
- throw new RuntimeException("Flow Strategy from the input : " + flowStrategy +" is invalid.");
- }
- String vnfType = params.get(Constants.VNF_TYPE);
- if(vnfType ==null || vnfType.length() ==0){
- throw new RuntimeException("Vnf Type is not passed in the input");
- }
- String vnfVersion = params.get(Constants.VNF_VERION);
- if(vnfVersion == null || vnfVersion.length() ==0){
- throw new RuntimeException("Vnf Version not found");
- }
- }
-
- private void logContext(SvcLogicContext context) {
- for(String key:context.getAttributeKeySet()){
- logger.debug(key + " = " + context.getAttribute(key) + "\n" );
- }
- }
-
- private void populateContext(VnfcFlowModel flowModel, SvcLogicContext context) {
- int flowIndex=0;
- Iterator<List<Vnfc>> iterator = flowModel.getModelIterator();
- while (iterator.hasNext()){
- for(Vnfc vnfc:iterator.next()){
- context.setAttribute("vnfcFlow["+flowIndex+"].vnfcName",vnfc.getVnfcName());
- context.setAttribute("vnfcFlow["+flowIndex+"].vnfcType",vnfc.getVnfcType());
- context.setAttribute("vnfcFlow["+flowIndex+"].resilienceType",vnfc.getResilienceType());
- context.setAttribute("vnfcFlow["+flowIndex+"].vmCount",Integer.toString(vnfc.getVserverList().size()));
- int vmIndex =0;
- for(Vserver vm :vnfc.getVserverList()){
- context.setAttribute("vnfcFlow["+flowIndex+"].vm["+vmIndex+"].url",vm.getUrl());
- vmIndex++;
- }
- flowIndex++;
- }
- }
- context.setAttribute("vnfcFlowCount",Integer.toString(flowIndex));
- }
-
- private InventoryModel readInventoryModel(SvcLogicContext context) {
- String vnfId = context.getAttribute("input.action-identifiers.vnf-id");
- String vnfType = context.getAttribute("vnf.type");
- String vnfVersion = context.getAttribute("vnf.version");
- String vnfcCountStr = context.getAttribute("vnf.vnfcCount");
- Integer vnfcCount = Integer.parseInt(vnfcCountStr);
-
- Vnf vnf = new Vnf(vnfId,vnfType,vnfVersion);
-
- for(Integer i=0;i<vnfcCount;i++){
- String vnfcName = context.getAttribute("vnf.vnfc["+ i+"].name");
- String vnfcType = context.getAttribute("vnf.vnfc["+ i+"].type");
- String vmCountStr = context.getAttribute("vnf.vnfc["+ i+"].vm_count");
- if(vnfcType ==null || vnfcType.length() ==0){
- throw new RuntimeException("Could not retrieve VNFC Type from DG Context for vnf.vnfc["+ i+"].type");
- }
- Integer vmCount = Integer.parseInt(vmCountStr);
- Vnfc vnfc = new Vnfc(vnfcType,null,vnfcName);
- for(Integer j=0;j<vmCount;j++){
- String vmURL = context.getAttribute("vnf.vnfc["+i+"].vm["+j+"].url");
- Vserver vm = new Vserver(vmURL);
- vnfc.addVm(vm);
- }
- vnf.addVnfc(vnfc);
- }
- return new InventoryModel(vnf);
- }
-
- private DependencyModelIdentifier readDependencyModelIdentifier(Map<String, String> params) {
- String vnfType = params.get(Constants.VNF_TYPE);
- String catalogVersion = params.get(Constants.VNF_VERION);
- return new DependencyModelIdentifier(vnfType,catalogVersion);
- }
-
- private void validateInventoryModelWithDependencyModel(VnfcDependencyModel dependencyModel, InventoryModel inventoryModel) {
- Set<String> dependencyModelVnfcSet = new HashSet<String>();
- Set<String> dependencyModelMandatoryVnfcSet = new HashSet<String>();
- Set<String> inventoryModelVnfcsSet = new HashSet<String>();
-
- for (Node<Vnfc> node : dependencyModel.getDependencies()) {
- dependencyModelVnfcSet.add(node.getChild().getVnfcType().toLowerCase());
- if (node.getChild().isMandatory()) {
- dependencyModelMandatoryVnfcSet.add(node.getChild().getVnfcType().toLowerCase());
- }
- }
-
- for (Vnfc vnfc : inventoryModel.getVnf().getVnfcs()) {
- inventoryModelVnfcsSet.add(vnfc.getVnfcType().toLowerCase());
- }
-
- // if dependency model and inventory model contains same set of VNFCs, validation succeed and hence return
- if (dependencyModelVnfcSet.equals(inventoryModelVnfcsSet)) {
- return;
- }
-
- if (inventoryModelVnfcsSet.size() >= dependencyModelVnfcSet.size()) {
- Set<String> difference = new HashSet<String>(inventoryModelVnfcsSet);
- difference.removeAll(dependencyModelVnfcSet);
- logger.error("Dependency model is missing following vnfc type(s): " + difference);
- throw new RuntimeException("Dependency model is missing following vnfc type(s): " + difference);
- } else {
- Set<String> difference = new HashSet<String>(dependencyModelVnfcSet);
- difference.removeAll(inventoryModelVnfcsSet);
- difference.retainAll(dependencyModelMandatoryVnfcSet);
- if (difference.size() > 0) {
- logger.error("Inventory model is missing following mandatory vnfc type(s): " + difference);
- throw new RuntimeException("Inventory model is missing following mandatory vnfc type(s): " + difference);
- }
- }
- }
-
- private void reconcileFlowModel(VnfcFlowModel flowModel) {
- Iterator<List<Vnfc>> flowIterator = flowModel.getModelIterator();
- while (flowIterator.hasNext()) {
- Iterator<Vnfc> vnfcIterator = flowIterator.next().iterator();
- while (vnfcIterator.hasNext()) {
- Vnfc vnfc = vnfcIterator.next();
- if (vnfc.getVserverList().size() == 0) {
- if (logger.isDebugEnabled()) {
- logger.debug("No vservers present for Vnfc type: " + vnfc.getVnfcType() + ". Hence, removing it from the flow model.");
- }
- vnfcIterator.remove();
- }
- }
- }
- }
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/objects/ConnectionDetails.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/objects/ConnectionDetails.java
deleted file mode 100644
index 1572e726b..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/objects/ConnectionDetails.java
+++ /dev/null
@@ -1,68 +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.onap.appc.dg.common.objects;
-
-
-
-public class ConnectionDetails {
-
- private String host;
- private int port;
- private String username;
- private String password;
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public int getPort() {
- return port;
- }
-
- public void setPort(int port) {
- this.port = port;
- }
-
- public String getUsername() {
- return username;
- }
-
- public void setUsername(String username) {
- this.username = username;
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- this.password = password;
- }
-
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/utils/JAXBUtil.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/utils/JAXBUtil.java
deleted file mode 100644
index 38012b1bd..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/utils/JAXBUtil.java
+++ /dev/null
@@ -1,53 +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.onap.appc.dg.common.utils;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-import javax.xml.bind.Unmarshaller;
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-
-
-
-public class JAXBUtil {
-
- public static <T> T toObject(String xml, Class<T> type) throws JAXBException {
-
- //create JAXB context
- JAXBContext context = JAXBContext.newInstance(type);
-
- //Create Unmarshaller using JAXB context
- Unmarshaller unmarshaller = context.createUnmarshaller();
-
- InputStream xmlInputStream = new ByteArrayInputStream(xml.getBytes());
- BufferedReader reader = new BufferedReader(new InputStreamReader(xmlInputStream));
-
- return type.cast(unmarshaller.unmarshal(reader));
-
- }
-}
diff --git a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/utils/JSONUtil.java b/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/utils/JSONUtil.java
deleted file mode 100644
index 388295a7d..000000000
--- a/appc-dg/appc-dg-shared/appc-dg-common/src/main/java/org/openecomp/appc/dg/common/utils/JSONUtil.java
+++ /dev/null
@@ -1,83 +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.onap.appc.dg.common.utils;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.util.*;
-
-
-public class JSONUtil {
-
- private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
-
- public static <T> T fromJson(String json, Class<T> clazz) {
-
- try {
- return OBJECT_MAPPER.readValue(json, clazz);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static <T> T fromJson(Reader reader, Class<T> clazz) {
-
- try {
- return OBJECT_MAPPER.readValue(reader, clazz);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static String toJson(Object object) {
-
- try {
- return OBJECT_MAPPER.writeValueAsString(object);
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- }
-
- public static Map<String,String> extractPlainValues(String json, String ... names) {
- if (null == names) return Collections.emptyMap();
- Map<String,String> values = new HashMap<>();
- try {
- final JsonNode jsonNode = OBJECT_MAPPER.readTree(json);
- for (String name : names) {
- values.put(name, jsonNode.path(name).asText());
- }
- } catch (IOException e) {
- throw new RuntimeException(e);
- }
- return values;
- }
-
-
-
-
-}