Merge "Update ACM design arch docs"
[policy/parent.git] / docs / clamp / acm / clamp-gui / policy-gui.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2
3 .. _clamp-policy-gui-label:
4
5 TOSCA Policy GUI
6 ################
7
8 .. contents::
9     :depth: 4
10
11 1 - How to run the Front-End Gui
12 ================================
13 This section describes how to run the front end on your local machine.
14
15 **Prerequisite:**
16
17 **Building and running CLAMP**
18
19 see
20 :ref:`Clamp ACM Smoke Tests <policy-clamp-runtime-smoke-label>`
21
22 **Step 1:** Go to the clamp directory
23
24 .. code-block:: bash
25
26     cd /clamp/extra/bin-for-dev
27
28 **Step 2:** Inside the clamp directory run
29
30 .. code-block:: bash
31
32     ./start-db.sh test
33
34 **Step 3:** Check docker container id
35
36 .. code-block:: bash
37
38     docker ps
39
40 **Step 4:** Log into docker container
41
42 .. code-block:: bash
43
44     docker exec -it 'container_id' bash
45
46 **Step 5:** Go into mariadb shell
47
48 .. code-block:: bash
49
50     mysql -u root -p
51
52 **Step 6:** Enter password
53
54     strong_pitchou
55
56 .. image:: images/01-gui.png
57
58 **Step 7:** Go into cldsdb4 database
59
60 .. code-block:: bash
61
62     use cldsdb4;
63
64 **Step 8:** Verify if there is data in the following table 'loop_templates'
65
66 .. code-block:: bash
67
68     select * from loop_templates;
69
70 ** If for some reason the database is empty do the go to the '/docker-entrypoint-initdb.d/dump' directory
71
72 .. code-block:: bash
73
74     ./load-fake-data.sh
75
76 **Step 9:** Once the database is up and running need to start the clamp emulator, by running the following command inside the /clamp/extra/bin-for-dev
77
78 .. code-block:: bash
79
80     ./start-emulator.sh
81
82 **Step 10:** Verify if mariadb and the emulator is running
83
84 .. code-block:: bash
85
86     docker ps
87
88 .. image:: images/02-gui.png
89
90 **Step 11:** Start the backend service by running the command inside the /clamp/extra/bin-for-dev
91
92 .. code-block:: bash
93
94     ./start-backend.sh
95
96
97 .. _building-ui-label:
98
99 2 - Checking out and building the UI
100 ====================================
101
102 **Step 1:** Checkout the UI from the repo
103
104 .. code-block:: bash
105
106     git clone "https://gerrit.nordix.org/onap/policy/gui"
107
108 **Step 2:** Change into the "gui" directory and run the following
109
110 .. code-block:: bash
111
112     mvn clean install
113
114 **Step 3:** Go into the gui-clamp/ui-react directory and run the following
115
116 .. code-block:: bash
117
118     npm install
119
120 **Step 4:** Start the front end UI
121
122 .. code-block:: bash
123
124     npm start --scripts-prepend-node-path
125
126 *If you get the following error*
127
128 .. image:: images/03-gui.png
129
130 .. code-block:: bash
131
132    gedit package.json
133
134 Then change ``"version": "${project.version}",`` to ``"version": "2.1.1",``
135
136 Save and close, then delete the node_modules directory
137
138 .. code-block:: bash
139
140     rm -rf node_modules/
141
142 Then run again
143
144 .. code-block:: bash
145
146     npm install
147
148 .. code-block:: bash
149
150     npm start --scripts-prepend-node-path
151
152 **Step 5:** Once the UI starts at localhost:3000 it will ask for credentials:
153
154     Login: admin
155     Password: password
156
157 3 - How to Commission/Decommission the TOSCA Service Template
158 =============================================================
159
160 This section describes how to commission and decommission the Tosca Service Template
161
162 ** Prerequisite:
163
164 See :ref:`Policy GUI Prerequisites<clamp-policy-gui-label>`
165
166 **Step 1:** From the Main Menu Click on TOSCA Automation Composition Dropdown
167
168 .. image:: images/04-gui.png
169
170 **Step 2:** From the Dropdown Menu Select Upload Automation Composition To Commissioning
171
172 .. image:: images/05-gui.png
173
174 **Step 3:** On the window Upload Tosca to Commissioning API Click on the input box that says 'Please Select a file'
175
176 .. image:: images/06-gui.png
177
178 **Step 4:** Once the yaml file is selected click on Upload Tosca Service Template
179
180 .. image:: images/07-gui.png
181
182 **Step 5:** After the upload there should have a message "Upload Success" in green
183
184 .. image:: images/08-gui.png
185
186 **Step 6:** To validate that the TOSCA Service Template has been commissioned click on Manage Commissioned Automation Composition Template
187
188 .. image:: images/09-gui.png
189
190 **Step 7:** In the View Tosca Template Window click on Pull Tosca Service Template
191
192 .. image:: images/10-gui.png
193
194 **Step 8:** Once the Tosca Service Template has been pulled there should be a json object rendered in the window
195
196 .. image:: images/11-gui.png
197
198 **Step 9:** Click on Close close the window
199
200 **Step 10:** Click on Edit Automation Composition Properties
201
202 .. image:: images/12-gui.png
203
204 **Step 11:** In the Change ACM Common Properties change the appropriate properties and click on save and there should have a popup saying 'Changes Saved.  Commission When Ready...'
205
206 .. image:: images/13-gui.png
207
208 **Step 12:** After saving the changes click on Commission and should have a Green message saying 'Commissioning Success'
209
210 .. image:: images/14-gui.png
211
212 **Step 13:** To Decommission the Tosca Service Follow Step 6 and 8
213
214 **Step 14:** Once the json objected is rendered in the window click on delete
215
216 .. image:: images/11-gui.png
217
218 **Step 14:** Once the json objected is rendered in the window click on delete
219
220 .. image:: images/11-gui.png
221
222 **Step 15:** If the delete is successful it should show a message "Delete Successful"
223
224 .. image:: images/15-gui.png
225
226 4 - How to Save Instance Properties and Change The Order State
227 ==============================================================
228
229 This section describes how to save the instance properties and change it's order state
230
231 ** Prerequisite:
232
233 see building-ui-label_
234
235 **Step 1:** Go to the participant http directory
236
237 .. code-block:: bash
238
239     cd /clamp/participant/participant-impl/participant-impl-http
240
241 **Step 2:** Run he following command
242
243 .. code-block:: bash
244
245     mvn spring-boot:run -Dspring-boot.run.arguments=--server.port=8080
246
247 **Step 3:** Go to the participant kubernetes directory
248
249 .. code-block:: bash
250
251     cd /clamp/participant/participant-impl/participant-impl-kubernetes
252
253 **Step 4:** Run he following command
254
255 .. code-block:: bash
256
257     mvn spring-boot:run -Dspring-boot.run.arguments=--server.port=8081
258
259 **Step 5:** Go to the participant policy directory
260
261 .. code-block:: bash
262
263     cd /clamp/participant/participant-impl/participant-impl-policy
264
265 **Step 6:** Run he following command
266
267 .. code-block:: bash
268
269     mvn spring-boot:run -Dspring-boot.run.arguments=--server.port=8082
270
271 **Step 7:** From the Main Menu Click on Instantiation Management
272
273 .. image:: images/16-gui.png
274
275 **Step 8:** Once the window for Manage Instance is open click on Create Instance
276
277 .. image:: images/17-gui.png
278
279 **Step 9:** With the Window Create Instance Properties Insert a Name and change the appropriate properties and click save
280
281 .. image:: images/18-gui.png
282
283 **Step 10:** After clicking save it should come with a green message saying "Instantiation Properties Success"
284
285 .. image:: images/19-gui.png
286
287 **Step 11:** To delete an instance repeat Step 7
288
289 .. image:: images/16-gui.png
290
291 **Step 12:** Once the window for Manage Instance is open click on Delete
292
293 .. image:: images/20-gui.png
294
295 * NOTE: The only way to delete the instance properties if the order state has to be UNINITIALISED
296
297 **Step 13:** To change the state click on Change in Manage Instances Window
298
299 .. image:: images/20-gui.png
300
301 **Step 14:** After clicking Change there should have a drop down with specific different ordered states
302
303 .. image:: images/21-gui.png
304
305 **Step 15:** From UNINITIALISED the user can only select Passive Ordered State
306
307 .. image:: images/22-gui.png
308
309 **Step 16:** Click on Save and a Message in Green "Ordered State Change Success"
310
311 .. image:: images/23-gui.png
312
313 * NOTE: Can't change from Passive to Running in a local developer machine, can only change in the production environment
314
315 End of document