Merge "Update policy cookbook documentation" into casablanca
[policy/engine.git] / docs / platform / cookbook.rst
1
2 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
3 .. http://creativecommons.org/licenses/by/4.0
4
5 ***************
6 Policy Cookbook
7 ***************
8
9 Openstack Heat Installation - Policy VM/Docker Recipes
10 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
11
12     .. code-block:: bash
13        :caption: Get the latest images in an already setup policy VM
14        :linenos:
15
16         /opt/policy_vm_init.sh
17
18
19     .. code-block:: bash
20        :caption: Install/start docker policy containers with no policies preloaded
21        :linenos:
22
23         echo "PRELOAD_POLICIES=false" > /opt/policy/.env
24         /opt/policy_vm_init.sh
25
26
27     .. code-block:: bash
28        :caption: Install/start docker policy containers with policies preloaded
29        :linenos:
30
31         # This is the current default mode of instantiation.
32         # These operations are unnecessary unless PRELOAD_POLICIES
33         # was previously set to true
34
35         echo "PRELOAD_POLICIES=true" > /opt/policy/.env
36         /opt/policy_vm_init.sh
37
38
39     .. code-block:: bash
40        :caption: Access the PDP-D container as the policy user
41        :linenos:
42
43         docker exec -it drools bash
44
45
46     .. code-block:: bash
47        :caption: Access the PDP-X container as the policy user
48        :linenos:
49
50         docker exec -it -u 0 pdp su - policy
51
52
53     .. code-block:: bash
54        :caption: Access the BRMSGW container as the policy user
55        :linenos:
56
57         docker exec -it -u 0 brmsgw su - policy
58
59
60     .. code-block:: bash
61        :caption: Access PAP container as the policy user
62        :linenos:
63
64         docker exec -it -u 0 pap su - policy
65
66
67     .. code-block:: bash
68        :caption: Access the CONSOLE container the a policy user
69        :linenos:
70
71         docker exec -it -u 0 console su - policy
72
73
74     .. code-block:: bash
75        :caption: Command line Healthcheck invokation
76        :linenos:
77
78         source /opt/app/policy/config/feature-healthcheck.conf.environment
79         curl --silent --user "${HEALTHCHECK_USER}:${HEALTHCHECK_PASSWORD}"
80              -X GET https://localhost:6969/healthcheck | python -m json.tool
81
82
83 OOM Installation - Policy Kubernetes Recipes
84 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
85
86     .. code-block:: bash
87        :caption: List the policy pods
88        :linenos:
89
90         kubectl get pods -n onap -o wide | grep policy
91
92
93     .. code-block:: bash
94        :caption: Access the PAP container
95        :linenos:
96
97         kubectl exec -it <pap-pod> -c pap -n onap bash
98
99
100     .. code-block:: bash
101        :caption: Access a PDPD-D container
102        :linenos:
103
104         # <policy-deployment-prefix> depends on the deployment configuration
105
106         kubectl exec -it <policy-deployment-prefix>-drools-0 -c drools -n onap bash
107
108
109     .. code-block:: bash
110        :caption: Access the PDP container
111        :linenos:
112
113         # <policy-deployment-prefix> depends on the deployment configuration
114
115         kubectl exec -it <policy-deployment-prefix>-pdp-0 -c drools -n onap bash
116
117
118     .. code-block:: bash
119        :caption: Push Default Policies
120        :linenos:
121
122         kubectl exec -it <pap-pod> -c pap -n onap -- bash -c "export PRELOAD_POLICIES=true; /tmp/policy-install/config/push-policies.sh"
123
124
125     .. code-block:: bash
126        :caption: Standalone Policy Web UI URL access
127        :linenos:
128
129         http://<pap-vm>:30219/onap/login.htm
130
131
132 PDP-D Recipes (inside the "drools" container)
133 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
134
135     .. code-block:: bash
136        :caption: Stop the PDP-D
137        :linenos:
138
139         policy stop
140
141
142     .. code-block:: bash
143        :caption: Start the PDP-D
144        :linenos:
145
146         policy start
147
148
149     .. code-block:: bash
150        :caption: Manual Healthcheck Invokation
151        :linenos:
152
153         source ${POLICY_HOME}/config/feature-healthcheck.conf
154         curl --silent --user "${HEALTHCHECK_USER}:${HEALTHCHECK_PASSWORD}"
155              -X GET https://localhost:6969/healthcheck | python -m json.tool
156
157
158     .. code-block:: bash
159        :caption: Start a telemetry shell
160        :linenos:
161
162         telemetry
163
164
165     .. code-block:: bash
166        :caption: See all the configured loggers
167        :linenos:
168
169        curl -k --silent --user "${ENGINE_MANAGEMENT_USER}:${ENGINE_MANAGEMENT_PASSWORD}"
170             https://localhost:9696/policy/pdp/engine/tools/loggers
171
172
173     .. code-block:: bash
174        :caption: See the logging level for a given logger (for example the network logger):
175        :linenos:
176
177        curl -k --silent --user"${ENGINE_MANAGEMENT_USER}:${ENGINE_MANAGEMENT_PASSWORD}"
178             https://localhost:9696/policy/pdp/engine/tools/loggers/network
179
180
181     .. code-block:: bash
182        :caption: Modify the logging level for a given logger (for example the network logger):
183        :linenos:
184
185        curl -k --silent --user"${ENGINE_MANAGEMENT_USER}:${ENGINE_MANAGEMENT_PASSWORD}"
186             -X PUT https://localhost:9696/policy/pdp/engine/tools/loggers/network/WARN
187
188
189 PAP Recipes (inside the "pap" container)
190 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
191
192     .. code-block:: bash
193        :caption: Bypass Portal Authentication with the Policy Web UI
194        :linenos:
195
196         edit: /opt/app/policy/servers/console/webapps/onap/WEB-INF/classes/portal.properties
197         comment out: #role_access_centralized = remote
198         restart pap: policy.sh stop; policy.sh start;
199
200
201     .. code-block:: bash
202        :caption: Access the Policy Web UI without going through the Portal UI
203        :linenos:
204
205        https://<pap-vm>:8443/onap/login.htm  (Heat)
206        https://<pap-vm>:30219/onap/login.htm  (Kubernetes)
207
208
209 End of Document
210
211 .. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/Policy+Cookbook
212
213
214