From 2154ace6b9d58100212fc5db917d60eb7f69a7a6 Mon Sep 17 00:00:00 2001 From: FrancescoFioraEst Date: Wed, 12 Apr 2023 16:12:50 +0100 Subject: Update doc CLAMP Automation Composition Smoke Tests Update "CLAMP Automation Composition Smoke Tests", and "CLAMP participants (kubernetes, http) Smoke Tests" docs Issue-ID: POLICY-4597 Change-Id: I5093888b5c378efbe14b0f5c71e8c8aaf9dacf10 Signed-off-by: FrancescoFioraEst --- .../devtools/acm-participants-smoke.rst | 258 ------------- docs/development/devtools/clamp-smoke.rst | 414 --------------------- docs/development/devtools/devtools.rst | 4 +- .../devtools/json/acm-instantiation.json | 53 --- .../devtools/smoke/acm-participants-smoke.rst | 267 +++++++++++++ docs/development/devtools/smoke/clamp-smoke.rst | 362 ++++++++++++++++++ .../devtools/smoke/json/acm-instantiation.json | 62 +++ .../smoke/tosca/smoke-test-participants.yaml | 217 +++++++++++ .../devtools/tosca/smoke-test-participants.yaml | 260 ------------- 9 files changed, 910 insertions(+), 987 deletions(-) delete mode 100644 docs/development/devtools/acm-participants-smoke.rst delete mode 100644 docs/development/devtools/clamp-smoke.rst delete mode 100644 docs/development/devtools/json/acm-instantiation.json create mode 100644 docs/development/devtools/smoke/acm-participants-smoke.rst create mode 100644 docs/development/devtools/smoke/clamp-smoke.rst create mode 100644 docs/development/devtools/smoke/json/acm-instantiation.json create mode 100644 docs/development/devtools/smoke/tosca/smoke-test-participants.yaml delete mode 100644 docs/development/devtools/tosca/smoke-test-participants.yaml (limited to 'docs') diff --git a/docs/development/devtools/acm-participants-smoke.rst b/docs/development/devtools/acm-participants-smoke.rst deleted file mode 100644 index 5e54d905..00000000 --- a/docs/development/devtools/acm-participants-smoke.rst +++ /dev/null @@ -1,258 +0,0 @@ -.. This work is licensed under a Creative Commons Attribution 4.0 International License. - -.. _clamp-acm-participants-smoke-tests: - -CLAMP participants (kubernetes, http) Smoke Tests -------------------------------------------------- -1. Introduction -*************** -The CLAMP participants (kubernetes and http) are used to interact with the helm client in a kubernetes environment for the -deployment of microservices via helm chart as well as to configure the microservices over REST endpoints. Both of these participants are -often used together in the Automation Composition Management workflow. - -This document will serve as a guide to do smoke tests on the different components that are involved when working with the participants and outline how they operate. It will also show a developer how to set up their environment for carrying out smoke tests on these participants. - -2. Setup Guide -************** -This article assumes that: - -* You are using the operating systems such as linux/macOS/windows. -* You are using a directory called *git* off your home directory *(~/git)* for your git repositories -* Your local maven repository is in the location *~/.m2/repository* -* You have copied the settings.xml from oparent to *~/.m2/* directory -* You have added settings to access the ONAP Nexus to your M2 configuration, see `Maven Settings Example `_ (bottom of the linked page) - -The procedure documented in this article has been verified using Ubuntu 20.04 LTS VM. - -2.1 Prerequisites -================= -- Java 11 -- Docker -- Maven 3 -- Git -- helm3 -- k8s cluster -- Refer to this guide for basic environment setup `Setting up dev environment `_ - -2.2 Assumptions -=============== -- You are accessing the policy repositories through gerrit. - -The following repositories are required for development in this project. These repositories should be present on your machine and you should run "mvn clean install" on all of them so that the packages are present in your .m2 repository. - -- policy/parent -- policy/common -- policy/models -- policy/clamp -- policy/docker - -In this setup guide, we will be setting up all the components technically required for a working dev environment. - -2.3 Setting up the components -============================= - -2.3.1 MariaDB Setup -^^^^^^^^^^^^^^^^^^^ -We will be using Docker to run our mariadb instance. It will have the acm-runtime database running in it. - -- AutomationComposition: the runtime-acm db - -The easiest way to do this is to perform a small alteration on an SQL script provided by the clamp backend in the file "runtime/extra/sql/bulkload/create-db.sql" - -.. code-block:: mysql - - CREATE DATABASE `clampacm`; - USE `clampacm`; - DROP USER 'policy'; - CREATE USER 'policy'; - GRANT ALL on clampacm.* to 'policy' identified by 'P01icY' with GRANT OPTION; - -Once this has been done, we can run the bash script provided here: "runtime/extra/bin-for-dev/start-db.sh" - -.. code-block:: bash - - ./start-db.sh - -This will setup all the automation composition runtime database. The database will be exposed locally on port 3306 and will be backed by an anonymous docker volume. - -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: - -.. code-block:: json - - { - "dmaapProvider":{ - "name":"DMaaP simulator", - "topicSweepSec":900 - }, - "restServers":[ - { - "name":"DMaaP simulator", - "providerClass":"org.onap.policy.models.sim.dmaap.rest.DmaapSimRestControllerV1", - "host":"localhost", - "port":3904, - "https":false - } - ] - } - -3. You can then start dmaap with: - -.. code-block:: bash - - mvn exec:java -Dexec.mainClass=org.onap.policy.models.simulators.Main -Dexec.args="src/test/resources/YOUR_CONF_FILE.json" - -At this stage the dmaap simulator should be running on your local machine on port 3904. - - -2.3.3 Automation composition Runtime -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -To start the automation composition runtime service, we need to execute the following maven command from the "runtime-acm" directory in the clamp repo. Automation composition runtime uses the config file "src/main/resources/application.yaml" by default. - -.. code-block:: bash - - mvn spring-boot:run - -2.3.4 Helm chart repository -^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Kubernetes participant consumes helm charts from the local chart database as well as from a helm repository. For the smoke testing, we are going to add `nginx-stable` helm repository to the helm client. -The following command can be used to add nginx repository to the helm client. - -.. code-block:: bash - - helm repo add nginx-stable https://helm.nginx.com/stable - -2.3.5 Kubernetes and http participants -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -The participants can be started from the clamp repository by executing the following maven command from the appropriate directories. -The participants will be started and get registered to the Automation composition runtime. - -Navigate to the directory "participant/participant-impl/participant-impl-kubernetes/" and start kubernetes participant. - -.. code-block:: bash - - mvn spring-boot:run - -Navigate to the directory "participant/participant-impl/participant-impl-http/" and start http participant. - -.. code-block:: bash - - mvn spring-boot:run - -For building docker images of runtime-acm and participants: - -.. code-block:: bash - - cd ~/git/onap/policy/clamp/packages/ - mvn clean install -P docker - - -3. Running Tests -**************** -In this section, we will run through the sequence of steps in ACM workflow . The workflow can be triggered via Postman client. - -3.1 Commissioning -================= -Commission Automation composition TOSCA definitions to Runtime. - -The Automation composition definitions are commissioned to runtime-acm which populates the ACM runtime database. -The following sample TOSCA template is commissioned to the runtime endpoint which contains definitions for kubernetes participant that deploys nginx ingress microservice -helm chart and a http POST request for http participant. - -:download:`Tosca Service Template ` - -Commissioning Endpoint: - -.. code-block:: bash - - POST: https:// : /onap/policy/clamp/acm/v2/commission - -A successful commissioning gives 200 responses in the postman client. - - -3.2 Create New Instances of Automation composition -================================================== -Once the template is commissioned, we can instantiate automation composition instances. This will create the instances with default state "UNINITIALISED". - -Instantiation Endpoint: - -.. code-block:: bash - - POST: https:// : /onap/policy/clamp/acm/v2/instantiation - -Request body: - -:download:`Instantiation json ` - -3.3 Change the State of the Instance -==================================== -When the automation composition is updated with state “PASSIVE”, the Kubernetes participant fetches the node template for all automation composition elements and deploys the helm chart of each AC element into the cluster. The following sample json input is passed on the request body. - -Automation Composition Update Endpoint: - -.. code-block:: bash - - PUT: https:// : /onap/policy/clamp/acm/v2/instantiation/command - - Request body: -.. code-block:: bash - - { - "orderedState": "PASSIVE", - "automationCompositionIdentifierList": [ - { - "name": "K8SInstance0", - "version": "1.0.1" - } - ] - } - - -After the state changed to "PASSIVE", nginx-ingress pod is deployed in the kubernetes cluster. And http participant should have posted the dummy data to the configured URL in the tosca template. - -The following command can be used to verify the pods deployed successfully by kubernetes participant. - -.. code-block:: bash - - helm ls -n onap | grep nginx - kubectl get po -n onap | grep nginx - -The overall state of the automation composition should be "PASSIVE" to indicate both the participants has successfully completed the operations. This can be verified by the following rest endpoint. - -Verify automation composition state: - -.. code-block:: bash - - GET: https:// : /onap/policy/clamp/acm/v2/instantiation - - -3.4 Automation Compositions can be "UNINITIALISED" after deployment -=================================================================== - -By changing the state to "UNINITIALISED", all the helm deployments under the corresponding automation composition will be uninstalled from the cluster. -Automation Composition Update Endpoint: - -.. code-block:: bash - - PUT: https:// : /onap/policy/clamp/acm/v2/instantiation/command - - Request body: -.. code-block:: bash - - { - "orderedState": "UNINITIALISED", - "automationCompositionIdentifierList": [ - { - "name": "K8SInstance0", - "version": "1.0.1" - } - ] - } - -The nginx pod should be deleted from the k8s cluster. - -This concludes the required smoke tests for http and kubernetes participants. diff --git a/docs/development/devtools/clamp-smoke.rst b/docs/development/devtools/clamp-smoke.rst deleted file mode 100644 index 3a1efa9b..00000000 --- a/docs/development/devtools/clamp-smoke.rst +++ /dev/null @@ -1,414 +0,0 @@ -.. This work is licensed under a -.. Creative Commons Attribution 4.0 International License. -.. http://creativecommons.org/licenses/by/4.0 - -.. _policy-clamp-runtime-smoke-label: - -CLAMP Automation Composition Smoke Tests -######################################## - -.. contents:: - :depth: 3 - - -This article explains how to build the CLAMP automation composition for development purposes and how to run smoke tests for automation composition. To start, the developer should consult the latest ONAP Wiki to familiarize themselves with developer best practices and how-tos to setup their environment, see `https://wiki.onap.org/display/DW/Developer+Best+Practices`. - - -This article assumes that: - -* You are using a *\*nix* operating system such as linux or macOS. -* You are using a directory called *git* off your home directory *(~/git)* for your git repositories -* Your local maven repository is in the location *~/.m2/repository* -* You have copied the settings.xml from oparent to *~/.m2/* directory -* You have added settings to access the ONAP Nexus to your M2 configuration, see `Maven Settings Example `_ (bottom of the linked page) - -The procedure documented in this article has been verified using Ubuntu 20.04 LTS VM. - -Cloning CLAMP automation composition and all dependency -******************************************************* - -Run a script such as the script below to clone the required modules from the `ONAP git repository `_. This script clones CLAMP automation composition and all dependency. - -ONAP Policy Framework has dependencies to the ONAP Parent *oparent* module, the ONAP ECOMP SDK *ecompsdkos* module, and the A&AI Schema module. - - -.. code-block:: bash - :caption: Typical ONAP Policy Framework Clone Script - :linenos: - - #!/usr/bin/env bash - - ## script name for output - MOD_SCRIPT_NAME='basename $0' - - ## the ONAP clone directory, defaults to "onap" - clone_dir="onap" - - ## the ONAP repos to clone - onap_repos="\ - policy/parent \ - policy/common \ - policy/models \ - policy/clamp \ - policy/docker " - - ## - ## Help screen and exit condition (i.e. too few arguments) - ## - Help() - { - echo "" - echo "$MOD_SCRIPT_NAME - clones all required ONAP git repositories" - echo "" - echo " Usage: $MOD_SCRIPT_NAME [-options]" - echo "" - echo " Options" - echo " -d - the ONAP clone directory, defaults to '.'" - echo " -h - this help screen" - echo "" - exit 255; - } - - ## - ## read command line - ## - while [ $# -gt 0 ] - do - case $1 in - #-d ONAP clone directory - -d) - shift - if [ -z "$1" ]; then - echo "$MOD_SCRIPT_NAME: no clone directory" - exit 1 - fi - clone_dir=$1 - shift - ;; - - #-h prints help and exists - -h) - Help;exit 0;; - - *) echo "$MOD_SCRIPT_NAME: undefined CLI option - $1"; exit 255;; - esac - done - - if [ -f "$clone_dir" ]; then - echo "$MOD_SCRIPT_NAME: requested clone directory '$clone_dir' exists as file" - exit 2 - fi - if [ -d "$clone_dir" ]; then - echo "$MOD_SCRIPT_NAME: requested clone directory '$clone_dir' exists as directory" - exit 2 - fi - - mkdir $clone_dir - if [ $? != 0 ] - then - echo cannot clone ONAP repositories, could not create directory '"'$clone_dir'"' - exit 3 - fi - - for repo in $onap_repos - do - repoDir=`dirname "$repo"` - repoName=`basename "$repo"` - - if [ ! -z $dirName ] - then - mkdir "$clone_dir/$repoDir" - if [ $? != 0 ] - then - echo cannot clone ONAP repositories, could not create directory '"'$clone_dir/repoDir'"' - exit 4 - fi - fi - - git clone https://gerrit.onap.org/r/${repo} $clone_dir/$repo - done - - echo ONAP has been cloned into '"'$clone_dir'"' - - -Execution of the script above results in the following directory hierarchy in your *~/git* directory: - - * ~/git/onap - * ~/git/onap/policy - * ~/git/onap/policy/parent - * ~/git/onap/policy/common - * ~/git/onap/policy/models - * ~/git/onap/policy/clamp - * ~/git/onap/policy/docker - - -Building CLAMP automation composition and all dependency -******************************************************** - -**Step 1:** Optionally, for a completely clean build, remove the ONAP built modules from your local repository. - - .. code-block:: bash - - rm -fr ~/.m2/repository/org/onap - - -**Step 2:** A pom such as the one below can be used to build the ONAP Policy Framework modules. Create the *pom.xml* file in the directory *~/git/onap/policy*. - -.. code-block:: xml - :caption: Typical pom.xml to build the ONAP Policy Framework - :linenos: - - - 4.0.0 - org.onap - onap-policy - 1.0.0-SNAPSHOT - pom - ${project.artifactId} - 2017 - - ONAP - - - - parent - common - models - clamp - - - - -**Step 3:** You can now build the Policy framework. - -Build java artifacts only: - - .. code-block:: bash - - cd ~/git/onap/policy - mvn -pl '!org.onap.policy.clamp:policy-clamp-runtime' install - -Build with docker images: - - .. code-block:: bash - - cd ~/git/onap/policy/clamp/packages/ - mvn clean install -P docker - -Running MariaDb and DMaaP Simulator -*********************************** - -Running a MariaDb Instance -++++++++++++++++++++++++++ - -Assuming you have successfully built the codebase using the instructions above. There are two requirements for the Clamp automation composition component to run, one of them is a -running MariaDb database instance. The easiest way to do this is to run the docker image locally. - -A sql such as the one below can be used to build the SQL initialization. Create the *mariadb.sql* file in the directory *~/git*. - - .. code-block:: SQL - - create database clampacm; - CREATE USER 'policy'@'%' IDENTIFIED BY 'P01icY'; - GRANT ALL PRIVILEGES ON clampacm.* TO 'policy'@'%'; - - -Execution of the command above results in the creation and start of the *mariadb-smoke-test* container. - - .. code-block:: bash - - cd ~/git - docker run --name mariadb-smoke-test \ - -p 3306:3306 \ - -e MYSQL_ROOT_PASSWORD=my-secret-pw \ - --mount type=bind,source=~/git/mariadb.sql,target=/docker-entrypoint-initdb.d/data.sql \ - mariadb:10.5.8 - - -Running the DMaaP Simulator during Development -++++++++++++++++++++++++++++++++++++++++++++++ -The second requirement for the Clamp automation composition component to run is to run the DMaaP simulator. You can run it from the command line using Maven. - - -Change the local configuration file *src/test/resources/simParameters.json* using the below code: - -.. code-block:: json - - { - "dmaapProvider": { - "name": "DMaaP simulator", - "topicSweepSec": 900 - }, - "restServers": [ - { - "name": "DMaaP simulator", - "providerClass": "org.onap.policy.models.sim.dmaap.rest.DmaapSimRestControllerV1", - "host": "localhost", - "port": 3904, - "https": false - } - ] - } - -Run the following commands: - - .. code-block:: bash - - cd ~/git/onap/policy/models/models-sim/policy-models-simulators - mvn exec:java -Dexec.mainClass=org.onap.policy.models.simulators.Main -Dexec.args="src/test/resources/simParameters.json" - - -Developing and Debugging CLAMP automation composition -***************************************************** - -Running on the Command Line using Maven -+++++++++++++++++++++++++++++++++++++++ - -Once the mariadb and DMaap simulator are up and running, run the following commands: - - .. code-block:: bash - - cd ~/git/onap/policy/clamp/runtime-acm - mvn spring-boot:run - - -Running on the Command Line -+++++++++++++++++++++++++++ - - .. code-block:: bash - - cd ~/git/onap/policy/clamp/runtime-acm - java -jar target/policy-clamp-runtime-acm-6.2.2-SNAPSHOT.jar - - -Running in Eclipse -++++++++++++++++++ - -1. Check out the policy models repository -2. Go to the *policy-clamp-runtime-acm* module in the clamp repo -3. Specify a run configuration using the class *org.onap.policy.clamp.acm.runtime.Application* as the main class -4. Run the configuration - -Swagger UI of Automation composition is available at *http://localhost:6969/onap/policy/clamp/acm/swagger-ui/*, and swagger JSON at *http://localhost:6969/onap/policy/clamp/acm/v2/api-docs/* - - -Running one or more participant simulators -++++++++++++++++++++++++++++++++++++++++++ - -Into *docker\csit\clamp\tests\data* you can find a test case with policy-participant. In order to use that test you can use particpant-simulator. -Copy the file *src/main/resources/config/application.yaml* and paste into *src/test/resources/*, after that change *participantId* and *participantType* as showed below: - - .. code-block:: yaml - - participantId: - name: org.onap.PM_Policy - version: 1.0.0 - participantType: - name: org.onap.policy.clamp.acm.PolicyParticipant - version: 2.3.1 - -Run the following commands: - - .. code-block:: bash - - cd ~/git/onap/policy/clamp/participant/participant-impl/participant-impl-simulator - java -jar target/policy-clamp-participant-impl-simulator-6.2.2-SNAPSHOT.jar --spring.config.location=src/main/resources/config/application.yaml - - -Creating self-signed certificate -++++++++++++++++++++++++++++++++ - -There is an additional requirement for the Clamp automation composition docker image to run, is creating the SSL self-signed certificate. - -Run the following commands: - - .. code-block:: bash - - cd ~/git/onap/policy/docker/csit/ - ./gen_truststore.sh - ./gen_keystore.sh - -Execution of the commands above results additional files into the following directory *~/git/onap/policy/docker/csit/config*: - - * ~/git/onap/policy/docker/csit/config/cakey.pem - * ~/git/onap/policy/docker/csit/config/careq.pem - * ~/git/onap/policy/docker/csit/config/caroot.cer - * ~/git/onap/policy/docker/csit/config/ks.cer - * ~/git/onap/policy/docker/csit/config/ks.csr - * ~/git/onap/policy/docker/csit/config/ks.jks - - -Running the CLAMP automation composition docker image -+++++++++++++++++++++++++++++++++++++++++++++++++++++ - -Run the following command: - - .. code-block:: bash - - docker run --name runtime-smoke-test \ - -p 6969:6969 \ - -e mariadb.host=host.docker.internal \ - -e topicServer=host.docker.internal \ - --mount type=bind,source=~/git/onap/policy/docker/csit/config/ks.jks,target=/opt/app/policy/clamp/etc/ssl/policy-keystore \ - --mount type=bind,source=~/git/onap/policy/clamp/runtime-acm/src/main/resources/application.yaml,target=/opt/app/policy/clamp/etc/AcRuntimeParameters.yaml \ - onap/policy-clamp-runtime-acm - - -Swagger UI of automation composition is available at *https://localhost:6969/onap/policy/clamp/acm/swagger-ui/*, and swagger JSON at *https://localhost:6969/onap/policy/clamp/acm/v2/api-docs/* - - -Using CLAMP runtime to connect to CLAMP automation composition -************************************************************** - -Build CLAMP runtime image: - - .. code-block:: bash - - cd ~/git/onap/policy/clamp/runtime - mvn clean install -P docker -DskipTests - - -Run the following docker composition: - - .. code-block:: yaml - - version: '3.1' - - services: - db: - image: mariadb:10.5.8 - volumes: - - "~/git/onap/policy/clamp/runtime/extra/sql/:/docker-entrypoint-initdb.d:rw" - environment: - - MYSQL_ROOT_PASSWORD=strong_pitchou - ports: - - "3306:3306" - - policy-clamp-backend: - image: onap/policy-clamp-backend - depends_on: - - db - - third-party-proxy - environment: - - SPRING_DATASOURCE_URL=jdbc:mariadb:sequential://db:3306/cldsdb4?autoReconnect=true&connectTimeout=10000&socketTimeout=10000&retriesAllDown=3 - - SPRING_PROFILES_ACTIVE=clamp-default,clamp-default-user,clamp-sdc-controller,clamp-ssl-config,clamp-policy-controller,default-dictionary-elements - - CLAMP_CONFIG_POLICY_API_URL=http://third-party-proxy:8085 - - CLAMP_CONFIG_ACM_RUNTIME_URL=http://host.docker.internal:6969 - - CLAMP_CONFIG_POLICY_PAP_URL=http://third-party-proxy:8085 - - CLAMP_CONFIG_DCAE_INVENTORY_URL=http://third-party-proxy:8085 - - CLAMP_CONFIG_DCAE_DEPLOYMENT_URL=http://third-party-proxy:8085 - - SPRING_CONFIG_LOCATION=classpath:/application.properties - ports: - - "10443:8443" - - third-party-proxy: - image: python:2-slim - volumes: - - "~/git/onap/policy/clamp/runtime/src/test/resources/http-cache/example/:/thirdparty:rw" - - "~/git/onap/policy/clamp/runtime/src/test/resources/http-cache/:/script/:ro" - ports: - - "8085:8085" - command: /bin/sh -c "pip install --no-cache-dir requests && pip install --no-cache-dir simplejson && python -u /script/third_party_proxy.py -v true --port 8085 --root /thirdparty --proxyaddress third-party-proxy:8085" - - -Run DMaaP simulator, and then run CLAMP Acm using java. diff --git a/docs/development/devtools/devtools.rst b/docs/development/devtools/devtools.rst index c626966f..0ea25d09 100644 --- a/docs/development/devtools/devtools.rst +++ b/docs/development/devtools/devtools.rst @@ -304,8 +304,8 @@ familiar with the Policy Framework components and test any local changes. policy-gui-acm-smoke.rst db-migrator-smoke.rst - acm-participants-smoke.rst - clamp-smoke.rst + smoke/acm-participants-smoke.rst + smoke/clamp-smoke.rst clamp-cl-participant-protocol-smoke.rst policy-participant-smoke.rst api-smoke.rst diff --git a/docs/development/devtools/json/acm-instantiation.json b/docs/development/devtools/json/acm-instantiation.json deleted file mode 100644 index 9977cf02..00000000 --- a/docs/development/devtools/json/acm-instantiation.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "automationCompositionList ": [ - { - "name": "K8SInstance0", - "version": "1.0.1", - "definition": { - "name": "org.onap.domain.sample.GenericK8s_AutomationCompositionDefinition", - "version": "1.2.3" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "K8s automation composition instance 0", - "elements": { - "709c62b3-8918-41b9-a747-d21eb79c6c21": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", - "definition": { - "name": "org.onap.policy.clamp.Local_K8SMicroserviceAutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "K8sParticipant0", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.policy.clamp.acm.KubernetesParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "K8s Automation composition Element for the nginx-ingress microservice" - }, - "709c62b3-8918-41b9-a747-d21eb79c6c22": { - "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", - "definition": { - "name": "org.onap.policy.clamp.Http_AutomationCompositionElement", - "version": "1.2.3" - }, - "participantId": { - "name": "HttpParticipant0", - "version": "1.0.0" - }, - "participantType": { - "name": "org.onap.policy.clamp.acm.HttpParticipant", - "version": "2.3.4" - }, - "state": "UNINITIALISED", - "orderedState": "UNINITIALISED", - "description": "Http Automation composition Element" - } - } - } - ] -} \ No newline at end of file diff --git a/docs/development/devtools/smoke/acm-participants-smoke.rst b/docs/development/devtools/smoke/acm-participants-smoke.rst new file mode 100644 index 00000000..0b8061e2 --- /dev/null +++ b/docs/development/devtools/smoke/acm-participants-smoke.rst @@ -0,0 +1,267 @@ +.. This work is licensed under a Creative Commons Attribution 4.0 International License. + +.. _clamp-acm-participants-smoke-tests: + +CLAMP participants (kubernetes, http) Smoke Tests +------------------------------------------------- +1. Introduction +*************** +The CLAMP participants (kubernetes and http) are used to interact with the helm client in a kubernetes environment for the +deployment of microservices via helm chart as well as to configure the microservices over REST endpoints. Both of these participants are +often used together in the Automation Composition Management workflow. + +This document will serve as a guide to do smoke tests on the different components that are involved when working with the participants and outline how they operate. It will also show a developer how to set up their environment for carrying out smoke tests on these participants. + +2. Setup Guide +************** +This article assumes that: + +* You are using the operating systems such as linux/macOS/windows. +* You are using a directory called *git* off your home directory *(~/git)* for your git repositories +* Your local maven repository is in the location *~/.m2/repository* +* You have copied the settings.xml from oparent to *~/.m2/* directory +* You have added settings to access the ONAP Nexus to your M2 configuration, see `Maven Settings Example `_ (bottom of the linked page) + +The procedure documented in this article has been verified using Ubuntu 20.04 LTS VM. + +2.1 Prerequisites +================= +- Java 11 +- Docker +- Maven 3 +- Git +- helm3 +- k8s cluster +- Refer to this guide for basic environment setup `Setting up dev environment `_ + +2.2 Assumptions +=============== +- You are accessing the policy repositories through gerrit. + +The following repositories are required for development in this project. These repositories should be present on your machine and you should run "mvn clean install" on all of them so that the packages are present in your .m2 repository. + +- policy/parent +- policy/common +- policy/models +- policy/clamp + +In this setup guide, we will be setting up all the components technically required for a working dev environment. + +2.3 Setting up the components +============================= + +2.3.1 MariaDB Setup +^^^^^^^^^^^^^^^^^^^ +We will be using Docker to run our mariadb instance. It will have the acm-runtime database running in it. + +- AutomationComposition: the runtime-acm db + +The easiest way to do this is to perform a SQL script. Create the *mariadb.sql* file in the directory *~/git*. + +.. code-block:: mysql + + CREATE DATABASE `clampacm`; + USE `clampacm`; + CREATE USER 'policy'; + GRANT ALL on clampacm.* to 'policy' identified by 'P01icY' with GRANT OPTION; + +Execution of the command above results in the creation and start of the *mariadb-smoke-test* container. + + .. code-block:: bash + + cd ~/git + docker run --name mariadb-smoke-test \ + -p 3306:3306 \ + -e MYSQL_ROOT_PASSWORD=my-secret-pw \ + --mount type=bind,source=$HOME/git/mariadb.sql,target=/docker-entrypoint-initdb.d/data.sql \ + -d mariadb:10.10.2 \ + --lower-case-table-names=1 + +The database will be exposed locally on port 3306 and will be backed by an anonymous docker volume. + +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: + +.. code-block:: json + + { + "dmaapProvider":{ + "name":"DMaaP simulator", + "topicSweepSec":900 + }, + "restServers":[ + { + "name":"DMaaP simulator", + "providerClass":"org.onap.policy.models.sim.dmaap.rest.DmaapSimRestControllerV1", + "host":"localhost", + "port":3904, + "https":false + } + ] + } + +3. You can then start dmaap with: + +.. code-block:: bash + + mvn exec:java -Dexec.mainClass=org.onap.policy.models.simulators.Main -Dexec.args="src/test/resources/YOUR_CONF_FILE.json" + +At this stage the dmaap simulator should be running on your local machine on port 3904. + + +2.3.3 Automation composition Runtime +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +To start the automation composition runtime service, we need to execute the following maven command from the "runtime-acm" directory in the clamp repo. Automation composition runtime uses the config file "src/main/resources/application.yaml" by default. + +.. code-block:: bash + + mvn spring-boot:run + +2.3.4 Helm chart repository +^^^^^^^^^^^^^^^^^^^^^^^^^^^ +Kubernetes participant consumes helm charts from the local chart database as well as from a helm repository. For the smoke testing, we are going to add `nginx-stable` helm repository to the helm client. +The following command can be used to add nginx repository to the helm client. + +.. code-block:: bash + + helm repo add nginx-stable https://helm.nginx.com/stable + +2.3.5 Kubernetes and http participants +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +The participants can be started from the clamp repository by executing the following maven command from the appropriate directories. +The participants will be started and get registered to the Automation composition runtime. + +Navigate to the directory "participant/participant-impl/participant-impl-kubernetes/" and start kubernetes participant. + +.. code-block:: bash + + mvn spring-boot:run + +Navigate to the directory "participant/participant-impl/participant-impl-http/" and start http participant. + +.. code-block:: bash + + mvn spring-boot:run + +For building docker images of runtime-acm and participants: + +.. code-block:: bash + + cd ~/git/onap/policy/clamp/packages/ + mvn clean install -P docker + + +3. Running Tests +**************** +In this section, we will run through the sequence of steps in ACM workflow . The workflow can be triggered via Postman client. + +3.1 Commissioning +================= +Commission Automation composition TOSCA definitions to Runtime. + +The Automation composition definitions are commissioned to runtime-acm which populates the ACM runtime database. +The following sample TOSCA template is commissioned to the runtime endpoint which contains definitions for kubernetes participant that deploys nginx ingress microservice +helm chart and a http POST request for http participant. + +:download:`Tosca Service Template ` + +Commissioning Endpoint: + +.. code-block:: bash + + POST: https:// : /onap/policy/clamp/acm/v2/compositions + +A successful commissioning gives 201 responses in the postman client. + +3.2 Prime an Automation composition definition +============================================== +Once the template is commissioned, we can prime it. This will connect AC definition with related participants. + +Prime Endpoint: + +.. code-block:: bash + + PUT: https:// : /onap/policy/clamp/acm/v2/compositions/{compositionId} + +Request body: + +.. code-block:: json + + { + "primeOrder": "PRIME" + } + +3.3 Create New Instances of Automation composition +================================================== +Once AC definition is primes, we can instantiate automation composition instances. This will create the instances with default state "UNDEPLOYED". + +Instantiation Endpoint: + +.. code-block:: bash + + POST: https:// : /onap/policy/clamp/acm/v2/compositions/{compositionId}/instances + +Request body: + +:download:`Instantiation json ` + +3.4 Change the State of the Instance +==================================== +When the automation composition is updated with state “DEPLOYED”, the Kubernetes participant fetches the node template for all automation composition elements and deploys the helm chart of each AC element into the cluster. The following sample json input is passed on the request body. + +Automation Composition Update Endpoint: + +.. code-block:: bash + + PUT: https:// : /onap/policy/clamp/acm/v2/compositions/{compositionId}/instances/{instanceId} + + Request body: +.. code-block:: bash + + { + "deployOrder": "DEPLOY" + } + + +After the state changed to "DEPLOYED", nginx-ingress pod is deployed in the kubernetes cluster. And http participant should have posted the dummy data to the configured URL in the tosca template. + +The following command can be used to verify the pods deployed successfully by kubernetes participant. + +.. code-block:: bash + + helm ls -n onap | grep nginx + kubectl get po -n onap | grep nginx + +The overall state of the automation composition should be "DEPLOYED" to indicate both the participants has successfully completed the operations. This can be verified by the following rest endpoint. + +Verify automation composition state: + +.. code-block:: bash + + GET: https:// : /onap/policy/clamp/acm/v2/compositions/{compositionId}/instances/{instanceId} + + +3.4 Automation Compositions can be "UNDEPLOYED" after deployment +================================================================ + +By changing the state to "UNDEPLOYED", all the helm deployments under the corresponding automation composition will be uninstalled from the cluster. +Automation Composition Update Endpoint: + +.. code-block:: bash + + PUT: https:// : /onap/policy/clamp/acm/v2/compositions/{compositionId}/instances/{instanceId} + + Request body: +.. code-block:: bash + + { + "deployOrder": "UNDEPLOY" + } + +The nginx pod should be deleted from the k8s cluster. + +This concludes the required smoke tests for http and kubernetes participants. diff --git a/docs/development/devtools/smoke/clamp-smoke.rst b/docs/development/devtools/smoke/clamp-smoke.rst new file mode 100644 index 00000000..19f4a214 --- /dev/null +++ b/docs/development/devtools/smoke/clamp-smoke.rst @@ -0,0 +1,362 @@ +.. This work is licensed under a +.. Creative Commons Attribution 4.0 International License. +.. http://creativecommons.org/licenses/by/4.0 + +.. _policy-clamp-runtime-smoke-label: + +CLAMP Automation Composition Smoke Tests +######################################## + +.. contents:: + :depth: 3 + + +This article explains how to build the CLAMP automation composition for development purposes and how to run smoke tests for automation composition. To start, the developer should consult the latest ONAP Wiki to familiarize themselves with developer best practices and how-tos to setup their environment, see `https://wiki.onap.org/display/DW/Developer+Best+Practices`. + + +This article assumes that: + +* You are using a *\*nix* operating system such as linux or macOS. +* You are using a directory called *git* off your home directory *(~/git)* for your git repositories +* Your local maven repository is in the location *~/.m2/repository* +* You have copied the settings.xml from oparent to *~/.m2/* directory +* You have added settings to access the ONAP Nexus to your M2 configuration, see `Maven Settings Example `_ (bottom of the linked page) + +The procedure documented in this article has been verified using Ubuntu 20.04 LTS VM. + +Cloning CLAMP automation composition and all dependency +******************************************************* + +Run a script such as the script below to clone the required modules from the `ONAP git repository `_. This script clones CLAMP automation composition and all dependency. + +ONAP Policy Framework has dependencies to the ONAP Parent *oparent* module, the ONAP ECOMP SDK *ecompsdkos* module, and the A&AI Schema module. + + +.. code-block:: bash + :caption: Typical ONAP Policy Framework Clone Script + :linenos: + + #!/usr/bin/env bash + + ## script name for output + MOD_SCRIPT_NAME='basename $0' + + ## the ONAP clone directory, defaults to "onap" + clone_dir="onap" + + ## the ONAP repos to clone + onap_repos="\ + policy/parent \ + policy/common \ + policy/models \ + policy/clamp " + + ## + ## Help screen and exit condition (i.e. too few arguments) + ## + Help() + { + echo "" + echo "$MOD_SCRIPT_NAME - clones all required ONAP git repositories" + echo "" + echo " Usage: $MOD_SCRIPT_NAME [-options]" + echo "" + echo " Options" + echo " -d - the ONAP clone directory, defaults to '.'" + echo " -h - this help screen" + echo "" + exit 255; + } + + ## + ## read command line + ## + while [ $# -gt 0 ] + do + case $1 in + #-d ONAP clone directory + -d) + shift + if [ -z "$1" ]; then + echo "$MOD_SCRIPT_NAME: no clone directory" + exit 1 + fi + clone_dir=$1 + shift + ;; + + #-h prints help and exists + -h) + Help;exit 0;; + + *) echo "$MOD_SCRIPT_NAME: undefined CLI option - $1"; exit 255;; + esac + done + + if [ -f "$clone_dir" ]; then + echo "$MOD_SCRIPT_NAME: requested clone directory '$clone_dir' exists as file" + exit 2 + fi + if [ -d "$clone_dir" ]; then + echo "$MOD_SCRIPT_NAME: requested clone directory '$clone_dir' exists as directory" + exit 2 + fi + + mkdir $clone_dir + if [ $? != 0 ] + then + echo cannot clone ONAP repositories, could not create directory '"'$clone_dir'"' + exit 3 + fi + + for repo in $onap_repos + do + repoDir=`dirname "$repo"` + repoName=`basename "$repo"` + + if [ ! -z $dirName ] + then + mkdir "$clone_dir/$repoDir" + if [ $? != 0 ] + then + echo cannot clone ONAP repositories, could not create directory '"'$clone_dir/repoDir'"' + exit 4 + fi + fi + + git clone https://gerrit.onap.org/r/${repo} $clone_dir/$repo + done + + echo ONAP has been cloned into '"'$clone_dir'"' + + +Execution of the script above results in the following directory hierarchy in your *~/git* directory: + + * ~/git/onap + * ~/git/onap/policy + * ~/git/onap/policy/parent + * ~/git/onap/policy/common + * ~/git/onap/policy/models + * ~/git/onap/policy/clamp + + +Building CLAMP automation composition and all dependency +******************************************************** + +**Step 1:** Optionally, for a completely clean build, remove the ONAP built modules from your local repository. + + .. code-block:: bash + + rm -fr ~/.m2/repository/org/onap + + +**Step 2:** A pom such as the one below can be used to build the ONAP Policy Framework modules. Create the *pom.xml* file in the directory *~/git/onap/policy*. + +.. code-block:: xml + :caption: Typical pom.xml to build the ONAP Policy Framework + :linenos: + + + 4.0.0 + org.onap + onap-policy + 1.0.0-SNAPSHOT + pom + ${project.artifactId} + 2023 + + ONAP + + + + parent + common + models + clamp + + + + +**Step 3:** You can now build the Policy framework. + +Build java artifacts only: + + .. code-block:: bash + + cd ~/git/onap/policy + mvn clean install + +Build with docker images: + + .. code-block:: bash + + cd ~/git/onap/policy/clamp/packages/ + mvn clean install -P docker + + cd ~/git/onap/policy/models/models-sim/packages + mvn clean install -P docker + +Running MariaDb and DMaaP Simulator +*********************************** + +Running a MariaDb Instance +++++++++++++++++++++++++++ + +Assuming you have successfully built the codebase using the instructions above. There are two requirements for the Clamp automation composition component to run, one of them is a +running MariaDb database instance. The easiest way to do this is to run the docker image locally. + +A sql such as the one below can be used to build the SQL initialization. Create the *mariadb.sql* file in the directory *~/git*. + + .. code-block:: SQL + + create database clampacm; + CREATE USER 'policy'@'%' IDENTIFIED BY 'P01icY'; + GRANT ALL PRIVILEGES ON clampacm.* TO 'policy'@'%'; + + +Execution of the command above results in the creation and start of the *mariadb-smoke-test* container. + + .. code-block:: bash + + cd ~/git + docker run --name mariadb-smoke-test \ + -p 3306:3306 \ + -e MYSQL_ROOT_PASSWORD=my-secret-pw \ + --mount type=bind,source=$HOME/git/mariadb.sql,target=/docker-entrypoint-initdb.d/data.sql \ + -d mariadb:10.10.2 \ + --lower-case-table-names=1 + + +Running the DMaaP Simulator during Development +++++++++++++++++++++++++++++++++++++++++++++++ +The second requirement for the Clamp automation composition component to run is to run the DMaaP simulator. You can run it from the command line using Maven. + + +Create a new configuration file *~/git/onap/policy/models/models-sim/policy-models-simulators/src/test/resources/newParameters.json* using the below code: + +.. code-block:: json + + { + "dmaapProvider": { + "name": "DMaaP simulator", + "topicSweepSec": 900 + }, + "restServers": [ + { + "name": "DMaaP simulator", + "providerClass": "org.onap.policy.models.sim.dmaap.rest.DmaapSimRestControllerV1", + "host": "localhost", + "port": 3904, + "https": false + } + ] + } + +Run the following commands: + + .. code-block:: bash + + cd ~/git/onap/policy/models/models-sim/policy-models-simulators + mvn exec:java -Dexec.mainClass=org.onap.policy.models.simulators.Main -Dexec.args="src/test/resources/newParameters.json" + + +Developing and Debugging CLAMP automation composition +***************************************************** + +Running on the Command Line using Maven ++++++++++++++++++++++++++++++++++++++++ + +Once the mariadb and DMaap simulator are up and running, run the following commands: + + .. code-block:: bash + + cd ~/git/onap/policy/clamp/runtime-acm + mvn spring-boot:run + + +Running on the Command Line ++++++++++++++++++++++++++++ + + .. code-block:: bash + + cd ~/git/onap/policy/clamp/runtime-acm + java -jar target/policy-clamp-runtime-acm-6.4.2-SNAPSHOT.jar + + +Running in Eclipse +++++++++++++++++++ + +1. Check out the policy models repository +2. Go to the *policy-clamp-runtime-acm* module in the clamp repo +3. Where necessary Add as Source Folder 'target/generated-sources/swagger' +4. Specify a run configuration using the class *org.onap.policy.clamp.acm.runtime.Application* as the main class +5. Run the configuration + +Swagger UI of Automation composition is available at *http://localhost:6969/onap/policy/clamp/acm/swagger-ui/index.html* + + +Running one or more participants +++++++++++++++++++++++++++++++++ + +Into :ref:`HTTP Participant ` you can find a test case with http-participant. + +Run the following commands: + + .. code-block:: bash + + cd ~/git/onap/policy/clamp/participant/participant-impl/participant-impl-http + java -jar target/policy-clamp-participant-impl-http-6.4.2-SNAPSHOT.jar + + +Running the CLAMP automation composition docker image ++++++++++++++++++++++++++++++++++++++++++++++++++++++ + +Create the '*docker-composition.yaml*' using following code: + + .. code-block:: yaml + + version: '3.1' + + services: + mariadb: + image: mariadb:10.10.2 + volumes: + - type: bind + source: ./mariadb.sql + target: /docker-entrypoint-initdb.d/data.sql + environment: + - MYSQL_ROOT_PASSWORD=my-secret-pw + - lower-case-table-names=1 + ports: + - "3306:3306" + + runtime-acm: + image: onap/policy-clamp-runtime-acm + environment: + - mariadb.host=mariadb + - topicServer=message-router + volumes: + - type: bind + source: ./onap/policy/clamp/runtime-acm/src/main/resources/application.yaml + target: /opt/app/policy/clamp/etc/AcRuntimeParameters.yaml + ports: + - "6969:6969" + + message-router: + image: onap/policy-models-simulator + volumes: + - type: bind + source: ./onap/policy/models/models-sim/policy-models-simulators/src/test/resources/newParameters.json + target: /opt/app/policy/simulators/etc/mounted/simParameters.json + ports: + - "3904:3904" + +Run the docker composition: + + .. code-block:: bash + + cd ~/git/ + docker-compose up + + +Swagger UI of automation composition is available at *http://localhost:6969/onap/policy/clamp/acm/swagger-ui/index.html* diff --git a/docs/development/devtools/smoke/json/acm-instantiation.json b/docs/development/devtools/smoke/json/acm-instantiation.json new file mode 100644 index 00000000..28eef7da --- /dev/null +++ b/docs/development/devtools/smoke/json/acm-instantiation.json @@ -0,0 +1,62 @@ +{ + "compositionId": "{{compositionId}}", + "name": "K8SInstance0", + "version": "1.0.1", + "description": "Demo automation composition instance 0", + "elements": { + "709c62b3-8918-41b9-a747-d21eb79c6c21": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c21", + "definition": { + "name": "org.onap.policy.clamp.Local_K8SMicroserviceAutomationCompositionElement", + "version": "1.2.3" + }, + "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c02", + "description": "K8s Automation composition Element for the nginx-ingress microservice", + "properties": { + "chart": { + "chartId": { + "name": "nginx-ingress", + "version": "0.11.0" + }, + "releaseName": "nginxapp", + "namespace": "onap" + } + } + }, + "709c62b3-8918-41b9-a747-d21eb79c6c22": { + "id": "709c62b3-8918-41b9-a747-d21eb79c6c22", + "definition": { + "name": "org.onap.policy.clamp.Http_AutomationCompositionElement", + "version": "1.2.3" + }, + "participantId": "101c62b3-8918-41b9-a747-d21eb79c6c01", + "description": "Http Automation composition Element", + "properties": { + "baseUrl": "http://httpbin.org", + "httpHeaders": { + "Content-Type": "application/json" + }, + "configurationEntities": [ + { + "configurationEntityId": { + "name": "entity1", + "version": "1.0.1" + }, + "restSequence": [ + { + "restRequestId": { + "name": "request1", + "version": "1.0.1" + }, + "httpMethod": "POST", + "path": "post", + "body": "Dummy data for smoke testing", + "expectedResponse": 200 + } + ] + } + ] + } + } + } +} \ No newline at end of file diff --git a/docs/development/devtools/smoke/tosca/smoke-test-participants.yaml b/docs/development/devtools/smoke/tosca/smoke-test-participants.yaml new file mode 100644 index 00000000..2cde26d8 --- /dev/null +++ b/docs/development/devtools/smoke/tosca/smoke-test-participants.yaml @@ -0,0 +1,217 @@ +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 + org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.RestRequest: + version: 1.0.0 + derived_from: tosca.datatypes.Root + properties: + restRequestId: + type: onap.datatypes.ToscaConceptIdentifier + type_version: 0.0.0 + required: true + description: The name and version of a REST request to be sent to a REST endpoint + httpMethod: + type: string + required: true + constraints: + - valid_values: [POST, PUT, GET, DELETE] + description: The REST method to use + path: + type: string + required: true + description: The path of the REST request relative to the base URL + body: + type: string + required: false + description: The body of the REST request for PUT and POST requests + expectedResponse: + type: integer + required: true + constraints: + - in_range: [100, 599] + description: THe expected HTTP status code for the REST request + org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.ConfigurationEntity: + version: 1.0.0 + derived_from: tosca.datatypes.Root + properties: + configurationEntityId: + type: onap.datatypes.ToscaConceptIdentifier + type_version: 0.0.0 + required: true + description: The name and version of a Configuration Entity to be handled by the HTTP Automation Composition Element + restSequence: + type: list + entry_schema: + type: org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.RestRequest + type_version: 1.0.0 + description: A sequence of REST commands to send to the REST endpoint +node_types: + org.onap.policy.clamp.acm.Participant: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + required: false + org.onap.policy.clamp.acm.AutomationCompositionElement: + version: 1.0.1 + derived_from: tosca.nodetypes.Root + properties: + provider: + type: string + requred: false + startPhase: + type: integer + required: false + constraints: + - greater_or_equal: 0 + metadata: + common: true + description: A value indicating the start phase in which this ACM element will be started, the + first start phase is zero. Automation Composition Elements are started in their start_phase order and stopped + in reverse start phase order. Automation Composition Elements with the same start phase are started and + stopped simultaneously + uninitializedToPassiveTimeout: + type: integer + required: false + constraints: + - greater_or_equal: 0 + default: 60 + metadata: + common: true + description: The maximum time in seconds to wait for a state chage from uninitialized to passive + passiveToRunningTimeout: + type: integer + required: false + constraints: + - greater_or_equal: 0 + default: 60 + metadata: + common: true + description: The maximum time in seconds to wait for a state chage from passive to running + runningToPassiveTimeout: + type: integer + required: false + constraints: + - greater_or_equal: 0 + default: 60 + metadata: + common: true + description: The maximum time in seconds to wait for a state chage from running to passive + passiveToUninitializedTimeout: + type: integer + required: false + constraints: + - greater_or_equal: 0 + default: 60 + metadata: + common: true + description: The maximum time in seconds to wait for a state chage from passive to uninitialized + org.onap.policy.clamp.acm.AutomationComposition: + 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.acm.K8SMicroserviceAutomationCompositionElement: + version: 1.0.0 + derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement + properties: + chart: + type: string + required: true + configs: + type: list + required: false + requirements: + type: string + requred: false + templates: + type: list + required: false + entry_schema: + values: + type: string + required: true + org.onap.policy.clamp.acm.HttpAutomationCompositionElement: + version: 1.0.0 + derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement + properties: + baseUrl: + type: string + required: true + description: The base URL to be prepended to each path, identifies the host for the REST endpoints. + httpHeaders: + type: map + required: false + entry_schema: + type: string + description: HTTP headers to send on REST requests + configurationEntities: + type: map + required: true + entry_schema: + type: org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.ConfigurationEntity + type_version: 1.0.0 + description: The connfiguration entities the Automation Composition Element is managing and their associated REST requests +topology_template: + node_templates: + org.onap.policy.clamp.acm.KubernetesParticipant: + version: 2.3.4 + type: org.onap.policy.clamp.acm.Participant + type_version: 1.0.1 + description: Participant for K8S + properties: + provider: ONAP + org.onap.policy.clamp.Local_K8SMicroserviceAutomationCompositionElement: + # Chart installation without passing repository info + version: 1.2.3 + type: org.onap.policy.clamp.acm.K8SMicroserviceAutomationCompositionElement + type_version: 1.0.0 + description: Automation Composition element for the K8S microservice for local chart + properties: + provider: ONAP + org.onap.policy.clamp.acm.HttpParticipant: + version: 2.3.4 + type: org.onap.policy.clamp.acm.Participant + type_version: 1.0.1 + description: Participant for Http requests + properties: + provider: ONAP + + org.onap.policy.clamp.Http_AutomationCompositionElement: + version: 1.2.3 + type: org.onap.policy.clamp.acm.HttpAutomationCompositionElement + type_version: 1.0.0 + description: Automation composition element for the http requests of PMSH microservice + properties: + provider: ONAP + uninitializedToPassiveTimeout: 180 + startPhase: 1 + + org.onap.domain.sample.GenericK8s_AutomationCompositionDefinition: + version: 1.2.3 + type: org.onap.policy.clamp.acm.AutomationComposition + type_version: 1.0.1 + description: Automation compostion for smoke testing participants + properties: + provider: ONAP + elements: + - name: org.onap.policy.clamp.Local_K8SMicroserviceAutomationCompositionElement + version: 1.2.3 + - name: org.onap.policy.clamp.Http_AutomationCompositionElement + version: 1.2.3 diff --git a/docs/development/devtools/tosca/smoke-test-participants.yaml b/docs/development/devtools/tosca/smoke-test-participants.yaml deleted file mode 100644 index d1244f9d..00000000 --- a/docs/development/devtools/tosca/smoke-test-participants.yaml +++ /dev/null @@ -1,260 +0,0 @@ -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 - org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.RestRequest: - version: 1.0.0 - derived_from: tosca.datatypes.Root - properties: - restRequestId: - type: onap.datatypes.ToscaConceptIdentifier - type_version: 0.0.0 - required: true - description: The name and version of a REST request to be sent to a REST endpoint - httpMethod: - type: string - required: true - constraints: - - valid_values: [POST, PUT, GET, DELETE] - description: The REST method to use - path: - type: string - required: true - description: The path of the REST request relative to the base URL - body: - type: string - required: false - description: The body of the REST request for PUT and POST requests - expectedResponse: - type: integer - required: true - constraints: - - in_range: [100, 599] - description: THe expected HTTP status code for the REST request - org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.ConfigurationEntity: - version: 1.0.0 - derived_from: tosca.datatypes.Root - properties: - configurationEntityId: - type: onap.datatypes.ToscaConceptIdentifier - type_version: 0.0.0 - required: true - description: The name and version of a Configuration Entity to be handled by the HTTP Automation Composition Element - restSequence: - type: list - entry_schema: - type: org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.RestRequest - type_version: 1.0.0 - description: A sequence of REST commands to send to the REST endpoint -node_types: - org.onap.policy.clamp.acm.Participant: - version: 1.0.1 - derived_from: tosca.nodetypes.Root - properties: - provider: - type: string - required: false - org.onap.policy.clamp.acm.AutomationCompositionElement: - version: 1.0.1 - derived_from: tosca.nodetypes.Root - properties: - provider: - type: string - requred: false - participant_id: - type: onap.datatypes.ToscaConceptIdentifier - requred: true - participantType: - type: onap.datatypes.ToscaConceptIdentifier - required: true - metadata: - common: true - description: The identity of the participant type that hosts this type of Automation Composition Element - startPhase: - type: integer - required: false - constraints: - - greater_or_equal: 0 - metadata: - common: true - description: A value indicating the start phase in which this ACM element will be started, the - first start phase is zero. Automation Composition Elements are started in their start_phase order and stopped - in reverse start phase order. Automation Composition Elements with the same start phase are started and - stopped simultaneously - uninitializedToPassiveTimeout: - type: integer - required: false - constraints: - - greater_or_equal: 0 - default: 60 - metadata: - common: true - description: The maximum time in seconds to wait for a state chage from uninitialized to passive - passiveToRunningTimeout: - type: integer - required: false - constraints: - - greater_or_equal: 0 - default: 60 - metadata: - common: true - description: The maximum time in seconds to wait for a state chage from passive to running - runningToPassiveTimeout: - type: integer - required: false - constraints: - - greater_or_equal: 0 - default: 60 - metadata: - common: true - description: The maximum time in seconds to wait for a state chage from running to passive - passiveToUninitializedTimeout: - type: integer - required: false - constraints: - - greater_or_equal: 0 - default: 60 - metadata: - common: true - description: The maximum time in seconds to wait for a state chage from passive to uninitialized - org.onap.policy.clamp.acm.AutomationComposition: - 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.acm.K8SMicroserviceAutomationCompositionElement: - version: 1.0.1 - derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement - properties: - chart: - type: string - required: true - configs: - type: list - required: false - requirements: - type: string - requred: false - templates: - type: list - required: false - entry_schema: - values: - type: string - required: true - org.onap.policy.clamp.acm.HttpAutomationCompositionElement: - version: 1.0.1 - derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement - properties: - baseUrl: - type: string - required: true - description: The base URL to be prepended to each path, identifies the host for the REST endpoints. - httpHeaders: - type: map - required: false - entry_schema: - type: string - description: HTTP headers to send on REST requests - configurationEntities: - type: map - required: true - entry_schema: - type: org.onap.datatypes.policy.clamp.acm.httpAutomationCompositionElement.ConfigurationEntity - type_version: 1.0.0 - description: The connfiguration entities the Automation Composition Element is managing and their associated REST requests -topology_template: - node_templates: - org.onap.policy.clamp.acm.KubernetesParticipant: - version: 2.3.4 - type: org.onap.policy.clamp.acm.Participant - type_version: 1.0.1 - description: Participant for K8S - properties: - provider: ONAP - org.onap.policy.clamp.Local_K8SMicroserviceAutomationCompositionElement: - # Chart installation without passing repository info - version: 1.2.3 - type: org.onap.policy.clamp.acm.K8SMicroserviceAutomationCompositionElement - type_version: 1.0.0 - description: Automation Composition element for the K8S microservice for local chart - properties: - provider: ONAP - participant_id: - name: K8sParticipant0 - version: 1.0.0 - participantType: - name: org.onap.policy.clamp.acm.KubernetesParticipant - version: 2.3.4 - chart: - chartId: - name: nginx-ingress - version: 0.11.0 - releaseName: nginxapp - namespace: onap - org.onap.policy.clamp.acm.HttpParticipant: - version: 2.3.4 - type: org.onap.policy.clamp.acm.Participant - type_version: 1.0.1 - description: Participant for Http requests - properties: - provider: ONAP - - org.onap.policy.clamp.Http_AutomationCompositionElement: - version: 1.2.3 - type: org.onap.policy.clamp.acm.HttpAutomationCompositionElement - type_version: 1.0.1 - description: Automation composition element for the http requests of PMSH microservice - properties: - provider: ONAP - participant_id: - name: HttpParticipant0 - version: 1.0.0 - participantType: - name: org.onap.policy.clamp.acm.HttpParticipant - version: 2.3.4 - uninitializedToPassiveTimeout: 180 - startPhase: 1 - baseUrl: http://httpbin.org - httpHeaders: - Content-Type: application/json - configurationEntities: - - configurationEntityId: - name: entity1 - version: 1.0.1 - restSequence: - - restRequestId: - name: request1 - version: 1.0.1 - httpMethod: POST - path: post - body: 'Dummy data for smoke testing' - expectedResponse: 200 - - - org.onap.domain.sample.GenericK8s_AutomationCompositionDefinition: - version: 1.2.3 - type: org.onap.policy.clamp.acm.AutomationComposition - type_version: 1.0.0 - description: Automation compostion for smoke testing participants - properties: - provider: ONAP - elements: - - name: org.onap.policy.clamp.Local_K8SMicroserviceAutomationCompositionElement - version: 1.2.3 - - name: org.onap.policy.clamp.Http_AutomationCompositionElement - version: 1.2.3 -- cgit 1.2.3-korg