diff options
author | FrancescoFioraEst <francesco.fiora@est.tech> | 2024-05-10 11:14:48 +0100 |
---|---|---|
committer | FrancescoFioraEst <francesco.fiora@est.tech> | 2024-05-10 11:30:38 +0100 |
commit | c0d44075a739a7ca0ccf9f4d5cf12667c816b4e5 (patch) | |
tree | 020c5c73a6625ae719e9a5bab538924ff071ce0d /docs/development/devtools/smoke | |
parent | 32367d1ee2d60cda964bbfa7d512d23696a43449 (diff) |
Update docs for CLAMP participants Kubernetes and http Smoke Tests
Issue-ID: POLICY-4991
Change-Id: I18b82bb0db3590d5aa3db381d69a570c5b258de9
Signed-off-by: FrancescoFioraEst <francesco.fiora@est.tech>
Diffstat (limited to 'docs/development/devtools/smoke')
3 files changed, 88 insertions, 60 deletions
diff --git a/docs/development/devtools/smoke/acm-participants-smoke.rst b/docs/development/devtools/smoke/acm-participants-smoke.rst index 0b8061e2..ad377768 100644 --- a/docs/development/devtools/smoke/acm-participants-smoke.rst +++ b/docs/development/devtools/smoke/acm-participants-smoke.rst @@ -26,92 +26,71 @@ The procedure documented in this article has been verified using Ubuntu 20.04 LT 2.1 Prerequisites ================= -- Java 11 +- Java 17 - Docker -- Maven 3 +- Maven 3.9 - Git - helm3 - k8s cluster - Refer to this guide for basic environment setup `Setting up dev environment <https://wiki.onap.org/display/DW/Setting+Up+Your+Development+Environment>`_ -2.2 Assumptions -=============== -- You are accessing the policy repositories through gerrit. +2.2 Cloning CLAMP automation composition +======================================== -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. +Run a script such as the script below to clone the required modules from the `ONAP git repository <https://gerrit.onap.org/r/admin/repos/q/filter:policy>`_. This script clones CLAMP automation composition and all dependency. -- policy/parent -- policy/common -- policy/models -- policy/clamp +.. code-block:: bash -In this setup guide, we will be setting up all the components technically required for a working dev environment. + cd ~/git + git clone https://gerrit.onap.org/r/policy/clamp clamp -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. +Execution of the command above results in the following directory hierarchy in your *~/git* directory: -- AutomationComposition: the runtime-acm db + * ~/git/clamp -The easiest way to do this is to perform a SQL script. Create the *mariadb.sql* file in the directory *~/git*. -.. code-block:: mysql +2.3 Setting up the components +============================= - CREATE DATABASE `clampacm`; - USE `clampacm`; - CREATE USER 'policy'; - GRANT ALL on clampacm.* to 'policy' identified by 'P01icY' with GRANT OPTION; +2.3.1 Running MariaDb and Kafka +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +We will be using Docker to run our mariadb instance and Kafka. It will have the acm-runtime database running in it. +The easiest way to do this is to perform a SQL script. Create the *mariadb.sql* file in the directory *~/git*. -Execution of the command above results in the creation and start of the *mariadb-smoke-test* container. +.. literalinclude:: files/mariadb.sql + :language: SQL - .. code-block:: bash +Create the '*docker-compose.yaml*' using following code: - 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 +.. literalinclude:: files/docker-compose-local.yaml + :language: yaml -The database will be exposed locally on port 3306 and will be backed by an anonymous docker volume. +Run the docker composition: -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: + .. code-block:: bash -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: + cd ~/git/ + docker compose up -.. code-block:: json +2.3.2 Setting topicParameterGroup for kafka localhost +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +It needs to set 'kafka' as topicCommInfrastructure and 'localhost:29092' as server. +In the clamp repo, you should find the file 'runtime-acm/src/main/resources/application.yaml'. This file (in the 'runtime' parameters section) may need to be altered as below: - { - "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: +.. literalinclude:: files/runtime-application.yaml + :language: yaml -.. code-block:: bash +Same changes (in the 'participant' parameters section) +may need to be apply into the file 'participant/participant-impl/participant-impl-http/src/main/resources/config/application.yaml'. - mvn exec:java -Dexec.mainClass=org.onap.policy.models.simulators.Main -Dexec.args="src/test/resources/YOUR_CONF_FILE.json" +.. literalinclude:: files/participant-http-application.yaml + :language: yaml -At this stage the dmaap simulator should be running on your local machine on port 3904. +And into the file 'participant/participant-impl/participant-impl-kubernetes/src/main/resources/config/application.yaml'. +.. literalinclude:: files/participant-kubernetes-application.yaml + :language: yaml 2.3.3 Automation composition Runtime ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -245,7 +224,7 @@ Verify automation composition state: GET: https://<Runtime ACM IP> : <Port>/onap/policy/clamp/acm/v2/compositions/{compositionId}/instances/{instanceId} -3.4 Automation Compositions can be "UNDEPLOYED" after deployment +3.5 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. diff --git a/docs/development/devtools/smoke/files/participant-http-application.yaml b/docs/development/devtools/smoke/files/participant-http-application.yaml new file mode 100644 index 00000000..142c24e5 --- /dev/null +++ b/docs/development/devtools/smoke/files/participant-http-application.yaml @@ -0,0 +1,23 @@ + +participant: + intermediaryParameters: + reportingTimeIntervalMs: 120000 + description: Participant Description + participantId: 101c62b3-8918-41b9-a747-d21eb79c6c01 + clampAutomationCompositionTopics: + topicSources: + - topic: policy-acruntime-participant + servers: + - ${topicServer:localhost:29092} + topicCommInfrastructure: kafka + fetchTimeout: 15000 + topicSinks: + - topic: policy-acruntime-participant + servers: + - ${topicServer:localhost:29092} + topicCommInfrastructure: kafka + participantSupportedElementTypes: + - + typeName: org.onap.policy.clamp.acm.HttpAutomationCompositionElement + typeVersion: 1.0.0 + diff --git a/docs/development/devtools/smoke/files/participant-kubernetes-application.yaml b/docs/development/devtools/smoke/files/participant-kubernetes-application.yaml new file mode 100644 index 00000000..9b25c615 --- /dev/null +++ b/docs/development/devtools/smoke/files/participant-kubernetes-application.yaml @@ -0,0 +1,26 @@ + +participant: + localChartDirectory: /home/policy/local-charts + infoFileName: CHART_INFO.json + intermediaryParameters: + reportingTimeIntervalMs: 120000 + description: Participant Description + participantId: 101c62b3-8918-41b9-a747-d21eb79c6c02 + clampAutomationCompositionTopics: + topicSources: + - + topic: policy-acruntime-participant + servers: + - ${topicServer:localhost:29092} + topicCommInfrastructure: kafka + fetchTimeout: 15000 + topicSinks: + - + topic: policy-acruntime-participant + servers: + - ${topicServer:localhost:29092} + topicCommInfrastructure: kafka + participantSupportedElementTypes: + - + typeName: org.onap.policy.clamp.acm.K8SMicroserviceAutomationCompositionElement + typeVersion: 1.0.0 |