Skip to end of metadata
Go to start of metadata

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.

Typical ONAP Policy Framework Clone Script
#!/usr/bin/env bash

## script name for output
MOD_SCRIPT_NAME=`basename $0`

## the ONAP clone directory, defaults to "onap"
clone_dir="onap"

## the ONAP repos to clone
onap_repos="\
policy/common \
policy/docker \
policy/drools-applications \
policy/drools-pdp \
policy/engine"

##
## Help screen and exit condition (i.e. too few arguments)
##
Help()
{
    echo ""
    echo "$MOD_SCRIPT_NAME - clones all required ONAP git repositories"
    echo ""
    echo "       Usage:  $MOD_SCRIPT_NAME [-options]"
    echo ""
    echo "       Options"
    echo "         -d          - the ONAP clone directory, defaults to '.'"
    echo "         -h          - this help screen"
    echo ""
    exit 255;
}

##
## read command line
##
while [ $# -gt 0 ]
do
    case $1 in
        #-d ONAP clone directory
        -d)
            shift
            if [ -z "$1" ]; then
                echo "$MOD_SCRIPT_NAME: no clone directory"
                exit 1
            fi
            clone_dir=$1
            shift
        ;;

        #-h prints help and exists
        -h)
            Help;exit 0;;

        *)    echo "$MOD_SCRIPT_NAME: undefined CLI option - $1"; exit 255;;
    esac
done

if [ -f "$clone_dir" ]; then
    echo "$MOD_SCRIPT_NAME: requested clone directory '$clone_dir' exists as file"
    exit 2
fi
if [ -d "$clone_dir" ]; then
    echo "$MOD_SCRIPT_NAME: requested clone directory '$clone_dir' exists as directory"
    exit 2
fi

mkdir $clone_dir
if [ $? != 0 ]
then
    echo cannot clone ONAP repositories, could not create directory '"'$clone_dir'"'
    exit 3
fi

for repo in $onap_repos
do
    repoDir=`dirname "$repo"`
    repoName=`basename "$repo"`

    if [ ! -z $dirName ]
    then
    mkdir "$clone_dir/$repoDir"
        if [ $? != 0 ]
        then
            echo cannot clone ONAP repositories, could not create directory '"'$clone_dir/repoDir'"'
            exit 4
        fi
    fi

    git clone https://gerrit.onap.org/r/${repo} $clone_dir/$repo
    git -C $clone_dir/$repo checkout beijing
done

echo ONAP has been cloned into '"'$clone_dir'"'


Execution of the script above results in the following directory hierarchy in your ~/git directory:

~/git/onap
~/git/onap/policy
~/git/onap/policy/common
~/git/onap/policy/docker
~/git/onap/policy/drools-applications
~/git/onap/policy/drools-pdp
~/git/onap/policy/engine

Following execution of the script above, all five git repositories should be on the "beijing" branch. Verify the branch using the following commands:

cd ~/git/onap/policy
find . -mindepth 1 -maxdepth 1 -type d -print -exec git -C {} status \;

Expect a result similar to:

./drools-pdp
On branch beijing
Your branch is up-to-date with 'origin/beijing'.
nothing to commit, working directory clean
./docker
On branch beijing
Your branch is up-to-date with 'origin/beijing'.
nothing to commit, working directory clean
./common
On branch beijing
Your branch is up-to-date with 'origin/beijing'.
nothing to commit, working directory clean
./engine
On branch beijing
Your branch is up-to-date with 'origin/beijing'.
nothing to commit, working directory clean
./drools-applications
On branch beijing
Your branch is up-to-date with 'origin/beijing'.
nothing to commit, working directory clean


