Skip to end of metadata
Go to start of metadata

This article explains how to install the Amsterdam policy controller and the Amsterdam policies on a raw ONAP Policy Framework installation running in Docker.

To build a raw Policy Framework installation, please follow either of the HowTo articles below prior to using this HowTo:

Having followed those articles, you should have the ONAP Policy Framework running in Docker, having started the Policy Framework with docker-compose

Test that the ONAP Policy Framework is up and is empty

  1. Run the command below

    curl --silent --user @1b3rt:31nst31n -X GET http://localhost:9696/policy/pdp/engine/controllers/amsterdam | python -m json.tool

    You should get a response similar to the following

    {
        "error": "amsterdam not found"
    }

Install the Amsterdam policy controller

  1. Log onto the Drools PDP

    docker exec -it drools bash

    You now have a shell open in the Drools PDP container running in docker

  2. Create a temporary directory for controller installation

    mkdir /tmp/apps-controlloop
    cd /tmp/apps-controlloop
  3. Download the latest controller from Nexus (1.2.0 at the time of writing)

    wget https://nexus.onap.org/content/repositories/releases/org/onap/policy/drools-applications/controlloop/packages/apps-controlloop/1.2.0/apps-controlloop-1.2.0.zip
  4. Unzip the controller

    unzip apps-controlloop-1.2.0.zip
  5. Stop the policy engine

    policy stop
  6. Install the controller by running the controller installation script

    ./apps-controlloop-installer
  7. Install the controlloop-utils Drools PDP feature to allow standalone execution of control loop policies

    features install controlloop-utils
    features enable controlloop-utils
  8. Start the policy engine

    policy start
  9. Check if the Amsterdam controller is loaded

    curl --silent --user @1b3rt:31nst31n -X GET http://localhost:9696/policy/pdp/engine/controllers/amsterdam | python -m json.tool

    You should get a response similar to the following:

    Amsterdam Controller JSON Response
    {
        "alive": true,
        "drools": {
            "alive": false,
            "artifactId": "NO-ARTIFACT-ID",
            "brained": false,
            "canonicalSessionNames": [],
            "container": null,
            "groupId": "NO-GROUP-ID",
            "locked": false,
            "recentSinkEvents": [],
            "recentSourceEvents": [],
            "sessionNames": [],
            "version": "NO-VERSION"
        },
        "locked": false,
        "name": "amsterdam",
        "topicSinks": [
            {
                "alive": true,
                "allowSelfSignedCerts": false,
                "apiKey": "",
                "apiSecret": "",
                "locked": false,
                "partitionKey": "ea44d32e-e2e6-4a77-862b-aa33437179ed",
                "recentEvents": [],
                "servers": [
                    "vm1.mr.simpledemo.openecomp.org"
                ],
                "topic": "APPC-CL",
                "topicCommInfrastructure": "UEB",
                "useHttps": false
            },
            {
                "alive": true,
                "allowSelfSignedCerts": false,
                "apiKey": "",
                "apiSecret": "",
                "locked": false,
                "partitionKey": "47769d22-03c8-4993-9f67-fe326a491b23",
                "recentEvents": [],
                "servers": [
                    "vm1.mr.simpledemo.openecomp.org"
                ],
                "topic": "APPC-LCM-READ",
                "topicCommInfrastructure": "UEB",
                "useHttps": false
            },
            {
                "alive": true,
                "allowSelfSignedCerts": false,
                "apiKey": "",
                "apiSecret": "",
                "locked": false,
                "partitionKey": "c33ca5ca-6ebd-47d7-a495-5a54f8a2a15a",
                "recentEvents": [],
                "servers": [
                    "vm1.mr.simpledemo.openecomp.org"
                ],
                "topic": "POLICY-CL-MGT",
                "topicCommInfrastructure": "UEB",
                "useHttps": false
            }
        ],
        "topicSources": [
            {
                "alive": true,
                "allowSelfSignedCerts": false,
                "apiKey": "",
                "apiSecret": "",
                "consumerGroup": "6dcfdfb8-7c54-4dbd-9337-e4f1883083fb",
                "consumerInstance": "drools",
                "fetchLimit": 100,
                "fetchTimeout": 15000,
                "locked": false,
                "recentEvents": [],
                "servers": [
                    "vm1.mr.simpledemo.openecomp.org"
                ],
                "topic": "unauthenticated.DCAE_CL_OUTPUT",
                "topicCommInfrastructure": "UEB",
                "useHttps": false
            },
            {
                "alive": true,
                "allowSelfSignedCerts": false,
                "apiKey": "",
                "apiSecret": "",
                "consumerGroup": "4f558331-3d32-494b-b7dc-4d5a509dda0d",
                "consumerInstance": "drools",
                "fetchLimit": 100,
                "fetchTimeout": 15000,
                "locked": false,
                "recentEvents": [],
                "servers": [
                    "vm1.mr.simpledemo.openecomp.org"
                ],
                "topic": "APPC-CL",
                "topicCommInfrastructure": "UEB",
                "useHttps": false
            },
            {
                "alive": true,
                "allowSelfSignedCerts": false,
                "apiKey": "",
                "apiSecret": "",
                "consumerGroup": "1e3edc1f-afa6-4ae5-907f-a7118ad7a0d2",
                "consumerInstance": "drools",
                "fetchLimit": 100,
                "fetchTimeout": 15000,
                "locked": false,
                "recentEvents": [],
                "servers": [
                    "vm1.mr.simpledemo.openecomp.org"
                ],
                "topic": "APPC-LCM-WRITE",
                "topicCommInfrastructure": "UEB",
                "useHttps": false
            }
        ]
    }
    
    

