1 .. This work is licensed under a
2 .. Creative Commons Attribution 4.0 International License.
3 .. http://creativecommons.org/licenses/by/4.0
6 Policy Platform Development
7 ###########################
13 This article explains how to build the ONAP Policy Framework for development purposes. 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`.
16 This article 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*
21 * 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)
23 The procedure documented in this article has been verified to work on a MacBook laptop running macOS Yosemite Version 10.10,5, Sierra Version 10.12.6, a HP Z600 desktop running Ubuntu 16.04.3 LTS, and an Unbuntu 16.04 VM.
25 Cloning All The Policy Repositories
26 ***********************************
28 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 all the ONAP Policy Framework repositories.
30 ONAP Policy Framework has dependencies to the ONAP Parent *oparent* module, the ONAP ECOMP SDK *ecompsdkos* module, and the A&AI Schema module.
34 :caption: Typical ONAP Policy Framework Clone Script
39 ## script name for output
40 MOD_SCRIPT_NAME=`basename $0`
42 ## the ONAP clone directory, defaults to "onap"
45 ## the ONAP repos to clone
55 policy/drools-applications \
61 ## Help screen and exit condition (i.e. too few arguments)
66 echo "$MOD_SCRIPT_NAME - clones all required ONAP git repositories"
68 echo " Usage: $MOD_SCRIPT_NAME [-options]"
71 echo " -d - the ONAP clone directory, defaults to '.'"
72 echo " -h - this help screen"
83 #-d ONAP clone directory
87 echo "$MOD_SCRIPT_NAME: no clone directory"
94 #-h prints help and exists
98 *) echo "$MOD_SCRIPT_NAME: undefined CLI option - $1"; exit 255;;
102 if [ -f "$clone_dir" ]; then
103 echo "$MOD_SCRIPT_NAME: requested clone directory '$clone_dir' exists as file"
106 if [ -d "$clone_dir" ]; then
107 echo "$MOD_SCRIPT_NAME: requested clone directory '$clone_dir' exists as directory"
114 echo cannot clone ONAP repositories, could not create directory '"'$clone_dir'"'
118 for repo in $onap_repos
120 repoDir=`dirname "$repo"`
121 repoName=`basename "$repo"`
125 mkdir "$clone_dir/$repoDir"
128 echo cannot clone ONAP repositories, could not create directory '"'$clone_dir/repoDir'"'
133 git clone https://gerrit.onap.org/r/${repo} $clone_dir/$repo
136 echo ONAP has been cloned into '"'$clone_dir'"'
139 Execution of the script above results in the following directory hierarchy in your *~/git* directory:
143 * ~/git/onap/policy/parent
144 * ~/git/onap/policy/common
145 * ~/git/onap/policy/models
146 * ~/git/onap/policy/api
147 * ~/git/onap/policy/pap
148 * ~/git/onap/policy/docker
149 * ~/git/onap/policy/drools-applications
150 * ~/git/onap/policy/drools-pdp
151 * ~/git/onap/policy/engine
152 * ~/git/onap/policy/apex-pdp
153 * ~/git/onap/policy/xacml-pdp
154 * ~/git/onap/policy/distribution
157 Building ONAP Policy Framework Components
158 *****************************************
160 **Step 1:** Optionally, for a completely clean build, remove the ONAP built modules from your local repository.
164 rm -fr ~/.m2/repository/org/onap
167 **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*.
170 :caption: Typical pom.xml to build the ONAP Policy Framework
173 <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">
174 <modelVersion>4.0.0</modelVersion>
175 <groupId>org.onap</groupId>
176 <artifactId>onap-policy</artifactId>
177 <version>1.0.0-SNAPSHOT</version>
178 <packaging>pom</packaging>
179 <name>${project.artifactId}</name>
180 <inceptionYear>2017</inceptionYear>
186 <module>parent</module>
187 <module>common</module>
188 <module>models</module>
191 <module>apex-pdp</module>
192 <module>xacml-pdp</module>
193 <module>drools-pdp</module>
194 <module>drools-applications</module>
195 <!-- The engine repo is being deprecated,
196 and can be ommitted if not working with
197 legacy api and components. -->
198 <module>engine</module>
199 <module>distribution</module>
203 Policy Architecture/API Transition
204 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
206 In Dublin, a new Policy Architecture was introduced. The legacy architecture runs in parallel with the new architecture. It will be deprecated after Frankfurt release.
208 If the developer is only interested in working with the new architecture components, the engine sub-module can be ommitted.
211 **Step 3:** You can now build the Policy framework