Building and running CLAMP



This page is Work in Progress



This page is not updated for Istanbul, the information below this point may or may not be correct for Istanbul.

This page documents how to get CLAMP up and running on a local machine and also how to get CLAMP loaded and set up in an IDE. We may use the information on this page as input for a page in the CLAMP documentation.

Checking out and building CLAMP

  1. Check CLAMP out of its repo

    git clone "https://gerrit.onap.org/r/clamp"



  2. Change into the "clamp" directory

  3. Build CLAMP

    mvn clean install

      You may get the following error (See CLAMP-944: CLAMP build fails with python timeout in dockerOpen)

    [ERROR] DOCKER> I/O Error [[docker.io/python:2-slim] "python": Timeout after 120088 ms while waiting on tcp port '[/172.17.0.3:8080]']

    If so, then run the following command to skip integration tests



Getting CLAMP set up locally in your IDE

  1. Import the CLAMP project into your IDE

  2. Eclipse only: Add the following Eclipse profile to pom.xml for Eclipse m2e support, then run Maven->Update



Running unit tests locally

In order to run the unit tests locally, you need to run an instance of MariaDB and an instance of the emulator for the REST endpoints CLAMP uses. You also need to set the values some variables in a number of configuration files. These values are automatically generated in the maven build but need to be set manually when running tests locally.

If you follow the steps here, all the tests will pass in a Linux environment. In Windows and Mac environments, the Robot test case will not pass because Host Networking is not supported in Docker on WIndows and Mac. The robot test framework cannot reach "localhost" endpoints on the host machine.



  1. Open a console and go into the directory extra/bin-for-dev



  2. Start an instance of the CLAMP MaraDB database in Docker using the helper script. This script uses docker-compose to bring up an instance of the CLAMP MariaDB.



  3. Start an instance of the CLAMP endpoint emulator in Docker using the helper script. This script uses docker-compose to bring up an instance of the CLAMP endpoint emulator.



  4. Check that the database and emulator are running

    You should see the two images running



  5. In the file src/test/resources/application.properties, run this sed command or make the changes below in a text editor:



    1. Change all occurrences of the string "${clamp.it.tests.http}" to "8080"

    2. Change all occurrences of the string "${docker.http-cache.port.host}" to "8085"

    3. Change all occurrences of the string "${docker.mariadb.port.host}" to "3306"

  6. In the file src/test/resources/https/https-test.properties, run this sed command or make the changes below in a text editor:



    1. Change all occurrences of the string "${clamp.it.tests.https}" to "8090" (Any free port value)

    2. Change all occurrences of the string "${clamp.it.tests.http-redirected}" to "8080"

    3. Change all occurrences of the string "${docker.mariadb.port.host}" to "3306"

  7.  In the file src/test/resources/robotframework/robotframework-test.properties, run this sed command or make the changes below in a text editor:



    1. Change all occurrences of the string "${clamp.it.tests.robotframework.http}" to "8080" (Any free port value)

    2. Change all occurrences of the string "${docker.http-cache.port.host}" to "8085"

    3. Change all occurrences of the string "${docker.mariadb.port.host}" to "3306"

Building ControlLoop docker images in CLAMP

Control loop docker images are built in clamp/packages and pushed to ONAP nexus docker registry nexus3.onap.org:10003
using maven command.

Steps are depicted as below:

  1. Open a console and go into the directory clamp/packages



  2. Run below command

    Note: This command when run from clamp main directory will build all docker images of Clamp. When run in clamp/packages folder will build
    ControlLoop docker images alone.

  3. There is a fabric8, docker-maven-plugin in clamp/packages/policy-clamp-docker/pom.xml which builds 3 docker images and pushes to ONAP nexus docker registry nexus3.onap.org:10003



  4. Configuration to build docker images is present in following files



  5. Docker images once built can be brought up manually on localhost using docker commands, or through docker-compose in CSIT
    Clone policy docker repo

    Note: More detailed information on CSIT is in Testing CLAMP

  6. Docker images from docker-compose file in /policy/docker/csit for clamp