Install the Amsterdam vCPE Policy

We now install the Amsterdam policy for the vCPE use case.

  1. Log onto (or remain logged onto) the Drools PDP

    docker exec -it drools bash

    You now have a shell open in the Drools PDP container running in docker

  2. Check that the Amsterdam policies are not loaded by querying for Drools facts

    curl --silent --user @1b3rt:31nst31n -X GET http://localhost:9696/policy/pdp/engine/controllers/amsterdam/drools/facts/amsterdam | python -m json.tool

    Expect the response
    {}


  3. Create a temporary directory for policy installation

    mkdir /tmp/basex-controlloop
    cd /tmp/basex-controlloop
  4. Extract the policies from the control loop zip file downloaded from Nexus and expanded in steps 3) and 4) above

    tar zxvf /tmp/apps-controlloop/basex-controlloop-1.2.0.tar.gz
  5. Install the Amsterdam policy rules, the script asks for a number of input parameters, accept the default for all parameters

    bin/create-cl-amsterdam

    Type Y when asked for confirmation of parameters
    Accept /tmp as the install directory
    Type Y to agree to creation of a Maven Artifact

  6. Maven artifact creation now proceeds. After some minutes, confirmation is requested for deployment of rules into Maven. Type Y to deploy the rules. The rules are deployed into Maven. Expect the rule deployment process to take a number of minutes, perhaps 10 minutes.
  7. Copy the Amsterdam properties file into the Drools PDP configuration directory. This file configures the Drools PDP with the Amsterdam policies

    cp /tmp/amsterdam/amsterdam-controller.properties /opt/app/policy/config
  8. Stop and start the Drools PDP

    policy stop
    policy start
  9. Now verify that the Amsterdam policies are loaded, there should be a fact in the Drools PDP

    curl --silent --user @1b3rt:31nst31n -X GET http://localhost:9696/policy/pdp/engine/controllers/amsterdam/drools/facts/amsterdam | python -m json.tool

    Expect the response

    {
     "org.onap.policy.controlloop.Params": 1
    }

Execute the vCPE Use Case Manually

You can now run the vCPE Policy use case manually using the HowTos below:

Note that

  1. You should check that the topic names you use match those in the Amsterdam configuration file /opt/app/policy/config/amsterdam-controller.properties.
  2. You should ensure that you change to the directory /tmp/amsterdam prior to running those HowTos
  • No labels