Building ONAP

  1. 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
  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

    Typical pom.xml to build the ONAP Policy Framework Policy Modules
    <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">
        <modelVersion>4.0.0</modelVersion>
        <groupId>org.onap</groupId>
        <artifactId>onap-policy</artifactId>
        <version>1.1.0</version>
        <packaging>pom</packaging>
        <name>${project.artifactId}</name>
        <inceptionYear>2017</inceptionYear>
        <organization>
            <name>ONAP</name>
        </organization>
    
        <modules>
            <module>common</module>
            <module>engine</module>
            <module>drools-pdp</module>
            <module>drools-applications</module>
        </modules>
    </project>
  3. 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

  1. Build the policy engine docker image:

    cd ~/git/onap/policy/engine/packages/docker/target
    docker build -t onap/policy-pe policy-pe

  2. Build the Drools PDP docker image:
    cd ~/git/onap/policy/drools-pdp/packages/docker/target
    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.

  1. Go into the docker directory

    cd ~/git/onap/policy/docker
  2. Make the file config/drools/drools-tweaks.sh executable.

    chmod +x config/drools/drools-tweaks.sh
  3. 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.

  4. Set the environment variable MTU to be a suitable MTU size for the application.

    export MTU=9126
  5. 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:

    export PRELOAD_POLICIES=false
  6. 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
    docker-compose up

Test that the ONAP Policy Framework is up

  1. Run the command below

    curl -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'ClientAuth: cHl0aG9uOnRlc3Q=' -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' -H 'Environment: TEST' -X POST -d '{"policyName": ".*"}' http://localhost:8081/pdp/api/getConfig  |  python -m json.tool
  2. 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

  • No labels

