2 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
3 .. http://creativecommons.org/licenses/by/4.0
5 ***********************************************************************************************
6 Using the Control Loop PDP-D docker image for standalone testing
7 ***********************************************************************************************
12 In this tutorial will start a Control Loop PDP-D container to use to test Operational Policies
13 without companion components.
15 **Step 1:** Copy a template *base.conf* with configuration to instantiate the container.
21 wget https://git.onap.org/policy/docker/plain/config/drools/base.conf?h=dublin -O base.conf
24 **Step 2:** Simplify *base.conf* for a standalone configuration (by disabling db and nexus access):
29 sed -i "s/^SQL_HOST=.*$/SQL_HOST=/g" base.conf
30 sed -i "s/^SNAPSHOT_REPOSITORY_ID=.*$/SNAPSHOT_REPOSITORY_ID=/g" base.conf
31 sed -i "s/^SNAPSHOT_REPOSITORY_URL=.*$/SNAPSHOT_REPOSITORY_URL=/g" base.conf
32 sed -i "s/^RELEASE_REPOSITORY_ID=.*$/RELEASE_REPOSITORY_ID=/g" base.conf
33 sed -i "s/^RELEASE_REPOSITORY_URL=.*$/RELEASE_REPOSITORY_URL=/g" base.conf
35 Note: For MacOS use - sed -i'' -e "s/^SQL_HOST=.*$/SQL_HOST=/g" base.conf and similar for all sed commands.
37 **Step 3:** Open a *bash* shell into the PDP-D Control Loop container.
41 docker run --rm --env-file config/base.conf -p 9696:9696 -p 6969:6969 -it --name pdpd -h pdpd nexus3.onap.org:10001/onap/policy-pdpd-cl:1.4.1 bash
43 **Step 4:** Disable the distributed-locking feature, since this is a single CL PDP-D instance.
47 features disable distributed-locking
49 **Step 5:** If using simulators (see tutorials), enable the *controlloop-utils* feature.
53 features enable controlloop-utils
55 **Step 6:** To reduce error logs due to being unable to communicate with DMaaP, change the official configuration to use *noop* topics instead (no network IO involved).
59 cd $POLICY_HOME/config
60 sed -i "s/^dmaap/noop/g" *.properties
62 **Step 7:** Disable PDP-X guard functionality.
66 cd $POLICY_HOME/config
67 sed -i "s/^guard.disabled=*$/guard.disabled=true/g" $POLICY_HOME/config/controlloop.properties.environment
68 sed -i "s/^aai.customQuery=*$/aai.customQuery=false/g" $POLICY_HOME/config/controlloop.properties.environment
70 **Step 8:** Start the CL PDP-D.
76 **Step 9:** Place the CL PDP-D in *ACTIVE* mode.
80 cat pdp-state-change.json
83 "messageName": "PDP_STATE_CHANGE",
84 "requestId": "385146af-adeb-4157-b97d-6ae85c1ddcb3",
85 "timestampMs": 1555791893587,
87 "pdpGroup": "controlloop",
88 "pdpSubgroup": "drools"
91 http --verify=no -a "${TELEMETRY_USER}:${TELEMETRY_PASSWORD}" PUT https://localhost:9696/policy/pdp/engine/topics/sources/noop/POLICY-PDP-PAP/events @pdp-state-change.json Content-Type:'text/plain'
94 > get lifecycle/fsm/state # verify that state is ACTIVE
96 Note that *name* in *pdp-state-change.json* can be obtained from running *hostname* in the container.
98 Proceed with testing your new policy as described in the specific tutorials:
100 • vCPE - `Tutorial: Testing the vCPE use case in a standalone PDP-D <tutorial_vCPE.html>`_
101 • vDNS - `Tutorial: Testing the vDNS Use Case in a standalone PDP-D <tutorial_vDNS.html>`_
102 • vFW - `Tutorial: Testing the vFW flow in a standalone PDP-D <tutorial_vFW.html>`_
104 .. seealso:: `Methods to run PDP-D <runningPDPD.html>`_.