diff options
author | Sirisha_Manchikanti <sirisha.manchikanti@est.tech> | 2021-06-08 09:28:21 +0100 |
---|---|---|
committer | Sirisha_Manchikanti <sirisha.manchikanti@est.tech> | 2021-06-22 15:12:05 +0100 |
commit | 4d0a1d766e645046a9bcbe3c0dbeb59d82fd2fa3 (patch) | |
tree | 27738876ee1a34e162cb866561fd3477e64a02bb /csit/clamp | |
parent | 3c231ae4fd843f56eb814133221dcd5595ccabb7 (diff) |
Add CSIT for clamp controlloop
Add CSIT testcases, scripts and a seperate docker-compose file for
integration testing between controlloop components, this involves
integration between Mariadb, Dmaap, ControlLoop-Runtime,
Policy-Participant, Policy-API and DCAE-Participant docker images.
Issue-ID: POLICY-3217
Signed-off-by: Sirisha_Manchikanti <sirisha.manchikanti@est.tech>
Change-Id: Id7cb1451afc4331b4ed1ad1ac6c2528a747eaaa0
Diffstat (limited to 'csit/clamp')
-rw-r--r-- | csit/clamp/plans/setup.sh | 57 | ||||
-rw-r--r-- | csit/clamp/plans/teardown.sh | 20 | ||||
-rw-r--r-- | csit/clamp/plans/testplan.txt | 3 | ||||
-rw-r--r-- | csit/clamp/tests/data/InstantiateCL.json | 59 | ||||
-rw-r--r-- | csit/clamp/tests/data/PMSHMultipleCLTosca.yaml | 242 | ||||
-rw-r--r-- | csit/clamp/tests/data/PassivateCL.json | 9 | ||||
-rw-r--r-- | csit/clamp/tests/data/StateChangeRunningCL.json | 9 | ||||
-rw-r--r-- | csit/clamp/tests/policy-clamp-test.robot | 82 |
8 files changed, 481 insertions, 0 deletions
diff --git a/csit/clamp/plans/setup.sh b/csit/clamp/plans/setup.sh new file mode 100644 index 00000000..746a16e2 --- /dev/null +++ b/csit/clamp/plans/setup.sh @@ -0,0 +1,57 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# Copyright (C) 2021 Nordix Foundation. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= +source ${SCRIPTS}/get-branch-mariadb.sh + +echo "Uninstall docker-py and reinstall docker." +pip uninstall -y docker-py +pip uninstall -y docker +pip install -U docker==2.7.0 + +sudo apt-get -y install libxml2-utils + +source ${SCRIPTS}/detmVers.sh + +docker-compose -f ${SCRIPTS}/docker-compose-all.yml up -d policy-controlloop-runtime + +sleep 10 +unset http_proxy https_proxy + +POLICY_CONTROLLOOP_RUNTIME_IP=`get-instance-ip.sh policy-controlloop-runtime` +POLICY_PARTICIPANT_IP=`get-instance-ip.sh policy-participant` +DCAE_PARTICIPANT_IP=`get-instance-ip.sh dcae-participant` +MARIADB_IP=`get-instance-ip.sh mariadb` +DMAAP_IP=`get-instance-ip.sh simulator` +POLICY_API_IP=`get-instance-ip.sh policy-api` + +echo MARIADB IP IS ${MARIADB_IP} +echo DMAAP_IP IS ${DMAAP_IP} +echo API IP IS ${POLICY_API_IP} +echo POLICY CONTROLLOOP RUNTIME IP IS ${POLICY_CONTROLLOOP_RUNTIME_IP} +echo POLICY PARTICIPANT IP IS ${POLICY_PARTICIPANT_IP} +echo DCAE PARTICIPANT IP IS ${DCAE_PARTICIPANT_IP} + +# wait for the app to start up +${SCRIPTS}/wait_for_port.sh ${POLICY_CONTROLLOOP_RUNTIME_IP} 6970 +${SCRIPTS}/wait_for_port.sh ${POLICY_API_IP} 6969 + +ROBOT_VARIABLES="" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_CONTROLLOOP_RUNTIME_IP:${POLICY_CONTROLLOOP_RUNTIME_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_PARTICIPANT_IP:${POLICY_PARTICIPANT_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v DCAE_PARTICIPANT_IP:${DCAE_PARTICIPANT_IP}" +ROBOT_VARIABLES="${ROBOT_VARIABLES} -v POLICY_API_IP:${POLICY_API_IP}" diff --git a/csit/clamp/plans/teardown.sh b/csit/clamp/plans/teardown.sh new file mode 100644 index 00000000..e0fc58ed --- /dev/null +++ b/csit/clamp/plans/teardown.sh @@ -0,0 +1,20 @@ +#!/bin/bash +# ============LICENSE_START======================================================= +# Copyright (C) 2021 Nordix Foundation. +# ================================================================================ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 +# ============LICENSE_END========================================================= + +docker-compose -f ${SCRIPTS}/docker-compose-all.yml down -v diff --git a/csit/clamp/plans/testplan.txt b/csit/clamp/plans/testplan.txt new file mode 100644 index 00000000..3c4f4bc2 --- /dev/null +++ b/csit/clamp/plans/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [policy/docker.git]/csit/[project]/tests. +# Place the suites in run order. +policy-clamp-test.robot diff --git a/csit/clamp/tests/data/InstantiateCL.json b/csit/clamp/tests/data/InstantiateCL.json new file mode 100644 index 00000000..d7402031 --- /dev/null +++ b/csit/clamp/tests/data/InstantiateCL.json @@ -0,0 +1,59 @@ +{ + "controlLoopList": [ + { + "name": "PMSHInstance0", + "version": "1.0.1", + "definition": { + "name": "org.onap.domain.pmsh.PMSHControlLoopDefinition", + "version": "1.2.3" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "PMSH control loop instance 0", + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c20": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c20", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_DCAEMicroservice", + "version": "1.2.3" + }, + "participantType": { + "name": "org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant", + "version": "2.3.4" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "DCAE Control Loop Element for the PMSH instance 0 control loop" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c21": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement", + "version": "1.2.3" + }, + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Monitoring Policy Control Loop Element for the PMSH instance 0 control loop" + }, + "709c62b3-8918-41b9-a747-d21eb79c6c22": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", + "definition": { + "name": "org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement", + "version": "1.2.3" + }, + "participantType": { + "name": "org.onap.policy.controlloop.PolicyControlLoopParticipant", + "version": "2.3.1" + }, + "state": "UNINITIALISED", + "orderedState": "UNINITIALISED", + "description": "Operational Policy Control Loop Element for the PMSH instance 0 control loop" + } + } + } + ] +} diff --git a/csit/clamp/tests/data/PMSHMultipleCLTosca.yaml b/csit/clamp/tests/data/PMSHMultipleCLTosca.yaml new file mode 100644 index 00000000..b0b35158 --- /dev/null +++ b/csit/clamp/tests/data/PMSHMultipleCLTosca.yaml @@ -0,0 +1,242 @@ +tosca_definitions_version: tosca_simple_yaml_1_3 +data_types: + onap.datatypes.ToscaConceptIdentifier: + derived_from: tosca.datatypes.Root + properties: + name: + type: string + required: true + version: + type: string + required: true +node_types: + org.onap.policy.clamp.controlloop.Participant: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + requred: false + org.onap.policy.clamp.controlloop.ControlLoopElement: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + requred: false + participant_id: + type: onap.datatypes.ToscaConceptIdentifier + requred: true + org.onap.policy.clamp.controlloop.ControlLoop: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + requred: false + elements: + type: list + required: true + entry_schema: + type: onap.datatypes.ToscaConceptIdentifier + org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement: + version: 1.0.1 + derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement + properties: + dcae_blueprint_id: + type: onap.datatypes.ToscaConceptIdentifier + requred: true + org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement: + version: 1.0.1 + derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement + properties: + policy_type_id: + type: onap.datatypes.ToscaConceptIdentifier + requred: true + org.onap.policy.clamp.controlloop.CDSControlLoopElement: + version: 1.0.1 + derived_from: org.onap.policy.clamp.controlloop.ControlLoopElement + properties: + cds_blueprint_id: + type: onap.datatypes.ToscaConceptIdentifier + requred: true +topology_template: + node_templates: + org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant: + version: 2.3.4 + type: org.onap.policy.clamp.controlloop.Participant + type_version: 1.0.1 + description: Participant for DCAE microservices + properties: + provider: ONAP + org.onap.policy.controlloop.PolicyControlLoopParticipant: + version: 2.2.1 + type: org.onap.policy.clamp.controlloop.Participant + type_version: 1.0.1 + description: Participant for DCAE microservices + properties: + provider: ONAP + org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant: + version: 2.2.1 + type: org.onap.policy.clamp.controlloop.Participant + type_version: 1.0.1 + description: Participant for DCAE microservices + properties: + provider: ONAP + org.onap.domain.pmsh.PMSH_DCAEMicroservice: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement + type_version: 1.0.0 + description: Control loop element for the DCAE microservice for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_id: + name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant + version: 2.3.4 + dcae_blueprint_id: + name: org.onap.dcae.blueprints.PMSHBlueprint + version: 1.0.0 + org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement + type_version: 1.0.0 + description: Control loop element for the monitoring policy for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_id: + name: org.onap.policy.controlloop.PolicyControlLoopParticipant + version: 2.2.1 + policy_type_id: + name: onap.policies.monitoring.pm-subscription-handler + version: 1.0.0 + org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement + type_version: 1.0.0 + description: Control loop element for the operational policy for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_id: + name: org.onap.policy.controlloop.PolicyControlLoopParticipant + version: 2.2.1 + policy_type_id: + name: onap.policies.operational.pm-subscription-handler + version: 1.0.0 + org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.ControlLoopElement + type_version: 1.0.0 + description: Control loop element for CDS for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_Id: + name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant + version: 3.2.1 + cds_blueprint_id: + name: org.onap.ccsdk.cds.PMSHCdsBlueprint + version: 1.0.0 + org.onap.domain.pmsh.PMSHControlLoopDefinition: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.ControlLoop + type_version: 1.0.0 + description: Control loop for Performance Management Subscription Handling + properties: + provider: Ericsson + elements: + - name: org.onap.domain.pmsh.PMSH_DCAEMicroservice + version: 1.2.3 + - name: org.onap.domain.pmsh.PMSH_MonitoringPolicyControlLoopElement + version: 1.2.3 + - name: org.onap.domain.pmsh.PMSH_OperationalPolicyControlLoopElement + version: 1.2.3 + - name: org.onap.domain.pmsh.PMSH_CDS_ControlLoopElement + version: 1.2.3 + org.onap.domain.pmsh.PMSD_DCAEMicroservice: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.DCAEMicroserviceControlLoopElement + type_version: 1.0.0 + description: Control loop element for the DCAE microservice for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_id: + name: org.onap.dcae.controlloop.DCAEMicroserviceControlLoopParticipant + version: 2.3.4 + dcae_blueprint_id: + name: org.onap.dcae.blueprints.PMSDBlueprint + version: 1.0.0 + org.onap.domain.pmsh.PMSD_MonitoringPolicyControlLoopElement: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement + type_version: 1.0.0 + description: Control loop element for the monitoring policy for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_id: + name: org.onap.policy.controlloop.PolicyControlLoopParticipant + version: 2.2.1 + policy_type_id: + name: onap.policies.monitoring.pm-subscription-handler + version: 1.0.0 + org.onap.domain.pmsh.PMSD_OperationalPolicyControlLoopElement: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.PolicyTypeControlLoopElement + type_version: 1.0.0 + description: Control loop element for the operational policy for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_id: + name: org.onap.policy.controlloop.PolicyControlLoopParticipant + version: 2.2.1 + policy_type_id: + name: onap.policies.operational.pm-subscription-handler + version: 1.0.0 + org.onap.domain.pmsh.PMSD_CDS_ControlLoopElement: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.ControlLoopElement + type_version: 1.0.0 + description: Control loop element for CDS for Performance Management Subscription Handling + properties: + provider: Ericsson + participant_Id: + name: org.onap.ccsdk.cds.controlloop.CdsControlLoopParticipant + version: 3.2.1 + cds_blueprint_id: + name: org.onap.ccsdk.cds.PMSDCdsBlueprint + version: 1.0.0 + org.onap.domain.pmsh.PMSDControlLoopDefinition: + version: 1.2.3 + type: org.onap.policy.clamp.controlloop.ControlLoop + type_version: 1.0.0 + description: Control loop for Performance Management Subscription Handling + properties: + provider: Ericsson + elements: + - name: org.onap.domain.pmsh.PMSD_DCAEMicroservice + version: 1.2.3 + - name: org.onap.domain.pmsh.PMSD_MonitoringPolicyControlLoopElement + version: 1.2.3 + - name: org.onap.domain.pmsh.PMSD_OperationalPolicyControlLoopElement + version: 1.2.3 + - name: org.onap.domain.pmsh.PMSD_CDS_ControlLoopElement + version: 1.2.3 +policies: + - TestCheckPolicy: + type: onap.policies.DemoCheckPolicyType + type_version: 1.0.0 + name: TestCheckPolicy + version: 1.0.0 + metadata: + policy-id: TestCheckPolicy + policy-version: 1.0.0 + properties: + pmsh_policy: + fileBasedGP: 15 + fileLocation: /pm/pm.xml + subscriptionName: subscriptiona + administrativeState: UNLOCKED +policy_types: + onap.policies.DemoCheckPolicyType: + derived_from: tosca.policies.Root + description: a base policy type for all policies that govern monitoring provisioning + version: 1.0.0 + name: onap.policies.DemoCheckPolicyType diff --git a/csit/clamp/tests/data/PassivateCL.json b/csit/clamp/tests/data/PassivateCL.json new file mode 100644 index 00000000..472d5f4e --- /dev/null +++ b/csit/clamp/tests/data/PassivateCL.json @@ -0,0 +1,9 @@ +{ + "orderedState": "PASSIVE", + "controlLoopIdentifierList": [ + { + "name": "PMSHInstance0", + "version": "1.0.1" + } + ] +} diff --git a/csit/clamp/tests/data/StateChangeRunningCL.json b/csit/clamp/tests/data/StateChangeRunningCL.json new file mode 100644 index 00000000..bbba0b16 --- /dev/null +++ b/csit/clamp/tests/data/StateChangeRunningCL.json @@ -0,0 +1,9 @@ +{ + "orderedState": "RUNNING", + "controlLoopIdentifierList": [ + { + "name": "PMSHInstance0", + "version": "1.0.1" + } + ] +} diff --git a/csit/clamp/tests/policy-clamp-test.robot b/csit/clamp/tests/policy-clamp-test.robot new file mode 100644 index 00000000..c9ad34af --- /dev/null +++ b/csit/clamp/tests/policy-clamp-test.robot @@ -0,0 +1,82 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Library OperatingSystem +Library json + +*** Test Cases *** + +CommissionControlLoopV1 + [Documentation] Commission control loop. + ${auth}= Create List healthcheck zb!XztG34 + Log Creating session http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970 + ${postyaml}= Get file ${CURDIR}/data/PMSHMultipleCLTosca.yaml + ${session}= Create Session policy http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970 auth=${auth} + ${headers}= Create Dictionary Accept=application/yaml Content-Type=application/yaml + ${resp}= POST On Session policy /onap/controlloop/v2/commission data=${postyaml} headers=${headers} + Log Received response from controlloop runtime ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + +InstantiateControlLoopV1 + [Documentation] Instantiate control loop. + ${auth}= Create List healthcheck zb!XztG34 + Log Creating session http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970 + ${postjson}= Get file ${CURDIR}/data/InstantiateCL.json + ${session}= Create Session policy http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970 auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= POST On Session policy /onap/controlloop/v2/instantiation data=${postjson} headers=${headers} + Log Received response from controlloop runtime ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + +PassivateControlLoop + [Documentation] Passivate control loop. + ${auth}= Create List healthcheck zb!XztG34 + Log Creating session http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970 + ${postjson}= Get file ${CURDIR}/data/PassivateCL.json + ${session}= Create Session policy http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970 auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= PUT On Session policy /onap/controlloop/v2/instantiation/command data=${postjson} headers=${headers} + Log Received response from controlloop runtime ${resp.text} + Should Be Equal As Strings ${resp.status_code} 202 + +QueryPolicies + [Documentation] Runs Policy Participant Query New Policies + ${auth}= Create List healthcheck zb!XztG34 + Log Creating session https://${POLICY_API_IP}:6969 + ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= GET On Session policy /policy/api/v1/policies headers=${headers} + Log Received response from policy-api {resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + +QueryPolicyTypes + [Documentation] Runs Policy Participant Query New Policy Types + ${auth}= Create List healthcheck zb!XztG34 + Log Creating session https://${POLICY_API_IP}:6969 + ${session}= Create Session policy https://${POLICY_API_IP}:6969 auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= GET On Session policy /policy/api/v1/policytypes headers=${headers} + Log Received response from policy-api ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + +StateChangeRunningControlLoop + [Documentation] ControlLoop State Change to RUNNING. + ${auth}= Create List healthcheck zb!XztG34 + Log Creating session http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970 + ${postjson}= Get file ${CURDIR}/data/StateChangeRunningCL.json + ${session}= Create Session policy http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970 auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= PUT On Session policy /onap/controlloop/v2/instantiation/command data=${postjson} headers=${headers} expected_status=406 + Log Received response from controlloop runtime ${resp.text} + +QueryInstantiatedCLs + [Documentation] Get Instantiated ControlLoops + ${auth}= Create List healthcheck zb!XztG34 + Log Creating session http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970 + ${session}= Create Session policy http://${POLICY_CONTROLLOOP_RUNTIME_IP}:6970 auth=${auth} + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json + ${resp}= GET On Session policy /onap/controlloop/v2/instantiation headers=${headers} + Log Received response from controlloop runtime ${resp.text} + Should Be Equal As Strings ${resp.status_code} 200 + Should Be Equal As Strings ${resp.json()['controlLoopList'][0]['state']} UNINITIALISED2PASSIVE + Should Be Equal As Strings ${resp.json()['controlLoopList'][0]['orderedState']} RUNNING |