1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
4 Standalone Quick Start Installation
5 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10 The installation of ONAP Policy is **automated** by design and can be done via Docker as a standalone system.
11 Various tools, including healthcheck, logs, and Swagger can be used to ensure proper operation.
13 This article explains how to build the ONAP Policy Framework and get it running in Docker as a standalone system.
14 This article assumes that:
16 * You are using a *\*nix* operating system such as linux or macOS.
17 * You are using a directory called *git* off your home directory *(~/git)* for your git repositories
18 * Your local maven repository is in the location *~/.m2/repository*
19 * 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)
21 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.
23 Cloning the ONAP repositories
24 -----------------------------
26 Run a script such as the script below to clone the required modules from the `ONAP git repository <https://gerrit.onap.org/r/#/admin/projects/?filter=policy>`_. This script clones the ONAP policy code and also clones some modules that ONAP Policy is dependent on.
28 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.
32 :caption: Typical ONAP Policy Framework Clone Script
37 ## script name for output
38 MOD_SCRIPT_NAME=`basename $0`
40 ## the ONAP clone directory, defaults to "onap"
43 ## the ONAP repos to clone
48 policy/drools-applications \
56 ## Help screen and exit condition (i.e. too few arguments)
61 echo "$MOD_SCRIPT_NAME - clones all required ONAP git repositories"
63 echo " Usage: $MOD_SCRIPT_NAME [-options]"
66 echo " -d - the ONAP clone directory, defaults to '.'"
67 echo " -h - this help screen"
78 #-d ONAP clone directory
82 echo "$MOD_SCRIPT_NAME: no clone directory"
89 #-h prints help and exists
93 *) echo "$MOD_SCRIPT_NAME: undefined CLI option - $1"; exit 255;;
97 if [ -f "$clone_dir" ]; then
98 echo "$MOD_SCRIPT_NAME: requested clone directory '$clone_dir' exists as file"
101 if [ -d "$clone_dir" ]; then
102 echo "$MOD_SCRIPT_NAME: requested clone directory '$clone_dir' exists as directory"
109 echo cannot clone ONAP repositories, could not create directory '"'$clone_dir'"'
113 for repo in $onap_repos
115 repoDir=`dirname "$repo"`
116 repoName=`basename "$repo"`
120 mkdir "$clone_dir/$repoDir"
123 echo cannot clone ONAP repositories, could not create directory '"'$clone_dir/repoDir'"'
128 git clone https://gerrit.onap.org/r/${repo} $clone_dir/$repo
131 echo ONAP has been cloned into '"'$clone_dir'"'
134 Execution of the script above results in the following directory hierarchy in your *~/git* directory:
138 * ~/git/onap/policy/api
139 * ~/git/onap/policy/common
140 * ~/git/onap/policy/docker
141 * ~/git/onap/policy/drools-applications
142 * ~/git/onap/policy/drools-pdp
143 * ~/git/onap/policy/engine
144 * ~/git/onap/policy/gui
145 * ~/git/onap/policy/pap
146 * ~/git/onap/policy/pdp
152 **Step 1:** Optionally, for a completely clean build, remove the ONAP built modules from your local repository.
156 rm -fr ~/.m2/repository/org/onap
157 rm -fr ~/.m2/repository/org/openecomp
158 rm -fr ~/.m2/repisotory/com/att
161 **Step 2:** 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*.
164 :caption: Typical pom.xml to build the ONAP Policy Framework
167 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
168 <modelVersion>4.0.0</modelVersion>
169 <groupId>org.onap</groupId>
170 <artifactId>onap-policy</artifactId>
171 <version>1.0.0-SNAPSHOT</version>
172 <packaging>pom</packaging>
173 <name>${project.artifactId}</name>
174 <inceptionYear>2017</inceptionYear>
180 <module>common</module>
181 <module>engine</module>
184 <module>drools-pdp</module>
185 <module>drools-applications</module>
188 <module>docker</module>
193 **Step 3:** You can now build the ONAP framework
201 Building the ONAP Policy Framework Docker Images
202 ------------------------------------------------
203 The instructions here are based on the instructions in the file *~/git/onap/policy/docker/README.md*.
206 **Step 1:** Build the policy engine docker image:
210 cd ~/git/onap/policy/engine/packages/docker/target
211 docker build -t onap/policy-pe policy-pe
214 **Step 2:** Build the Drools PDP docker image:
218 cd ~/git/onap/policy/drools-pdp/packages/docker/target
219 docker build -t onap/policy-drools policy-drools
222 Starting the ONAP Policy Framework Docker Images
223 ------------------------------------------------
225 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.
227 **Step 1:** Make the file config/drools/drools-tweaks.sh executable.
231 chmod +x config/drools/drools-tweaks.sh
234 **Step 2:** 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*.
237 **Step 3:** Set the environment variable *MTU* to be a suitable MTU size for the application.
244 **Step 4:** 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:
248 export PRELOAD_POLICIES=false
251 **Step 5:** 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.
258 **You now have a full standalone ONAP Policy framework up and running!**
261 Installation of Controllers and Policies
262 ----------------------------------------
264 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.
266 * `Installation of Amsterdam Controller and vCPE Policy <installAmsterController.html>`_
267 * `Installation of Beijing Controller and Policies <installBeijingController.html>`_
271 .. _Standalone Quick Start : https://wiki.onap.org/display/DW/ONAP+Policy+Framework%3A+Standalone+Quick+Start