lapentafd | 9695f70 | 2022-03-30 11:37:20 +0100 | [diff] [blame] | 1 | .. This work is licensed under a |
| 2 | .. Creative Commons Attribution 4.0 International License. |
| 3 | .. http://creativecommons.org/licenses/by/4.0 |
| 4 | |
| 5 | .. _policy-distribution-smoke-testing-label: |
| 6 | |
| 7 | Policy Distribution Smoke Test |
| 8 | ################################ |
| 9 | |
lapentafd | 45ce655 | 2022-04-12 11:23:22 +0100 | [diff] [blame] | 10 | The policy-distribution smoke testing is executed against a custom ONAP docker installation as defined in the docker compose file in "policy/docker/csit/". |
| 11 | The policy-distribution configuration file is located in "docker/csit/config/distribution/". |
lapentafd | 9695f70 | 2022-03-30 11:37:20 +0100 | [diff] [blame] | 12 | This test verifies the execution of the REST api's exposed by the component to make sure the CSAR Decoding and Forwarding works as expected. |
| 13 | |
| 14 | General Setup |
| 15 | ***************** |
| 16 | In policy/docker/csit/ |
| 17 | |
| 18 | .. code-block:: bash |
| 19 | |
| 20 | ./start-grafana.sh distribution |
| 21 | |
| 22 | This script will compose the ONAP components used during the smoke tests are: |
| 23 | |
| 24 | - Policy API to perform CRUD of policies. |
| 25 | - Policy DB to store the policies, and DB Migrator to start the db. |
| 26 | - DMAAP Simulator for the communication between components. |
| 27 | - Policy PAP to perform runtime administration (deploy/undeploy/status/statistics/etc). |
| 28 | - Policy Apex-PDP to deploy & undeploy policies. And send heartbeats to PAP. |
| 29 | - Policy Drools-PDP to deploy & undeploy policies. And send heartbeats to PAP. |
| 30 | - Policy Xacml-PDP to deploy & undeploy policies. And send heartbeats to PAP. |
| 31 | |
lapentafd | 45ce655 | 2022-04-12 11:23:22 +0100 | [diff] [blame] | 32 | - Policy Distribution to test the Decoding and Forwarding functions. |
lapentafd | 9695f70 | 2022-03-30 11:37:20 +0100 | [diff] [blame] | 33 | |
lapentafd | 45ce655 | 2022-04-12 11:23:22 +0100 | [diff] [blame] | 34 | Use this script to easily bring down the containers : |
lapentafd | 9695f70 | 2022-03-30 11:37:20 +0100 | [diff] [blame] | 35 | |
| 36 | .. code-block:: bash |
| 37 | |
| 38 | ./stop-grafana.sh |
| 39 | |
| 40 | Testing procedure |
| 41 | ********************** |
| 42 | |
| 43 | The test set is focused on the following use cases: |
| 44 | |
| 45 | - Wait until Distribution starts and reach the built-in REST endpoints for fetching healthcheck & statistics. |
| 46 | - Execute some of the REST api's exposed by policy-pap component. |
| 47 | |
| 48 | Starting Policy Distribution |
| 49 | ------------------------------------ |
| 50 | |
| 51 | Check the docker logs to see when Distribution service is up and running. |
| 52 | |
| 53 | Get the ips of distribution and pap services: |
| 54 | |
| 55 | .. code:: |
| 56 | :number-lines: |
| 57 | |
| 58 | ./get-instance-ip.sh policy-distribution |
| 59 | ./get-instance-ip.sh policy-pap |
| 60 | |
| 61 | Health check status & statistical data of running distribution system. |
| 62 | |
| 63 | .. code-block:: bash |
| 64 | |
| 65 | curl -u 'healthcheck:zb!XztG34' --basic http://{POLICY_DISTRIBUTION_IP}:6969/healthcheck |
| 66 | curl -u 'healthcheck:zb!XztG34' --basic http://{POLICY_DISTRIBUTION_IP}:6969/statistics |
| 67 | |
| 68 | Expected result for healthcheck |
| 69 | |
| 70 | .. code-block:: json |
| 71 | |
| 72 | {"name":"Policy SSD","url":"policy-distribution","healthy":true,"code":200,"message":"alive"} |
| 73 | |
| 74 | Expected result for statistics |
| 75 | |
| 76 | .. code-block:: json |
| 77 | |
| 78 | {"code":200,"totalDistributionCount":0,"distributionSuccessCount":0,"distributionFailureCount":0,"totalDownloadCount":0,"downloadSuccessCount":0,"downloadFailureCount":0} |
| 79 | |
| 80 | Trigger Policy Distribution Core |
| 81 | ------------------------------------------ |
| 82 | |
| 83 | In order to test policy-distribution, we need to trigger the decoding copying a .csar in the mapped volume, |
| 84 | defined in the docker-compose-distribution-smoke.yml as : |
| 85 | |
| 86 | .. code-block:: yaml |
| 87 | |
| 88 | volumes: |
| 89 | - ./distribution/config/temp/:/opt/app/policy/distribution/etc/temp/ |
| 90 | |
| 91 | So now copy the "sample_csar_with_apex_policy.csar" from ./distribution/config/csar/ to ./distribution/config/temp/ |
| 92 | |
| 93 | If the commissioning is successful we should see from the logs this message |
| 94 | |
| 95 | .. image:: images/message-commissioning-participant.png |
| 96 | |
| 97 | So if we check the distribution statistics again |
| 98 | |
| 99 | .. code-block:: bash |
| 100 | |
| 101 | {"code":200,"totalDistributionCount":1,"distributionSuccessCount":1,"distributionFailureCount":0,"totalDownloadCount":1,"downloadSuccessCount":1,"downloadFailureCount":0} |
| 102 | |
| 103 | Execute policy-pap testing |
| 104 | ------------------------------------ |
| 105 | .. note:: |
| 106 | The user for pap is different. |
| 107 | |
| 108 | Check the details of policies deployed |
| 109 | |
| 110 | .. code-block:: bash |
| 111 | |
| 112 | curl -k --user 'policyadmin:zb!XztG34' http://{POLICY_PAP_IP}:6969/policy/pap/v1/policies/status |
| 113 | |
| 114 | Expected SUCCESS result |
| 115 | |
| 116 | .. code-block:: json |
| 117 | |
| 118 | [{"pdpGroup":"defaultGroup","pdpType":"apex","pdpId":"apex-91fa25a1-0456-42fa-9556-6a4d2bd613fc","policy":{"name":"operational.apex.sampledomain","version":"1.0.0"},"policyType":{"name":"onap.policies.native.Apex","version":"1.0.0"},"deploy":true,"state":"SUCCESS"},{"pdpGroup":"defaultGroup","pdpType":"xacml","pdpId":"xacml-83e19452-0854-41dd-9f17-8b0a68f11813","policy":{"name":"SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP","version":"1.0.0"},"policyType":{"name":"onap.policies.Naming","version":"1.0.0"},"deploy":true,"state":"SUCCESS"}] |
| 119 | |
| 120 | Check number of policies deployed |
| 121 | |
| 122 | .. code-block:: bash |
| 123 | |
| 124 | curl -k --user 'policyadmin:zb!XztG34' http://{POLICY_PAP_IP}:6969/policy/pap/v1/policies/deployed |
| 125 | |
| 126 | Expected success-count result |
| 127 | |
| 128 | .. code-block:: json |
| 129 | |
| 130 | [{"policy-type":"onap.policies.native.Apex","policy-type-version":"1.0.0","policy-id":"operational.apex.sampledomain","policy-version":"1.0.0","success-count":1,"failure-count":0,"incomplete-count":0},{"policy-type":"onap.policies.Naming","policy-type-version":"1.0.0","policy-id":"SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP","policy-version":"1.0.0","success-count":1,"failure-count":0,"incomplete-count":0}] |
| 131 | |
| 132 | Or download & execute the steps in postman collection for verifying policy-pap component. |
lapentafd | 45ce655 | 2022-04-12 11:23:22 +0100 | [diff] [blame] | 133 | The steps need to be performed sequentially one after another. And no input is required from user. |
lapentafd | 9695f70 | 2022-03-30 11:37:20 +0100 | [diff] [blame] | 134 | |
| 135 | `Policy Framework Administration API <https://github.com/onap/policy-pap/blob/master/postman/pap-api-collection.json>`_ |
| 136 | |
| 137 | Make sure to execute the delete steps in order to clean the setup after testing. |