1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
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 ONAP Policy Framework: Standalone Quick Start
14 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
15 This procedure explains how build the ONAP Policy Framework and get it running in Docker as a standalone system.
16 This procedure assumes that:
18 * You are using a *\*nix* operating system such as linux or macOS.
19 * You are using a directory called *git* off your home directory *(~/git)* for your git repositories
20 * Your local maven repository is in the location *~/.m2/repository*
22 The procedure documented here 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.
26 :caption: Typical ONAP Policy Framework Clone Script
31 ## script name for output
32 MOD_SCRIPT_NAME=`basename $0`
34 ## the ONAP clone directory, defaults to "onap"
37 ## the ONAP repos to clone
44 policy/drools-applications \
52 ## Help screen and exit condition (i.e. too few arguments)
57 echo "$MOD_SCRIPT_NAME - clones all required ONAP git repositories"
59 echo " Usage: $MOD_SCRIPT_NAME [-options]"
62 echo " -d - the ONAP clone directory, defaults to '.'"
63 echo " -h - this help screen"
74 #-d ONAP clone directory
78 echo "$MOD_SCRIPT_NAME: no clone directory"
85 #-h prints help and exists
89 *) echo "$MOD_SCRIPT_NAME: undefined CLI option - $1"; exit 255;;
93 if [ -f "$clone_dir" ]; then
94 echo "$MOD_SCRIPT_NAME: requested clone directory '$clone_dir' exists as file"
97 if [ -d "$clone_dir" ]; then
98 echo "$MOD_SCRIPT_NAME: requested clone directory '$clone_dir' exists as directory"
105 echo cannot clone ONAP repositories, could not create directory '"'$clone_dir'"'
109 for repo in $onap_repos
111 repoDir=`dirname "$repo"`
112 repoName=`basename "$repo"`
116 mkdir "$clone_dir/$repoDir"
119 echo cannot clone ONAP repositories, could not create directory '"'$clone_dir/repoDir'"'
124 git clone https://gerrit.onap.org/r/${repo} $clone_dir/$repo
127 echo ONAP has been cloned into '"'$clone_dir'"'
129 Execution of the script above results in the following directory hierarchy in your *~/git* directory:
132 * ~/git/onap/ecompsdkos
135 * ~/git/onap/policy/api
136 * ~/git/onap/policy/common
137 * ~/git/onap/policy/docker
138 * ~/git/onap/policy/drools-applications
139 * ~/git/onap/policy/drools-pdp
140 * ~/git/onap/policy/engine
141 * ~/git/onap/policy/gui
142 * ~/git/onap/policy/pap
143 * ~/git/onap/policy/pdp
150 **Step 1.** Optionally, for a completely clean build, remove the ONAP built modules from your local repository.
152 * rm -fr ~/.m2/repository/org/onap
153 * rm -fr ~/.m2/repository/org/openecomp
156 **Step 2**. A pom such as the one below can be used to build all the ONAP policy modules and their dependencies. Create the *pom.xml* file in the directory *~/git/onap*.
159 :caption: Typical pom.xml to build the ONAP Policy Framework
162 <project xmlns="http://maven.apache.org/POM/4.0.0"
163 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
164 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
166 <modelVersion>4.0.0</modelVersion>
167 <groupId>org.onap</groupId>
168 <artifactId>onap-policy_standalone</artifactId>
169 <version>1.0.0-SNAPSHOT</version>
170 <packaging>pom</packaging>
171 <name>${project.artifactId}</name>
172 <inceptionYear>2017</inceptionYear>
179 <id>policy-dependencies</id>
182 <name>policyDeps</name>
186 <module>oparent</module>
187 <module>ecompsdkos/ecomp-sdk</module>
193 <activeByDefault>true</activeByDefault>
196 <module>oparent</module>
197 <module>ecompsdkos/ecomp-sdk</module>
198 <module>policy</module>
206 **Step 3**. 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*
209 :caption: Typical pom.xml to build the ONAP Policy Framework Policy Modules
212 <project xmlns="http://maven.apache.org/POM/4.0.0"
213 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
214 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
216 <modelVersion>4.0.0</modelVersion>
217 <groupId>org.onap</groupId>
218 <artifactId>onap-policy</artifactId>
219 <version>1.0.0-SNAPSHOT</version>
220 <packaging>pom</packaging>
221 <name>${project.artifactId}</name>
222 <inceptionYear>2017</inceptionYear>
228 <module>common</module>
229 <module>engine</module>
232 <module>drools-pdp</module>
233 <module>drools-applications</module>
236 <module>docker</module>
240 **Step 4**. The build cannot currently find the *org.onap.oparent:version-check-maven-plugin* plugin so, for now, comment that plugin out in the POMs *policy/drools-pdp/pom.xml* and *policy/drools-applications/pom.xml*.
242 **Step 5**. Build the ONAP dependencies that are required for the ONAP policy framework and which must be built first to be available to the ONAP Policy Framework proper.
245 * mvn clean install -DpolicyDeps
247 **Step 6**. You can now build the ONAP framework
249 * On *Ubuntu*, just build the Policy Framework tests and all
254 * On *macOS*, you must build build the ONAP framework with tests turned off first. Then rebuild the framework with tests turned on and all tests will pass. Note: The reason for this behaviour will be explored later.
257 - mvn clean install -DskipTests
261 Building the ONAP Policy Framework Docker Images
262 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
263 The instructions here are based on the instructions in the file *~/git/onap/policy/docker/README*.
265 **Step 1.** Prepare the Docker packages. This will pull the installation zip files needed for building the policy-pe and policy-drools Docker images into the target directory. It will not actually build the docker images; the additional steps below must be followed to actually build the Docker images.
267 * cd ~/git/onap/policy/docker
268 * mvn prepare-package
270 **Step 2**. Copy the files under *policy-pe* to *target/policy-pe*.
272 * cp policy-pe/* target/policy-pe
274 **Step 3**. Copy the files under *policy-drools* to *target/policy-drools*.
276 * cp policy-drools/* target/policy-drools
278 **Step 4**. Run the *docker build* command on the following directories in the order below.
279 Note that on some systems you may have to run the *docker* command as root or using *sudo*.
281 * docker build -t onap/policy/policy-os policy-os
282 * docker build -t onap/policy/policy-db policy-db
283 * docker build -t onap/policy/policy-nexus policy-nexus
284 * docker build -t onap/policy/policy-base policy-base
285 * docker build -t onap/policy/policy-pe target/policy-pe
286 * docker build -t onap/policy/policy-drools target/policy-drools
288 Starting the ONAP Policy Framework Docker Images
289 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
290 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.
292 **Step 1.** Make the file *config/drools/drools-tweaks.sh* executable
294 * chmod +x config/drools/drools-tweaks.sh
296 **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*.
298 **Step 3**. Set the environment variable *MTU* to be a suitable MTU size for the application.
302 **Step 4**. 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.
307 Installation Complete
308 ^^^^^^^^^^^^^^^^^^^^^
310 **You now have a full standalone ONAP Policy framework up and running!**
313 .. _Standalone Quick Start : https://wiki.onap.org/display/DW/ONAP+Policy+Framework%3A+Standalone+Quick+Start