blob: 0a834b40acd2edee70f5e990c04918534d51fc9a [file] [log] [blame]
Saryu Shah82b62ca2018-03-19 22:18:13 +00001
2.. This work is licensed under a Creative Commons Attribution 4.0 International License.
3.. http://creativecommons.org/licenses/by/4.0
4
Saryu Shahab8bc202018-04-23 21:54:37 +00005***************
6Policy Cookbook
7***************
Saryu Shah82b62ca2018-03-19 22:18:13 +00008
Jorge Hernandez5a91dc32018-11-05 15:34:55 -06009Openstack Heat Installation - Policy VM/Docker Recipes
10^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Saryu Shah82b62ca2018-03-19 22:18:13 +000011
12 .. code-block:: bash
Jorge Hernandez5a91dc32018-11-05 15:34:55 -060013 :caption: Get the latest images in an already setup policy VM
Saryu Shah82b62ca2018-03-19 22:18:13 +000014 :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
Jorge Hernandez5a91dc32018-11-05 15:34:55 -060034
Saryu Shah82b62ca2018-03-19 22:18:13 +000035 echo "PRELOAD_POLICIES=true" > /opt/policy/.env
36 /opt/policy_vm_init.sh
37
38
39 .. code-block:: bash
Jorge Hernandez5a91dc32018-11-05 15:34:55 -060040 :caption: Access the PDP-D container as the policy user
Saryu Shah82b62ca2018-03-19 22:18:13 +000041 :linenos:
42
43 docker exec -it drools bash
44
45
46 .. code-block:: bash
Jorge Hernandez5a91dc32018-11-05 15:34:55 -060047 :caption: Access the PDP-X container as the policy user
Saryu Shah82b62ca2018-03-19 22:18:13 +000048 :linenos:
49
50 docker exec -it -u 0 pdp su - policy
51
52
53 .. code-block:: bash
Jorge Hernandez5a91dc32018-11-05 15:34:55 -060054 :caption: Access the BRMSGW container as the policy user
Saryu Shah82b62ca2018-03-19 22:18:13 +000055 :linenos:
56
57 docker exec -it -u 0 brmsgw su - policy
58
59
60 .. code-block:: bash
Jorge Hernandez5a91dc32018-11-05 15:34:55 -060061 :caption: Access PAP container as the policy user
Saryu Shah82b62ca2018-03-19 22:18:13 +000062 :linenos:
63
64 docker exec -it -u 0 pap su - policy
65
66
67 .. code-block:: bash
Jorge Hernandez5a91dc32018-11-05 15:34:55 -060068 :caption: Access the CONSOLE container the a policy user
Saryu Shah82b62ca2018-03-19 22:18:13 +000069 :linenos:
70
71 docker exec -it -u 0 console su - policy
72
73
74 .. code-block:: bash
Jorge Hernandez5a91dc32018-11-05 15:34:55 -060075 :caption: Command line Healthcheck invokation
Saryu Shah82b62ca2018-03-19 22:18:13 +000076 :linenos:
77
Saryu Shah82b62ca2018-03-19 22:18:13 +000078 source /opt/app/policy/config/feature-healthcheck.conf.environment
Jorge Hernandez5a91dc32018-11-05 15:34:55 -060079 curl --silent --user "${HEALTHCHECK_USER}:${HEALTHCHECK_PASSWORD}"
80 -X GET https://localhost:6969/healthcheck | python -m json.tool
Saryu Shah82b62ca2018-03-19 22:18:13 +000081
82
Jorge Hernandez5a91dc32018-11-05 15:34:55 -060083OOM 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
jhhffd72412019-10-02 22:35:40 -050097 kubectl exec -it <pap-pod> -c pap -n onap -- bash --login
Jorge Hernandez5a91dc32018-11-05 15:34:55 -060098
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
jhhffd72412019-10-02 22:35:40 -0500115 kubectl exec -it <policy-deployment-prefix>-pdp-0 -c pdp -n onap -- bash --login
Jorge Hernandez5a91dc32018-11-05 15:34:55 -0600116
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
132PDP-D Recipes (inside the "drools" container)
133^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Saryu Shah82b62ca2018-03-19 22:18:13 +0000134
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
Saryu Shah82b62ca2018-03-19 22:18:13 +0000153 source ${POLICY_HOME}/config/feature-healthcheck.conf
Jorge Hernandez5a91dc32018-11-05 15:34:55 -0600154 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
Saryu Shah82b62ca2018-03-19 22:18:13 +0000188
Jorge Hernandeza4c3b2d2018-11-06 12:05:41 -0600189PAP Recipes (inside the "pap" container)
190^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
191
192 .. code-block:: bash
193 :caption: Bypass Portal Authentication with the Policy Web UI
194 :linenos:
195
jhhffd72412019-10-02 22:35:40 -0500196 sed -i "s/^role_access_centralized.*$/#role_access_centralized=remote/g" /opt/app/policy/servers/console/webapps/onap/WEB-INF/classes/portal.properties
197 cd /opt/app/policy/servers/pap
198 /opt/app/policy/etc/init.d/pap stop; /opt/app/policy/etc/init.d/pap start
199 policy.sh status
Jorge Hernandeza4c3b2d2018-11-06 12:05:41 -0600200
201
202 .. code-block:: bash
203 :caption: Access the Policy Web UI without going through the Portal UI
204 :linenos:
205
jhhffd72412019-10-02 22:35:40 -0500206 https://policy.api.simpledemo.onap.org:30219/onap/policy (Kubernetes)
Jorge Hernandeza4c3b2d2018-11-06 12:05:41 -0600207
208
Saryu Shah82b62ca2018-03-19 22:18:13 +0000209End of Document
210
211.. SSNote: Wiki page ref. https://wiki.onap.org/display/DW/Policy+Cookbook
212
213
214