From 29e3cd1afbd3202a0c16ef6a4057662942ddefa2 Mon Sep 17 00:00:00 2001 From: sebdet Date: Thu, 13 Feb 2020 05:49:21 -0800 Subject: Add tests Add tests for https and aaf Issue-ID: CLAMP-624 Signed-off-by: sebdet Change-Id: Ia78ed8da7e54eaeaaed4fb87f483e0aff3a4a8c5 --- .../clamp/clds/client/PolicyEngineServices.java | 67 ++- .../policy/downloader/PolicyEngineController.java | 29 +- .../PolicyEngineControllerTestItCase.java | 10 + .../java/org/onap/clamp/util/PassDecoderTest.java | 4 +- src/test/resources/clds/aaf/org.onap.clamp.keyfile | 27 - .../resources/clds/camel/rest/clamp-api-v2.xml | 659 --------------------- .../resources/clds/camel/rest/clds-services.xml | 29 - .../resources/clds/camel/routes/dcae-flows.xml | 466 --------------- .../resources/clds/camel/routes/loop-flows.xml | 268 --------- .../resources/clds/camel/routes/policy-flows.xml | 587 ------------------ .../resources/clds/camel/routes/utils-flows.xml | 28 - src/test/resources/https/https-test.properties | 51 +- 12 files changed, 127 insertions(+), 2098 deletions(-) delete mode 100644 src/test/resources/clds/aaf/org.onap.clamp.keyfile delete mode 100644 src/test/resources/clds/camel/rest/clamp-api-v2.xml delete mode 100644 src/test/resources/clds/camel/rest/clds-services.xml delete mode 100644 src/test/resources/clds/camel/routes/dcae-flows.xml delete mode 100644 src/test/resources/clds/camel/routes/loop-flows.xml delete mode 100644 src/test/resources/clds/camel/routes/policy-flows.xml delete mode 100644 src/test/resources/clds/camel/routes/utils-flows.xml (limited to 'src') diff --git a/src/main/java/org/onap/clamp/clds/client/PolicyEngineServices.java b/src/main/java/org/onap/clamp/clds/client/PolicyEngineServices.java index e916afc1..2302cc89 100644 --- a/src/main/java/org/onap/clamp/clds/client/PolicyEngineServices.java +++ b/src/main/java/org/onap/clamp/clds/client/PolicyEngineServices.java @@ -26,6 +26,11 @@ package org.onap.clamp.clds.client; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; +import java.util.ArrayList; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + import org.apache.camel.CamelContext; import org.apache.camel.Exchange; import org.apache.camel.builder.ExchangeBuilder; @@ -38,6 +43,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; +import org.yaml.snakeyaml.Yaml; + + + /** * The class implements the communication with the Policy Engine to retrieve @@ -60,27 +69,52 @@ public class PolicyEngineServices { public static final String POLICY_RETRY_INTERVAL = "policy.retry.interval"; public static final String POLICY_RETRY_LIMIT = "policy.retry.limit"; + /** + * Default constructor. + * + * @param camelContext Camel context bean + * @param clampProperties ClampProperties bean + * @param policyModelsRepository policyModel repository bean + */ @Autowired - public PolicyEngineServices(CamelContext camelContext, ClampProperties refProp, + public PolicyEngineServices(CamelContext camelContext, ClampProperties clampProperties, PolicyModelsRepository policyModelsRepository) { this.camelContext = camelContext; this.policyModelsRepository = policyModelsRepository; - if (refProp.getStringValue(POLICY_RETRY_LIMIT) != null) { - retryLimit = Integer.valueOf(refProp.getStringValue(POLICY_RETRY_LIMIT)); + if (clampProperties.getStringValue(POLICY_RETRY_LIMIT) != null) { + retryLimit = Integer.valueOf(clampProperties.getStringValue(POLICY_RETRY_LIMIT)); } - if (refProp.getStringValue(POLICY_RETRY_INTERVAL) != null) { - retryInterval = Integer.valueOf(refProp.getStringValue(POLICY_RETRY_INTERVAL)); + if (clampProperties.getStringValue(POLICY_RETRY_INTERVAL) != null) { + retryInterval = Integer.valueOf(clampProperties.getStringValue(POLICY_RETRY_INTERVAL)); } } + /** + * This method query Policy engine and create a PolicyModel object with type and version. + * + * @param policyType The policyType id + * @param policyVersion The policy version of that type + * @return A PolicyModel created from policyEngine data + */ public PolicyModel createPolicyModelFromPolicyEngine(String policyType, String policyVersion) { return new PolicyModel(policyType, this.downloadOnePolicy(policyType, policyVersion), policyVersion); } + /** + * This method query Policy engine and create a PolicyModel object with type and version. + * + * @param microService microservice object instance + * @return A PolicyModel created from policyEngine data + */ public PolicyModel createPolicyModelFromPolicyEngine(BlueprintMicroService microService) { return createPolicyModelFromPolicyEngine(microService.getModelType(), microService.getModelVersion()); } + /** + * Thie method creates an PolicyModel in Db if it does not exist. + * + * @param policyModel The policyModel to save + */ @Transactional(propagation = Propagation.REQUIRES_NEW) public void createPolicyInDbIfNeeded(PolicyModel policyModel) { if (!policyModelsRepository @@ -89,6 +123,29 @@ public class PolicyEngineServices { } } + /** + * This method synchronize the clamp database and the policy engine. + * So it creates the required PolicyModel. + */ + public void synchronizeAllPolicies() { + LinkedHashMap loadedYaml; + loadedYaml = new Yaml().load(downloadAllPolicies()); + if (loadedYaml == null || loadedYaml.isEmpty()) { + logger.warn("getAllPolicyType yaml returned by policy engine could not be decoded, as it's null or empty"); + return; + } + + List> policyTypesList = (List>) loadedYaml + .get("policy_types"); + policyTypesList.parallelStream().forEach(policyType -> { + Map.Entry policyTypeEntry = (Map.Entry) new ArrayList(policyType.entrySet()).get(0); + + createPolicyInDbIfNeeded( + createPolicyModelFromPolicyEngine(policyTypeEntry.getKey(), + ((String) ((LinkedHashMap) policyTypeEntry.getValue()).get("version")))); + }); + } + /** * This method can be used to download all policy types + data types defined in * policy engine. diff --git a/src/main/java/org/onap/clamp/policy/downloader/PolicyEngineController.java b/src/main/java/org/onap/clamp/policy/downloader/PolicyEngineController.java index f3eaf0c8..50be035b 100644 --- a/src/main/java/org/onap/clamp/policy/downloader/PolicyEngineController.java +++ b/src/main/java/org/onap/clamp/policy/downloader/PolicyEngineController.java @@ -26,6 +26,7 @@ package org.onap.clamp.policy.downloader; import com.att.eelf.configuration.EELFLogger; import com.att.eelf.configuration.EELFManager; +import java.time.Instant; import java.util.ArrayList; import java.util.LinkedHashMap; import java.util.List; @@ -56,31 +57,23 @@ public class PolicyEngineController { private final PolicyEngineServices policyEngineServices; + private Instant lastInstantExecuted; + @Autowired public PolicyEngineController(PolicyEngineServices policyEngineService, - PolicyModelsRepository policyModelsRepository) { + PolicyModelsRepository policyModelsRepository) { this.policyEngineServices = policyEngineService; } @Scheduled(fixedRate = 120000) - public void synchronizeAllPolicies() { - LinkedHashMap loadedYaml; - loadedYaml = new Yaml().load(policyEngineServices.downloadAllPolicies()); - if (loadedYaml == null || loadedYaml.isEmpty()) { - logger.warn("getAllPolicyType yaml returned by policy engine could not be decoded, as it's null or empty"); - return; - } - - List> policyTypesList = (List>) loadedYaml - .get("policy_types"); - policyTypesList.parallelStream().forEach(policyType -> { - Entry policyTypeEntry = (Entry) new ArrayList(policyType.entrySet()).get(0); - - policyEngineServices.createPolicyInDbIfNeeded( - policyEngineServices.createPolicyModelFromPolicyEngine(policyTypeEntry.getKey(), - ((String) ((LinkedHashMap) policyTypeEntry.getValue()).get("version")))); + public synchronized void synchronizeAllPolicies() { + policyEngineServices.synchronizeAllPolicies(); + lastInstantExecuted = Instant.now(); + } - }); + public Instant getLastInstantExecuted() { + return lastInstantExecuted; } + } 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 912e0d60..7762111b 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 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 56443e31..e5de8b0a 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 c2521fc8..00000000 --- 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 a0a3eb10..00000000 --- a/src/test/resources/clds/camel/rest/clamp-api-v2.xml +++ /dev/null @@ -1,659 +0,0 @@ - - - - - - - - - - - - java.lang.Exception - - false - - - - - - - - - - - - - - - - java.lang.Exception - - false - - - - - - - - - - - - - - - - java.lang.Exception - - false - - - - - - - - - - - - - - - ${body} - - - - - - - java.lang.Exception - - false - - - - - - - - - - - - - - ${body} - - - - - - - java.lang.Exception - - false - - - - - - - - - - - - - - ${body} - - - - - - - - java.lang.Exception - - false - - - - - - - - - - - - - - - - - - - - - - - java.lang.Exception - - false - - - - - - - - - - - - - - - - - - - - - - java.lang.Exception - - false - - - - - - - - - - - - - - - - - - - - - - - - java.lang.Exception - - false - - - - - - - - - - - - - - - - - - - - - - - - java.lang.Exception - - false - - - - - - - - - - - - - - - - - - - - - - - - - java.lang.Exception - - false - - - - - - - - - - - - - - - - - - - false - - - - - ${exchangeProperty[loopObject].getMicroServicePolicies()} - - - ${body} - - - - false - - - - - - - ${exchangeProperty[loopObject].getOperationalPolicies()} - - - ${body} - - - - false - - - - - - - - ${exchangeProperty[operationalPolicy].createGuardPolicyPayloads().entrySet()} - - - ${body} - - - - - false - - - - - - - - 3000 - - - - - - - - - java.lang.Exception - - false - - - - - - - - - - - - - - - - - - - - - ${exchangeProperty[loopObject].getMicroServicePolicies()} - - - ${body} - - - - - - - - ${exchangeProperty[loopObject].getOperationalPolicies()} - - - ${body} - - - - - - ${exchangeProperty[operationalPolicy].createGuardPolicyPayloads().entrySet()} - - - ${body} - - - - - - - - - - - java.lang.Exception - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - java.lang.Exception - - false - - - - - - - - ${exchangeProperty[loopObject]} - - - - - - - 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 dd3a4bfd..00000000 --- a/src/test/resources/clds/camel/rest/clds-services.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - ${body} == 'NOT-OK' - - 404 - - - - - - - - - - - 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 f40207cc..00000000 --- a/src/test/resources/clds/camel/routes/dcae-flows.xml +++ /dev/null @@ -1,466 +0,0 @@ - - - - - - ${exchangeProperty['loopObject'].getLoopTemplate().getUniqueBlueprint()} == true - - - - - ${exchangeProperty['loopObject'].getLoopTemplate().getUniqueBlueprint()} == false - - - - - - - - - - - - ${exchangeProperty[loopObject].getMicroServicePolicies()} - - - ${body} - - - - false - - - - - - - - - PUT - - - application/json - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - - - - - - - - java.lang.Exception - - false - - - DEPLOY micro service failed - (MicroService name:${exchangeProperty[microServicePolicy].getName()}), - Dep-id:${exchangeProperty[dcaeDeploymentId]}, - StatusUrl:${exchangeProperty[dcaeStatusUrl]}) - - - - DCAE - - - - - - - - - - - - - - - - - - - - - - PUT - - - application/json - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - - - - - - - - - - - DEPLOY loop status - (Dep-id:${exchangeProperty[dcaeDeploymentId]}, - StatusUrl:${exchangeProperty[dcaeStatusUrl]}) - - - - DCAE - - - - - - - - - - ${exchangeProperty['loopObject'].getLoopTemplate().getUniqueBlueprint()} == true - - - - - ${exchangeProperty['loopObject'].getLoopTemplate().getUniqueBlueprint()} == false - - - - - - - - - - - - ${exchangeProperty[loopObject].getMicroServicePolicies()} - - - ${body} - - - - - ${exchangeProperty[microServicePolicy].getDcaeDeploymentId()} != null - - - - - - DELETE - - - application/json - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - - - - - - - - - - - - - - java.lang.Exception - - false - - - UNDEPLOY micro service failed - (MicroService name:${exchangeProperty[microServicePolicy].getName()}) - - - - DCAE - - - - - - - - - - - - - - - - ${exchangeProperty[loopObject].getDcaeDeploymentId()} - != null - - - - - - - DELETE - - - application/json - - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - - - - - - - - - UNDEPLOY loop status - - - DCAE - - - - - - - - - - - - - - - - - - GET - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - DCAE deployment status - - - DCAE - - - - - - - - - - - - GET - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - - - - - - - - - - - GET - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - - ${exchangeProperty[dcaeResponseList]} - - - ${body} - - - - - - - - - - \ 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 c4e9fee6..00000000 --- a/src/test/resources/clds/camel/routes/loop-flows.xml +++ /dev/null @@ -1,268 +0,0 @@ - - - - - ${header.loopName} - - - - - - - ${exchangeProperty[loopObject]} == null - - 404 - - - - - - - - - ${exchangeProperty[loopObject].getComponent('POLICY')} - - - - true - - - true - - - - ${exchangeProperty[loopObject].getMicroServicePolicies()} - - - ${body.getName()} - - - ${body.getModelType()} - - - 1.0.0 - - - null - - - - - - - ${exchangeProperty[loopObject].getOperationalPolicies()} - - - ${body.getName()} - - - onap.policies.controlloop.Operational - - - 1 - - - ${body} - - - null - - - - - - ${exchangeProperty[operationalPolicy].createGuardPolicyPayloads().entrySet()} - - - ${body.getKey()} - - - onap.policies.controlloop.Guard - - - 1 - - - null - - - - - - - ${exchangeProperty[policyComponent].getState()} - - - - - - - - - - - ${exchangeProperty['loopObject'].getLoopTemplate().getUniqueBlueprint()} == true - - - ${exchangeProperty[loopObject].getComponent('DCAE')} - - - ${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()} != null - - - ${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()} - - - false - - - - ${header.CamelHttpResponseCode} == 200 - - - - - - - - ${exchangeProperty[dcaeComponent].computeState(*)} - - - - - - - ${exchangeProperty['loopObject'].getLoopTemplate().getUniqueBlueprint()} == false - - - ${exchangeProperty[loopObject].getMicroServicePolicies()} - - - ${body} - - - ${exchangeProperty[loopObject].getComponent('DCAE_' + ${exchangeProperty[microServicePolicy].getName())} - - - ${exchangeProperty[microServicePolicy].getDcaeDeploymentStatusUrl()} != null - - - ${exchangeProperty[microServicePolicy].getDcaeDeploymentStatusUrl()} - - - false - - - - ${header.CamelHttpResponseCode} == 200 - - - - - - - - ${exchangeProperty[dcaeComponent].computeState(*)} - - - - - > - - - - - - - - - ${exchangeProperty['dcaeState'].getStateName()} == - 'BLUEPRINT_DEPLOYED' and ${exchangeProperty['policyState'].getStateName()} - == 'NOT_SENT' - - - - - ${exchangeProperty['dcaeState'].getStateName()} == 'IN_ERROR' or - ${exchangeProperty['dcaeState'].getStateName()} == - 'MICROSERVICE_INSTALLATION_FAILED' - - - - - ${exchangeProperty['dcaeState'].getStateName()} == - 'MICROSERVICE_UNINSTALLATION_FAILED' or - ${exchangeProperty['policyState'].getStateName()} == 'IN_ERROR' - - - - - ${exchangeProperty['dcaeState'].getStateName()} == - 'MICROSERVICE_INSTALLED_SUCCESSFULLY' and - ${exchangeProperty['policyState'].getStateName()} == 'SENT_AND_DEPLOYED' - - - - - ${exchangeProperty['dcaeState'].getStateName()} == - 'MICROSERVICE_INSTALLED_SUCCESSFULLY' and - ${exchangeProperty['policyState'].getStateName()} == 'SENT' - - - - - ${exchangeProperty['dcaeState'].getStateName()} == - 'BLUEPRINT_DEPLOYED' or ${exchangeProperty['dcaeState'].getStateName()} == - 'MICROSERVICE_UNINSTALLED_SUCCESSFULLY' and - ${exchangeProperty['policyState'].getStateName()} == 'SENT_AND_DEPLOYED' - - - - - ${exchangeProperty['dcaeState'].getStateName()} == - 'PROCESSING_MICROSERVICE_INSTALLATION' or - ${exchangeProperty['dcaeState'].getStateName()} == - 'PROCESSING_MICROSERVICE_UNINSTALLATION' and - ${exchangeProperty['policyState'].getStateName()} == 'SENT_AND_DEPLOYED' - - - - - ${exchangeProperty['dcaeState'].getStateName()} == - 'MICROSERVICE_INSTALLED_SUCCESSFULLY' and - ${exchangeProperty['policyState'].getStateName()} != 'NOT_SENT' - - - - - - - - - \ 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 c28e4543..00000000 --- a/src/test/resources/clds/camel/routes/policy-flows.xml +++ /dev/null @@ -1,587 +0,0 @@ - - - - - - false - - - - ${header.CamelHttpResponseCode} != 200 - - false - - - - - false - - - - ${header.CamelHttpResponseCode} != 200 - - false - - - - - ${exchangeProperty[policyComponent].computeState(*)} - - - - - - - - - - GET - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - ${exchangeProperty[policyName]} GET - Policy status - - - - POLICY - - - - - - - - - - - - - GET - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - ${exchangeProperty[policyName]} GET Policy deployment - status - - - - POLICY - - - - - - - - - - - - GET - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - - - - - - - - - - GET - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - - - - - - - - - - ${exchangeProperty[microServicePolicy].createPolicyPayload()} - - - - POST - - - application/json - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - ${exchangeProperty[microServicePolicy].getName()} creation - status - - - - POLICY - - - - - - - - - - - - - null - - - DELETE - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - - ${exchangeProperty[microServicePolicy].getName()} removal - status - - - - POLICY - - - - - - - - - - - - - ${exchangeProperty[operationalPolicy].createPolicyPayload()} - - - - POST - - - application/json - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - ${exchangeProperty[operationalPolicy].getName()} creation - status - - - - POLICY - - - - - - - - - - - - - null - - - DELETE - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - ${exchangeProperty[operationalPolicy].getName()} removal - status - - - - POLICY - - - - - - - - - - - - - ${exchangeProperty[guardPolicy].getValue()} - - - - POST - - - application/json - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - ${exchangeProperty[guardPolicy].getKey()} creation status - - - - POLICY - - - - - - - - - - - - - null - - - DELETE - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - - ${exchangeProperty[guardPolicy].getKey()} removal status - - - - POLICY - - - - - - - - - - - - - ${exchangeProperty[loopObject].getComponent("POLICY").createPoliciesPayloadPdpGroup(exchangeProperty[loopObject])} - - - - POST - - - application/json - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - - PDP Group push ALL status - - - POLICY - - - - - - - - - - - - - ${exchangeProperty[loopObject].getComponent("POLICY").listPolicyNamesPdpGroup(exchangeProperty[loopObject])} - - - ${body} - - - null - - - DELETE - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - ${exchangeProperty[policyName]} PDP Group removal status - - - - POLICY - - - - - java.lang.Exception - - false - - - PDP Group removal, Error reported: ${exception} - - - POLICY - - - - - - - - - - \ 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 bbbc46a2..00000000 --- a/src/test/resources/clds/camel/routes/utils-flows.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - true - - - - - - - - - ${exchangeProperty[logComponent]} == null - - - - - - null - - - - - \ 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 0be9e298..46bca153 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 -- cgit 1.2.3-korg