CLAMP Policy Participant Smoke Tests
------------------------------------
+
1. Introduction
***************
+
The Smoke testing of the policy participant is executed in a local CLAMP/Policy environment. The CLAMP-Controlloop interfaces interact with the Policy Framework to perform actions based on the state of the policy participant. The goal of the Smoke tests is the ensure that CLAMP Policy Participant and Policy Framework work together as expected.
2. Setup Guide
**************
+
This section will show the developer how to set up their environment to start testing in GUI with some instruction on how to carry out the tests. There are a number of prerequisites. Note that this guide is written by a Linux user - although the majority of the steps show will be exactly the same in Windows or other systems.
2.1 Prerequisites
=================
+
- Java 11
- Maven 3
- Git
- policy/docker
- policy/gui
- policy/api
+
In this setup guide, we will be setting up all the components technically required for a working convenient dev environment.
2.3 Setting up the components
2.3.2 DMAAP Simulator
^^^^^^^^^^^^^^^^^^^^^
+
For convenience, a dmaap simulator has been provided in the policy/models repository. To start the simulator, you can do the following:
1. Navigate to /models-sim/policy-models-simulators in the policy/models repository.
2. Add a configuration file to src/test/resources with the following contents:
2.3.3 Policy API
^^^^^^^^^^^^^^^^
+
In the policy-api repo, you should find the file "src/main/resources/etc/defaultConfig.json". This file must be altered slightly - as below with the restServerParameters and databaseProviderParameters shown. Note how the database parameters match-up with what you setup in Mariadb:
.. code-block:: json
2.3.4 Policy PAP
^^^^^^^^^^^^^^^^
+
In the policy-pap repo, you should find the file 'main/src/test/resources/parameters/PapConfigParameters.json'. This file may need to be altered slightly as below:
.. code-block:: json
2.3.5 Controlloop Runtime
^^^^^^^^^^^^^^^^^^^^^^^^^
+
To start the controlloop runtime we need to go the "runtime-controlloop" directory in the clamp repo. There is a config file that is used, by default, for the controlloop runtime. That config file is here: "src/main/resources/application.yaml". For development in your local environment, it shouldn't need any adjustment and we can just run the controlloop runtime with:
.. code-block:: bash
2.3.6 Controlloop Policy Participant
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
To start the policy participant we need to go to the "participant-impl/participant-impl-policy" directory in the clamp repo. There is a config file under "src/main/resources/config/application.yaml". For development in your local environment, we will need to adjust this file slightly:
.. code-block:: yaml
3.1 Testing Outline
^^^^^^^^^^^^^^^^^^^
+
To perform the Smoke testing of the policy-participant we will be verifying the behaviours of the participant when the control loop changes state. The scenarios are:
- UNINITIALISED to PASSIVE: participant creates policies and policyTypes specified in the ToscaServiceTemplate using policy-api
Creation of Controlloop:
************************
+
A Control Loop is created by commissioning a Tosca template with Control loop definitions and instantiating the Control Loop with the state "UNINITIALISED".
Using postman, commision a TOSCA template and instantiate using the following template:
Creation of policies and policyTypes:
*************************************
+
The Controlloop STATE is changed from UNINITIALISED to PASSIVE using postman:
.. code-block:: json
Deployment of policies:
***********************
+
The Controlloop STATE is changed from PASSIVE to RUNNING using postman:
.. code-block:: json
Undeployment of policies:
*************************
+
The Controlloop STATE is changed from RUNNING to PASSIVE using postman:
.. code-block:: json
Deletion of policies and policyTypes:
*************************************
+
The Controlloop STATE is changed from PASSIVE to UNINITIALISED using postman:
.. code-block:: json
.. image:: images/pol-part-controlloop-sirisha-nf.png
.. image:: images/pol-part-controlloop-pmcontrol-nf.png
-