Add and run some linters via tox and pre-commit
[bgpcep.git] / docs / pcep / pcep-user-guide-session-statistics.rst
1 .. _pcep-user-guide-session-statistics:
2
3 Session statistics
4 ==================
5 The PCEP statistics provides information about PCE <-> PCC session and its stateful listener (topology-provider).
6
7 Usage
8 '''''
9
10 **URL:** ``/restconf/operational/network-topology:network-topology/topology/pcep-topology/node/pcc:%2F%2F43.43.43.43/pcep-session-state``
11
12 **RFC8040 URL:** ``/rests/data/network-topology:network-topology/topology=pcep-topology/node=pcc%3A%2F%2F43.43.43.43/pcep-session-state?content=nonconfig``
13
14 **Method:** ``GET``
15
16 .. tabs::
17
18    .. tab:: XML
19
20       **Response Body:**
21
22       .. code-block:: xml
23          :linenos:
24          :emphasize-lines: 3,4,5,6,7,8,9,10,12,13,14,15,24,25,26,27,30,31,32,33,36,37,38,40,41,42
25
26          <pcep-session-state xmlns="urn:opendaylight:params:xml:ns:yang:topology:pcep:stats">
27             <messages>
28                <last-received-rpt-msg-timestamp xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">1512640592</last-received-rpt-msg-timestamp>
29                <sent-upd-msg-count xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">0</sent-upd-msg-count>
30                <received-rpt-msg-count xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">2</received-rpt-msg-count>
31                <sent-init-msg-count xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">0</sent-init-msg-count>
32                <sent-msg-count>0</sent-msg-count>
33                <last-sent-msg-timestamp>0</last-sent-msg-timestamp>
34                <unknown-msg-received>0</unknown-msg-received>
35                <received-msg-count>2</received-msg-count>
36                <error-messages>
37                   <last-sent-error></last-sent-error>
38                   <received-error-msg-count>0</received-error-msg-count>
39                   <sent-error-msg-count>0</sent-error-msg-count>
40                   <last-received-error></last-received-error>
41                </error-messages>
42                <reply-time>
43                   <average-time>0</average-time>
44                   <min-time>0</min-time>
45                   <max-time>0</max-time>
46                </reply-time>
47             </messages>
48             <peer-pref>
49                <keepalive>30</keepalive>
50                <deadtimer>120</deadtimer>
51                <ip-address>127.0.0.1</ip-address>
52                <session-id>0</session-id>
53             </peer-pref>
54             <local-pref>
55                <keepalive>30</keepalive>
56                <deadtimer>120</deadtimer>
57                <ip-address>127.0.0.1</ip-address>
58                <session-id>0</session-id>
59             </local-pref>
60             <peer-capabilities>
61                <stateful xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">true</stateful>
62                <instantiation xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">true</instantiation>
63                <active xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">true</active>
64             </peer-capabilities>
65             <session-duration>0:00:00:18</session-duration>
66             <delegated-lsps-count>1</delegated-lsps-count>
67             <synchronized>true</synchronized>
68          </pcep-session-state>
69
70       @line 3: **last-received-rpt-msg-timestamp** - The timestamp of last received PCRpt message.
71
72       @line 4: **sent-upd-msg-count** - The number of sent PCUpd messages.
73
74       @line 5: **received-rpt-msg-count** - The number of received PcRpt messages.
75
76       @line 6: **sent-init-msg-count** - The number of sent PCInitiate messages.
77
78       @line 7: **sent-msg-count** - Total number of sent PCEP messages.
79
80       @line 8: **last-sent-msg-timestamp** - The timestamp of last sent message.
81
82       @line 9: **unknown-msg-received** - The number of received unknown messages.
83
84       @line 10: **received-msg-count** - Total number of received PCEP messages.
85
86       @line 12: **last-sent-error** - Type/value tuple of last sent error.
87
88       @line 13: **received-error-msg-count** - Total number of received PCErr messages.
89
90       @line 14: **sent-error-msg-count** - Total number of sent PCErr messages.
91
92       @line 15: **last-received-error** - Type/value tuple of last sent error.
93
94       @line 24: **keepalive** - Advertised keep-alive value.
95
96       @line 25: **deadtimer** - Advertised deadtimer value.
97
98       @line 26: **ip-address** - Peer's IP address.
99
100       @line 27: **session-id** - Peer's session identifier.
101
102       @line 30: **keepalive** - Advertised keep-alive value.
103
104       @line 31: **deadtimer** - Advertised deadtimer value.
105
106       @line 32: **ip-address** - Peer's IP address.
107
108       @line 33: **session-id** - Peer's session identifier.
109
110       @line 35: **stateful** - Represents peer's stateful/stateless capability.
111
112       @line 36: **instantiation** - Represents peer's instantiation capability.
113
114       @line 37: **active** - Represents peer's LSP update capability.
115
116       @line 40: **session-duration** - Elapsed time (in d:H:m:s) from session-up until last statistic update.
117
118       @line 41: **delegated-lsps-count** - The number of delegated LSPs (tunnels) from PCC.
119
120       @line 42: **synchronized** - Represents synchronization status.
121
122    .. tab:: JSON
123
124       **Response Body:**
125
126       .. code-block:: json
127          :linenos:
128          :emphasize-lines: 4,5,6,7,8,9,10,11,13,14,15,16,25,26,27,28,31,32,33,34,37,38,39,41,42,43
129
130          {
131              "pcep-session-state": {
132                  "messages": {
133                      "last-received-rpt-msg-timestamp": 1512640592,
134                      "sent-upd-msg-count": 0,
135                      "received-rpt-msg-count": 2,
136                      "sent-init-msg-count": 0,
137                      "sent-msg-count": 0,
138                      "last-sent-msg-timestamp": 0,
139                      "unknown-msg-received": 0,
140                      "received-msg-count": 2,
141                      "error-messages": {
142                          "last-sent-error": null,
143                          "received-error-msg-count": 0,
144                          "sent-error-msg-count": 0,
145                          "last-received-error": null
146                      },
147                      "reply-time": {
148                          "average-time": 0,
149                          "min-time": 0,
150                          "max-time": 0
151                      }
152                  },
153                  "peer-pref": {
154                      "keepalive": 30,
155                      "deadtimer": 120,
156                      "ip-address": "127.0.0.1",
157                      "session-id": 0
158                  },
159                  "local-pref": {
160                      "keepalive": 30,
161                      "deadtimer": 120,
162                      "ip-address": "127.0.0.1",
163                      "session-id": 0
164                  },
165                  "peer-capabilities": {
166                      "stateful": true,
167                      "instantiation": true,
168                      "active": true
169                  },
170                  "session-duration": "0:00:00:18",
171                  "delegated-lsps-count": 1,
172                  "synchronized": true
173              }
174          }
175
176       @line 4: **last-received-rpt-msg-timestamp** - The timestamp of last received PCRpt message.
177
178       @line 5: **sent-upd-msg-count** - The number of sent PCUpd messages.
179
180       @line 6: **received-rpt-msg-count** - The number of received PcRpt messages.
181
182       @line 7: **sent-init-msg-count** - The number of sent PCInitiate messages.
183
184       @line 8: **sent-msg-count** - Total number of sent PCEP messages.
185
186       @line 9: **last-sent-msg-timestamp** - The timestamp of last sent message.
187
188       @line 10: **unknown-msg-received** - The number of received unknown messages.
189
190       @line 11: **received-msg-count** - Total number of received PCEP messages.
191
192       @line 13: **last-sent-error** - Type/value tuple of last sent error.
193
194       @line 14: **received-error-msg-count** - Total number of received PCErr messages.
195
196       @line 15: **sent-error-msg-count** - Total number of sent PCErr messages.
197
198       @line 16: **last-received-error** - Type/value tuple of last sent error.
199
200       @line 25: **keepalive** - Advertised keep-alive value.
201
202       @line 26: **deadtimer** - Advertised deadtimer value.
203
204       @line 27: **ip-address** - Peer's IP address.
205
206       @line 28: **session-id** - Peer's session identifier.
207
208       @line 31: **keepalive** - Advertised keep-alive value.
209
210       @line 32: **deadtimer** - Advertised deadtimer value.
211
212       @line 33: **ip-address** - Peer's IP address.
213
214       @line 34: **session-id** - Peer's session identifier.
215
216       @line 37: **stateful** - Represents peer's stateful/stateless capability.
217
218       @line 38: **instantiation** - Represents peer's instantiation capability.
219
220       @line 39: **active** - Represents peer's LSP update capability.
221
222       @line 41: **session-duration** - Elapsed time (in d:H:m:s) from session-up until last statistic update.
223
224       @line 42: **delegated-lsps-count** - The number of delegated LSPs (tunnels) from PCC.
225
226       @line 43: **synchronized** - Represents synchronization status.
227
228 Following RPC can be used to fetch PCEP session statistics. If PCEP topology and/or PCC node is not specified in input,
229 statistics for all PCEP sessions under the context are returned.
230
231 Usage
232 '''''
233
234 **URL:** ``/restconf/operations/pcep-topology-stats-rpc:get-stats``
235
236 **RFC8040 URL:** ``/rests/operations/pcep-topology-stats-rpc:get-stats``
237
238 **Method:** ``POST``
239
240 .. tabs::
241
242    .. tab:: XML
243
244       **Content-Type:** ``application/xml``
245
246       **Request Body:**
247
248       .. code-block:: xml
249
250          <input xmlns="urn:opendaylight:params:xml:ns:yang:pcep:topology:stats:rpc">
251             <topology>
252                <topology-id>pcep-topology</topology-id>
253                <node>
254                   <node-id>pcc://43.43.43.43</node-id>
255                </node>
256             </topology>
257          </input>
258
259       **Response Body:**
260
261       .. code-block:: xml
262
263          <output xmlns="urn:opendaylight:params:xml:ns:yang:pcep:topology:stats:rpc">
264             <topology>
265                <topology-id>pcep-topology</topology-id>
266                <node>
267                   <node-id>pcc://43.43.43.43</node-id>
268                   <pcep-session-state>
269                      <synchronized>true</synchronized>
270                      <peer-capabilities>
271                         <stateful xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">true</stateful>
272                         <instantiation xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">true</instantiation>
273                         <active xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">true</active>
274                      </peer-capabilities>
275                      <local-pref>
276                         <keepalive>30</keepalive>
277                         <deadtimer>120</deadtimer>
278                         <session-id>1</session-id>
279                         <ip-address>127.0.0.1</ip-address>
280                      </local-pref>
281                      <session-duration>4:01:59:46</session-duration>
282                      <messages>
283                         <unknown-msg-received>0</unknown-msg-received>
284                         <received-msg-count>11752</received-msg-count>
285                         <error-messages>
286                            <last-sent-error>
287                               <error-type>0</error-type>
288                               <error-value>0</error-value>
289                            </last-sent-error>
290                            <received-error-msg-count>0</received-error-msg-count>
291                            <last-received-error>
292                               <error-type>0</error-type>
293                               <error-value>0</error-value>
294                            </last-received-error>
295                            <sent-error-msg-count>0</sent-error-msg-count>
296                         </error-messages>
297                         <sent-msg-count>11759</sent-msg-count>
298                         <last-sent-msg-timestamp>1553547804</last-sent-msg-timestamp>
299                         <reply-time>
300                            <average-time>0</average-time>
301                            <min-time>0</min-time>
302                            <max-time>0</max-time>
303                         </reply-time>
304                         <received-rpt-msg-count xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">1</received-rpt-msg-count>
305                         <sent-init-msg-count xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">0</sent-init-msg-count>
306                         <last-received-rpt-msg-timestamp xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">1553195032</last-received-rpt-msg-timestamp>
307                         <sent-upd-msg-count xmlns="urn:opendaylight:params:xml:ns:yang:pcep:stateful:stats">0</sent-upd-msg-count>
308                      </messages>
309                      <peer-pref>
310                         <keepalive>30</keepalive>
311                         <deadtimer>120</deadtimer>
312                         <session-id>8</session-id>
313                         <ip-address>127.0.0.1</ip-address>
314                      </peer-pref>
315                      <delegated-lsps-count>0</delegated-lsps-count>
316                   </pcep-session-state>
317                </node>
318             </topology>
319          </output>
320
321    .. tab:: JSON
322
323       **Content-Type:** ``application/json``
324
325       **Request Body:**
326
327       .. code-block:: json
328
329          {
330              "input": {
331                  "topology": [
332                      {
333                        "topology-id": "pcep-topology",
334                          "node": [
335                              {
336                                  "node-id": "pcc://43.43.43.43"
337                              }
338                          ]
339                      }
340                  ]
341              }
342          }
343
344       **Response Body:**
345
346       .. code-block:: json
347
348          {
349              "output": {
350                  "topology": {
351                      "topology-id": "pcep-topology",
352                      "node": {
353                          "node-id": "pcc://43.43.43.43",
354                          "pcep-session-state": {
355                              "synchronized": true,
356                              "peer-capabilities": {
357                                  "stateful": true,
358                                  "instantiation": true,
359                                  "active": true
360                              },
361                              "local-pref": {
362                                  "keepalive": 30,
363                                  "deadtimer": 120,
364                                  "session-id": 1,
365                                  "ip-address": "127.0.0.1"
366                              },
367                              "session-duration": "4:01:59:46",
368                              "messages": {
369                                  "unknown-msg-received": 0,
370                                  "received-msg-count": 11752,
371                                  "error-messages": {
372                                      "last-sent-error": {
373                                      "error-type": 0,
374                                      "error-value": 0
375                                  },
376                                  "received-error-msg-count": 0,
377                                      "last-received-error": {
378                                      "error-type": 0,
379                                      "error-value": 0
380                                  },
381                                  "sent-error-msg-count": 0
382                              },
383                              "sent-msg-count": 11759,
384                              "last-sent-msg-timestamp": 1553547804,
385                              "reply-time": {
386                                  "average-time": 0,
387                                  "min-time": 0,
388                                  "max-time": 0
389                              },
390                              "received-rpt-msg-count": 1,
391                              "sent-init-msg-count": 0,
392                              "last-received-rpt-msg-timestamp": 1553195032,
393                              "sent-upd-msg-count": 0
394                          },
395                          "peer-pref": {
396                              "keepalive": 30,
397                              "deadtimer": 120,
398                              "session-id": 8,
399                              "ip-address": "127.0.0.1"
400                          },
401                          "delegated-lsps-count": 0
402                      }
403                  }
404              }
405          }