13 Comments

  1. Liam Fallon


    Hello Liam  - Would really appreciate if i can be guided from the below . 


    The Control Loop Rules Maven Project Source Rules will be installed at /tmp
    Do you want to change the Rules Source Project install directory? /tmp
    Create Maven Artifact (Y/N)? Y


    The error is as shown below 

    [INFO] ------------------------------------------------------------------------

    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 4.634s
    [INFO] Finished at: Wed Dec 19 06:50:44 UTC 2018
    [INFO] Final Memory: 15M/196M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.0.1:generate (default-cli) on project standalone-pom: The desired archetype does not exist (org.onap.policy.drools-applications.controlloop.templates:archetype-cl-amsterdam:1.1.1) -> [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

    Aborting: amsterdam has not been successfully generated


    1. Hi samir kumar maven reaching out to ONAP nexus to fetch archetype-cl-Amsterdam artifact with version 1.1.1. Ensure of the artifact present at https://nexus.onap.org/content/repositories/releases/org/onap/policy/drools-applications/controlloop/templates/archetype-cl-amsterdam/.

      You may try giving artifact version available in nexus.

      1. Hi samir kumar, can you try the suggestion from Vamshi Krishna Namilikonda and get back to us if the problems persist? Thanks.

        Pamela Dragosh Jorge Hernandez

        1. Vamshi Krishna Namilikonda Liam Fallon Pamela Dragosh Jorge Hernandez

          i tried with the target snapshot of 1.3.4 which was the latest on the link shared by Vamshi 

          https://nexus.onap.org/content/repositories/releases/org/onap/policy/drools-applications/controlloop/templates/archetype-cl-amsterdam/.

          yet got the error below . snapshot attached 

           Do advise while i try and see if something else can be done .


          First this is what the behaviour was followed by the snapshot attached 


          1) No implementation for org.codehaus.plexus.languages.java.jpms.LocationManager was bound.
          while locating org.apache.maven.plugin.surefire.SurefirePlugin

          1 error
          at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:999)
          at com.google.inject.internal.InjectorImpl.getInstance(InjectorImpl.java:1025)
          at org.sonatype.guice.bean.reflect.AbstractDeferredClass.get(AbstractDeferredClass.java:45)
          at com.google.inject.internal.ProviderInternalFactory.provision(ProviderInternalFactory.java:84)
          at com.google.inject.internal.InternalFactoryToInitializableAdapter.provision(InternalFactoryToInitializableAdapter.java:52)
          at com.google.inject.internal.ProviderInternalFactory$1.call(ProviderInternalFactory.java:70)
          at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:100)
          at org.sonatype.guice.plexus.lifecycles.PlexusLifecycleManager.onProvision(PlexusLifecycleManager.java:138)
          at com.google.inject.internal.ProvisionListenerStackCallback$Provision.provision(ProvisionListenerStackCallback.java:108)
          at com.google.inject.internal.ProvisionListenerStackCallback.provision(ProvisionListenerStackCallback.java:55)
          at com.google.inject.internal.ProviderInternalFactory.circularGet(ProviderInternalFactory.java:68)
          at com.google.inject.internal.InternalFactoryToInitializableAdapter.get(InternalFactoryToInitializableAdapter.java:45)
          at com.google.inject.internal.InjectorImpl$3$1.call(InjectorImpl.java:990)
          at com.google.inject.internal.InjectorImpl.callInContext(InjectorImpl.java:1036)
          at com.google.inject.internal.InjectorImpl$3.get(InjectorImpl.java:986)
          at com.google.inject.Scopes$1$1.get(Scopes.java:59)
          at org.sonatype.guice.bean.locators.LazyBeanEntry.getValue(LazyBeanEntry.java:83)
          at org.sonatype.guice.plexus.locators.LazyPlexusBean.getValue(LazyPlexusBean.java:49)
          at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:253)
          at org.codehaus.plexus.DefaultPlexusContainer.lookup(DefaultPlexusContainer.java:245)
          at org.apache.maven.plugin.internal.DefaultMavenPluginManager.getConfiguredMojo(DefaultMavenPluginManager.java:455)
          at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:92)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
          at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
          at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
          at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
          at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320)
          at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
          at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
          at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
          at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
          at java.lang.reflect.Method.invoke(Method.java:498)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
          at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
          at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
          at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)

          and then the Build Failure 

          1. have also tried with 1.2.0 as well, Many thanks 

            1. Hello samir kumar, I haven't experienced this particular problem myself, so environments may play a factor.   In any case, it seems the solution from this post may be what you want:   https://lists.onap.org/g/onap-discuss/message/14022.

    2. Liam Fallon Vamshi Krishna Namilikonda  Thanks a lot guys . I will and get back to you 


      Let me take this opportunity to add more context to what am trying to do 

       i am following the below comments from the link --

      ONAP Policy Framework: Standalone installation in Virtual Machine#InstallationofControllersandPolicies

      Jorge Hernandez   I found his approach quite useful  as it takes minutes to set up the container ..and start playing 

      Then i tried to follow the steps – from --ONAP Policy Framework: Installation of Amsterdam Controller and vCPE Policy

      To my surprise – it appears as soon as the docker containers are up for some reason --

      I got the below error ---- 


      stage 

      ./apps-controlloop-installer

      error: feature controlloop-beijing has already been installed


      when running the below commands

      features install controlloop-utils
      features enable controlloop-utils

      I get the below error – 

      error: feature controlloop-utils has already been installed


      so i just carried on with the steps from 


      And to my surprise i was able to navigate to below step and that where i got the error 

      1. Maven artifact creation now proceeds. After some minutes, confirmation is requested for deployment of rules into Maven. Type Y to deploy the rules. The rules are deployed into Maven. Expect the rule deployment process to take a number of minutes, perhaps 10 minutes.

      so one question for all Jorge Hernandez Vamshi Krishna Namilikonda Liam Fallon

      As per Jorge on wiki –  ONAP Policy Framework: Standalone installation in Virtual Machine

      He says if you follow the below 

      The easiest way to install the controlloop-applications is to before executing /usr/local/bin/docker-compose -f docker-compose.yml up -d is to place the "apps-controlloop-1.2.0-SNAPSHOT.zip" under the config/drools directory from the cloned docker project from step 1. above.   It will do all the unzipping, etc .. that you are doing manually automatically when docker-compose is done.    So the instructions will become more simpler.    You can use this script to download the application control zip:  https://git.onap.org/policy/docker/tree/config/drools/apps-install.sh.    For the snapshot just do:   apps-install.sh controlloop 1.2.0-SNAPSHOT config/drools  (config/drools is the directory where you cloned from step 1).

      Then one can avoid the below from the wiki – 

      ONAP Policy Framework: Installation of Amsterdam Controller and vCPE Policy

      One doesn't need to pull the snapshot again as show 

      Download the latest controller from Nexus (1.2.0 at the time of writing)

      wget https://nexus.onap.org/content/repositories/releases/org/onap/policy/drools-applications/controlloop/packages/apps-controlloop/1.2.0/apps-controlloop-1.2.0.zip


      So appreciate if all  of you can help me and draft the best practices - I am happy to do it as well if i can get collective inputs 

      1. Hello samir kumar, thanks for the work, and your contributions to improve the documentation are very welcome.   Not sure, if I am addressing all your questions, but then just want to confirm that if you place the apps-controlloop.zip under the installation directory, regardless if it is VM install, or docker/kubernetes, it should do all the installing for you, so in theory you wouldn't require extra steps.

  2. Also the cursor stops at this stage so am i expected to hit enter to move on to the ext line 

    1. samir kumar It will keep on asking to ensure or check against the pre-defined values from the script. If you wish to change you can, otherwise proceed further by pressing enter.

      1. Thanks a lot Vamshi - Much appreciated