Wrap long lines
[multicloud/framework.git] / docs / multicloud-plugin-windriver / Tutorial-VESagent-MultiCloud-WindRiver-TitaniumCloud.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0\r
2 .. International License.  http://creativecommons.org/licenses/by/4.0\r
3 .. Copyright (c) 2017-2018 Wind River Systems, Inc.\r
4 \r
5 Tutorial: VESagent configuration and Testing\r
6 ````````````````````````````````````````````\r
7 \r
8 VESagent is a FCAPS relaying service offered by MultiCloud Plugin for Wind\r
9 River Titanium Cloud. It allows user to monitor specified VM status and report\r
10 VES collector with onset or abate fault event "Fault_MultiCloud_VMFailure"\r
11 \r
12 VESagent provisoning APIs\r
13 -------------------------\r
14 \r
15 ### assume OOM deployment as below endpoints:\r
16 \r
17 *   OOM k8s Node IP, e.g. 10.12.5.184\r
18 *   OOM k8s Node port for multicloud-titaniumcloud POD: 30294\r
19 *   On-boarded cloud region with {cloud-owner}/{cloud-region-id} : CloudOwner/pod01\r
20 *   VES collector endpoint: 10.12.6.79:8081\r
21 \r
22 \r
23 \r
24 .. code-block:: console\r
25 \r
26     #!/bin/bash\r
27     export MC_EP_IP=10.12.5.184\r
28     export MC_EP_PORT=30294\r
29 \r
30     export MC_EPv0=http://$OPENO_IP:$MC_EP_PORT/api/multicloud-titaniumcloud/v0/CloudOwner_pod01\r
31     export MC_EPv1=http://$OPENO_IP:$MC_EP_PORT/api/multicloud-titaniumcloud/v1/CloudOwner/pod01\r
32 \r
33 \r
34 \r
35 1. Setup VESagent backlogs\r
36 ^^^^^^^^^^^^^^^^^^^^^^^^^^\r
37 \r
38 ** Option 1: monitor all VMs of a tenant**\r
39 \r
40 .. code-block:: console\r
41 \r
42     curl -v -s -H "Content-Type: application/json" -d '{"vesagent_config": \\r
43          {"backlogs":[ {"domain":"fault","type":"vm","tenant":"VIM"}],\\r
44          "poll_interval_default":10,"ves_subscription":\\r
45          {"username":"admin","password":"admin","endpoint":"http://10.12.6.79:8081/eventListener/v5"}}}'\\r
46           -X POST  $MC_EPv0/vesagent\r
47 \r
48 ** Option 2: monitor specified VMs**\r
49 \r
50 .. code-block:: console\r
51 \r
52     ### zdfw1lb01dns01, zdfw1lb01dns02\r
53     curl -v -s -H "Content-Type: application/json" -d '{"vesagent_config":\\r
54          {"backlogs":[ {"source":"zdfw1lb01dns01", "domain":"fault","type":"vm","tenant":"VIM"},\\r
55           {"source":"zdfw1lb01dns02", "domain":"fault","type":"vm","tenant":"VIM"}],\r
56          "poll_interval_default":10,"ves_subscription":\\r
57          {"username":"admin","password":"admin","endpoint":"http://10.12.6.79:8081/eventListener/v5"}}}' \\r
58          -X POST  $MC_EPv0/vesagent\r
59 \r
60 2. Dump the VESagent backlogs\r
61 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r
62 \r
63 .. code-block:: console\r
64 \r
65     curl -v -s -H "Content-Type: application/json" -X GET  $MC_EPv0/vesagent\r
66 \r
67 3. Delete the VESagent backlogs\r
68 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r
69 \r
70 .. code-block:: console\r
71 \r
72     curl -v -s -H "Content-Type: application/json" -X DELETE  $MC_EPv0/vesagent\r
73 \r
74 \r
75 VESagent exercises\r
76 ------------------\r
77 \r
78 Step 1: Monitor the DMaaP events\r
79 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r
80 \r
81 Subscribe to and keep polling DMaaP Topic: "unauthenticated.SEC_FAULT_OUTPUT" with curl command\r
82 \r
83 .. code-block:: console\r
84 \r
85     curl -X GET \\r
86           'http://$DMAAP_IP:3904/events/unauthenticated.SEC_FAULT_OUTPUT/EVENT-LISTENER-POSTMAN/304?timeout=6000&limit=10&filter=' \\r
87           -H 'Cache-Control: no-cache' \\r
88           -H 'Content-Type: application/json' \\r
89           -H 'Postman-Token: 4e2e3589-d742-48c7-8d48-d1b3577df259' \\r
90           -H 'X-FromAppId: 121' \\r
91           -H 'X-TransactionId: 9999'\r
92 \r
93 \r
94 Step 2: Setup VESagent backlog\r
95 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r
96 .. code-block:: console\r
97 \r
98     ### zdfw1lb01dns01, zdfw1lb01dns02\r
99     curl -v -s -H "Content-Type: application/json" -d '{"vesagent_config":\\r
100          {"backlogs":[ {"source":"zdfw1lb01dns01", "domain":"fault","type":"vm","tenant":"VIM"}],\\r
101          "poll_interval_default":10,"ves_subscription":\\r
102          {"username":"admin","password":"admin","endpoint":"http://10.12.6.79:8081/eventListener/v5"}}}' \\r
103          -X POST  $MC_EPv0/vesagent\r
104 \r
105 Step 3: Simulate the Faults\r
106 ^^^^^^^^^^^^^^^^^^^^^^^^^^^\r
107 \r
108 Manually stop the monitored VMs,e.g. VM with name 'zdfw1lb01dns01',\r
109 \r
110 Step 4: Observe DMaaP event: "Fault_MultiCloud_VMFailure"\r
111 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r
112 \r
113 Poll the subscribed DMaaP topic "unauthenticated.SEC_FAULT_OUTPUT" with curl command,\r
114 you should be able to observe the following VES fault event generated from DMaaP:\r
115 \r
116 .. code-block:: console\r
117 \r
118     [\r
119 \r
120         "{\"event\":{\"commonEventHeader\":{\"startEpochMicrosec\":1537233558255872,\"sourceId\":\"8e606aa7-39c8-4df7-b2f4-1f6785b9f682\",\"eventId\":\"a236f561-f0fa-48a3-96cd-3a61ccfdf421\",\"reportingEntityId\":\"CloudOwner_pod01\",\"internalHeaderFields\":{\"collectorTimeStamp\":\"Tue, 09 18 2018 01:19:19 GMT\"},\"eventType\":\"\",\"priority\":\"High\",\"version\":3,\"reportingEntityName\":\"CloudOwner_pod01\",\"sequence\":0,\"domain\":\"fault\",\"lastEpochMicrosec\":1537233558255872,\"eventName\":\"Fault_MultiCloud_VMFailure\",\"sourceName\":\"zdfw1lb01dns01\"},\"faultFields\":{\"eventSeverity\":\"CRITICAL\",\"alarmCondition\":\"Guest_Os_Failure\",\"faultFieldsVersion\":2,\"specificProblem\":\"Fault_MultiCloud_VMFailure\",\"alarmInterfaceA\":\"aaaa\",\"alarmAdditionalInformation\":[{\"name\":\"objectType\",\"value\":\"VIM\"},{\"name\":\"eventTime\",\"value\":\"2018-09-18 01:19:18.255937\"}],\"eventSourceType\":\"virtualMachine\",\"vfStatus\":\"Active\"}}}",\r
121 \r
122     ]\r
123 \r
124 \r
125 Step 5: Simulate the Recovery\r
126 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r
127 \r
128 Manually restart the stopped VM 'zdfw1lb01dns01'\r
129 \r
130 \r
131 Step 6: Observe DMaaP event: "Fault_MultiCloud_VMFailureCleared"\r
132 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r
133 \r
134 .. code-block:: console\r
135 \r
136     [\r
137         "{\"event\":{\"commonEventHeader\":{\"startEpochMicrosec\":1537233558255872,\"sourceId\":\"8e606aa7-39c8-4df7-b2f4-1f6785b9f682\",\"eventId\":\"a236f561-f0fa-48a3-96cd-3a61ccfdf421\",\"reportingEntityId\":\"CloudOwner_pod01\",\"internalHeaderFields\":{\"collectorTimeStamp\":\"Tue, 09 18 2018 01:19:31 GMT\"},\"eventType\":\"\",\"priority\":\"Normal\",\"version\":3,\"reportingEntityName\":\"CloudOwner_pod01\",\"sequence\":1,\"domain\":\"fault\",\"lastEpochMicrosec\":1537233570150714,\"eventName\":\"Fault_MultiCloud_VMFailureCleared\",\"sourceName\":\"zdfw1lb01dns01\"},\"faultFields\":{\"eventSeverity\":\"NORMAL\",\"alarmCondition\":\"Vm_Restart\",\"faultFieldsVersion\":2,\"specificProblem\":\"Fault_MultiCloud_VMFailure\",\"alarmInterfaceA\":\"aaaa\",\"alarmAdditionalInformation\":[{\"name\":\"objectType\",\"value\":\"VIM\"},{\"name\":\"eventTime\",\"value\":\"2018-09-18 01:19:30.150736\"}],\"eventSourceType\":\"virtualMachine\",\"vfStatus\":\"Active\"}}}"\r
138 \r
139     ]\r