56 Comments

  1. Would you please share the syntax of the file and/or an example config for the file referenced in this instruction:

    "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."

    Edit: When I run it without giving an IP address, it appears to pick up the localhost (0.0.0.0).

    Would you please add notes on how to access the policy GUI in a local installation (if it is possible to use the GUI in local install)? 

  2. The format of the ip_addr.txt file is simply a file with just the IP address in it and nothing else, for example

    $ more ./config/pe/ip_addr.txt
    10.11.11.123

    $


    Regarding the Policy GUI, I have not managed to get access to my local policy GUI but I had to cheat a little:

    in my /etc/hosts file I created an alias for the ONAP portal installation on another machine and a separate alias pointing at my Policy framework installation machine to pick up the policy framework GUI. This allowed me to use the portal on another machine for authentication and then work towards the Policy framework on my on installation.

    $ cat /etc/hosts
    10.11.11.120 portal.api.simpledemo.onap.org
    10.11.11.123  policy.api.simpledemo.onap.org




    1. Liam Fallon  Please advise in the above i assume 10.11.11.120 is you host IP and you amended the VM etc hosts.

      The reason i ask this is in our case we run the VM on AWS EC2 instance and when we do the full installatio

      for the portal we need to update the etc file of the Laptop/ Desktop that we use to ssh into the VM on AWS EC2 

      Thanks

      samir K

  3. When i run the mvn clean install -DskipTests to build the policy framework, i get below error,

    Failed to execute goal on project BRMSGateway: Could not resolve dependencies for project org.onap.policy.engine:BRMSGateway:jar:1.2.0-SNAPSHOT: The following artifacts could not be resolved: org.apache.maven.indexer:indexer-artifact:jar:5.1.1-d928049c927da992071a6c6bba892568dbcf27a3, org.apache.maven.indexer:indexer-core:jar:5.1.1-d928049c927da992071a6c6bba892568dbcf27a3, org.restlet:org.restlet:jar:1.1.6-SONATYPE-5348-V7, org.restlet:org.restlet.ext.fileupload:jar:1.1.6-SONATYPE-5348-V7, org.restlet:org.restlet.ext.velocity:jar:1.1.6-SONATYPE-5348-V7, org.restlet:org.restlet.ext.jaxrs:jar:1.1.6-SONATYPE-5348-V7, com.noelios.restlet:com.noelios.restlet:jar:1.1.6-SONATYPE-5348-V7, com.noelios.restlet:com.noelios.restlet.ext.httpclient:jar:1.1.6-SONATYPE-5348-V7, com.noelios.restlet:com.noelios.restlet.ext.servlet:jar:1.1.6-SONATYPE-5348-V7, org.json:org.json:jar:2.0-NEXUS-3758: Could not find artifact org.apache.maven.indexer:indexer-artifact:jar:5.1.1-d928049c927da992071a6c6bba892568dbcf27a3


    I see the nexus repository also does not have these jars. Has anyone succeeded in building this without errors?

    1. I did a fresh clone and build on Monday without any problems (w/o tests, i.e. -DskipTests). Several possible root causes

      • you might need to add the ONAP Nexus to your Maven (M2) settings, I have added a link at the top of this page (the prereq list)
      • you might need to do a fresh pull of the code

      Hope this helps.

  4. Liam Fallon, after setting up the standalone mode of policy, I tried to send the below curl request. 

    curl -v --silent --user @1b3rt:31nst31n -X GET http://<Policy-IP>:9696/policy/pdp/engine/controllers/amsterdam/drools/facts/closedloop-amsterdam/org.onap.policy.controlloop.Params  | python -m json.tool


    But it gives empty list, which I think should give closedloop policies. I took the curl request from this file https://git.onap.org/demo/tree/vnfs/vFW/scripts/update-vfw-op-policy.sh?h=amsterdam

    1. Bharath Thiruveedula sorry for the very late response. In order to get policies loaded, please look at the other wiki we have created at:
      ONAP Policy Framework: Standalone installation in Virtual Machine

  5. Hi,

    When I run "docker-compose up", I get the below error.

    ERROR: Network "policy_default" needs to be recreated - options have changed


    1. Hi Sangeeth G,

      I have been working on updating this Quick Start for the Beijing release. I just ran through the whole thing on a clean machine running Ubuntu 16.04 natively (not a VM) and it worked fine.

      Could you try running through all the setps again? If the error still exists, please forward a full error trace to us and we'll look at it.

      1. Hi Liam,

        Now noticing the below issue. The step was mvn clean install

        [INFO] BUILD FAILURE

        [INFO] ------------------------------------------------------------------------
        [INFO] Total time: 01:18 h
        [INFO] Finished at: 2018-04-16T07:15:18+00:00
        [INFO] Final Memory: 136M/1562M
        [INFO] ------------------------------------------------------------------------
        [ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test (default-test) on project ONAP-PDP-REST: There are test failures.
        [ERROR]
        [ERROR] Please refer to /home/ubuntu/git/onap/policy/engine/ONAP-PDP-REST/target/surefire-reports for the individual test results.
        [ERROR] -> [Help 1]
        [ERROR]
        [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
        [ERROR] Re-run Maven using the -X switch to enable full debug logging.
        [ERROR]
        [ERROR] For more information about the errors and possible solutions, please read the following articles:
        [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
        [ERROR]
        [ERROR] After correcting the problems, you can resume the build with the command
        [ERROR] mvn <goals> -rf :ONAP-PDP-REST

        1. Hi Sangeeth,

          I just pulled the latest policy engine code from git and cleaned my .m2 repository and ran "mvn clean install" and everything built fine.

          There were some updates to the code so cold you just pull again to ensure you have the latest version of everything. You will appreciate that there are likely to be fixes at this stage of Beijing because the code is only just released, sorry for that.


          Could you pull again and delete the directory ~/.m2/repository/org/onap and try to build again.

          If you continue to encounter problems, please attach the entire build log because that will allow us to look back and see what tests are failing.

          Liam



          1. Thanks Liam. Now the build is successful.

          2. Hi Liam,

            Seeing an issue on drools. I don't find the target directory with necessary sub-dir created for drools-pdp. But other two build works fine.

            Build the Drools PDP docker image:

            cd ~/git/onap/policy/drools-pdp/packages/docker/target
            docker build -t onap/policy-drools policy-drools
            1. Hi Sangeeth,

              Did you do a mvn clean install in the docker directory? That creates the target directory for me.


              1. Yep. I did that. It created target directory for policy engine and nexus. But i dont see it created for drools

                1. Just pulled a clean drools-pdp and then did a mvn clean install:

                    410  rm -fr drools-pdp/
                    411  git clone https://gerrit.onap.org/r/policy/drools-pdp
                    412  cd drools-pdp/
                    413  mvn clean isntall
                    414  mvn clean install
                    415  ls packages/docker/target/
                    416  history
                  eeilfn@elx78051wzy:~/git/onap/policy/drools-pdp$ ls packages/docker/target/
                  checkstyle-cachefile  checkstyle-checker.xml  checkstyle-result.xml  failsafe-reports  policy-drools  version


                  1. Thanks Liam. Did the same. Now the target directory gets created. (smile)

                  2. Hi Liam,

                    Standalone policy is setup. All the containers are up and running. When i do curl, i get the below stating "config not found". Is this the expected behaviour ?

                    ubuntu@policy:~/git/onap/policy/docker$ sudo curl -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'ClientAuth: cHl0aG9uOnRlc3Q=' -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' -H 'Environment: TEST' -X POST -d '{"policyName": ".*"}' http://localhost:8081/pdp/api/getConfig | python -m json.tool
                    % Total % Received % Xferd Average Speed Time Time Time Current
                    Dload Upload Total Spent Left Speed
                    100 259 0 239 100 20 5251 439 --:--:-- --:--:-- --:--:-- 5311
                    [
                    {
                    "config": null,
                    "matchingConditions": null,
                    "policyConfigMessage": "No Response Received",
                    "policyConfigStatus": "CONFIG_NOT_FOUND",
                    "policyName": null,
                    "policyType": null,
                    "policyVersion": null,
                    "property": null,
                    "responseAttributes": null,
                    "type": null
                    }
                    ]

                    1. Hi Sangeeth G,

                      We're in the process of adding to and updating our wikis and howtos for Beijing. If you could bear with us for a few days, we'll get the instructions up.


                      Thanks Liam

                      1. Yeah Sure Liam. Thanks a lot (smile)

                        1. Hi Sangeeth, Check our our other wiki below, which you can use to get policies up and running:
                          ONAP Policy Framework: Standalone installation in Virtual Machine

                          1. Hi Liam,

                            Thanks a lot.

  6. Hello Liam,

    I am trying out this setup on another instance. But now I get the below issues when I do mvn clean install

    onap@onap-pm:~/git/onap/policy$ mvn clean install
    [INFO] Scanning for projects...
    Downloading: https://nexus.opendaylight.org/content/repositories/public/org/onap/oparent/oparent/1.1.0/oparent-1.1.0.pom
    Downloading: https://nexus.onap.org/content/repositories/releases/org/onap/oparent/oparent/1.1.0/oparent-1.1.0.pom
    Downloaded: https://nexus.onap.org/content/repositories/releases/org/onap/oparent/oparent/1.1.0/oparent-1.1.0.pom (21 KB at 34.9 KB/sec)
    Downloading: https://nexus.opendaylight.org/content/repositories/public/org/onap/oparent/version/1.1.0/version-1.1.0.pom
    Downloading: https://nexus.onap.org/content/repositories/releases/org/onap/oparent/version/1.1.0/version-1.1.0.pom
    Downloaded: https://nexus.onap.org/content/repositories/releases/org/onap/oparent/version/1.1.0/version-1.1.0.pom (6 KB at 29.1 KB/sec)
    [ERROR] [ERROR] Some problems were encountered while processing the POMs:
    [ERROR] Child module /home/onap/git/onap/policy/docker/pom.xml of /home/onap/git/onap/policy/pom.xml does not exist @
     @
    [ERROR] The build could not read 1 project -> [Help 1]
    [ERROR]
    [ERROR]   The project org.onap:onap-policy:1.1.0 (/home/onap/git/onap/policy/pom.xml) has 1 error
    [ERROR]     Child module /home/onap/git/onap/policy/docker/pom.xml of /home/onap/git/onap/policy/pom.xml does not exist
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException

    1. Sangeeth G I think the script may need to change as the policy/docker repo no longer has a pom.xml in it. 

      1. Yes, I have removed the following line from the sample pom.xml above:

                <module>docker</module>

        Sangeeth G Thanks for finding this problem. Please feel free to dig into these problems and update the wiki page yourself!

        1. Sure. Thanks Pamela DragoshLiam Fallon . Let me change it and try it again.

          1. Now it goes through (smile)

  7. seeing another one during build.


    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 16:06 min
    [INFO] Finished at: 2018-05-11T16:05:57+01:00
    [INFO] Final Memory: 401M/9461M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-assembly-plugin:2.4.1:single (create-distribution) on project stability: Assembly is incorrectly configured: null: Assembly is incorrectly configured: null:
    [ERROR] Assembly: null is not configured correctly: Assembly ID must be present and non-empty.
    [ERROR] -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
    [ERROR]
    [ERROR] After correcting the problems, you can resume the build with the command
    [ERROR]   mvn <goals> -rf :stability

    1. Sangeeth G We're rather busy doing tests and releasing the Beijing PF. Perhaps you could do some troubleshooting on this one? It looks like an assembly invoked by the maven build has a problem. Have a look for an assembly.xml file.



    2. Sangeeth G I faced this issue. Add <id>releases</id> above this line https://github.com/onap/policy-drools-applications/blob/master/testsuites/stability/src/assembly/assembly.xml#L27 and try again

      1. I just checked out the entire Policy Framework and ran a build on the whole thing. It built without errors. Sangeeth G maybe do a fresh pull and try again.

  8. Thanks Guys, Now the build is successful. docker build is also good. Standalone setup works (smile)

  9. Pamela Dragosh Liam Fallon

    Though it is not related this wiki page. I have few queries regarding policy architecture.

    when I run the docker containers of the policy, where I can see containers as follows:

    • PAP from policy-pe image
    • PDP from policy-pe image
    • drools from policy-drools image
    • nexus from nexus image
    • brmsgw from policy-pe image
    • mariadb from mariadb image

    As far as the code, whenever a new PDP is added it has to notify PAP according to this https://github.com/onap/policy-engine/blob/master/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/XACMLPapServlet.java#L522.

    I can see whenever pdp container is up, I can see the logs of pap which shows "a new pdp is requesting" kind of message. But this pdp actually refers to PDP-X. 

    I am expecting a similar logs in PAP when "drools" container is up because drools-pdp folder refers PDP-D, but it was not happened. Is my assumption wrong?

    • when and how PAP will contact pdp-d?
    • If PDP-D is used for running operational policies, can we run closed loop just with pdp-d after pushing policies?



    1. The PAP uses the PDP-X to talk to the PDP-D. Have a look at the Policy Framework architecture on this page. It has a nice diagram (the second diagram) explaining the interfaces.
      Policy

    2. Yes Liam is correct, the PDP-X use BRMSGW to push policies to the drools PDP. We hope to change this in the Casablanca architecture so that all PDP's go directly to the PAP for their policies.

  10. Hi Guys,

    I'm unable to connect to the repo's by running the script Typical ONAP Policy Framework Clone Script. It gives me the below error. Please help:

    [root@servername ~]# git clone https://gerrit.onap.org/r/integration
    Cloning into 'integration'...

    fatal: unable to access 'https://gerrit.onap.org/r/integration/': Failed connect to gerrit.onap.org:443; Connection timed out

    Any idea how to resolve this? Help appreciated. Thanks

    1. Hi Vishnu,

      I copy/pasted the script and ran it just now and it ran fine.

      I can't understand how you got a clone error on an "integration" repo because this repo is not referenced anywhere in the script. Could you check everything you did and try it again?

      Best Regards

      Liam

    2. The integration repo is not a policy project repository. Nevertheless, you have an access problem and need to ensure you are either using ssh or https to clone the repo using your Linux Foundation key. See Developing ONAP for instructions on getting started.

  11. Hi Guys Thanks for the reply,

    I have tried cloning ssh and https to clone the repo using my Linux Foundation key using the commands:

    1. git clone ssh://Vishnumu@gerrit.onap.org:29418/integration

          2.git clone ssh://Vishnumu@gerrit.onap.org:29418/integration && scp -p -P 29418 Vishnumu@gerrit.onap.org:hooks/commit-msg   integration/.git/hooks/

    Is there any pre-requisites like "firewall service should be down" or anything?

    and also If I'm trying to access the links thru browser I'm getting a Not Found Error:

    1. https://gerrit.onap.org/r/integration
      Is there any downloadable files available to set it offline without cloning the URL? Thanks.



    1. Hi Vishnu,

      Just to point out again that this page describes how to start the ONAP Policy Framework. The Integration project is not part of the policy framework.If you want to work with the Integration project I suggest you have a look at the HowTos on their page at: HOWTOs


      I am able to clone the integration project with the command:
      git clone https://gerrit.onap.org/r/integration

      In order to clone and build a project, you do not have to log in at all.

      To see the integration project in Gerrit on the web, use this link:
      https://gerrit.onap.org/r/gitweb?p=integration.git;a=summary

      Best Regards
      Liam

  12. Thanks Pamela Dragosh and Liam Fallon. It worked. My system was not configured with open internet; I connected and got it resolved. Thanks much guys!!!

  13. Building the ONAP Policy Framework Docker Images

    The instructions here are based on the instructions in the file ~/git/onap/policy/docker/README.md

    1. Build the policy engine docker image:

      cd ~/git/onap/policy/engine/packages/docker/target
      docker build -t onap/policy-pe policy-pe

    2. Build the Drools PDP docker image:
      cd ~/git/onap/policy/drools-pdp/packages/docker/target
      docker build -t onap/policy-drools policy-drools

      I'm using a RHEL 7.4 system, any idea how the installation scripts run? Because when i checked the Dockerfile in  ~/git/onap/policy/engine/packages/docker/target/policy-pe;  and same while builiding the Drools PDP docker image, It was specifically written for Ubunutu. Please help.

  14. Helo Team,

    Very clear instructions, but I've hit a snag and have a question. I'm on MacOS

    question: In 'Starting .. Docker Images', (also looking at <>docker/README.md)

    3. Set the IP address... ifconfig on my system does not report eth0, should I use en0?

    snag: docker-conductor up

    .....

    Status: Downloaded newer image for sonatype/nexus:2.14.8-01

    Creating mariadb ... error

    Creating nexus   ... 


    ERROR: for mariadb  Cannot start service mariadb: b'driver failed programming external connectivity on endpoint mariadb (6eba2bc6931a96f24843fac806b3a21ecdb6c5bd5c567cefaef11503515e966b): Error startiCreating nexus   ... done


    ERROR: for mariadb  Cannot start service mariadb: b'driver failed programming external connectivity on endpoint mariadb (6eba2bc6931a96f24843fac806b3a21ecdb6c5bd5c567cefaef11503515e966b): Error starting userland proxy: Bind for 0.0.0.0:3306 failed: port is already allocated'

    ERROR: Encountered errors while bringing up the project.

    -----------------

    related to question on ip address?


    Thanks or the help - Frank



    1. Hi Frank,

      I used a macbook when doing this work so it should be possible for you to get it working too.

      I used the en0 address, I think that it should work as long as the IP address of a real working interface on your system. It worked fine with the en0 IP address on my machine.

      Try it and let me know how you get on,

      Liam

  15. Thanks for the quick reply Liam.

    I had tried using en0, and using the MTU value reported on that interface, and have tried again, but with the same result starting mariadb

    1. I haven't run through this howto in a month or two. I'll run through it later today and see if anything has changed.

      1. Hi Frank,

        I walked through the howto yesterday/this morning in parallel on a Macbook Pro running High Sierra 10.13.6 and a HP ZBook laptop running Ubuntu 16.04. All the steps of the HowTo worked fine for me right through to the end.


        On the MacBook I used the IP address of my wired connection (en0) and I used a MTU size of 9126.
        I changed a few of the steps in the HowTo to simplify it, maybe you could try to run through it from the beginning one more time just to see if it works now.

        1. Hi Liam, thanks for the support. 

          I have run through the entire set of steps again (with one change: mvn clean install -DskipTests)

          Here is a sequence of commands that appear ti indicate that the MTU value may be problematic

          ----------------

          Franciss-MacBook-Air:docker francissandoval$ ifconfig en0

          en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500

          ether 98:01:a7:da:05:67 

          inet6 fe80::1c64:71d3:c252:3%en0 prefixlen 64 secured scopeid 0x4 

          inet 192.168.0.98 netmask 0xffffff00 broadcast 192.168.0.255

          nd6 options=201<PERFORMNUD,DAD>

          media: autoselect

          status: active

          Franciss-MacBook-Air:docker francissandoval$ IP_ADDRESS=192.168.0.98

          Franciss-MacBook-Air:docker francissandoval$ echo $IP_ADDRESS > config/pe/ip_addr.tx

          Franciss-MacBook-Air:docker francissandoval$ export MTU=9126

          Franciss-MacBook-Air:docker francissandoval$ docker-compose up

          ERROR: Network "docker_default" needs to be recreated - option "com.docker.network.driver.mtu" has changed

          Franciss-MacBook-Air:docker francissandoval$ export MTU=1500

          Franciss-MacBook-Air:docker francissandoval$ docker-compose up

          Creating mariadb ... error

          Creating nexus   ... 


          ERROR: for mariadb  Cannot start service mariadb: b'driver failed programming external connectivity on endpoint mariadb (9365c7079236b6573df6e1c413bCreating nexus   ... done


          ERROR: for mariadb  Cannot start service mariadb: b'driver failed programming external connectivity on endpoint mariadb (9365c7079236b6573df6e1c413b15a149e603b977489fbd7397b0342a270ba38): Error starting userland proxy: Bind for 0.0.0.0:3306 failed: port is already allocated'

          Any ideas? Thanks again for all the help thus far

          • Frank




          1. Hi again Liam,

            I restarted my laptop to ensure port 3306 was unused, and set MTU=1450, as my Mac's en0 interface mtg is 1500. All seems good if output below is expected from curl cmd above

            [

                {

                    "config": null,

                    "matchingConditions": null,

                    "policyConfigMessage": "No Response Received",

                    "policyConfigStatus": "CONFIG_NOT_FOUND",

                    "policyName": null,

                    "policyType": null,

                    "policyVersion": null,

                    "property": null,

                    "responseAttributes": null,

                    "type": null

                }

            ]

            1. Hi Frank,

              That seems to be correct. If you look at the next comment below to Krishnakumar  you will see he got the same response. Have a look at the answer to his comment you will see where to go next.


              Best Regards

              Liam

  16. Thank you for the detailed steps. The steps are very clear. I followed as given in this guide. I was able to get the policy running and try the curl command.

    to start the docker, i added these into a shell script and start the shell script: start_policy.sh

    cd ~/git/onap/policy/docker
    export MTU=9126
    export PRELOAD_POLICIES=false
    docker-compose up

    For testing: test_policy.sh 

    curl -H 'Content-Type: application/json' -H 'Accept: application/json' -H 'ClientAuth: cHl0aG9uOnRlc3Q=' -H 'Authorization: Basic dGVzdHBkcDphbHBoYTEyMw==' -H 'Environment: TEST' -X POST -d '{"policyName": ".*"}' http://localhost:8081/pdp/api/getConfig | python -m json.tool

    The reason was my laptop at home with Ubuntu 17.10 does not have enough RAM(5.xGB), just about 3.x GB left, so want to get this up and running, without opening any browser. 

    Following was the result:

    % Total % Received % Xferd Average Speed Time Time Time Current
    Dload Upload Total Spent Left Speed
    100 259 0 239 100 20 11 1 0:00:20 0:00:20 --:--:-- 65
    [
    {
    "config": null,
    "matchingConditions": null,
    "policyConfigMessage": "No Response Received",
    "policyConfigStatus": "CONFIG_NOT_FOUND",
    "policyName": null,
    "policyType": null,
    "policyVersion": null,
    "property": null,
    "responseAttributes": null,
    "type": null
    }
    ]

    please let me know if this result is correct

    1. If under the heading "Starting the ONAP Policy Framework Docker Images", you decided not to load policies, then the response you have is correct, that is disabled policy preloading by setting "export PRELOAD_POLICIES=false"

      You can now move on and try the tutorials suggested and linked under the "Installation of Controllers and Policies" headings.

  17. Hello, can someone please point casablanca standalone setup?

  18. Hi All, 

    I am trying to starting docker.

    When I am running command:-- docker-compose up, its showing error:

    command:---   onap/policy/docker/config/pe$ sudo docker-compose up

    WARNING: The PRELOAD_POLICIES variable is not set. Defaulting to a blank string.
    WARNING: The MTU variable is not set. Defaulting to a blank string.
    Creating network "docker_default" with driver "bridge"
    ERROR: failed to parse com.docker.network.driver.mtu value: (strconv.Atoi: parsing "": invalid syntax)

    Please suggest.

  19. Hi Dushyant Thakur , the variable MTU hasn't set. It's not recognized by docker. You may recheck the MTU env has set.