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
+++ /dev/null
-{
- "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
- 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.
- 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"
+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`;
- 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"
+Execution of the command above results in the creation and start of the *mariadb-smoke-test* container.
-.. code-block:: bash
+ .. code-block:: bash
- ./start-db.sh
+ 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
-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.
+The database will be exposed locally on port 3306 and will be backed by an anonymous docker volume.
2.3.2 DMAAP Simulator
^^^^^^^^^^^^^^^^^^^^^
.. code-block:: bash
- POST: https://<Runtime ACM IP> : <Port> /onap/policy/clamp/acm/v2/commission
+ POST: https://<Runtime ACM IP> : <Port> /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://<Runtime ACM IP> : <Port> /onap/policy/clamp/acm/v2/compositions/{compositionId}
+
+Request body:
-A successful commissioning gives 200 responses in the postman client.
+.. code-block:: json
+ {
+ "primeOrder": "PRIME"
+ }
-3.2 Create New Instances of Automation composition
+3.3 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".
+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://<Runtime ACM IP> : <Port> /onap/policy/clamp/acm/v2/instantiation
+ POST: https://<Runtime ACM IP> : <Port> /onap/policy/clamp/acm/v2/compositions/{compositionId}/instances
Request body:
:download:`Instantiation json <json/acm-instantiation.json>`
-3.3 Change the State of the Instance
+3.4 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.
+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://<Runtime ACM IP> : <Port> /onap/policy/clamp/acm/v2/instantiation/command
+ PUT: https://<Runtime ACM IP> : <Port> /onap/policy/clamp/acm/v2/compositions/{compositionId}/instances/{instanceId}
Request body:
.. code-block:: bash
{
- "orderedState": "PASSIVE",
- "automationCompositionIdentifierList": [
- {
- "name": "K8SInstance0",
- "version": "1.0.1"
- }
- ]
+ "deployOrder": "DEPLOY"
}
-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.
+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.
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.
+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://<Runtime ACM IP> : <Port>/onap/policy/clamp/acm/v2/instantiation
+ GET: https://<Runtime ACM IP> : <Port>/onap/policy/clamp/acm/v2/compositions/{compositionId}/instances/{instanceId}
-3.4 Automation Compositions can be "UNINITIALISED" after deployment
-===================================================================
+3.4 Automation Compositions can be "UNDEPLOYED" after deployment
+================================================================
-By changing the state to "UNINITIALISED", all the helm deployments under the corresponding automation composition will be uninstalled from the cluster.
+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://<Runtime ACM IP> : <Port> /onap/policy/clamp/acm/v2/instantiation/command
+ PUT: https://<Runtime ACM IP> : <Port> /onap/policy/clamp/acm/v2/compositions/{compositionId}/instances/{instanceId}
Request body:
.. code-block:: bash
{
- "orderedState": "UNINITIALISED",
- "automationCompositionIdentifierList": [
- {
- "name": "K8SInstance0",
- "version": "1.0.1"
- }
- ]
+ "deployOrder": "UNDEPLOY"
}
The nginx pod should be deleted from the k8s cluster.
policy/parent \
policy/common \
policy/models \
- policy/clamp \
- policy/docker "
+ policy/clamp "
##
## Help screen and exit condition (i.e. too few arguments)
* ~/git/onap/policy/common
* ~/git/onap/policy/models
* ~/git/onap/policy/clamp
- * ~/git/onap/policy/docker
Building CLAMP automation composition and all dependency
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
- <inceptionYear>2017</inceptionYear>
+ <inceptionYear>2023</inceptionYear>
<organization>
<name>ONAP</name>
</organization>
.. code-block:: bash
cd ~/git/onap/policy
- mvn -pl '!org.onap.policy.clamp:policy-clamp-runtime' install
+ mvn clean install
Build with docker images:
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
***********************************
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
+ --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.
-Change the local configuration file *src/test/resources/simParameters.json* using the below code:
+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
.. 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"
+ mvn exec:java -Dexec.mainClass=org.onap.policy.models.simulators.Main -Dexec.args="src/test/resources/newParameters.json"
Developing and Debugging CLAMP automation composition
.. code-block:: bash
cd ~/git/onap/policy/clamp/runtime-acm
- java -jar target/policy-clamp-runtime-acm-6.2.2-SNAPSHOT.jar
+ 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. 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
-++++++++++++++++++++++++++++++++++++++++++
+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
-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:
+Swagger UI of Automation composition is available at *http://localhost:6969/onap/policy/clamp/acm/swagger-ui/index.html*
- .. 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
+Running one or more participants
++++++++++++++++++++++++++++++++
-There is an additional requirement for the Clamp automation composition docker image to run, is creating the SSL self-signed certificate.
+Into :ref:`HTTP Participant <clamp-acm-http-participant>` you can find a test case with http-participant.
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
+ 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
+++++++++++++++++++++++++++++++++++++++++++++++++++++
-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:
+Create the '*docker-composition.yaml*' using following code:
.. code-block:: yaml
version: '3.1'
services:
- db:
- image: mariadb:10.5.8
+ mariadb:
+ image: mariadb:10.10.2
volumes:
- - "~/git/onap/policy/clamp/runtime/extra/sql/:/docker-entrypoint-initdb.d:rw"
+ - type: bind
+ source: ./mariadb.sql
+ target: /docker-entrypoint-initdb.d/data.sql
environment:
- - MYSQL_ROOT_PASSWORD=strong_pitchou
+ - MYSQL_ROOT_PASSWORD=my-secret-pw
+ - lower-case-table-names=1
ports:
- "3306:3306"
- policy-clamp-backend:
- image: onap/policy-clamp-backend
- depends_on:
- - db
- - third-party-proxy
+ runtime-acm:
+ image: onap/policy-clamp-runtime-acm
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
+ - 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:
- - "10443:8443"
+ - "6969:6969"
- third-party-proxy:
- image: python:2-slim
+ message-router:
+ image: onap/policy-models-simulator
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"
+ - 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:
- - "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"
+ - "3904:3904"
+
+Run the docker composition:
+
+ .. code-block:: bash
+
+ cd ~/git/
+ docker-compose up
-Run DMaaP simulator, and then run CLAMP Acm using java.
+Swagger UI of automation composition is available at *http://localhost:6969/onap/policy/clamp/acm/swagger-ui/index.html*
--- /dev/null
+{
+ "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
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
entry_schema:
type: onap.datatypes.ToscaConceptIdentifier
org.onap.policy.clamp.acm.K8SMicroserviceAutomationCompositionElement:
- version: 1.0.1
+ version: 1.0.0
derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
chart:
type: string
required: true
org.onap.policy.clamp.acm.HttpAutomationCompositionElement:
- version: 1.0.1
+ version: 1.0.0
derived_from: org.onap.policy.clamp.acm.AutomationCompositionElement
properties:
baseUrl:
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
org.onap.policy.clamp.Http_AutomationCompositionElement:
version: 1.2.3
type: org.onap.policy.clamp.acm.HttpAutomationCompositionElement
- type_version: 1.0.1
+ type_version: 1.0.0
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
+ type_version: 1.0.1
description: Automation compostion for smoke testing participants
properties:
provider: ONAP