aboutsummaryrefslogtreecommitdiffstats
path: root/src/test
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2020-02-13 05:49:21 -0800
committersebdet <sebastien.determe@intl.att.com>2020-02-14 05:11:42 -0800
commit29e3cd1afbd3202a0c16ef6a4057662942ddefa2 (patch)
treeb7811512dc4f7c08f7f2695868e3be66e57572a3 /src/test
parent728ad5ce6d3b5e3d973b6349469f96d6c3600fef (diff)
Add tests
Add tests for https and aaf Issue-ID: CLAMP-624 Signed-off-by: sebdet <sebastien.determe@intl.att.com> Change-Id: Ia78ed8da7e54eaeaaed4fb87f483e0aff3a4a8c5
Diffstat (limited to 'src/test')
-rw-r--r--src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java10
-rw-r--r--src/test/java/org/onap/clamp/util/PassDecoderTest.java4
-rw-r--r--src/test/resources/clds/aaf/org.onap.clamp.keyfile27
-rw-r--r--src/test/resources/clds/camel/rest/clamp-api-v2.xml659
-rw-r--r--src/test/resources/clds/camel/rest/clds-services.xml29
-rw-r--r--src/test/resources/clds/camel/routes/dcae-flows.xml466
-rw-r--r--src/test/resources/clds/camel/routes/loop-flows.xml268
-rw-r--r--src/test/resources/clds/camel/routes/policy-flows.xml587
-rw-r--r--src/test/resources/clds/camel/routes/utils-flows.xml28
-rw-r--r--src/test/resources/https/https-test.properties51
10 files changed, 54 insertions, 2075 deletions
diff --git a/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java b/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java
index 912e0d604..7762111b0 100644
--- a/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java
+++ b/src/test/java/org/onap/clamp/policy/downloader/PolicyEngineControllerTestItCase.java
@@ -27,6 +27,7 @@ import static org.assertj.core.api.Assertions.assertThat;
import com.google.gson.JsonSyntaxException;
import java.io.IOException;
+import java.time.Instant;
import java.util.List;
import javax.transaction.Transactional;
@@ -56,10 +57,19 @@ public class PolicyEngineControllerTestItCase {
@Transactional
public void synchronizeAllPoliciesTest() throws JsonSyntaxException, IOException, InterruptedException {
policyController.synchronizeAllPolicies();
+ Instant firstExecution = policyController.getLastInstantExecuted();
+ assertThat (firstExecution).isNotNull();
List<PolicyModel> policyModelsList = policyModelsRepository.findAll();
assertThat(policyModelsList.size()).isGreaterThanOrEqualTo(8);
assertThat(policyModelsList).contains(new PolicyModel("onap.policies.Monitoring", null, "1.0.0"));
assertThat(policyModelsList).contains(new PolicyModel("onap.policies.controlloop.Operational", null, "1.0.0"));
+
+ // Re-do it to check that there is no issue with duplicate key
+ policyController.synchronizeAllPolicies();
+ Instant secondExecution = policyController.getLastInstantExecuted();
+ assertThat (secondExecution).isNotNull();
+
+ assertThat(firstExecution).isBefore(secondExecution);
}
}
diff --git a/src/test/java/org/onap/clamp/util/PassDecoderTest.java b/src/test/java/org/onap/clamp/util/PassDecoderTest.java
index 56443e31d..e5de8b0a8 100644
--- a/src/test/java/org/onap/clamp/util/PassDecoderTest.java
+++ b/src/test/java/org/onap/clamp/util/PassDecoderTest.java
@@ -40,13 +40,13 @@ public class PassDecoderTest {
@Test
public final void testDecryptionNoPassword() throws Exception {
- String decodedPass = PassDecoder.decode(null, "src/test/resources/clds/aaf/org.onap.clamp.keyfile");
+ String decodedPass = PassDecoder.decode(null, "classpath:clds/aaf/org.onap.clamp.keyfile");
assertNull(decodedPass);
}
@Test
public final void testDecryption() throws Exception {
- String decodedPass = PassDecoder.decode(encrypted, "src/test/resources/clds/aaf/org.onap.clamp.keyfile");
+ String decodedPass = PassDecoder.decode(encrypted, "classpath:clds/aaf/org.onap.clamp.keyfile");
assertEquals(decodedPass, "China in the Spring");
}
}
diff --git a/src/test/resources/clds/aaf/org.onap.clamp.keyfile b/src/test/resources/clds/aaf/org.onap.clamp.keyfile
deleted file mode 100644
index c2521fc81..000000000
--- a/src/test/resources/clds/aaf/org.onap.clamp.keyfile
+++ /dev/null
@@ -1,27 +0,0 @@
-kzJMxgphAoBxJz1_vYjxx-V87fahDQdYUqBIyWhZp8ojXdNpmB-96T9CvgJScJynbLcqw2Cj2CYx
-wd97vFOYhlyz5zK3tSyIuydOkVGJsJ1S4PviTtjhiJvNourJNDHgtas1Y1y2fQ5_8aVxj-s4W72N
-MNYhkeTinaQx_d_5hkBPABJlgCxKLnmxHo2jAJktnZYa5t5h48m7KiUx_RVEkQVtEvux-7vgXaC4
-ymTXj6zI9XoMTVxM0OAl4y7kBiUoOUaxS4tVKV34RJYNNqBjiUTQa_ag-KeUacRABk1ozfwzpvE5
-Sjz8WCy0L-LtCQnapkhKLt04ndCZtw8LDJ-Zz0ZgR2PVIPpTgs9VnVuOi5jf4LzTrtUatvOWkKB9
-drXKzp6cNXnZ0jkD3vV1BzqzhynKnZR2o_ilZv5CTTdpGUt906N_DwZuX6LfcV_7yvjX42bTfeIR
-ycPtodFPXlqqn9VUyh5nOauJlnOHAQmSDzjMEgjy17nQX3Ad7s4BfvujzUl-d0MqB_HCKbaW32UT
-xcY-0JfI1Y-2IdYfIkUdhVmxop6sSg0jAobWzgCRoRQkP3a2iIlKdfMyskshoWKIDVtlr-3fkDEb
-x_b_o1rRoUfzUzxEdphaUAq80Sc0i77ZLT3KF9vJOhyU_pBnApYFxVk7Hkk3VRxJKS7jyL4H7k1x
-2m5-2G8fB9XbYZT82xmAquNx4oBdpwj3_ncGF9YRF94K6NZgqemT5iWhpXMoelSU1blASgT3qlTm
-B6YgbD5owExNHwRVd8KeRsYrOnBWUiktsIhXFhNZmDUNWMFGQ2KxEcOt1tJwsQDehJFgY_l1JQ0d
-643wJ7rTJkGkYX309cydRQUX4Z0ckSQS9LhMd9stxF5XOHlvHdbW0pXNS7SaLbzKCVldUgncvI6z
-KWkwrWbftrZK2RT1UZKNngQDMGOk9OhbHAs7YzhFNFARZoRNobIv5tZVDomy-YgJb9-mD1UTkRBL
-WXOyoryDlgKrgFsgHclGDI1UFO5N-JfebPKxbP505f4924hxF2r8bspvVW8ZtHQo_SJmhauOX8n_
-eN_LK43LB9k53WAHZ_utvs0s6wGf7I73oj_N7DIFaHTDSm_MhDsFDLVG_wUzCpZ5FP2uL3nnqMkF
-Ob-l1fywfmfOmrz1BY6g4sRPPeWXuclYTnRnDRu5VQyc7_aBEVkyt3zw0JEex0vJNFUJl3pYjS55
-GplAB6p7VbS9ceZEtc5Z3qFIVHEzKWZxT190E23t_LlMuEoQ1zaqdHynNaMs61-q_A2aHRiTqlRm
-7FahVB3RX4AVLl23mu4u3A9ZDXc40nzjs9mwOVsuKlPvQ2rteDUG1njr2R1_V_MyQuoJjdfbIkPG
-4eF0QzlSMdbkeprdQxSfV5YT-yPpkBxSsCMMM43sKm4Hy7_CUdvp4Iayrp3vtK3oYMuCGi6qTadz
-KzxfTf8meKan3eMZW4RLByyniH5nQnX_KGfBly05AmFyVH_j0fyOg-48kDhtEKeqmDnP4C01jOID
-Ip_AKaB6e0GwsHzVTLZOklHwu_qzsaTzchBOG_dJJju7bxY7qv78Pa92wZIP311gSCVbc-gxxbsR
-qI555twmYEoasFm4xz10OYDOkvM1E1Rtxu3ymRLZpe6AoyFBVzEW7Dncdw7O98dKcgrp8ZlQ_8Wg
-5zZH0Cic7xnIZ0bNZyQXw56CSUiXVWuwVY3e0djXP3F-FO5gP8VTxbpW4C0t6McXAOlvSEfFKxN7
-u6OBeOKwjrtHaJk2ghF8MUcpDXanhbAgHez9larGlscCkgvoRLNaRH9GIdSVgY3HtNhJRaJIq01S
-OGeBjC5J4o-nTrqRFkwyDAYcPL373eYX1dBFFVHR-4q50H9m_zMxZHXETafxzV4DT3Qi8Sxh3uaS
-ZX7mRaNaOE0uC1n87_IZ9WhrwIQaZng2lnd9yZ-4rx8fB8WA8KQzifzvHAcMb_HV10JWGaz5A2Rm
-EXDsfexQC6CqYg5rdzzlNWDPNlHy5ubyz7fRXZ99uIwBY9aJcvCXCiEXJkC6utj3NcXQrJmk \ No newline at end of file
diff --git a/src/test/resources/clds/camel/rest/clamp-api-v2.xml b/src/test/resources/clds/camel/rest/clamp-api-v2.xml
deleted file mode 100644
index a0a3eb104..000000000
--- a/src/test/resources/clds/camel/rest/clamp-api-v2.xml
+++ /dev/null
@@ -1,659 +0,0 @@
-<rests xmlns="http://camel.apache.org/schema/spring">
- <rest>
- <get
- uri="/v2/loop/getAllNames"
- outType="java.lang.String[]"
- produces="application/json">
- <route>
- <removeHeaders pattern="*" />
- <doTry>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Loop')" />
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=getLoopNames()" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
- </doCatch>
- </doTry>
- </route>
- </get>
- <get
- uri="/v2/loop/{loopName}"
- outType="org.onap.clamp.loop.Loop"
- produces="application/json">
- <route>
- <removeHeaders
- pattern="*"
- excludePattern="loopName" />
- <doTry>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET Loop')" />
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
- </doCatch>
- </doTry>
- </route>
- </get>
- <get
- uri="/v2/loop/svgRepresentation/{loopName}"
- outType="java.lang.String"
- produces="application/xml">
- <route>
- <removeHeaders
- pattern="*"
- excludePattern="loopName" />
- <doTry>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Get SVG Representation')" />
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=getSvgRepresentation(${header.loopName})" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
- </doCatch>
- </doTry>
- </route>
- </get>
-
- <post
- uri="/v2/loop/updateGlobalProperties/{loopName}"
- type="com.google.gson.JsonObject"
- consumes="application/json"
- outType="org.onap.clamp.loop.Loop"
- produces="application/json">
- <route>
- <removeHeaders
- pattern="*"
- excludePattern="loopName" />
- <doTry>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Update the global properties')" />
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <setHeader headerName="GlobalPropertiesJson">
- <simple>${body}</simple>
- </setHeader>
- <to uri="direct:load-loop" />
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=updateGlobalPropertiesJson(${header.loopName},${header.GlobalPropertiesJson})" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Global Properties UPDATED','INFO',${exchangeProperty[loopObject]})" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
- </doCatch>
- </doTry>
- </route>
- </post>
- <post
- uri="/v2/loop/updateOperationalPolicies/{loopName}"
- type="com.google.gson.JsonArray"
- consumes="application/json"
- outType="org.onap.clamp.loop.Loop"
- produces="application/json">
- <route>
- <removeHeaders
- pattern="*"
- excludePattern="loopName" />
- <doTry>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Update operational policies')" />
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <setHeader headerName="OperationalPoliciesArray">
- <simple>${body}</simple>
- </setHeader>
- <to uri="direct:load-loop" />
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=updateOperationalPolicies(${header.loopName},${header.OperationalPoliciesArray})" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Operational and Guard policies UPDATED','INFO',${exchangeProperty[loopObject]})" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
- </doCatch>
- </doTry>
- </route>
- </post>
- <post
- uri="/v2/loop/updateMicroservicePolicy/{loopName}"
- type="org.onap.clamp.policy.microservice.MicroServicePolicy"
- consumes="application/json"
- outType="org.onap.clamp.policy.microservice.MicroServicePolicy"
- produces="application/json">
- <route>
- <removeHeaders
- pattern="*"
- excludePattern="loopName" />
- <doTry>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Update Microservice policies')" />
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <setProperty propertyName="MicroServicePolicyObject">
- <simple>${body}</simple>
- </setProperty>
-
- <to uri="direct:load-loop" />
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=updateMicroservicePolicy(${header.loopName},${exchangeProperty[MicroServicePolicyObject]})" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Micro Service policies UPDATED','INFO',${exchangeProperty[loopObject]})" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
- </doCatch>
- </doTry>
- </route>
- </post>
- <put
- uri="/v2/loop/deploy/{loopName}"
- outType="org.onap.clamp.loop.Loop"
- produces="application/json">
- <route>
- <removeHeaders
- pattern="*"
- excludePattern="loopName" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="DCAE DEPLOY request for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'DCAE DEPLOY request')" />
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to uri="direct:load-loop" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DCAE DEPLOY request','INFO',${exchangeProperty[loopObject]})" />
-
- <to uri="direct:deploy-loop" />
-
- <log
- loggingLevel="INFO"
- message="DEPLOY request successfully executed for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DEPLOY request successfully executed','INFO',${exchangeProperty[loopObject]})" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
- <log
- loggingLevel="ERROR"
- message="DEPLOY request failed for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DEPLOY request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" />
- </doCatch>
- </doTry>
- </route>
- </put>
- <put
- uri="/v2/loop/refreshOpPolicyJsonSchema/{loopName}"
- outType="org.onap.clamp.loop.Loop"
- produces="application/json">
- <route>
- <removeHeaders
- pattern="*"
- excludePattern="loopName" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="Refresh Operational Policy UI for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'REFRESH OP Policy UI request')" />
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to uri="direct:load-loop" />
- <to
- uri="bean:org.onap.clamp.loop.LoopController?method=refreshOpPolicyJsonRepresentation(${header.loopName})" />
- <log
- loggingLevel="INFO"
- message="REFRESH request successfully executed for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('REFRESH request successfully executed','INFO',${exchangeProperty[loopObject]})" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
- <log
- loggingLevel="ERROR"
- message="REFRESH request failed for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('REFRESH request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" />
- </doCatch>
- </doTry>
- </route>
- </put>
- <put
- uri="/v2/loop/undeploy/{loopName}"
- outType="org.onap.clamp.loop.Loop"
- produces="application/json">
- <route>
- <removeHeaders
- pattern="*"
- excludePattern="loopName" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="DCAE UNDEPLOY request for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'DCAE UNDEPLOY request')" />
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to uri="direct:load-loop" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DCAE UNDEPLOY request','INFO',${exchangeProperty[loopObject]})" />
- <to uri="direct:undeploy-loop" />
-
- <log
- loggingLevel="INFO"
- message="UNDEPLOY request successfully executed for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('UNDEPLOY request successfully executed','INFO',${exchangeProperty[loopObject]})" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
- <log
- loggingLevel="ERROR"
- message="UNDEPLOY request failed for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('UNDEPLOY request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" />
- </doCatch>
- </doTry>
- </route>
- </put>
- <put
- uri="/v2/loop/stop/{loopName}"
- outType="org.onap.clamp.loop.Loop"
- produces="application/json">
- <route>
- <removeHeaders
- pattern="*"
- excludePattern="loopName" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="STOP request for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*,'STOP request')" />
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to uri="direct:load-loop" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('STOP request','INFO',${exchangeProperty[loopObject]})" />
-
- <to uri="direct:remove-all-policy-from-active-pdp-group" />
- <log
- loggingLevel="INFO"
- message="STOP request successfully executed for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('STOP request successfully executed','INFO',${exchangeProperty[loopObject]})" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
- <log
- loggingLevel="ERROR"
- message="STOP request failed for loop: $${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('STOP request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" />
- </doCatch>
- </doTry>
- </route>
- </put>
- <put
- uri="/v2/loop/restart/{loopName}"
- outType="org.onap.clamp.loop.Loop"
- produces="application/json">
- <route>
- <removeHeaders
- pattern="*"
- excludePattern="loopName" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="RESTART request for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*,'RESTART request')" />
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to uri="direct:load-loop" />
-
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('RESTART request','INFO',${exchangeProperty[loopObject]})" />
-
- <to uri="direct:add-all-to-active-pdp-group" />
- <log
- loggingLevel="INFO"
- message="RESTART request successfully executed for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('RESTART request successfully executed','INFO',${exchangeProperty[loopObject]})" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
- <log
- loggingLevel="ERROR"
- message="RESTART request failed for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('RESTART request failed, Error reported: ${exception} - Body: ${exception.responseBody}','INFO',${exchangeProperty[loopObject]})" />
- </doCatch>
- </doTry>
- </route>
- </put>
- <put
- uri="/v2/loop/submit/{loopName}"
- outType="org.onap.clamp.loop.Loop"
- produces="application/json">
- <route>
- <removeHeaders
- pattern="*"
- excludePattern="loopName" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="POLICY SUBMIT request for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'POLICY SUBMIT request')" />
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to uri="direct:load-loop" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('POLICY SUBMIT request','INFO',${exchangeProperty[loopObject]})" />
- <setProperty propertyName="raiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <to uri="direct:remove-all-policy-from-active-pdp-group" />
- <log
- loggingLevel="INFO"
- message="Processing all MICRO-SERVICES policies defined in loop ${exchangeProperty[loopObject].getName()}" />
- <split>
- <simple>${exchangeProperty[loopObject].getMicroServicePolicies()}
- </simple>
- <setProperty propertyName="microServicePolicy">
- <simple>${body}</simple>
- </setProperty>
- <log
- loggingLevel="INFO"
- message="Processing Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" />
- <setProperty propertyName="raiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <to uri="direct:delete-micro-service-policy" />
- <to uri="direct:create-micro-service-policy" />
- </split>
- <log
- loggingLevel="INFO"
- message="Processing all OPERATIONAL policies defined in loop ${exchangeProperty[loopObject].getName()}" />
- <split>
- <simple>${exchangeProperty[loopObject].getOperationalPolicies()}
- </simple>
- <setProperty propertyName="operationalPolicy">
- <simple>${body}</simple>
- </setProperty>
- <log
- loggingLevel="INFO"
- message="Processing Operational Policy: ${exchangeProperty[operationalPolicy].getName()}" />
- <setProperty propertyName="raiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
-
- <to uri="direct:delete-operational-policy" />
- <to uri="direct:create-operational-policy" />
-
- <log
- loggingLevel="INFO"
- message="Processing all GUARD policies defined in loop ${exchangeProperty[loopObject].getName()}" />
- <split>
- <simple>${exchangeProperty[operationalPolicy].createGuardPolicyPayloads().entrySet()}
- </simple>
- <setProperty propertyName="guardPolicy">
- <simple>${body}</simple>
- </setProperty>
- <log
- loggingLevel="INFO"
- message="Processing Guard Policy: ${exchangeProperty[guardPolicy].getKey()}" />
-
- <setProperty propertyName="raiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <to uri="direct:delete-guard-policy" />
- <to uri="direct:create-guard-policy" />
- </split>
- </split>
-
- <delay>
- <constant>3000</constant>
- </delay>
-
- <to uri="direct:add-all-to-active-pdp-group" />
-
- <log
- loggingLevel="INFO"
- message="SUBMIT request successfully executed for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('SUBMIT request successfully executed','INFO',${exchangeProperty[loopObject]})" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
- <log
- loggingLevel="ERROR"
- message="SUBMIT request failed for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('SUBMIT request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" />
- </doCatch>
- </doTry>
- </route>
- </put>
- <put uri="/v2/loop/delete/{loopName}">
- <route>
- <removeHeaders
- pattern="*"
- excludePattern="loopName" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="DELETE request for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*,'DELETE request')" />
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
- <to uri="direct:load-loop" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DELETE request','INFO',${exchangeProperty[loopObject]})" />
- <to uri="direct:undeploy-loop" />
- <to uri="direct:remove-all-policy-from-active-pdp-group" />
- <split>
- <simple>${exchangeProperty[loopObject].getMicroServicePolicies()}
- </simple>
- <setProperty propertyName="microServicePolicy">
- <simple>${body}</simple>
- </setProperty>
- <log
- loggingLevel="INFO"
- message="Processing Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" />
- <to uri="direct:delete-micro-service-policy" />
- </split>
-
- <log
- loggingLevel="INFO"
- message="Processing all OPERATIONAL policies defined in loop ${exchangeProperty[loopObject].getName()}" />
- <split>
- <simple>${exchangeProperty[loopObject].getOperationalPolicies()}
- </simple>
- <setProperty propertyName="operationalPolicy">
- <simple>${body}</simple>
- </setProperty>
- <log
- loggingLevel="INFO"
- message="Processing Operational Policy: ${exchangeProperty[operationalPolicy].getName()}" />
- <to uri="direct:delete-operational-policy" />
- <log
- loggingLevel="INFO"
- message="Processing all GUARD policies defined in loop ${exchangeProperty[loopObject].getName()}" />
- <split>
- <simple>${exchangeProperty[operationalPolicy].createGuardPolicyPayloads().entrySet()}
- </simple>
- <setProperty propertyName="guardPolicy">
- <simple>${body}</simple>
- </setProperty>
- <log
- loggingLevel="INFO"
- message="Processing Guard Policy: ${exchangeProperty[guardPolicy].getKey()}" />
- <to uri="direct:delete-guard-policy" />
- </split>
- </split>
- <to
- uri="bean:org.onap.clamp.loop.log.LoopService?method=deleteLoop(${header.loopName})" />
- <log
- loggingLevel="INFO"
- message="DELETE request successfully executed for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DELETE request successfully executed','INFO',${exchangeProperty[loopObject]})" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
- <log
- loggingLevel="ERROR"
- message="DELETE request failed for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DELETE request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" />
- </doCatch>
- </doTry>
- </route>
- </put>
- <get
- uri="/v2/loop/getstatus/{loopName}"
- outType="org.onap.clamp.loop.Loop"
- produces="application/json">
- <route>
- <removeHeaders
- pattern="*"
- excludePattern="loopName" />
- <doTry>
- <log
- loggingLevel="INFO"
- message="GET STATUS request for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET STATUS request')" />
- <to
- uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
- <to uri="direct:load-loop" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('GET STATUS request','INFO',${exchangeProperty[loopObject]})" />
- <doTry>
- <to uri="direct:update-policy-status-for-loop" />
- <to uri="direct:update-dcae-status-for-loop" />
- <to uri="direct:update-loop-state" />
-
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Get Status request successfully executed','INFO',${exchangeProperty[loopObject]})" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
- </doTry>
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
- <log
- loggingLevel="ERROR"
- message="Get Status request failed for loop: ${header.loopName}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Get Status request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" />
- </doCatch>
- <doFinally>
- <setBody>
- <simple>${exchangeProperty[loopObject]}</simple>
- </setBody>
- </doFinally>
- </doTry>
- </route>
- </get>
- </rest>
-</rests>
diff --git a/src/test/resources/clds/camel/rest/clds-services.xml b/src/test/resources/clds/camel/rest/clds-services.xml
deleted file mode 100644
index dd3a4bfdc..000000000
--- a/src/test/resources/clds/camel/rest/clds-services.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<rests xmlns="http://camel.apache.org/schema/spring">
- <rest>
- <get uri="/v1/clds/cldsInfo" outType="org.onap.clamp.clds.model.CldsInfo"
- produces="application/json">
- <to
- uri="bean:org.onap.clamp.clds.service.CldsService?method=getCldsInfo()" />
- </get>
- <get uri="/v1/healthcheck" produces="application/json"
- outType="org.onap.clamp.clds.model.CldsHealthCheck">
- <route>
- <setBody>
- <method ref="org.onap.clamp.clds.service.CldsHealthcheckService"
- method="gethealthcheck()" />
- </setBody>
- <when>
- <simple> ${body} == 'NOT-OK'</simple>
- <setHeader headerName="CamelHttpResponseCode">
- <constant>404</constant>
- </setHeader>
- <log loggingLevel="ERROR" message="HealthCheck failed" />
- </when>
- </route>
- </get>
-
- <get uri="/v1/user/getUser" produces="text/plain">
- <to uri="bean:org.onap.clamp.clds.service.UserService?method=getUser()" />
- </get>
- </rest>
-</rests>
diff --git a/src/test/resources/clds/camel/routes/dcae-flows.xml b/src/test/resources/clds/camel/routes/dcae-flows.xml
deleted file mode 100644
index f40207cc7..000000000
--- a/src/test/resources/clds/camel/routes/dcae-flows.xml
+++ /dev/null
@@ -1,466 +0,0 @@
-<routes xmlns="http://camel.apache.org/schema/spring">
- <route id="deploy-loop">
- <from uri="direct:deploy-loop" />
- <choice>
- <when>
- <simple>${exchangeProperty['loopObject'].getLoopTemplate().getUniqueBlueprint()} == true
- </simple>
- <to uri="direct:deploy-loop-single-blueprint" />
- </when>
- <when>
- <simple>${exchangeProperty['loopObject'].getLoopTemplate().getUniqueBlueprint()} == false
- </simple>
- <to uri="direct:deploy-loop-multi-blueprint" />
- </when>
- </choice>
- </route>
- <route id="deploy-loop-multi-blueprint">
- <from uri="direct:deploy-loop-multi-blueprint" />
- <doTry>
- <log loggingLevel="INFO"
- message="Deploying the blueprints for loop: ${exchangeProperty[loopObject].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Deploying the loop with multiple blueprints')" />
- <split>
- <simple>${exchangeProperty[loopObject].getMicroServicePolicies()}
- </simple>
- <setProperty propertyName="microServicePolicy">
- <simple>${body}</simple>
- </setProperty>
- <log
- loggingLevel="INFO"
- message="Processing Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" />
- <setProperty propertyName="raiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <setBody>
- <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
- method="getDeployPayload(${exchangeProperty[loopObject]},${exchangeProperty[microServicePolicy]})" />
- </setBody>
- <setProperty propertyName="dcaeDeploymentId">
- <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
- method="generateDeploymentId()" />
- </setProperty>
- <setHeader headerName="CamelHttpMethod">
- <constant>PUT</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to deploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[dcaeDeploymentId]}"></log>
- <toD
- uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[dcaeDeploymentId]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=300000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <convertBodyTo type="java.lang.String" />
- <setProperty propertyName="dcaeResponse">
- <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
- method="convertDcaeResponse(${body})" />
- </setProperty>
- <setProperty propertyName="dcaeStatusUrl">
- <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
- method="getStatusUrl(${exchangeProperty[dcaeResponse]})" />
- </setProperty>
- <to
- uri="bean:org.onap.clamp.policy.microservice.MicroServicePolicyService?method=updateDcaeDeploymentFields(${exchangeProperty[microServicePolicy]},${exchangeProperty[dcaeDeploymentId]},${exchangeProperty[dcaeStatusUrl]})" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLogForComponent('Deploy for the micro service: ${exchangeProperty[microServicePolicy].getName()} - ${header.CamelHttpResponseCode} : ${header.CamelHttpResponseText}','INFO','DCAE',${exchangeProperty[loopObject]})" />
- </split>
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <setProperty propertyName="logMessage">
- <simple>DEPLOY micro service failed
- (MicroService name:${exchangeProperty[microServicePolicy].getName()}),
- Dep-id:${exchangeProperty[dcaeDeploymentId]},
- StatusUrl:${exchangeProperty[dcaeStatusUrl]})
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>DCAE</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doCatch>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doFinally>
- </doTry>
- </route>
- <route id="deploy-loop-single-blueprint">
- <from uri="direct:deploy-loop-single-blueprint" />
- <doTry>
- <log loggingLevel="INFO"
- message="Deploying the loop: ${exchangeProperty[loopObject].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Deploying the loop')" />
- <setBody>
- <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
- method="getDeployPayload(${exchangeProperty[loopObject]})" />
- </setBody>
- <setProperty propertyName="dcaeDeploymentId">
- <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
- method="generateDeploymentId()" />
- </setProperty>
- <setHeader headerName="CamelHttpMethod">
- <constant>PUT</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to deploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[dcaeDeploymentId]}"></log>
- <toD
- uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[dcaeDeploymentId]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=300000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <convertBodyTo type="java.lang.String" />
- <setProperty propertyName="dcaeResponse">
- <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
- method="convertDcaeResponse(${body})" />
- </setProperty>
-
-
- <setProperty propertyName="dcaeStatusUrl">
- <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
- method="getStatusUrl(${exchangeProperty[dcaeResponse]})" />
- </setProperty>
- <to
- uri="bean:org.onap.clamp.loop.LoopService?method=updateDcaeDeploymentFields(${exchangeProperty[loopObject]},${exchangeProperty[dcaeDeploymentId]},${exchangeProperty[dcaeStatusUrl]})" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>DEPLOY loop status
- (Dep-id:${exchangeProperty[dcaeDeploymentId]},
- StatusUrl:${exchangeProperty[dcaeStatusUrl]})
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>DCAE</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
- <route id="undeploy-loop">
- <from uri="direct:undeploy-loop" />
- <choice>
- <when>
- <simple>${exchangeProperty['loopObject'].getLoopTemplate().getUniqueBlueprint()} == true
- </simple>
- <to uri="direct:undeploy-loop-single-blueprint" />
- </when>
- <when>
- <simple>${exchangeProperty['loopObject'].getLoopTemplate().getUniqueBlueprint()} == false
- </simple>
- <to uri="direct:undeploy-loop-multi-blueprint" />
- </when>
- </choice>
- </route>
- <route id="undeploy-loop-multi-blueprint">
- <from uri="direct:undeploy-loop-multi-blueprint" />
- <doTry>
- <log loggingLevel="INFO"
- message="Undeploying the blueprints for loop: ${exchangeProperty[loopObject].getName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Undeploying the loop with multiple blueprints')" />
- <split>
- <simple>${exchangeProperty[loopObject].getMicroServicePolicies()}
- </simple>
- <setProperty propertyName="microServicePolicy">
- <simple>${body}</simple>
- </setProperty>
- <log
- loggingLevel="INFO"
- message="Processing Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" />
- <choice>
- <when>
- <simple>${exchangeProperty[microServicePolicy].getDcaeDeploymentId()} != null
- </simple>
- <setBody>
- <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
- method="getUndeployPayload(${exchangeProperty[microServicePolicy]})" />
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to undeploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[microServicePolicy].getDcaeDeploymentId()}"></log>
- <toD
- uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[microServicePolicy].getDcaeDeploymentId()}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=300000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <convertBodyTo type="java.lang.String" />
- <setProperty propertyName="dcaeResponse">
- <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
- method="convertDcaeResponse(${body})" />
- </setProperty>
- <setProperty propertyName="dcaeStatusUrl">
- <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
- method="getStatusUrl(${exchangeProperty[dcaeResponse]})" />
- </setProperty>
- <to
- uri="bean:org.onap.clamp.policy.microservice.MicroServicePolicyService?method=updateDcaeDeploymentFields(${exchangeProperty[microServicePolicy]},${exchangeProperty[microServicePolicy].getDcaeDeploymentId()},${exchangeProperty[dcaeStatusUrl]})" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLogForComponent('Undeploy for the micro service: ${exchangeProperty[microServicePolicy].getName()} - ${header.CamelHttpResponseCode} : ${header.CamelHttpResponseText}','INFO','DCAE',${exchangeProperty[loopObject]})" />
- </when>
- <otherwise>
- <log loggingLevel="WARNING"
- message="Cannot Undeploy for the micro service: ${exchangeProperty[microServicePolicy].getName()}, the Deployment ID does not exist !" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLogForComponent('Cannot Undeploy for the micro service: ${exchangeProperty[microServicePolicy].getName()}, the Deployment ID does not exist !','WARNING','DCAE',${exchangeProperty[loopObject]})" />
- </otherwise>
- </choice>
- </split>
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <setProperty propertyName="logMessage">
- <simple>UNDEPLOY micro service failed
- (MicroService name:${exchangeProperty[microServicePolicy].getName()})
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>DCAE</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doCatch>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doFinally>
- </doTry>
- </route>
- <route id="undeploy-loop-single-blueprint">
- <from uri="direct:undeploy-loop-single-blueprint" />
- <log loggingLevel="INFO"
- message="Undeploying the loop: ${exchangeProperty[loopObject].getName()} : ${exchangeProperty[loopObject].getDcaeDeploymentId()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Undeploying the loop')" />
- <choice>
- <when>
- <simple>${exchangeProperty[loopObject].getDcaeDeploymentId()}
- != null
- </simple>
- <doTry>
- <setBody>
- <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
- method="getUndeployPayload(${exchangeProperty[loopObject]})" />
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
-
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to undeploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}"></log>
- <toD
- uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=300000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <convertBodyTo type="java.lang.String" />
- <setProperty propertyName="dcaeResponse">
- <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
- method="convertDcaeResponse(${body})" />
- </setProperty>
- <setProperty propertyName="dcaeStatusUrl">
- <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
- method="getStatusUrl(${exchangeProperty[dcaeResponse]})" />
- </setProperty>
- <to
- uri="bean:org.onap.clamp.loop.LoopService?method=updateDcaeDeploymentFields(${exchangeProperty[loopObject]},${exchangeProperty[loopObject].getDcaeDeploymentId()},${exchangeProperty[dcaeStatusUrl]})" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>UNDEPLOY loop status</simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>DCAE</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </when>
- <otherwise>
- <log loggingLevel="WARNING"
- message="Cannot Undeploy for the loop: ${exchangeProperty[loopObject].getName()}, the Deployment ID does not exist !" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Cannot Undeploy for the loop: ${exchangeProperty[loopObject].getName()}, the Deployment ID does not exist !','WARNING',${exchangeProperty[loopObject]})" />
- </otherwise>
- </choice>
- </route>
- <route id="get-dcae-deployment-status">
- <from uri="direct:get-dcae-deployment-status" />
- <log loggingLevel="INFO"
- message="Getting DCAE deployment status for loop: ${exchangeProperty[loopObject].getName()} - ${exchangeProperty[dcaeComponent].getComponentName()}" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Getting Deployment status')" />
- <doTry>
- <setHeader headerName="CamelHttpMethod">
- <constant>GET</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to query Closed Loop status: ${exchangeProperty[getStatusUrl]}"></log>
- <toD
- uri="${exchangeProperty[getStatusUrl]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=30000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- <setProperty propertyName="logMessage">
- <simple>DCAE deployment status</simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>DCAE</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response" />
- </doFinally>
- </doTry>
- </route>
- <route id="get-dcae-blueprint-inventory">
- <from uri="direct:get-dcae-blueprint-inventory" />
- <log loggingLevel="INFO"
- message="Getting DCAE blueprint id in inventory" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Getting blueprint id in inventory')" />
- <doTry>
- <setHeader headerName="CamelHttpMethod">
- <constant>GET</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to query Dcae inventory Loop status: {{clamp.config.dcae.inventory.url}}/dcae-service-types?${header[CamelHttpQuery]}"></log>
- <toD
- uri="{{clamp.config.dcae.inventory.url}}/dcae-service-types?asdcResourceId=${exchangeProperty[blueprintResourceId]}&amp;asdcServiceId=${exchangeProperty[blueprintServiceId]}&amp;typeName=${exchangeProperty[blueprintName]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=30000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <convertBodyTo type="java.lang.String" />
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doFinally>
- </doTry>
-
- </route>
- <route id="get-all-dcae-blueprint-inventory">
- <from uri="direct:get-all-dcae-blueprint-inventory" />
- <log loggingLevel="INFO"
- message="Getting all DCAE blueprint from inventory" />
- <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Getting all blueprint from inventory')" />
- <doTry>
- <setHeader headerName="CamelHttpMethod">
- <constant>GET</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to query Blueprints from DCAE inventory: {{clamp.config.dcae.inventory.url}}/dcae-service-types?${header[CamelHttpQuery]}"></log>
- <toD uri="{{clamp.config.dcae.inventory.url}}/dcae-service-types;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=30000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
- <convertBodyTo type="java.lang.String" />
- <setProperty propertyName="dcaeResponseList">
- <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
- method="convertToDcaeInventoryResponse(${body})" />
- </setProperty>
- <split>
- <simple>${exchangeProperty[dcaeResponseList]}</simple>
- <convertBodyTo type="org.onap.clamp.clds.model.dcae.DcaeInventoryResponse" />
- <setProperty propertyName="dcaeResponse">
- <simple>${body}</simple>
- </setProperty>
- <to uri="bean:org.onap.clamp.clds.model.dcae.DcaeInventoryCache?method=addDcaeInventoryResponse(${exchangeProperty[dcaeResponse]})" />
- </split>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag" />
- <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
- </doFinally>
- </doTry>
- </route>
-</routes> \ No newline at end of file
diff --git a/src/test/resources/clds/camel/routes/loop-flows.xml b/src/test/resources/clds/camel/routes/loop-flows.xml
deleted file mode 100644
index c4e9fee6d..000000000
--- a/src/test/resources/clds/camel/routes/loop-flows.xml
+++ /dev/null
@@ -1,268 +0,0 @@
-<routes xmlns="http://camel.apache.org/schema/spring">
- <route id="load-loop">
- <from uri="direct:load-loop" />
- <setBody>
- <simple>${header.loopName}</simple>
- </setBody>
- <setProperty propertyName="loopObject">
- <method ref="org.onap.clamp.loop.LoopService" method="getLoop" />
- </setProperty>
-
- <when>
- <simple>${exchangeProperty[loopObject]} == null</simple>
- <setHeader headerName="CamelHttpResponseCode">
- <constant>404</constant>
- </setHeader>
- <log loggingLevel="WARN" message="Loop not found in database: ${body}" />
- <stop />
- </when>
- </route>
- <route id="update-policy-status-for-loop">
- <from uri="direct:update-policy-status-for-loop" />
- <setProperty propertyName="policyComponent">
- <simple>${exchangeProperty[loopObject].getComponent('POLICY')}
- </simple>
- </setProperty>
- <setProperty propertyName="policyFound">
- <simple resultType="java.lang.Boolean">true</simple>
- </setProperty>
- <setProperty propertyName="policyDeployed">
- <simple resultType="java.lang.Boolean">true</simple>
- </setProperty>
- <log loggingLevel="INFO"
- message="Processing all MICRO-SERVICES policies defined in loop ${exchangeProperty[loopObject].getName()}" />
- <split>
- <simple>${exchangeProperty[loopObject].getMicroServicePolicies()}
- </simple>
- <setProperty propertyName="policyName">
- <simple>${body.getName()}</simple>
- </setProperty>
- <setProperty propertyName="policyType">
- <simple>${body.getModelType()}</simple>
- </setProperty>
- <setProperty propertyName="policyVersion">
- <simple>1.0.0</simple>
- </setProperty>
- <setBody>
- <constant>null</constant>
- </setBody>
- <log loggingLevel="INFO"
- message="Processing Micro Service Policy: ${exchangeProperty[policyName]} of type ${exchangeProperty[policyType]}" />
- <to uri="direct:verify-one-policy" />
- </split>
- <log loggingLevel="INFO"
- message="Processing all OPERATIONAL policies defined in loop ${exchangeProperty[loopObject].getName()}" />
- <split>
- <simple>${exchangeProperty[loopObject].getOperationalPolicies()}
- </simple>
- <setProperty propertyName="policyName">
- <simple>${body.getName()}</simple>
- </setProperty>
- <setProperty propertyName="policyType">
- <simple>onap.policies.controlloop.Operational</simple>
- </setProperty>
- <setProperty propertyName="policyVersion">
- <simple>1</simple>
- </setProperty>
- <setProperty propertyName="operationalPolicy">
- <simple>${body}</simple>
- </setProperty>
- <setBody>
- <constant>null</constant>
- </setBody>
- <log loggingLevel="INFO"
- message="Processing Micro Service Policy: ${exchangeProperty[policyName]} of type ${exchangeProperty[policyType]}" />
- <to uri="direct:verify-one-policy" />
- <log loggingLevel="INFO"
- message="Processing all GUARD policies defined in loop ${exchangeProperty[loopObject].getName()}" />
- <split>
- <simple>${exchangeProperty[operationalPolicy].createGuardPolicyPayloads().entrySet()}
- </simple>
- <setProperty propertyName="policyName">
- <simple>${body.getKey()}</simple>
- </setProperty>
- <setProperty propertyName="policyType">
- <simple>onap.policies.controlloop.Guard</simple>
- </setProperty>
- <setProperty propertyName="policyVersion">
- <simple>1</simple>
- </setProperty>
- <setBody>
- <constant>null</constant>
- </setBody>
- <log loggingLevel="INFO"
- message="Processing Guard Policy: ${exchangeProperty[policyName]} of type ${exchangeProperty[policyType]}" />
- <to uri="direct:verify-one-policy" />
- </split>
- </split>
- <setProperty propertyName="policyState">
- <simple> ${exchangeProperty[policyComponent].getState()}
- </simple>
- </setProperty>
- <log loggingLevel="INFO"
- message="Policy state set to: ${exchangeProperty[policyState].getStateName()}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLogForComponent('Policy state set to: ${exchangeProperty[policyState].getStateName()}','INFO','POLICY',${exchangeProperty[loopObject]})" />
- </route>
- <route id="update-dcae-status-for-loop">
- <from uri="direct:update-dcae-status-for-loop" />
- <log loggingLevel="INFO"
- message="Updating DCAE status for loop: ${exchangeProperty[loopObject].getName()}" />
- <choice>
- <when>
- <simple>${exchangeProperty['loopObject'].getLoopTemplate().getUniqueBlueprint()} == true
- </simple>
- <setProperty propertyName="dcaeComponent">
- <simple>${exchangeProperty[loopObject].getComponent('DCAE')}</simple>
- </setProperty>
- <when>
- <simple>${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()} != null
- </simple>
- <setProperty propertyName="getStatusUrl">
- <simple>${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()}</simple>
- </setProperty>
- <setProperty propertyName="raiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <to uri="direct:get-dcae-deployment-status" />
- <when>
- <simple> ${header.CamelHttpResponseCode} == 200 </simple>
- <convertBodyTo type="java.lang.String" />
- <setProperty propertyName="dcaeResponse">
- <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
- method="convertDcaeResponse(${body})" />
- </setProperty>
- </when>
- </when>
- <setProperty propertyName="dcaeState">
- <simple> ${exchangeProperty[dcaeComponent].computeState(*)}
- </simple>
- </setProperty>
- <log loggingLevel="INFO"
- message="DCAE state set to: ${exchangeProperty[dcaeState].getStateName()} - DCAE message: ${exchangeProperty[dcaeResponse].getError()}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLogForComponent('DCAE state set to: ${exchangeProperty[dcaeState].getStateName()} - message: ${exchangeProperty[dcaeResponse].getError()}','INFO','DCAE',${exchangeProperty[loopObject]})" />
- </when>
- <when>
- <simple>${exchangeProperty['loopObject'].getLoopTemplate().getUniqueBlueprint()} == false
- </simple>
- <split>
- <simple>${exchangeProperty[loopObject].getMicroServicePolicies()}
- </simple>
- <setProperty propertyName="microServicePolicy">
- <simple>${body}</simple>
- </setProperty>
- <setProperty propertyName="dcaeComponent">
- <simple>${exchangeProperty[loopObject].getComponent('DCAE_' + ${exchangeProperty[microServicePolicy].getName())}</simple>
- </setProperty>
- <when>
- <simple>${exchangeProperty[microServicePolicy].getDcaeDeploymentStatusUrl()} != null
- </simple>
- <setProperty propertyName="getStatusUrl">
- <simple>${exchangeProperty[microServicePolicy].getDcaeDeploymentStatusUrl()}</simple>
- </setProperty>
- <setProperty propertyName="raiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <to uri="direct:get-dcae-deployment-status" />
- <when>
- <simple> ${header.CamelHttpResponseCode} == 200 </simple>
- <convertBodyTo type="java.lang.String" />
- <setProperty propertyName="dcaeResponse">
- <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
- method="convertDcaeResponse(${body})" />
- </setProperty>
- </when>
- </when>
- <setProperty propertyName="dcaeState">
- <simple> ${exchangeProperty[dcaeComponent].computeState(*)}
- </simple>
- </setProperty>
- <log loggingLevel="INFO"
- message="DCAE state set to: ${exchangeProperty[dcaeState].getStateName()} - DCAE message: ${exchangeProperty[dcaeResponse].getError()}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLogForComponent('DCAE state set to: ${exchangeProperty[dcaeState].getStateName()} - message: ${exchangeProperty[dcaeResponse].getError()}','INFO','DCAE',${exchangeProperty[microServicePolicy]})" />
- </split>>
- </when>
- </choice>
- </route>
- <route id="direct:update-loop-state">
- <from uri="direct:update-loop-state" />
- <log loggingLevel="INFO"
- message="Updating status for loop: ${exchangeProperty[loopObject].getName()}" />
- <choice>
- <when>
- <simple>${exchangeProperty['dcaeState'].getStateName()} ==
- 'BLUEPRINT_DEPLOYED' and ${exchangeProperty['policyState'].getStateName()}
- == 'NOT_SENT'
- </simple>
- <to
- uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'DESIGN')" />
- </when>
- <when>
- <simple>${exchangeProperty['dcaeState'].getStateName()} == 'IN_ERROR' or
- ${exchangeProperty['dcaeState'].getStateName()} ==
- 'MICROSERVICE_INSTALLATION_FAILED'
- </simple>
- <to
- uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'IN_ERROR')" />
- </when>
- <when>
- <simple>${exchangeProperty['dcaeState'].getStateName()} ==
- 'MICROSERVICE_UNINSTALLATION_FAILED' or
- ${exchangeProperty['policyState'].getStateName()} == 'IN_ERROR'
- </simple>
- <to
- uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'IN_ERROR')" />
- </when>
- <when>
- <simple>${exchangeProperty['dcaeState'].getStateName()} ==
- 'MICROSERVICE_INSTALLED_SUCCESSFULLY' and
- ${exchangeProperty['policyState'].getStateName()} == 'SENT_AND_DEPLOYED'
- </simple>
- <to
- uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'RUNNING')" />
- </when>
- <when>
- <simple>${exchangeProperty['dcaeState'].getStateName()} ==
- 'MICROSERVICE_INSTALLED_SUCCESSFULLY' and
- ${exchangeProperty['policyState'].getStateName()} == 'SENT'
- </simple>
- <to
- uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'STOPPED')" />
- </when>
- <when>
- <simple>${exchangeProperty['dcaeState'].getStateName()} ==
- 'BLUEPRINT_DEPLOYED' or ${exchangeProperty['dcaeState'].getStateName()} ==
- 'MICROSERVICE_UNINSTALLED_SUCCESSFULLY' and
- ${exchangeProperty['policyState'].getStateName()} == 'SENT_AND_DEPLOYED'
- </simple>
- <to
- uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'SUBMITTED')" />
- </when>
- <when>
- <simple>${exchangeProperty['dcaeState'].getStateName()} ==
- 'PROCESSING_MICROSERVICE_INSTALLATION' or
- ${exchangeProperty['dcaeState'].getStateName()} ==
- 'PROCESSING_MICROSERVICE_UNINSTALLATION' and
- ${exchangeProperty['policyState'].getStateName()} == 'SENT_AND_DEPLOYED'
- </simple>
- <to
- uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'WAITING')" />
- </when>
- <when>
- <simple>${exchangeProperty['dcaeState'].getStateName()} ==
- 'MICROSERVICE_INSTALLED_SUCCESSFULLY' and
- ${exchangeProperty['policyState'].getStateName()} != 'NOT_SENT'
- </simple>
- <to
- uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'DEPLOYED')" />
- </when>
- </choice>
- <log loggingLevel="INFO"
- message="New loop state is: ${exchangeProperty[loopObject].getLastComputedState().toString()}" />
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('New loop state is: ${exchangeProperty[loopObject].getLastComputedState().toString()}','INFO',${exchangeProperty[loopObject]})" />
-
- </route>
-</routes> \ No newline at end of file
diff --git a/src/test/resources/clds/camel/routes/policy-flows.xml b/src/test/resources/clds/camel/routes/policy-flows.xml
deleted file mode 100644
index c28e45435..000000000
--- a/src/test/resources/clds/camel/routes/policy-flows.xml
+++ /dev/null
@@ -1,587 +0,0 @@
-
-<routes xmlns="http://camel.apache.org/schema/spring">
- <route id="verify-one-policy">
- <from uri="direct:verify-one-policy"/>
- <setProperty propertyName="raiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <to uri="direct:get-policy"/>
- <when>
- <simple> ${header.CamelHttpResponseCode} != 200 </simple>
- <setProperty propertyName="policyFound">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <log loggingLevel="WARN"
- message="At least one policy has not been found on policy engine: ${exchangeProperty[policyName]}"/>
- </when>
- <setProperty propertyName="raiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <to uri="direct:get-deployment-policy"/>
- <when>
- <simple> ${header.CamelHttpResponseCode} != 200 </simple>
- <setProperty propertyName="policyDeployed">
- <simple resultType="java.lang.Boolean">false</simple>
- </setProperty>
- <log loggingLevel="WARN"
- message="At least one policy has not been deployed on policy engine: ${exchangeProperty[policyName]}"/>
- </when>
- <setProperty propertyName="newPolicyState">
- <simple>${exchangeProperty[policyComponent].computeState(*)}</simple>
- </setProperty>
- </route>
-
- <route id="get-policy">
- <from uri="direct:get-policy"/>
- <doTry>
- <log loggingLevel="INFO"
- message="Getting Policy: ${exchangeProperty[policyName]}"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Get Policy')"/>
- <setHeader headerName="CamelHttpMethod">
- <constant>GET</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to get policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/${exchangeProperty[policyVersion]}"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/${exchangeProperty[policyVersion]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[policyName]} GET
- Policy status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response"/>
- </doFinally>
- </doTry>
- </route>
-
- <route id="get-deployment-policy">
- <from uri="direct:get-deployment-policy"/>
- <doTry>
- <log loggingLevel="INFO"
- message="Getting the policy deployment in PDP: ${exchangeProperty[policyName]}"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Getting the policy deployment in PDP')"/>
- <setHeader headerName="CamelHttpMethod">
- <constant>GET</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to get policy deployment status: {{clamp.config.policy.pap.url}}/policy/pap/v1/policies/deployed/${exchangeProperty[policyName]}/1.0.0"></log>
- <toD
- uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/policies/deployed/${exchangeProperty[policyName]}/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[policyName]} GET Policy deployment
- status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response"/>
- </doFinally>
- </doTry>
- </route>
- <route id="get-all-policy-models">
- <from uri="direct:get-all-policy-models"/>
- <doTry>
- <log loggingLevel="INFO" message="Getting all the policy models"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Getting all the policy models')"/>
- <setHeader headerName="CamelHttpMethod">
- <constant>GET</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to get all policy models: {{clamp.config.policy.pap.url}}/policy/api/v1/policytypes"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
- <convertBodyTo type="java.lang.String"/>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
- </doFinally>
- </doTry>
- </route>
- <route id="get-policy-model">
- <from uri="direct:get-policy-model"/>
- <doTry>
- <log loggingLevel="INFO"
- message="Getting the policy model: ${exchangeProperty[policyModelName]}/${exchangeProperty[policyModelVersion]}"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Getting the policy model')"/>
- <setHeader headerName="CamelHttpMethod">
- <constant>GET</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to get policy model: {{clamp.config.policy.pap.url}}/policy/api/v1/policytypes/${exchangeProperty[policyModelName]}/versions/${exchangeProperty[policyModelVersion]}"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyModelName]}/versions/${exchangeProperty[policyModelVersion]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
- <convertBodyTo type="java.lang.String"/>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
- </doFinally>
- </doTry>
- </route>
- <route id="create-micro-service-policy">
- <from uri="direct:create-micro-service-policy"/>
- <doTry>
- <log loggingLevel="INFO"
- message="Creating Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Micro Service Policy')"/>
- <setBody>
- <simple>${exchangeProperty[microServicePolicy].createPolicyPayload()}
- </simple>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>POST</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to create microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[microServicePolicy].getName()} creation
- status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response"/>
- </doFinally>
- </doTry>
- </route>
-
- <route id="delete-micro-service-policy">
- <from uri="direct:delete-micro-service-policy"/>
- <doTry>
- <log loggingLevel="INFO"
- message="Deleting Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Micro Service Policy')"/>
- <setBody>
- <constant>null</constant>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to delete microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
-
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[microServicePolicy].getName()} removal
- status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response"/>
- </doFinally>
- </doTry>
- </route>
-
- <route id="create-operational-policy">
- <from uri="direct:create-operational-policy"/>
- <doTry>
- <log loggingLevel="INFO"
- message="Creating Operational Policy: ${exchangeProperty[operationalPolicy].getName()}"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Operational Policy')"/>
- <setBody>
- <simple>${exchangeProperty[operationalPolicy].createPolicyPayload()}
- </simple>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>POST</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to create operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[operationalPolicy].getName()} creation
- status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response"/>
- </doFinally>
- </doTry>
- </route>
-
- <route id="delete-operational-policy">
- <from uri="direct:delete-operational-policy"/>
- <doTry>
- <log loggingLevel="INFO"
- message="Deleting Operational Policy: ${exchangeProperty[operationalPolicy].getName()}"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Operational Policy')"/>
- <setBody>
- <constant>null</constant>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to delete operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[operationalPolicy].getName()} removal
- status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response"/>
- </doFinally>
- </doTry>
- </route>
-
- <route id="create-guard-policy">
- <from uri="direct:create-guard-policy"/>
- <doTry>
- <log loggingLevel="INFO"
- message="Creating Guard Policy: ${exchangeProperty[guardPolicy].getKey()}"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Guard Policy')"/>
- <setBody>
- <simple>${exchangeProperty[guardPolicy].getValue()}
- </simple>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>POST</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to create guard policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[guardPolicy].getKey()} creation status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response"/>
- </doFinally>
- </doTry>
- </route>
-
- <route id="delete-guard-policy">
- <from uri="direct:delete-guard-policy"/>
- <doTry>
- <log loggingLevel="INFO"
- message="Deleting Guard Policy: ${exchangeProperty[guardPolicy].getKey()}"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Guard Policy')"/>
- <setBody>
- <constant>null</constant>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to delete guard policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}/versions/1"></log>
- <toD
- uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${exchangeProperty[guardPolicy].getKey()}/versions/1?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
-
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[guardPolicy].getKey()} removal status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response"/>
- </doFinally>
- </doTry>
- </route>
-
- <route id="add-all-to-active-pdp-group">
- <from uri="direct:add-all-to-active-pdp-group"/>
- <doTry>
- <log loggingLevel="INFO"
- message="Adding loop policies to PDP Group: ${exchangeProperty[loopObject].getName()}"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Add policies to PDP group')"/>
- <setBody>
- <simple>${exchangeProperty[loopObject].getComponent("POLICY").createPoliciesPayloadPdpGroup(exchangeProperty[loopObject])}
- </simple>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>POST</constant>
- </setHeader>
- <setHeader headerName="Content-Type">
- <constant>application/json</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to add policies to PDP Group: {{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies"></log>
- <toD
- uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies?bridgeEndpoint=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;useSystemProperties=true&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
-
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
- <setProperty propertyName="logMessage">
- <simple>PDP Group push ALL status</simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response"/>
- </doFinally>
- </doTry>
- </route>
-
- <route id="remove-all-policy-from-active-pdp-group">
- <from uri="direct:remove-all-policy-from-active-pdp-group"/>
- <doTry>
- <log loggingLevel="INFO"
- message="Removing policies from active PDP group for loop: ${exchangeProperty[loopObject].getName()}"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Removing policies PDP group')"/>
- <split>
- <simple>${exchangeProperty[loopObject].getComponent("POLICY").listPolicyNamesPdpGroup(exchangeProperty[loopObject])}
- </simple>
- <setProperty propertyName="policyName">
- <simple>${body}</simple>
- </setProperty>
- <setBody>
- <constant>null</constant>
- </setBody>
- <setHeader headerName="CamelHttpMethod">
- <constant>DELETE</constant>
- </setHeader>
- <setHeader headerName="X-ONAP-RequestID">
- <simple>${exchangeProperty[X-ONAP-RequestID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-InvocationID">
- <simple>${exchangeProperty[X-ONAP-InvocationID]}
- </simple>
- </setHeader>
- <setHeader headerName="X-ONAP-PartnerName">
- <simple>${exchangeProperty[X-ONAP-PartnerName]}
- </simple>
- </setHeader>
- <log loggingLevel="INFO"
- message="Endpoint to delete policy from PDP Group: {{clamp.config.policy.pap.url}}/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0"></log>
- <toD
- uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.pap.userName}}&amp;authPassword={{clamp.config.policy.pap.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
- <setProperty propertyName="logMessage">
- <simple>${exchangeProperty[policyName]} PDP Group removal status
- </simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response"/>
- </split>
- <doCatch>
- <exception>java.lang.Exception</exception>
- <handled>
- <constant>false</constant>
- </handled>
- <setProperty propertyName="logMessage">
- <simple>PDP Group removal, Error reported: ${exception}</simple>
- </setProperty>
- <setProperty propertyName="logComponent">
- <simple>POLICY</simple>
- </setProperty>
- <to uri="direct:dump-loop-log-http-response"/>
- </doCatch>
- <doFinally>
- <to uri="direct:reset-raise-http-exception-flag"/>
- <to
- uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/>
- </doFinally>
- </doTry>
- </route>
-</routes> \ No newline at end of file
diff --git a/src/test/resources/clds/camel/routes/utils-flows.xml b/src/test/resources/clds/camel/routes/utils-flows.xml
deleted file mode 100644
index bbbc46a20..000000000
--- a/src/test/resources/clds/camel/routes/utils-flows.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<routes xmlns="http://camel.apache.org/schema/spring">
- <route id="reset-raise-http-exception-flag">
- <from uri="direct:reset-raise-http-exception-flag" />
- <setProperty propertyName="raiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">true</simple>
- </setProperty>
- </route>
-
- <route id="dump-loop-log-http-response">
- <from uri="direct:dump-loop-log-http-response" />
- <log loggingLevel="INFO"
- message="${exchangeProperty[logMessage]} - ${header.CamelHttpResponseCode} : ${header.CamelHttpResponseText}" />
- <choice>
- <when>
- <simple>${exchangeProperty[logComponent]} == null</simple>
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('${exchangeProperty[logMessage]} - ${header.CamelHttpResponseCode} : ${header.CamelHttpResponseText}','INFO',${exchangeProperty[loopObject]})" />
- </when>
- <otherwise>
- <to
- uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLogForComponent('${exchangeProperty[logMessage]} - ${header.CamelHttpResponseCode} : ${header.CamelHttpResponseText}','INFO','${exchangeProperty[logComponent]}',${exchangeProperty[loopObject]})" />
- <setProperty propertyName="logComponent">
- <constant>null</constant>
- </setProperty>
- </otherwise>
- </choice>
- </route>
-</routes> \ No newline at end of file
diff --git a/src/test/resources/https/https-test.properties b/src/test/resources/https/https-test.properties
index 0be9e298a..46bca153b 100644
--- a/src/test/resources/https/https-test.properties
+++ b/src/test/resources/https/https-test.properties
@@ -26,11 +26,21 @@
### To have only HTTP, keep the lines server.ssl.* commented
### To have only HTTPS enabled, uncomment the server.ssl.* lines and specify a right keystore location
server.port=${clamp.it.tests.https}
-### Settings for HTTPS (this automatically enables the HTTPS on the port 'server.port')
-server.ssl.key-store=classpath:https/keystore-test.jks
-server.ssl.key-store-password=testpass
-server.ssl.key-password=testpass
-server.ssl.key-store-type=JKS
+### Settings for HTTPS (this automatically enables the HTTPS on the port 'server.port')
+server.ssl.key-store=classpath:clds/aaf/org.onap.clamp.p12
+server.ssl.key-store-password=enc:WWCxchk4WGBNSvuzLq3MLjMs5ObRybJtts5AI0XD1Vc
+server.ssl.key-password=enc:WWCxchk4WGBNSvuzLq3MLjMs5ObRybJtts5AI0XD1Vc
+server.ssl.key-store-type=PKCS12
+server.ssl.key-alias=clamp@clamp.onap.org
+
+# The key file used to decode the key store and trust store password
+# If not defined, the key store and trust store password will not be decrypted
+clamp.config.keyFile=classpath:clds/aaf/org.onap.clamp.keyfile
+
+## Config part for Client certificates
+server.ssl.client-auth=want
+server.ssl.trust-store=classpath:clds/aaf/truststoreONAPall.jks
+server.ssl.trust-store-password=enc:iDnPBBLq_EMidXlMa1FEuBR8TZzYxrCg66vq_XfLHdJ
### In order to be user friendly when HTTPS is enabled,
### you can add another HTTP port that will be automatically redirected to HTTPS
@@ -58,13 +68,14 @@ server.http-to-https-redirection.port=${clamp.it.tests.http-redirected}
server.servlet.context-path=/
#Modified engine-rest applicationpath
-spring.profiles.active=clamp-default,clamp-default-user
+spring.profiles.active=clamp-default, clamp-aaf-authentication,clamp-ssl-config
+
#clds datasource connection details
spring.datasource.cldsdb.driverClassName=org.mariadb.jdbc.Driver
-spring.datasource.cldsdb.url=jdbc:mariadb:sequential://localhost:${docker.mariadb.port.host}/cldsdb4?autoReconnect=true&retriesAllDown=2147483647&failoverLoopRetries=2147483647
+spring.datasource.cldsdb.url=jdbc:mariadb:sequential://localhost:${docker.mariadb.port.host}/cldsdb4?autoReconnect=true&retriesAllDown=2147483647&failoverLoopRetries=2147483647
spring.datasource.cldsdb.username=clds
-spring.datasource.cldsdb.password=4c90a0b48204383f4283448d23e0b885a47237b2a23588e7c4651604f51c1067
+spring.datasource.cldsdb.password=4c90a0b48204383f4283448d23e0b885a47237b2a23588e7c4651604f51c1067
spring.datasource.cldsdb.validationQuery=SELECT 1
spring.datasource.cldsdb.validationQueryTimeout=20000
spring.datasource.cldsdb.validationInterval=30000
@@ -93,4 +104,26 @@ camel.springboot.xmlRests=classpath:/clds/camel/rest/*.xml
#com.att.eelf.logging.path=
com.att.eelf.logging.file=logback-default.xml
#The log folder that will be used in logback.xml file
-clamp.config.log.path=log \ No newline at end of file
+clamp.config.log.path=log
+
+#Define user permission related parameters, the permission type can be changed but MUST be redefined in clds-users.properties in that case !
+clamp.config.security.permission.type.cl=org.onap.clamp.clds.cl
+clamp.config.security.permission.type.cl.manage=org.onap.clamp.clds.cl.manage
+clamp.config.security.permission.type.cl.event=org.onap.clamp.clds.cl.event
+clamp.config.security.permission.type.filter.vf=org.onap.clamp.clds.filter.vf
+clamp.config.security.permission.type.template=org.onap.clamp.clds.template
+clamp.config.security.permission.type.tosca=org.onap.clamp.clds.tosca
+#This one indicates the type of instances (dev|prod|perf...), this must be set accordingly in clds-users.properties
+clamp.config.security.permission.instance=dev
+clamp.config.security.authentication.class=org.onap.aaf.cadi.principal.X509Principal
+
+#AAF related parameters
+clamp.config.cadi.cadiLoglevel=DEBUG
+clamp.config.cadi.cadiLatitude=10
+clamp.config.cadi.cadiLongitude=10
+clamp.config.cadi.aafLocateUrl=https://aaf-locate:8095
+clamp.config.cadi.oauthTokenUrl= https://AAF_LOCATE_URL/locate/onap.org.osaaf.aaf.token:2.1/token
+clamp.config.cadi.oauthIntrospectUrll=https://AAF_LOCATE_URL/locate/onap.org.osaaf.aaf.introspect:2.1/introspect
+clamp.config.cadi.aafEnv=DEV
+clamp.config.cadi.aafUrl=https://AAF_LOCATE_URL/onap.org.osaaf.aaf.service:2.1
+clamp.config.cadi.cadiX509Issuers=CN=intermediateCA_1, OU=OSAAF, O=ONAP, C=US:CN=intermediateCA_7, OU=OSAAF, O=ONAP, C=US:CN=intermediateCA_9, OU=OSAAF, O=ONAP, C=US \ No newline at end of file