This article explains how build the ONAP Policy Framework and get it running in Docker as a standalone system for the Beijing release of ONAP. 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 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 to work on a MacBook laptop running macOS Sierra Version 10.12.6 and a HP Z600 desktop running Ubuntu 16.04.3 LTS.
Cloning the ONAP repositories
Run a script such as the script below to clone the required modules from the ONAP git repository. This script clones the ONAP policy code and also clones some modules that ONAP Policy is dependent on.
ONAP Policy requires all the policy modules from the ONAP repository. It also requires the ONAP Parent oparent module and the ONAP ECOMP SDK ecompsdkos module.
Execution of the script above results in the following directory hierarchy in your ~/git directory:
Following execution of the script above, all five git repositories should be on the "beijing" branch. Verify the branch using the following commands:
Expect a result similar to:
Optionally, for a completely clean build, remove the ONAP built modules from your local repository.
rm -fr ~/.m2/repository/org/onap rm -fr ~/.m2/repository/org/openecomp
rm -fr ~/.m2/repisotory/com/att
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
You can now build the ONAP Policy framework
cd ~/git/onap/policy mvn clean install
Building the ONAP Policy Framework Docker Images
The instructions here are based on the instructions in the file ~/git/onap/policy/docker/README.md
Build the policy engine docker image:
docker build -t onap/policy-pe policy-pe
- Build the Drools PDP docker image:
docker build -t onap/policy-drools policy-drools
Starting the ONAP Policy Framework Docker Images
In order to run the containers, you can use docker-compose. This uses the docker-compose.yml yaml file to bring up the ONAP Policy Framework.
Go into the docker directory
Make the file config/drools/drools-tweaks.sh executable.
chmod +x config/drools/drools-tweaks.sh
Set the IP address to use to be an IP address of a suitable interface on your machine. Save the IP address into the file config/pe/ip_addr.txt.
Set the environment variable MTU to be a suitable MTU size for the application.
Determine if you want policies pre-loaded or not. By default, all the configuration and operational policies will be pre-loaded by the docker compose script. If you do not wish for that to happen, then export this variable:
- Run the system using docker-compose. Note that on some systems you may have to run the docker-compose command as root or using sudo. Note that this command takes a number of minutes to execute on a laptop or desktop computer
Test that the ONAP Policy Framework is up
Run the command below
- You should observe a JSON document containing the configuration information from the PDP.
You now have a full standalone ONAP Policy framework up and running!
Installation of Controllers and Policies
You may now install a controller and policies on the ONAP Policy Framework. Follow either of the HowTos below to install either the Amsterdam or Beijing controller and policies