1 .. This work is licensed under a
2 .. Creative Commons Attribution 4.0 International License.
3 .. http://creativecommons.org/licenses/by/4.0
5 .. _policy-clamp-runtime-smoke-label:
7 CLAMP Automation Composition Smoke Tests
8 ########################################
14 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`.
17 This article assumes that:
19 * You are using a *\*nix* operating system such as linux or macOS.
20 * You are using a directory called *git* off your home directory *(~/git)* for your git repositories
21 * Your local maven repository is in the location *~/.m2/repository*
22 * You have copied the settings.xml from oparent to *~/.m2/* directory
23 * You have added settings to access the ONAP Nexus to your M2 configuration, see `Maven Settings Example <https://wiki.onap.org/display/DW/Setting+Up+Your+Development+Environment>`_ (bottom of the linked page)
25 The procedure documented in this article has been verified using Ubuntu 20.04 LTS VM.
27 Cloning CLAMP automation composition
28 ************************************
30 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.
35 git clone https://gerrit.onap.org/r/policy/clamp clamp
38 Execution of the command above results in the following directory hierarchy in your *~/git* directory:
43 Building CLAMP automation composition
44 *************************************
46 **Step 1:** Setting topicParameterGroup for kafka localhost.
47 It needs to set 'kafka' as topicCommInfrastructure and 'localhost:29092' as server.
48 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:
50 .. literalinclude:: files/runtime-application.yaml
53 Same changes (in the 'participant' parameters section) may need to be apply into the file 'participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml'.
55 .. literalinclude:: files/participant-sim-application.yaml
58 **Step 2:** Optionally, for a completely clean build, remove the ONAP built modules from your local repository.
62 rm -fr ~/.m2/repository/org/onap
65 **Step 3:** You can now build the Policy framework.
67 Build java artifacts only:
72 mvn clean install -DskipTests
74 Build with docker images:
78 cd ~/git/clamp/packages/
79 mvn clean install -P docker
81 Running MariaDb and Kafka
82 *************************
84 Assuming you have successfully built the codebase using the instructions above. There are two requirements for the Clamp automation composition component to run, MariaDb database and Kafka/Zookeeper. The easiest way to do this is to run a docker compose locally.
86 A sql such as the one below can be used to build the SQL initialization. Create the *mariadb.sql* file in the directory *~/git*.
88 .. literalinclude:: files/mariadb.sql
91 Create the '*docker-compose.yaml*' using following code:
93 .. literalinclude:: files/docker-compose-local.yaml
96 Run the docker composition:
104 Developing and Debugging CLAMP automation composition
105 *****************************************************
107 Running on the Command Line using Maven
108 +++++++++++++++++++++++++++++++++++++++
110 Once the mariadb and DMaap simulator are up and running, run the following commands:
114 cd ~/git/clamp/runtime-acm
118 Running on the Command Line
119 +++++++++++++++++++++++++++
123 cd ~/git/clamp/runtime-acm
124 java -jar target/policy-clamp-runtime-acm-7.1.3-SNAPSHOT.jar
127 Running participant simulator
128 +++++++++++++++++++++++++++++
130 Run the following commands:
134 cd ~/git/clamp/participant/participant-impl/participant-impl-simulator
135 java -jar target/policy-clamp-participant-impl-simulator-7.1.3-SNAPSHOT.jar
138 Running the CLAMP automation composition docker image
139 +++++++++++++++++++++++++++++++++++++++++++++++++++++
141 Create the '*docker-compose.yaml*' using following code:
147 image: mariadb:10.10.2
148 command: ['mysqld', '--lower_case_table_names=1']
151 source: ./mariadb.sql
152 target: /docker-entrypoint-initdb.d/data.sql
154 - MYSQL_ROOT_PASSWORD=my-secret-pw
159 image: confluentinc/cp-zookeeper:latest
161 ZOOKEEPER_CLIENT_PORT: 2181
162 ZOOKEEPER_TICK_TIME: 2000
166 image: confluentinc/cp-kafka:latest
167 container_name: kafka
175 KAFKA_ZOOKEEPER_CONNECT: zookeeper:2181
176 KAFKA_ADVERTISED_LISTENERS: PLAINTEXT://kafka:9092,PLAINTEXT_HOST://localhost:29092
177 KAFKA_LISTENER_SECURITY_PROTOCOL_MAP: PLAINTEXT:PLAINTEXT,PLAINTEXT_HOST:PLAINTEXT
178 KAFKA_INTER_BROKER_LISTENER_NAME: PLAINTEXT
179 KAFKA_OFFSETS_TOPIC_REPLICATION_FACTOR: 1
182 image: onap/policy-clamp-runtime-acm
188 MARIADB_HOST: mariadb
189 TOPICSERVER: kafka:9092
190 SERVER_SSL_ENABLED: false
193 source: ./clamp/runtime-acm/src/main/resources/application.yaml
194 target: /opt/app/policy/clamp/etc/AcRuntimeParameters.yaml
198 participant-simulator:
199 image: onap/policy-clamp-ac-sim-ppnt
204 MARIADB_HOST: mariadb
205 TOPICSERVER: kafka:9092
206 SERVER_SSL_ENABLED: false
209 source: ./clamp/participant/participant-impl/participant-impl-simulator/src/main/resources/config/application.yaml
210 target: /opt/app/policy/clamp/etc/SimulatorParticipantParameters.yaml
214 Run the docker composition:
222 Swagger UI of automation composition is available at *http://localhost:6969/onap/policy/clamp/acm/swagger-ui/index.html*