From cea67fafd905f169b8db5c4be0b47959b66c32e3 Mon Sep 17 00:00:00 2001 From: "Keighron, Lori (lk2924)" Date: Mon, 25 Nov 2019 14:17:57 -0500 Subject: Add new LCM actions GetConfig, StartTraffic, StopTraffic, etc New LCM actions Change-Id: Ic59607f2a7fc515bdd01be162018aaf695668f82 Issue-ID: APPC-1790 Signed-off-by: Keighron, Lori (lk2924) --- .../artifact/handler/node/ArtifactHandlerNode.java | 26 ++++++++++++++++++---- .../handler/node/ArtifactHandlerNodeTest.java | 2 ++ 2 files changed, 24 insertions(+), 4 deletions(-) (limited to 'appc-inbound/appc-artifact-handler') diff --git a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNode.java b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNode.java index d0b8a834c..b6fd2f599 100644 --- a/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNode.java +++ b/appc-inbound/appc-artifact-handler/provider/src/main/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNode.java @@ -119,7 +119,14 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin { private static final String CONFIGURE_PARAM = "Configure"; private static final String CONFIG_SCALE_OUT_PARAM = "ConfigScaleOut"; private static final String CONFIG_MODIFY_PARAM = "ConfigModify"; - + private static final String GET_CONFIG = "GetConfig"; + private static final String POST_EVACUATE= "PostEvacuate"; + private static final String PRE_EVACUATE = "PreEvacuate"; + private static final String POST_MIGRATE = "PostMigrate"; + private static final String PRE_MIGRATE = "PreMigrate"; + private static final String PRE_REBUILD = "PreRebuild"; + private static final String POST_REBUILD = "PostRebuild"; + private static final String STOP_TRAFFIC = "StopTraffic"; public void processArtifact(Map inParams, SvcLogicContext ctx) throws ArtifactProcessorException { if (inParams == null || inParams.isEmpty()) { @@ -155,6 +162,7 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin { } updateStoreArtifacts(requestInfo, documentInfo); + if (artifactName.toLowerCase().startsWith(REFERENCE)) { return storeReferenceData(requestInfo, documentInfo); } else if (artifactName.toLowerCase().startsWith(PD)) { @@ -172,6 +180,7 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin { } public void validateAnsibleAdminArtifact(JSONObject documentInfo) throws ArtifactHandlerInternalException { + String fn = "ArtifactHandlerNode.validateAnsibleAdminArtifact"; String artifactName = documentInfo.getString(ARTIFACT_NAME); log.info(fn + ": Received Admin File Name: " + artifactName + " ArtifactCotent : " @@ -598,7 +607,16 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin { public void processConfigTypeActions(JSONObject content, DBService dbservice, SvcLogicContext context) throws ArtifactHandlerInternalException { try { - if (isContentActionConfig(content)) { + if (isContentActionConfig(content) + || contentsActionEquals(content, GET_CONFIG) + || contentsActionEquals(content, POST_EVACUATE) + || contentsActionEquals(content, PRE_EVACUATE) + || contentsActionEquals(content, POST_MIGRATE) + || contentsActionEquals(content, PRE_MIGRATE) + || contentsActionEquals(content, POST_REBUILD) + || contentsActionEquals(content, PRE_REBUILD) + || contentsActionEquals(content, STOP_TRAFFIC) + ) { if (content.has(DOWNLOAD_DG_REFERENCE) && content.getString(DOWNLOAD_DG_REFERENCE).length() > 0) { @@ -763,7 +781,7 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin { private void populateProtocolReference(DBService dbservice, JSONObject content) throws ArtifactHandlerInternalException { - log.info("Begin-->populateProtocolReference "); + log.info("Begin-->populateProtocolReference"); try { SvcLogicContext context = new SvcLogicContext(); JSONObject scope = content.getJSONObject("scope"); @@ -784,7 +802,7 @@ public class ArtifactHandlerNode implements SvcLogicJavaPlugin { log.error("Error inserting record into protocolReference", e); throw new ArtifactHandlerInternalException("Error inserting record into protocolReference", e); } finally { - log.info("End-->populateProtocolReference "); + log.info("End-->populateProtocolReference"); } } diff --git a/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNodeTest.java b/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNodeTest.java index 7adee0da9..cb3a4625d 100644 --- a/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNodeTest.java +++ b/appc-inbound/appc-artifact-handler/provider/src/test/java/org/onap/appc/artifact/handler/node/ArtifactHandlerNodeTest.java @@ -97,6 +97,7 @@ public class ArtifactHandlerNodeTest { JSONObject documentInfo = getDocumentInfo("templates/reference_template"); documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, "reference_Junit.json"); requestInfo.put("RequestInfo", "testValue"); + requestInfo.put("request-id","testREQUEST_ID"); input.put(SdcArtifactHandlerConstants.DOCUMENT_PARAMETERS, documentInfo); input.put(SdcArtifactHandlerConstants.REQUEST_INFORMATION, requestInfo); postData.put("input", input); @@ -273,6 +274,7 @@ public class ArtifactHandlerNodeTest { JSONObject documentInfo = getDocumentInfo("templates/pd_template"); documentInfo.put(SdcArtifactHandlerConstants.ARTIFACT_NAME, "pd_Junit.json"); requestInfo.put("RequestInfo", "testValue"); + requestInfo.put("request-id","testREQUEST_ID"); input.put(SdcArtifactHandlerConstants.DOCUMENT_PARAMETERS, documentInfo); input.put(SdcArtifactHandlerConstants.REQUEST_INFORMATION, requestInfo); postData.put("input", input); -- cgit 1.2.3-korg