Use released version of infrautils
[netvirt.git] / docs / specs / oxygen / netvirt-statistics-spec.rst
1 .. contents:: Table of Contents
2             :depth: 3
3
4 =====================
5 Netvirt Statistics
6 =====================
7
8 https://git.opendaylight.org/gerrit/#/q/topic:netvirt-counters
9
10 The feature enables getting statistics on ports and switches.
11
12
13 Problem description
14 ===================
15
16 Being able to ask for statistics, given as input Netvirt identifiers.
17 It will enable filtering the results and having aggregated result.
18 In a later stage, it will be also used to get element to element counters.
19 Examples for possible filters: RX only, TX only, port + VLAN counters...
20
21 Use Cases
22 ---------
23
24 * Getting port counters, given its interface id (ietf interface name).
25 * Getting node counters, given its node id.
26
27 Port counters can be useful also to get statistics on traffic going into tunnels
28 when requesting it from the tunnel endpoint port.
29 In addition, there will also be support in aggregated results. For example:
30 Getting the total number of transmitted packets from a given switch.
31
32 Proposed change
33 ===============
34
35 Adding a new bundle named "statistics-plugin" to Netvirt.
36 This bundle will be responsible for converting the Netvirt unique identifiers into OpenFlow ones,
37 and will get the relevant statistics by using OpenFlowPlugin capabilities.
38 It will also be responsible of validating and filtering the results.
39 It will be able to provide a wide range of aggregated results in the future.
40
41 Work flow description: Once a port statistics request is received, it is translated to a port statistics request from openflow plugin. Once the transaction is received, the data is validated and translated to a user friendly data. The user will be notified if a timeout occurs.
42 In case of a request for aggregated counters, the user will receive a single counter result divided to groups (such as "bits", "packets"...). The counters in each group will be the sum of all of the matching counters for all ports.
43 Neither one of the counter request nor the counter response will not be stored in the configuration database. Moreover, requests are not periodic and they are on demand only.
44
45 Pipeline changes
46 ----------------
47 None
48
49 Yang changes
50 ------------
51 The new plugin introduced will have the following models:
52 ::
53
54       grouping result {
55         list counterResult {
56             key id;
57             leaf id {
58                 type string;
59             }
60             list groups {
61                 key name;
62                 leaf name {
63                     type string;
64                 }
65                 list counters {
66                     key name;
67                     leaf name {
68                         type string;
69                     }
70                     leaf value {
71                         type uint64;
72                     }
73                 }
74             }
75         }
76     }
77
78     grouping filters {
79         leaf-list groupFilters {
80             type string;
81         }
82         leaf-list counterFilter {
83             type string;
84         }
85     }
86
87     rpc getNodeConnectorCounters {
88         input {
89             leaf portId {
90                 type string;
91             }
92             uses filters;
93         }
94         output {
95             uses result;
96         }
97     }
98
99     rpc getNodeCounters {
100         input {
101             leaf nodeId {
102                 type uint64;
103             }
104         }
105         output {
106             uses result;
107         }
108     }
109
110     rpc getNodeAggregatedCounters {
111         input {
112             leaf nodeId {
113                 type uint64;
114             }
115             uses filters;
116         }
117         output {
118             uses result;
119         }
120     }
121
122
123 Configuration impact
124 ---------------------
125 None
126
127 Clustering considerations
128 -------------------------
129 None
130
131 Other Infra considerations
132 --------------------------
133 None
134
135 Security considerations
136 -----------------------
137 None
138
139 Scale and Performance Impact
140 ----------------------------
141 None
142
143 Targeted Release
144 -----------------
145 Carbon
146
147 Alternatives
148 ------------
149 Getting the statistics from OpenFlow flows: it would be possible to target the appropriate rules in ingress/egress tables, and count the hits on these flows. The reason we decided to work with ports instead is because we don't want to be dependent on flow structure changes.
150
151 Usage
152 =====
153 * Create router, network, VMS, VXLAN tunnel.
154 * Connect to one of the VMs, send ping ping to the other VM.
155 * Use REST to get the statistics.
156
157 Port statistics:
158
159 ::
160
161     http://10.0.77.135:8181/restconf/operational/ietf-interfaces:interfaces-state/
162
163 Choose a port id and use the following REST in order to get the statistics:
164
165 ::
166
167     10.0.77.135:8181/restconf/operations/statistics-plugin:getNodeConnectorCounters, input={"input":{"portId":"b99a7352-1847-4185-ba24-9ecb4c1793d9"}}, headers={Authorization=Basic YWRtaW46YWRtaW4=, Cache-Control=no-cache, Content-Type=application/json}]
168
169
170 Node statistics:
171
172 ::
173
174     http://10.0.77.135:8181/restconf/config/odl-interface-meta:bridge-interface-info/
175
176 Choose a node dpId and use the following REST in order to get the statistics:
177
178 ::
179
180     10.0.77.135:8181/restconf/operations/statistics-plugin:getNodeCounters, input=
181            {"input": { "portId": "b99a7352-1847-4185-ba24-9ecb4c1793d9","groups": [{ "name": "byte*",
182                                 "counters": [{
183                                                                 "name": "rec*",
184                                                         }, {
185                                                                 "name": "transmitted*",
186                                                         }]
187                                         }]
188             }},
189     headers={Authorization=Basic YWRtaW46YWRtaW4=, Cache-Control=no-cache, Content-Type=application/json}]
190
191 ::
192
193     10.0.77.135:8181/restconf/operations/statistics-plugin:getNodeAggregatedCounters, input=
194            {"input": { "portId": "b99a7352-1847-4185-ba24-9ecb4c1793d9","groups": [{ "name": "byte*",
195                                 "counters": [{
196                                                                 "name": "rec*",
197                                                         }, {
198                                                                 "name": "transmitted*",
199                                                         }]
200                                         }]
201             }},
202     headers={Authorization=Basic YWRtaW46YWRtaW4=, Cache-Control=no-cache, Content-Type=application/json}]
203
204 Example for a filtered request:
205
206 ::
207
208     10.0.77.135:8181/restconf/operations/statistics-plugin:getPortCounters, input={"input": {"portId":"b99a7352-1847-4185-ba24-9ecb4c1793d9"} }, headers={Authorization=Basic YWRtaW46YWRtaW4=, Cache-Control=no-cache, Content-Type=application/json}]
209
210 An example for node connector counters result:
211
212 ::
213
214     {
215   "output": {
216     "counterResult": [
217       {
218         "id": "openflow:194097926788804:5",
219         "groups": [
220           {
221             "name": "Duration",
222             "counters": [
223               {
224                 "name": "durationNanoSecondCount",
225                 "value": 471000000
226               },
227               {
228                 "name": "durationSecondCount",
229                 "value": 693554
230               }
231             ]
232           },
233           {
234             "name": "Bytes",
235             "counters": [
236               {
237                 "name": "bytesReceivedCount",
238                 "value": 1455
239               },
240               {
241                 "name": "bytesTransmittedCount",
242                 "value": 14151299
243               }
244             ]
245           },
246           {
247             "name": "Packets",
248             "counters": [
249               {
250                 "name": "packetsReceivedCount",
251                 "value": 9
252               },
253               {
254                 "name": "packetsTransmittedCount",
255                 "value": 9
256               }
257             ]
258           }
259         ]
260       }
261     ]
262   }
263  }
264
265 An example for node counters result:
266
267 ::
268
269     {
270   "output": {
271     "counterResult": [
272       {
273         "id": "openflow:194097926788804:3",
274         "groups": [
275           {
276             "name": "Duration",
277             "counters": [
278               {
279                 "name": "durationNanoSecondCount",
280                 "value": 43000000
281               },
282               {
283                 "name": "durationSecondCount",
284                 "value": 694674
285               }
286             ]
287           },
288           {
289             "name": "Bytes",
290             "counters": [
291               {
292                 "name": "bytesReceivedCount",
293                 "value": 0
294               },
295               {
296                 "name": "bytesTransmittedCount",
297                 "value": 648
298               }
299             ]
300           },
301           {
302             "name": "Packets",
303             "counters": [
304               {
305                 "name": "packetsReceivedCount",
306                 "value": 0
307               },
308               {
309                 "name": "packetsTransmittedCount",
310                 "value": 0
311               }
312             ]
313           }
314         ]
315       },
316       {
317         "id": "openflow:194097926788804:2",
318         "groups": [
319           {
320             "name": "Duration",
321             "counters": [
322               {
323                 "name": "durationNanoSecondCount",
324                 "value": 882000000
325               },
326               {
327                 "name": "durationSecondCount",
328                 "value": 698578
329               }
330             ]
331           },
332           {
333             "name": "Bytes",
334             "counters": [
335               {
336                 "name": "bytesReceivedCount",
337                 "value": 0
338               },
339               {
340                 "name": "bytesTransmittedCount",
341                 "value": 648
342               }
343             ]
344           },
345           {
346             "name": "Packets",
347             "counters": [
348               {
349                 "name": "packetsReceivedCount",
350                 "value": 0
351               },
352               {
353                 "name": "packetsTransmittedCount",
354                 "value": 0
355               }
356             ]
357           }
358         ]
359       },
360       {
361         "id": "openflow:194097926788804:1",
362         "groups": [
363           {
364             "name": "Duration",
365             "counters": [
366               {
367                 "name": "durationNanoSecondCount",
368                 "value": 978000000
369               },
370               {
371                 "name": "durationSecondCount",
372                 "value": 698627
373               }
374             ]
375           },
376           {
377             "name": "Bytes",
378             "counters": [
379               {
380                 "name": "bytesReceivedCount",
381                 "value": 6896336558
382               },
383               {
384                 "name": "bytesTransmittedCount",
385                 "value": 161078765
386               }
387             ]
388           },
389           {
390             "name": "Packets",
391             "counters": [
392               {
393                 "name": "packetsReceivedCount",
394                 "value": 35644913
395               },
396               {
397                 "name": "packetsTransmittedCount",
398                 "value": 35644913
399               }
400             ]
401           }
402         ]
403       },
404       {
405         "id": "openflow:194097926788804:LOCAL",
406         "groups": [
407           {
408             "name": "Duration",
409             "counters": [
410               {
411                 "name": "durationNanoSecondCount",
412                 "value": 339000000
413               },
414               {
415                 "name": "durationSecondCount",
416                 "value": 698628
417               }
418             ]
419           },
420           {
421             "name": "Bytes",
422             "counters": [
423               {
424                 "name": "bytesReceivedCount",
425                 "value": 0
426               },
427               {
428                 "name": "bytesTransmittedCount",
429                 "value": 0
430               }
431             ]
432           },
433           {
434             "name": "Packets",
435             "counters": [
436               {
437                 "name": "packetsReceivedCount",
438                 "value": 0
439               },
440               {
441                 "name": "packetsTransmittedCount",
442                 "value": 0
443               }
444             ]
445           }
446         ]
447       },
448       {
449         "id": "openflow:194097926788804:5",
450         "groups": [
451           {
452             "name": "Duration",
453             "counters": [
454               {
455                 "name": "durationNanoSecondCount",
456                 "value": 787000000
457               },
458               {
459                 "name": "durationSecondCount",
460                 "value": 693545
461               }
462             ]
463           },
464           {
465             "name": "Bytes",
466             "counters": [
467               {
468                 "name": "bytesReceivedCount",
469                 "value": 1455
470               },
471               {
472                 "name": "bytesTransmittedCount",
473                 "value": 14151073
474               }
475             ]
476           },
477           {
478             "name": "Packets",
479             "counters": [
480               {
481                 "name": "packetsReceivedCount",
482                 "value": 9
483               },
484               {
485                 "name": "packetsTransmittedCount",
486                 "value": 9
487               }
488             ]
489           }
490         ]
491       }
492     ]
493   }
494  }
495
496 Features to Install
497 -------------------
498 odl-netvirt-openflowplugin-genius-openstack
499
500
501 REST API
502 --------
503
504 CLI
505 ---
506
507 Implementation
508 ==============
509
510 Assignee(s)
511 -----------
512
513 Primary assignee:
514   Guy Regev <guy.regev@hpe.com>
515
516 Other contributors:
517   TBD
518
519
520 Work Items
521 ----------
522 https://trello.com/c/ZdoLQWoV/126-netvirt-statistics
523
524 * Support port counters.
525 * Support node counters.
526 * Support aggregated results.
527 * Support filters on results.
528
529 Dependencies
530 ============
531 * Genius
532 * OpenFlow Plugin
533 * Infrautils
534
535
536 Testing
537 =======
538 Capture details of testing that will need to be added.
539
540 Unit Tests
541 ----------
542
543 Integration Tests
544 -----------------
545
546 CSIT
547 ----
548
549 Documentation Impact
550 ====================
551
552 References
553 ==========
554
555 .. note::
556
557   This template was derived from [2], and has been modified to support our project.
558
559   This work is licensed under a Creative Commons Attribution 3.0 Unported License.
560   http://creativecommons.org/licenses/by/3.0/legalcode
561
562