blob: 9a8b8bcdb9d334c2918b739e014ebf3895c74f5c [file] [log] [blame]
Srikanth Vavilapalli1725e492014-12-01 17:50:52 -08001#
2# Copyright (c) 2013 Big Switch Networks, Inc.
3#
4# Licensed under the Eclipse Public License, Version 1.0 (the
5# "License"); you may not use this file except in compliance with the
6# License. You may obtain a copy of the License at
7#
8# http://www.eclipse.org/legal/epl-v10.html
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13# implied. See the License for the specific language governing
14# permissions and limitations under the License.
15#
16
17import command
18import run_config
19
20"""
21SHOW_RUNNING_CONFIG_COMMAND_DESCRIPTION = {
22 'name' : 'show',
23 'mode' : 'login',
24 'short-help' : 'Show the current active configuration',
25 'action' : 'legacy-cli',
26 'no-supported' : False,
27 'obj-type' : 'running-config',
28 'doc' : 'running-config|show',
29 'doc-example' : 'running-config|show-example',
30 'args' : (
31 'running-config',
32 run_config.running_config_command_choices,
33 )
34}
35
36SHOW_CLOCK_COMMAND_DESCRIPTION = {
37 'name' : 'show',
38 'mode' : 'login',
39 'short-help' : 'Show the current date and time',
40 'action' : 'display-rest',
41 'no-supported' : False,
42 'url' : 'system/clock/local',
43 'rest-type' : 'dict-with-time|tz|year|month|day|hour|minute|second',
44 'format' : 'system-clock',
45 'doc' : 'clock|show',
46 'doc-example' : 'clock|show-example',
47 'args' : (
48 'clock',
49 {
50 'optional' : True,
51 'field' : 'detail',
52 'type' : 'enum',
53 'values' : ('details'),
54 'short-help' : 'Show more date/time information',
55 'doc' : 'clock|show-format-details',
56 },
57 )
58}
59
60SHOW_CONFIG_COMMAND_DESCRIPTION = {
61 'name' : 'show',
62 'mode' : 'login',
63 'short-help' : 'Show saved configs (ex: startup-config, etc)',
64 'action' : 'legacy-cli',
65 'obj-type' : 'config',
66 'no-supported' : False,
67 'doc' : 'config|show',
68 'doc-example' : 'config|show-example',
69 'args' : (
70 'config',
71 {
72 'optional' : True,
73 'choices' : (
74 # <first> [ <version> ]
75 # <first> diff <second> [ version ]
76 ( # 1nd choice 'diff' <config> <config> [ version ]
77 {
78 'optional' : False,
79 'field' : 'first',
80 'type' : 'config',
81 'completion' : 'complete-config',
82 'doc' : 'config|show-first',
83 },
84 {
85 'optional' : False,
86 'token' : 'diff',
87 # XXX implies config's aren't called 'diff'
88 },
89 {
90 'optional' : False,
91 'field' : 'second',
92 'type' : 'config',
93 'completion' : 'complete-config',
94 'doc' : 'config|show-second',
95 },
96 {
97 'optional' : True,
98 'field' : 'version',
99 'type' : 'string',
100 'doc' : 'config|show-version',
101 },
102
103 ),
104 ( # 2st choice <name> [ version ]
105 {
106 'optional' : False,
107 'field' : 'config',
108 'type' : 'config',
109 'completion' : 'complete-config',
110 'syntax-help' : 'Config file name',
111 'doc' : 'config|show-single',
112 },
113 {
114 'optional' : True,
115 'field' : 'version',
116 'type' : 'string',
117 'doc' : 'config|show-version',
118 },
119 ),
120 )
121 }
122 )
123}
124
125SHOW_CONFIG_FILE_COMMAND_DESCRIPTION = {
126 'name' : 'show',
127 'mode' : 'login',
128 'short-help' : 'Show a specific saved config file',
129 'doc' : 'config-file|show',
130 'doc-example' : 'config-file|show-example',
131 'obj-type' : 'config-file',
132 'action' : 'legacy-cli',
133 'no-supported' : False,
134 'args' : (
135 'config-file',
136 {
137 'optional' : True,
138 'field' : 'config',
139 'type' : 'config',
140 'completion' : 'complete-config',
141 'syntax-help' : 'Config file name',
142 }
143 ),
144}
145
146SHOW_TECH_SUPPORT_COMMAND_DESCRIPTION = {
147 'name' : 'show',
148 'mode' : 'login',
149 'short-help' : 'Show tech-support, collect output of various commands',
150 'doc' : 'tech-support|show',
151 'doc-example' : 'tech-support|show-example',
152 'obj-type' : 'tech-support',
153 'action' : 'legacy-cli',
154 'no-supported' : False,
155 'args' : (
156 'tech-support',
157 ),
158}
159
160SHOW_FLOW_ENTRY_COMMAND_DESCRIPTION = {
161 'name' : 'show',
162 'obj-type' : 'flow-entry',
163 'short-help' : 'Show configured static flow-entries',
164 'doc' : 'flow-entry|show',
165 'doc-example' : 'flow-entry|show-example',
166 'mode' : 'login',
167 'command-type' : 'display-table',
168 'args' : (
169 'flow-entry',
170 {
171 'field' : 'name',
172 'optional' : True,
173 'base-type' : 'identifier',
174 'reserved' : [ 'switch' ],
175 'completion' : 'complete-object-field',
176 },
177 {
178 'field' : 'switch',
179 'tag' : 'switch',
180 'optional' : True,
181 'type' : 'dpid',
182 'completion' : 'complete-from-another',
183 'other' : 'switches',
184 'syntax-help' : 'switch dpid or alias',
185 'short-help' : 'Show flow entries for a specific switch'
186 }
187
188 )
189}
190
191SHOW_FIREWALL_COMMAND_DESCRIPTION = {
192 'name' : 'show',
193 'obj-type' : 'firewall-rule',
194 'short-help' : 'Show firewall rules for controller interfaces',
195 'doc' : 'firewall-rule|show',
196 'doc-example' : 'firewall-rule|show-example',
197 'mode' : 'login',
198 'command-type' : 'display-table',
199 'args' : (
200 'firewall-rule',
201 {
202 'optional' : True,
203 'tag' : 'controller',
204 'field' : 'controller',
205 'type' : 'string',
206 'short-help': 'Show rules from a specific controller',
207 'doc' : 'firewall-rule|show-controller',
208 },
209 {
210 'optional' : True,
211 'tag' : 'type',
212 'field' : 'type',
213 'type' : 'string',
214 'short-help': 'Show rules with a specific rule type',
215 'doc' : 'firewall-rule|show-type',
216 },
217 {
218 'optional' : True,
219 'tag' : 'number',
220 'field' : 'number',
221 'type' : 'integer',
222 'short-help': 'Show rules with a specific rule number',
223 'doc' : 'firewall-rule|show-number',
224 },
225 {
226 'optional' : True,
227 'tag' : 'port',
228 'field' : 'port',
229 'type' : 'integer',
230 'short-help': 'Show rules with a specific port number',
231 'doc' : 'firewall-rule|show-port',
232 },
233 {
234 'optional' : True,
235 'tag' : 'proto',
236 'field' : 'proto',
237 'type' : 'enum',
238 'values' : ('tcp', 'udp', 'vrrp'),
239 'short-help': 'Show rules with a specific IP protocol',
240 'doc' : 'firewall-rule|show-proto',
241 },
242 {
243 'optional' : True,
244 'field' : 'src-ip',
245 'tag' : 'src-ip',
246 'type' : 'ip-address',
247 'short-help' : 'Show rules with this src-ip configured',
248 'doc' : 'firewall-rule|show-src-ip',
249 },
250 {
251 'optional' : True,
252 'field' : 'vrrp-ip',
253 'tag' : 'local-ip',
254 'type' : 'ip-address',
255 'short-help' : 'Show rules with this src-ip configured',
256 'doc' : 'firewall-rule|show-src-ip',
257 },
258 )
259}
260
261SHOW_THIS_COMMAND_DESCRIPTION = {
262 'name' : 'show',
263 'obj-type' : 'this',
264 'mode' : 'config-*',
265 'short-help' : 'Show the object associated with the current submode',
266 'doc' : 'show-this',
267 'doc-example' : 'show-this-example',
268 'action' : 'legacy-cli',
269 'no-supported' : False,
270 'args' : (
271 'this',
272 )
273}
274
275SHOW_SWITCH_CLUSTER_COMMAND_DESCRIPTION = {
276 'name' : 'show',
277 'mode' : 'login',
278 'obj-type' : 'switch-cluster',
279 'short-help' : 'Show groups of interconnected openflow switches',
280 'doc' : 'switch-cluster|show',
281 'doc-example' : 'switch-cluster|show-example',
282 'command-type' : 'display-rest',
283 'url' : 'realtimestatus/network/cluster/',
284 'rest-type' : 'dict-of-list-of-cluster-id|[switches]',
285 'format' : 'switch-cluster',
286 'args' : (
287 {
288 'token' : 'switch-cluster',
289 }
290 )
291}
292
293SHOW_EXTERNAL_PORTS_COMMAND_DESCRIPTION = {
294 'name' : 'show',
295 'mode' : 'login',
296 'obj-type' : 'external-ports',
297 'short-help' : 'Show switch ports connected to external L2 networks',
298 'doc' : 'external-ports|show',
299 'doc-example' : 'external-ports|show-example',
300 'command-type' : 'display-rest',
301 'url' : 'realtimestatus/network/externalports/',
302 'rest-type' : 'dict-of-list-of-id|[ports]',
303 'format' : 'external-ports',
304 'args' : (
305 {
306 'token' : 'external-ports',
307 }
308 )
309}
310
311
312SHOW_VERSION_COMMAND_DESCRIPTION = {
313 'name' : 'show',
314 'mode' : 'login',
315 'short-help' : 'Show current build version number',
316 'doc' : 'core|version',
317 'doc-example' : 'core|version-example',
318 'action' : 'display-rest',
319 'no-supported' : False,
320 'url' : 'system/version',
321 'format' : 'version',
322 'detail' : 'details',
323 'args' : (
324 'version',
325 )
326}
327
328
329SHOW_LOGGING_COMMAND_DESCRIPTION = {
330 'name' : 'show',
331 'mode' : 'login',
332 'short-help' : 'Show various controller logs',
333 'doc' : 'show-logging',
334 'doc-example' : 'show-logging-example',
335 'no-supported' : False,
336 'obj-type' : 'logging',
337 'args' : (
338 'logging',
339 {
340 'optional' : 'true',
341 'args' : (
342 {
343 'token' : 'controller',
344 },
345 {
346 'choices' : (
347 {
348 'field' : 'controller-node',
349 'type' : 'enum',
350 'values' : 'all',
351 },
352 {
353 'field' : 'controller-node',
354 'type' : 'identifier',
355 'completion' : 'complete-from-another',
356 'other' : 'controller-node|id',
357 'data-handler' : 'alias-to-value',
358 }
359 ),
360 }
361 ),
362 },
363 {
364 'field' : 'log-name',
365 'type' : 'string',
366 'completion' : 'complete-log-names',
367 'doc' : 'show-logging-+',
368 'action' : 'dump-log',
369 },
370 ),
371}
372
373SHOW_EVENT_HISTORY_COMMAND_DESCRIPTION = {
374 'name' : 'show',
375 'mode' : 'login',
376 'short-help' : 'Show recent network or system events',
377 'doc' : 'event-history|show',
378 'doc-example' : 'event-history|show-example',
379 'action' : 'legacy-cli',
380 'no-supported' : False,
381 'obj-type' : 'event-history',
382 'args' : (
383 'event-history',
384 {
385 'field' : 'event',
386 'type' : 'enum',
387 'values' : (
388 # 'attachment-point', not currently available
389 # 'packet-in', not currently available
390 'topology-link',
391 'topology-switch',
392 'topology-cluster',
393 ),
394 'doc' : 'show-event-history-+',
395 },
396 {
397 'optional' : True,
398 'field' : 'count',
399 'tag' : 'last',
400 'base-type' : 'integer',
401 'range' : (1,10000),
402 'doc' : 'show-event-history-count',
403 }
404 ),
405}
406
407SHOW_FLOW_CACHE_COMMAND_DESCRIPTION = {
408 'name' : 'show',
409 'mode' : 'login',
410 'short-help' : 'Show the contents of the controller flow cache',
411 'doc' : 'flow-cache|show',
412 'doc-example' : 'flow-cache|show-example',
413 'action' : 'display-rest',
414 'url' : 'flow-cache/vns/all/all',
415 'rest-type' : 'dict-with-flows',
416 'format' : 'flow-cache',
417 'no-supported' : False,
418 #'obj-type' : 'flow-cache',
419 'args' : (
420 'flow-cache',
421 {
422 'optional' : True,
423 'choices' : (
424 (
425 {
426 'optional' : False,
427 'field' : 'application',
428 'tag' : 'app',
429 'type' : 'string',
430 'short-help': 'Show the entries associated with a specific application',
431 'doc' : 'flow-cache|show-application',
432 },
433 {
434 'optional' : False,
435 'field' : 'instance',
436 'tag' : 'app-instance',
437 'type' : 'string',
438 'doc' : 'flow-cache|show-instance',
439 'action' : 'display-rest',
440 'url' : 'flow-cache/%(application)s/%(instance)s/all',
441 'rest-type': 'dict-with-flows',
442 },
443 ),
444 {
445 'field' : 'counters',
446 'type' : 'enum',
447 'values' : 'counters',
448 'action' : 'display-rest',
449 'url' : 'flow-cache/vns/all/counters',
450 'format' : 'flow-cache-counters',
451 'rest-type' : 'dict-with-counters|status',
452 'detail' : 'details',
453 'short-help': 'Show the counters for the flow cache',
454 'doc' : 'flow-cache|show-counters',
455 },
456 )
457 }
458 ),
459}
460
461FEATURE_COMMAND_DESCRIPTION = {
462 'name' : 'feature',
463 'mode' : 'config',
464 'short-help' : 'Enable features for controller',
465 'doc' : 'feature',
466 'doc-example' : 'feature-example',
467 'command-type' : 'config',
468 'obj-type' : 'feature',
469 'args': {
470 'choices': (
471 {
472 'token' : 'vns',
473 'short-help' : 'Enable the VNS feature',
474 'doc' : 'feature-vns',
475 'action' : (
476 {
477 'proc' : 'write-object',
478 'data' : {
479 # The primary key ('id') must be present to
480 # read the old row value, and update items,
481 # otherwise a 'new' row is written with default
482 # values
483
484 'id' : 'feature',
485 'netvirt-feature' : True,
486 },
487 },
488 {
489 'proc' : 'wait-for-controller',
490 },
491 ),
492 'no-action' : (
493 {
494 'proc' : 'write-object',
495 'data' : {
496 'id' : 'feature',
497 'netvirt-feature' : False ,
498 },
499 },
500 {
501 'proc' : 'wait-for-controller',
502 },
503 )
504 },
505 {
506 'token' : 'flow-pusher',
507 'short-help' : 'Enable the static flow pusher feature',
508 'doc' : 'feature-flow-pusher',
509 'action' : (
510 {
511 'proc' : 'write-object',
512 'data' : {
513 'id' : 'feature',
514 'static-flow-pusher-feature' : True,
515 },
516 },
517 {
518 'proc' : 'wait-for-controller',
519 },
520
521 ),
522 'no-action' : (
523 {
524 'proc' : 'write-object',
525 'data' : {
526 'id' : 'feature',
527 'static-flow-pusher-feature' : False,
528 },
529 },
530 {
531 'proc' : 'wait-for-controller',
532 },
533 )
534 },
535 {
536 'token' : 'performance-monitor',
537 'short-help' : 'Enable the performance monitor feature',
538 'doc' : 'feature-performance-monitor',
539 'action' : (
540 {
541 'proc' : 'write-object',
542 'data' : {
543 'id' : 'feature',
544 'performance-monitor-feature' : True,
545 },
546 },
547 {
548 'proc' : 'wait-for-controller',
549 },
550 ),
551 'no-action' : (
552 {
553 'proc' : 'write-object',
554 'data' : {
555 'id' : 'feature',
556 'performance-monitor-feature' : False,
557 },
558 },
559 {
560 'proc' : 'wait-for-controller',
561 },
562 )
563 },
564 ),
565 },
566}
567
568
569SHOW_FEATURE_COMMAND_DESCRIPTION = {
570 'name' : 'show',
571 'mode' : 'login',
572 'short-help' : 'Show enabled and disabled features',
573 'doc' : 'show-feature',
574 'doc-example' : 'show-feature-example',
575 'command-type' : 'display-table',
576 'obj-type' : 'feature',
577 'data' : { 'id' : 'feature' },
578 'args' : (
579 'feature',
580 )
581}
582
583
584VERSION_COMMAND_DESCRIPTION = {
585 'name' : 'version',
586 'no-supported' : False,
587 'short-help' : 'Move to a specific version of command syntax',
588 'doc' : 'core|version',
589 'doc-example' : 'core|version-example',
590 'mode' : 'config*',
591 'action' : 'version',
592 'args': {
593 'field' : 'version',
594 'type' : 'string',
595 'completion' : 'description-versions'
596 }
597}
598
599"""
600CLEAR_COMMAND_DESCRIPTION = {
601 'name' : 'clearterm',
602 'no-supported' : False,
603 'short-help' : 'Clears and resets the terminal screen',
604 'doc' : 'clearterm',
605 'doc-example' : 'clearterm-example',
606 'mode' : 'login',
607 'action' : 'clearterm',
608 'args' : {}
609}
610"""
611
612COPY_COMMAND_DESCRIPTION = {
613 'name' : 'copy',
614 'no-supported' : False,
615 'short-help' : 'Copy configs to other configs',
616 'doc' : 'copy|copy',
617 'doc-example' : 'copy|copy-example',
618 'mode' : 'enable',
619 'action' : 'legacy-cli',
620 'obj-type' : 'copy',
621 'args': (
622 {
623 'choices' : (
624 {
625 'field' : 'source',
626 'type' : 'config',
627 'completion' : 'complete-config-copy',
628 'help-name' : 'source specifier',
629 'doc' : 'copy|copy-source',
630 },
631 ),
632 },
633 {
634 'optional': True,
635 'choices' : (
636 {
637 'field' : 'dest',
638 'type' : 'config',
639 'completion' : 'complete-config-copy',
640 'help-name' : 'destination specifier',
641 'doc' : 'copy|copy-dest',
642 },
643 )
644 },
645 )
646}
647
648
649WRITE_COMMAND_DESCRIPTION = {
650 'name' : 'write',
651 'no-supported' : False,
652 'short-help' : 'Write config to memory or terminal, or clear',
653 'doc' : 'core|write',
654 'doc-example' : 'core|write-example',
655 'mode' : 'enable',
656 'action' : 'legacy-cli',
657 'obj-type' : 'write',
658 'args': (
659 {
660 'field' : 'source',
661 'type' : 'enum',
662 'values' : {'terminal' : 'running-config'},
663 'short-help' : 'Show the current active configuration',
664 'doc' : 'core|write-terminal',
665 'action' : 'legacy-cli',
666 'obj-type' : 'copy',
667 'doc-example' : 'write-source-+',
668 },
669 ),
670}
671
672WRITE_ERASE_COMMAND_DESCRIPTION = {
673 'name' : 'write',
674 'no-supported' : False,
675 'mode' : 'enable',
676 'args' : (
677 {
678 'field' : 'erase',
679 'type' : 'enum',
680 'values' : ('erase'),
681 'short-help' : 'Erase settings and restore to factory defaults',
682 'doc' : 'core|factory-default',
683 }
684 ),
685 'action' : (
686 {
687 'proc' : 'factory-default',
688 },
689 )
690}
691"""
692ENABLE_SUBMODE_COMMAND_DESCRIPTION = {
693 'name' : 'enable',
694 'mode' : 'login',
695 'no-supported' : False,
696 'help' : 'Enter enable mode',
697 'short-help' : 'Enter enable mode',
698 'doc' : 'enable',
699 'doc-example' : 'enable-example',
700 'command-type' : 'config-submode',
701 'obj-type' : None,
702 'parent-field' : None,
703 'submode-name' : 'enable',
704 'args' : (),
705}
706
707CONFIGURE_SUBMODE_COMMAND_DESCRIPTION = {
708 'name' : 'configure',
709 'mode' : 'enable',
710 'no-supported' : False,
711 'help' : 'Enter configure mode',
712 'short-help' : 'Enter configure mode',
713 'doc' : 'config',
714 'doc-example' : 'config-example',
715 'command-type' : 'config-submode',
716 'obj-type' : None,
717 'parent-field' : None,
718 'submode-name' : 'config',
719 'args' : {
720 'token' : 'terminal',
721 'optional' : 'true',
722 },
723}
724"""
725DEBUG_CLI_COMMAND_DESCRIPTION = {
726 'name' : 'debug',
727 'mode' : ['login', 'enable', 'config*'],
728 'short-help' : 'Manage various cli debugging features',
729 'doc' : 'debug|debug-cli',
730 'doc-example' : 'debug|debug-cli-example',
731 'args' : {
732 'choices' : (
733 {
734 'token' : 'cli',
735 'action' : 'cli-set',
736 'no-action' : 'cli-unset',
737 'variable' : 'debug',
738 'short-help' : 'Display more detailed information on errors',
739 'doc' : 'debug|cli',
740 },
741 {
742 'token' : 'cli-backtrace',
743 'action' : 'cli-set',
744 'no-action' : 'cli-unset',
745 'variable' : 'cli-backtrace',
746 'short-help' : 'Display backtrace information on errors',
747 'doc' : 'debug|cli-backtrace',
748 },
749 {
750 'token' : 'cli-batch',
751 'action' : 'cli-set',
752 'no-action' : 'cli-unset',
753 'variable' : 'cli-batch',
754 'short-help' : 'Disable any prompts to allow simpler batch processing',
755 'doc' : 'debug|cli-batch',
756 },
757 {
758 'token' : 'description',
759 'action' : 'cli-set',
760 'no-action' : 'cli-unset',
761 'variable' : 'description',
762 'short-help' : 'Display verbose debug information while processing commands',
763 'doc' : 'debug|description',
764 },
765 (
766 {
767 'token' : 'rest',
768 'action' : 'cli-set',
769 'no-action' : 'cli-unset',
770 'variable' : 'rest',
771 'short-help' : 'Display URLs of any information retrieved via REST',
772 'doc' : 'debug|rest',
773 },
774 {
775 'optional' : True,
776 'optional-for-no' : True,
777 'choices' : (
778 {
779 'field' : 'detail',
780 'type' : 'enum',
781 'values' : ('details', 'brief'),
782 'short-help' : 'Display both URLs and returned content for REST requests',
783 'doc' : 'debug|debug-cli-rest-format',
784 },
785 {
786 'field' : 'record',
787 'tag' : 'record',
788 'type' : 'string',
789 'short-help' : 'record rest api activitiy',
790 },
791 ),
792 },
793 ),
794 {
795 'token' : 'python',
796 'action' : 'shell-command',
797 'command' : 'python',
798 'short-help' : 'Enter a python shell',
799 'doc' : 'debug|python',
800 },
801 {
802 'token' : 'bash',
803 'action' : 'shell-command',
804 'command' : 'bash',
805 'short-help' : 'Enter a bash shell',
806 'doc' : 'debug|bash',
807 },
808 {
809 'token' : 'cassandra-cli',
810 'action' : 'shell-command',
811 'command' : 'cassandra-cli',
812 'short-help' : 'Enter a cassandra shell',
813 'doc' : 'debug|assandra-cli',
814 },
815 {
816 'token' : 'netconfig',
817 'action' : 'shell-command',
818 'command' : 'netconfig',
819 'short-help' : 'Enter a netconfig shell',
820 'doc' : 'debug|netconfig',
821 },
822 # tcpdump requires that the 'tail' of the debug command be tcpdump syntax,
823 # but that would mean describing the complete tcpdump syntax here, and parsing it
824 # {
825 # 'token' : 'tcpdump',
826 # 'action' : 'shell-command',
827 # 'command' : '/opt/sdnplatform/sys/bin/bscnetconfig',
828 # },
829 )
830 }
831}
832
833
834HA_CONFIG_CLI_COMMAND_DESCRIPTION = {
835 'name' : 'ha',
836 'short-help' : 'Configure high availability',
837 'doc' : 'ha|ha-vrrp',
838 'doc-example' : 'ha|ha-vrrp-example',
839 'mode' : 'config*',
840 'feature' : 'ha',
841 'args' : {
842 'choices' : (
843 {
844 'field' : 'cluster-number',
845 'tag' : 'cluster-number',
846 'base-type' : 'integer',
847 'range' : (1, 255),
848 'completion-text' : '1-255',
849 'syntax-help' : "Enter a small integer (1-255) to distinguish different controller clusters",
850 'short-help' : 'Set the VRRP cluster number',
851 'doc' : 'ha|ha-cluster-number',
852 'obj-type' : 'global-config',
853 'obj-id' : 'global',
854 'default-for-no' : 1,
855 'action' : 'write-fields-explicit',
856 'no-action' : 'reset-fields-explicit',
857 },
858 )
859 }
860}
861
862HA_CLI_COMMAND_DESCRIPTION = {
863 'name' : 'ha',
864 'no-supported' : False,
865 'short-help' : 'Perform actions related to high availability',
866 'doc' : 'ha|ha-failover',
867 'doc-example' : 'ha|ha-failover-example',
868 'feature' : 'ha',
869 'mode' : 'enable',
870 'args' : {
871 'choices' : (
872 {
873 'token' : 'failover',
874 'short-help': 'Trigger a failure of the current node',
875 'path' : 'system/ha/failback',
876 'action' : (
877 {
878 'proc' : 'confirm',
879 'prompt' : 'Fallback will change the HA operating mode,'
880 'enter "yes" (or "y") to continue:',
881 },
882 {
883 'proc' : 'rest-post-data',
884 },
885 ),
886 },
887 (
888 {
889 'token' : 'provision',
890 },
891 {
892 'field' : 'ip',
893 'type' : 'ip-address-not-mask',
894 'action' : (
895 {
896 'proc' : 'confirm',
897 'prompt' : "Confirm to continue addition of new ip, "
898 'enter "yes" (or "y") to continue:',
899 },
900 {
901 'proc' : 'rest-post-data',
902 'path' : 'system/ha/provision'
903 },
904 ),
905 },
906 ),
907 (
908 {
909 'token' : 'decommission',
910 },
911 {
912 'action' : 'controller-decommission',
913 'obj-type' : 'controller-node',
914 'optional' : False,
915 'field' : 'id',
916 'type' : 'identifier',
917 'completion' : 'complete-alias-choice',
918 'data-handler' : 'alias-to-value',
919 'doc' : 'controller|controller-node-name',
920 },
921 ),
922 )
923 }
924}
925
926
927SHOW_HA_COMMAND_DESCRIPTION = {
928 'name' : 'show',
929 'no-supported' : False,
930 'short-help' : 'Show high availability configuration',
931 'doc' : 'ha|show',
932 'doc-example' : 'ha|show-example',
933 'feature' : 'ha',
934 'mode' : 'login',
935 'obj-type' : 'global-config',
936 'command-type' : 'display-table',
937 'action' : (
938 {
939 'proc' : 'display-table',
940 },
941 # borrowed from controller-node, would be better to
942 # have this in common code
943 {
944 'proc' : 'query-table',
945 'obj-type' : 'controller-node',
946 },
947 {
948 'proc' : 'join-table',
949 'obj-type' : 'controller-alias',
950 'key' : 'controller',
951 'join-field' : 'id', # field in queried items
952 },
953 {
954 'proc' : 'join-rest',
955 'url' : 'system/controller',
956 'rest-type' : 'dict-with-id',
957 'key' : 'id',
958 'join-field' : 'id',
959 'add-field' : 'me',
960 },
961 # need a description mechanism to join ha-role, which
962 # needs to send urls to controller-node interfaces
963 # ie: the rest actions alwaus use the local controller
964 # (uptime has the same issue)
965 {
966 'proc' : 'display',
967 'title' : '\nController Nodes\n',
968 'format' : 'controller-node',
969 }
970 ),
971 'args' : (
972 'ha',
973 {
974 'optional' : True,
975 'field' : 'detail',
976 'type' : 'enum',
977 'values' : 'details',
978 'doc' : 'format|details',
979 },
980
981 )
982}
983
984BOOT_COMMAND_DESCRIPTION = {
985 'name' : 'boot',
986 'no-supported' : False,
987 'short-help' : 'Configure system boot options',
988 'doc' : 'core|boot',
989 'doc-example' : 'core|boot-example',
990 'mode' : 'enable',
991 'args' : (
992 {
993 'field' : 'factory-default',
994 'type' : 'enum',
995 'values' : ('factory-default'),
996 'short-help' : 'Erase settings and restore to factory defaults',
997 'doc' : 'core|factory-default',
998 }
999 ),
1000 'action' : (
1001 {
1002 'proc' : 'factory-default',
1003 },
1004 )
1005}
1006
1007RELOAD_COMMAND_DESCRIPTION = {
1008 'name' : 'reload',
1009 'no-supported' : False,
1010 'short-help' : 'Reload and reboot',
1011 'doc' : 'core|reload',
1012 'doc-example' : 'core|reload-example',
1013 'mode' : 'enable',
1014 'args' : (),
1015 'obj-type' : 'reload',
1016 'action' : (
1017 {
1018 'proc' : 'confirm',
1019 'prompt' : 'Confirm Reload (yes to continue) '
1020 },
1021 # XXX what about checking to see if the running-config
1022 # has been copied to the startup config?
1023 {
1024 'proc' : 'query-rest',
1025 'url' : 'system/reload'
1026 },
1027 )
1028}
1029
1030UPGRADE_COMMAND_DESCRIPTION = {
1031 'name' : 'upgrade',
1032 'no-supported' : False,
1033 'short-help' : 'Manage the controller upgrade process',
1034 'doc' : 'core|upgrade',
1035 'doc-example' : 'core|upgrade-example',
1036 'mode' : 'enable',
1037 'args' : (
1038 {
1039 'optional' : True,
1040 'type' : 'enum',
1041 'field' : 'force',
1042 'values' : ('force'),
1043 'short-help' : 'Ignore validation errors and upgrade anyway',
1044 'doc' : 'core|upgrade-force'
1045 },
1046 {
1047 'optional' : True,
1048 'type' : 'enum',
1049 'field' : 'details',
1050 'values' : ('details'),
1051 'short-help' : 'Display more information on the upgrade',
1052 'doc' : 'core|upgrade-details'
1053 }
1054 ),
1055 'obj-type' : 'upgrade',
1056 'action' : 'controller-upgrade',
1057}
1058
1059UPGRADE_ABORT_COMMAND_DESCRIPTION = {
1060 'name' : 'upgrade',
1061 'no-supported' : False,
1062 'short-help' : 'Manage the controller upgrade process',
1063 'mode' : 'enable',
1064 'doc-example' : 'core|upgrade-abort-example',
1065 'obj-type' : 'upgrade',
1066 'args' : (
1067 {
1068 'type' : 'enum',
1069 'field' : 'abort',
1070 'values' : 'abort',
1071 'short-help' : 'Abort an upgrade already installed',
1072 'doc' : 'core|upgrade-abort'
1073 },
1074 ),
1075 'action' : (
1076 {
1077 'proc' : 'confirm',
1078 'prompt' : 'Confirm to abort an upgrade already installed'\
1079 ' onto second partition\n'\
1080 'enter "yes" (or "y") to continue:',
1081 },
1082 {
1083 'proc' : 'rest-post-data',
1084 'path' : 'system/upgrade/abort'
1085 },
1086 )
1087}
1088
1089ROLLBACK_COMMAND_DESCRIPTION = {
1090 'name' : 'rollback',
1091 'no-supported' : False,
1092 'short-help' : 'rollback cluster to specified config',
1093 'mode' : 'enable',
1094 'doc-example' : 'core|rollback-config-example',
1095 'obj-type' : 'rollback',
1096 'args' : (
1097 {
1098 'type' : 'enum',
1099 'field' : 'dir',
1100 'short-help' : 'source directory',
1101 'values' : ('images://', 'saved-configs://'),
1102 },
1103 {
1104 'field' : 'file',
1105 'type' : 'string',
1106 'short-help' : 'config file name',
1107 },
1108 ),
1109 'action' : 'controller-config-rollback'
1110}
1111
1112
1113command.add_action('implement-connect', command.sdnsh.implement_connect,
1114 {'kwargs': {'data' : '$data',}})
1115
1116
1117CONNECT_COMMAND_DESCRIPTION = {
1118 'name' : 'connect',
1119 'mode' : 'login',
1120 'no-supported' : False,
1121 'short-help' : 'Connect to a controller\'s REST API',
1122 'doc' : 'connect|connect',
1123 'doc-example' : 'connect|connect-example',
1124 'obj-type' : 'controller-node',
1125 'action' : 'implement-connect',
1126 'args' : (
1127 {
1128 'choices': (
1129 {
1130 'field' : 'controller-id',
1131 'type' : 'obj-type',
1132 'completion' : 'complete-alias-choice',
1133 'completion-text' : 'controller id or alias',
1134 'short-help' : 'controller-id',
1135 'doc' : 'connect|connect-id',
1136 },
1137 {
1138 'field' : 'ip-address',
1139 'type' : 'ip-address',
1140 'completion' : 'complete-alias-choice',
1141 'completion-text' : 'ip address',
1142 'short-help' : 'controller-id',
1143 'doc' : 'connect|connect-ip',
1144 },
1145 ),
1146 },
1147 {
1148 'field' : 'port',
1149 'tag' : 'port',
1150 'type' : 'integer',
1151 'range' : (1,65535),
1152 'optional' : True,
1153 'doc' : 'connect|connect-port'
1154 },
1155 )
1156}
1157
1158command.add_action('implement-ping', command.sdnsh.implement_ping,
1159 {'kwargs': {'data' : '$data',}})
1160
1161PING_COMMAND_DESCRIPTION = {
1162 'name' : 'ping',
1163 'mode' : 'login',
1164 'no-supported' : False,
1165 'short-help' : 'ping a switch or ip address',
1166 'doc' : 'ping|ping',
1167 'doc-example' : 'ping|ping-example',
1168 'obj-type' : 'switches',
1169 'action' : 'implement-ping',
1170 'args' : (
1171 {
1172 'field' : 'count',
1173 'type' : 'integer',
1174 'tag' : 'count',
1175 'optional' : True,
1176 'completion-text' : 'ping count',
1177 'doc' : 'ping|ping-count'
1178 },
1179 {
1180 'field' : 'ip-address',
1181 'type' : 'resolvable-ip-address',
1182 'completion-text' : 'ip-address ping target',
1183 'other' : 'switches|dpid',
1184 'completion' : [
1185 'complete-alias-choice',
1186 'complete-from-another',
1187 ],
1188 'data-handler' : 'alias-to-value',
1189 'doc' : 'types|resolvable-ip-address'
1190 },
1191 ),
1192}
1193
1194
1195command.add_action('implement-traceroute', command.sdnsh.implement_traceroute,
1196 {'kwargs': {'data' : '$data',}})
1197
1198TRACEROUTE_COMMAND_DESCRIPTION = {
1199 'name' : 'traceroute',
1200 'mode' : 'login',
1201 'no-supported' : False,
1202 'short-help' : 'Determine the L3 path to some destination',
1203 'doc' : 'traceroute|traceroute',
1204 'doc-example' : 'traceroute|traceroute-example',
1205 'obj-type' : 'switches',
1206 'action' : 'implement-traceroute',
1207 'args' : (
1208 {
1209 'field' : 'ip-address',
1210 'type' : 'resolvable-ip-address',
1211 'completion-text' : 'ip-address ping target',
1212 'other' : 'switches|dpid',
1213 'completion' : [
1214 'complete-alias-choice',
1215 'complete-from-another',
1216 ],
1217 'data-handler' : 'alias-to-value',
1218 'doc' : 'types|resolvable-ip-address'
1219 },
1220 ),
1221}
1222
1223SET_CLI_COMMAND_DESCRIPTION = {
1224 'name' : 'set',
1225 'mode' : 'login',
1226 'no-supported' : False,
1227 'short-help' : 'Manage CLI sessions settings',
1228 'doc' : 'set|set',
1229 'doc-example' : 'set|set-example',
1230 'action' : 'cli-set',
1231 'variable' : 'set',
1232 'args' : (
1233 'length',
1234 {
1235 'choices' : (
1236 {
1237 'field' : 'length',
1238 'base-type' : 'integer',
1239 'range' : (0,512),
1240 },
1241 {
1242 'field' : 'length',
1243 'type' : 'enum',
1244 'values' : 'term',
1245 },
1246 )
1247 },
1248 ),
1249}
1250#"""
1251#
1252# FORMATS
1253#
1254
1255import fmtcnv
1256
1257"""
1258GLOBAL_CONFIG_FORMAT = {
1259 'global-config' : {
1260 'field-orderings' : {
1261 'details' : [
1262 'cluster-name',
1263 'cluster-number',
1264 'ha-enabled',
1265 ],
1266 'default' : [
1267 'cluster-name',
1268 'cluster-number',
1269 'ha-enabled',
1270 ],
1271 },
1272
1273 'fields' : {
1274 'cluster-name' : {
1275 'verbose-name' : 'Cluster Name',
1276 },
1277 'cluster-number' : {
1278 'verbose-name' : 'Cluster Number',
1279 },
1280 'ha-enabled' : {
1281 'verbose-name' : 'HA Enabled',
1282 },
1283 },
1284 },
1285}
1286
1287
1288FEATURE_FORMAT = {
1289 'feature' : {
1290 'field-orderings' : {
1291 'default' : [
1292 'netvirt-feature',
1293 'static-flow-pusher-feature',
1294 'performance-monitor-feature',
1295 ],
1296 },
1297
1298 'fields' : {
1299 'netvirt-feature' : { 'verbose-name' : 'VNS Feature',
1300 'formatter' : fmtcnv.replace_boolean_with_enable_disable,
1301 },
1302 'static-flow-pusher-feature' : { 'verbose-name' : 'Static Flow Pusher Feature',
1303 'formatter' : fmtcnv.replace_boolean_with_enable_disable,
1304 },
1305 'performance-monitor-feature' : { 'verbose-name' : 'Performance Monitoring Feature',
1306 'formatter' : fmtcnv.replace_boolean_with_enable_disable,
1307 },
1308 }
1309 },
1310}
1311
1312LINK_FORMAT = {
1313 'link' : {
1314 'field-orderings' : {
1315 'default' : [ 'Idx', 'src-switch', 'src-port', 'src-port-state',
1316 'Idx', 'dst-switch', 'dst-port', 'dst-port-state', 'link-type' ]
1317 },
1318 'fields' : {
1319 'src-port' : { 'formatter' : fmtcnv.decode_openflow_port_src_switch },
1320 'dst-port' : { 'formatter' : fmtcnv.decode_openflow_port_dst_switch },
1321 'src-switch' : { 'formatter' : fmtcnv.replace_switch_with_alias },
1322 'dst-switch' : { 'formatter' : fmtcnv.replace_switch_with_alias },
1323 'src-port-state' : { 'formatter' : fmtcnv.decode_port_state },
1324 'dst-port-state' : { 'formatter' : fmtcnv.decode_port_state },
1325 'link-type' : { 'verbose-name' : 'Link Type',
1326 },
1327 }
1328 },
1329}
1330
1331CONFIG_FORMAT = {
1332 'config' : {
1333 'field-orderings' : {
1334 'default' : ['Idx', 'name', 'length', 'version', 'timestamp' ],
1335 },
1336 'fields' : {
1337 'name' : { 'primary_key': True
1338 },
1339 'version' : {
1340 },
1341 'length' : {
1342 },
1343 'timestamp': {
1344 },
1345 },
1346 },
1347}
1348
1349
1350TEST_PKTIN_ROUTE_FORMAT = {
1351 'test-pktin-route' : {
1352 'field-orderings' : {
1353 'default' : ['Idx', 'cluster', 'hop', 'dpid', 'inPort', 'outPort'],
1354 },
1355 'fields' : {
1356 'cluster' : {'verbose-name' : 'Cluster',
1357 'formatter' : fmtcnv.print_cluster_id
1358 },
1359 'hop' : {'verbose-name' : 'Hop'
1360 },
1361 'dpid' : {'verbose-name' : 'Switch',
1362 'formatter' : fmtcnv.print_switch_and_alias,
1363 },
1364 'inPort' : {'verbose-name' : 'Input-Intf',
1365 'formatter' : fmtcnv.decode_openflow_port_dpid,
1366 },
1367 'outPort': {'verbose-name': 'Output-Intf',
1368 'formatter' : fmtcnv.decode_openflow_port_dpid,
1369 },
1370 },
1371 },
1372}
1373
1374
1375PERFORMANCE_DATA_FORMAT = {
1376 'performance-data' : {
1377 'field-orderings' : {
1378 'default' : ['BktNo', 'StartTime', 'CompName', 'Pkts', 'Avg',
1379 'Min', 'Max', 'StdDev'],
1380 },
1381 'fields' : {
1382 'Pkts' : {'verbose-name': 'Pkts*'
1383 },
1384 'CompName' : {'verbose-name' : 'Component'
1385 },
1386 'StartTime': {'verbose-name' : 'Start Time'
1387 }
1388 }
1389 },
1390}
1391
1392
1393FLOW_CACHE_COUNTERS_FORMAT = {
1394 'flow-cache-counters' : {
1395 'field-orderings' : {
1396 'details' : [
1397 'applName',
1398 'maxFlows',
1399 'activeCnt',
1400 'inactiveCnt',
1401 'addCnt',
1402 'delCnt',
1403 'activatedCnt',
1404 'deactivatedCnd',
1405 'cacheHitCnt',
1406 'missCnt',
1407 'flowModRemovalMsgLossCnt',
1408 'notStoredFullCnt',
1409 'fcObjFreedCnt',
1410 'unknownOperCnt',
1411 'flowCacheAlmostFull',
1412 ],
1413
1414 },
1415
1416 'fields' : {
1417 'applName' : { 'verbose-name' : 'Application name',
1418 },
1419 'maxFlows' : { 'verbose-name' : 'Max flow cache size',
1420 },
1421 'activeCnt' : { 'verbose-name' : 'Active entries',
1422 },
1423 'inactiveCnt' : { 'verbose-name' : 'Inactive entries',
1424 },
1425 'addCnt' : { 'verbose-name' : 'Add operations',
1426 },
1427 'delCnt' : { 'verbose-name' :'Del operations',
1428 },
1429 'activatedCnt' : { 'verbose-name' : 'Activated',
1430 },
1431 'deactivatedCnd' : { 'verbose-name' : 'Deactivated',
1432 },
1433 'cacheHitCnt' : { 'verbose-name' : 'Cache hits',
1434 },
1435 'missCnt' : { 'verbose-name' : 'Cache misses',
1436 },
1437 'flowModRemovalMsgLossCnt' : { 'verbose-name' : 'Lost removal messages',
1438 },
1439 'notStoredFullCnt' : { 'verbose-name' : 'Not stored; cache full',
1440 },
1441 'fcObjFreedCnt' : { 'verbose-name' : 'Free count',
1442 },
1443 'unknownOperCnt' : { 'verbose-name' : 'Unknown operations',
1444 },
1445 'flowCacheAlmostFull' : { 'verbose-name' : 'Cache near full',
1446 },
1447 },
1448 },
1449}
1450
1451
1452FLOW_CACHE_FORMAT = {
1453 'flow-cache' : {
1454 'field-orderings' : {
1455 'default': ['Idx', 'Appl', 'AppInst', 'VLAN', 'PCP', 'SrcMAC',
1456 'DestMAC', 'EtherType', 'SrcIPAddr', 'DstIPAddr',
1457 'Protocol', 'TOS', 'SrcPort', 'DstPort',
1458 'Source-Switch', 'InputPort', 'Wildcards', 'Action',
1459 'Cookie', 'State', 'Time', 'SC'],
1460 },
1461 'fields' : {
1462 'VLAN' : {'formatter' : fmtcnv.convert_signed_short_for_vlan
1463 },
1464 'Source-Switch' : {'formatter' : fmtcnv.print_switch_and_alias
1465 },
1466 'InputPort' : {'formatter' : fmtcnv.decode_openflow_port_source_switch
1467 },
1468 'SrcMAC' : {'formatter' : fmtcnv.print_host_and_alias
1469 },
1470 'DestMAC' : {'formatter' : fmtcnv.print_host_and_alias
1471 },
1472 'EtherType' : {'formatter' : fmtcnv.decode_ether_type
1473 },
1474 'Protocol' : {'formatter' : fmtcnv.decode_network_protocol
1475 },
1476 'SrcPort' : {'formatter' : fmtcnv.decode_src_port
1477 },
1478 'DstPort' : {'formatter' : fmtcnv.decode_dst_port
1479 },
1480 'Cookie' : {'formatter' : fmtcnv.decode_flow_cookie
1481 },
1482 'Time' : {'formatter' : fmtcnv.timestamp_to_local_timestr
1483 },
1484 }
1485 },
1486}
1487
1488
1489EV_HIST_TOPOLOGY_FORMAT = {
1490 'ev-hist-topology-switch' : {
1491 'field-orderings' : {
1492 'default' : ['Idx', 'Time', 'Switch' , 'IpAddr', 'Port',
1493 'State', 'Action', 'Reason' ],
1494 },
1495 'fields' : {
1496 'Time' : {
1497 'verbose-name' : 'Time'
1498 },
1499 'Switch' : {'verbose-name' : 'Switch',
1500 'formatter' : fmtcnv.print_switch_and_alias
1501 },
1502 'Port' : {'verbose-name' : 'Port'
1503 },
1504 'IpAddr' : {'verbose-name' : 'IpAddr.'
1505 },
1506 'Action' : {'verbose-name' : 'Action'
1507 },
1508 'Reason' : {'verbose-name' : 'Reason'
1509 },
1510 'State' : {'verbose-name' : 'State'
1511 },
1512 }
1513 },
1514}
1515
1516
1517
1518EV_HIST_TOPOLOGY_CLUSTER_FORMAT = {
1519 'ev-hist-topology-cluster' : {
1520 'field-orderings' : {
1521 'default' : ['Idx', 'Time', 'Switch' , 'OldClusterId',
1522 'NewClusterId', 'State', 'Action', 'Reason' ],
1523 },
1524 'fields' : {
1525 'Time' : {
1526 'verbose-name' : 'Time'
1527 },
1528 'Switch' : {'verbose-name' : 'Switch',
1529 'formatter' : fmtcnv.print_switch_and_alias
1530 },
1531 'Action' : {'verbose-name' : 'Action'
1532 },
1533 'Reason' : {'verbose-name' : 'Reason'
1534 },
1535 'State' : {'verbose-name' : 'State'
1536 },
1537 }
1538 },
1539}
1540
1541
1542EV_HIST_TOPOLOGY_LINK_FORMAT = {
1543 'ev-hist-topology-link' : {
1544 'field-orderings' : {
1545 'default' : ['Idx', 'Time', 'Source-Switch' , 'Dest-Switch',
1546 'SrcPort', 'DstPort',
1547 'SrcPortState', 'DstPortState',
1548 'State', 'Action', 'Reason' ],
1549 },
1550 'fields' : {
1551 'Time' : {
1552 'verbose-name' : 'Time'
1553 },
1554 'Source-Switch' : {'verbose-name' : 'Source-Switch',
1555 'formatter' : fmtcnv.print_switch_and_alias
1556 },
1557 'Dest-Switch' : {'verbose-name' : 'Dest-Switch',
1558 'formatter' : fmtcnv.print_switch_and_alias
1559 },
1560 'SrcPort' : {'verbose-name' : 'SrcPort',
1561 'formatter' : fmtcnv.decode_openflow_port_source_switch
1562 },
1563 'DstPort' : {'verbose-name' : 'DstPort',
1564 'formatter' : fmtcnv.decode_openflow_port_dest_switch
1565 },
1566 'SrcPortState' : {'verbose-name' : 'SrcPrtSt'
1567 },
1568 'DstPortState' : {'verbose-name' : 'DstPrtSt'
1569 },
1570 'Action' : {'verbose-name' : 'Action'
1571 },
1572 'Reason' : {'verbose-name' : 'Reason'
1573 },
1574 'State' : {'verbose-name' : 'State'
1575 },
1576 }
1577 },
1578}
1579
1580
1581EV_HIST_ATTACHMENT_POINT_FORMAT = {
1582 'ev-hist-attachment-point' : {
1583 'field-orderings' : {
1584 'default' : ['Idx', 'Time', 'Host', 'Switch' , 'Port', 'VLAN',
1585 'Action', 'Reason' ],
1586 },
1587 'fields' : {
1588 'Time_ns' : {
1589 'verbose-name' : 'Time'
1590 #'formatter' : fmtcnv.timestamp_ns_to_local_timestr
1591 },
1592 'Host' : {'verbose-name' : 'Host',
1593 'formatter' : fmtcnv.print_host_and_alias
1594 },
1595 'Switch' : {'verbose-name' : 'Switch',
1596 'formatter' : fmtcnv.print_switch_and_alias
1597 },
1598 'Port' : {'verbose-name' : 'IF',
1599 'formatter' : fmtcnv.decode_openflow_port,
1600 },
1601 'VLAN' : {'verbose-name' : 'VLAN'
1602 },
1603 'Action' : {'verbose-name' : 'Action'
1604 },
1605 'Reason' : {'verbose-name' : 'Reason'
1606 },
1607 }
1608 },
1609}
1610
1611
1612EV_HIST_PACKET_IN_FORMAT = {
1613 'ev-hist-packet-in' : {
1614 'field-orderings' : {
1615 'default' : ['Idx', 'Time',
1616 'dataLayerSource',
1617 'dataLayerDestination',
1618 'dataLayerType',
1619 'dataLayerVirtualLan',
1620 #'dataLayerVirtualLanPriorityCodePoint',
1621 'inputSwitch',
1622 'inputPort',
1623 'networkSource',
1624 'networkDestination',
1625 #'networkSourceMaskLen',
1626 #'networkDestinationMaskLen',
1627 'networkProtocol',
1628 'networkTypeOfService',
1629 'transportSource',
1630 'transportDestination',
1631 #'Action', 'reason'
1632 ],
1633 },
1634 'fields' : {
1635 'Time' : {
1636 'verbose-name' : 'Time'
1637 #'formatter' : fmtcnv.timestamp_ns_to_local_timestr
1638 },
1639 'wildcards' : { 'verbose-name' : 'Wildcards',
1640 'formatter' : fmtcnv.convert_integer_to_bitmask
1641 },
1642 'dataLayerSource' : { 'verbose-name' : 'Src MAC',
1643 'formatter' : fmtcnv.print_host_and_alias
1644 },
1645 'dataLayerDestination' : { 'verbose-name' : 'Dst MAC',
1646 'formatter' : fmtcnv.print_host_and_alias
1647 },
1648 'dataLayerType' : { 'verbose-name' : 'Eth Type',
1649 'formatter' : fmtcnv.decode_ether_type
1650 },
1651 'dataLayerVirtualLan' : { 'verbose-name' : 'VLAN',
1652 'formatter' : fmtcnv.convert_signed_short_for_vlan
1653 },
1654 'dataLayerVirtualLanPriorityCodePoint' : { 'verbose-name' : 'VLAN PCP'
1655 },
1656 'inputSwitch' : { 'verbose-name' : 'Switch',
1657 'formatter' : fmtcnv.print_switch_and_alias
1658 },
1659 'inputPort' : { 'verbose-name' : 'Port',
1660 'formatter' : fmtcnv.decode_openflow_port_inputSwitch
1661 },
1662 'networkSource' : { 'verbose-name' : 'Src IP'
1663 },
1664 'networkDestination' : { 'verbose-name' : 'Dst IP'
1665 },
1666 'networkSourceMaskLen' : { 'verbose-name' : 'Src IP Bits'
1667 },
1668 'networkDestinationMaskLen' : { 'verbose-name' : 'Dst IP Bits'
1669 },
1670 'networkProtocol' : { 'verbose-name' : 'Proto.',
1671 'formatter' : fmtcnv.decode_network_protocol
1672 },
1673 'networkTypeOfService' : { 'verbose-name' : 'TOS'
1674 },
1675 'transportSource' : { 'verbose-name' : 'NwSPort',
1676 'formatter' : fmtcnv.decode_src_port
1677 },
1678 'transportDestination' : { 'verbose-name' : 'NwDPort',
1679 'formatter' : fmtcnv.decode_dst_port
1680 },
1681 'Action' : {'verbose-name' : 'Action'
1682 },
1683 'Reason' : {'verbose-name' : 'Reason'
1684 },
1685 }
1686 },
1687}
1688"""
1689
1690def realtime_flow_timeout(i, data=None):
1691 return ('%s/%s' %
1692 (fmtcnv.convert_signed_short_to_unsigned(data['hardTimeout']),
1693 fmtcnv.convert_signed_short_to_unsigned(data['idleTimeout'])))
1694
1695REALTIME_FLOW_FORMAT = {
1696 'realtime_flow' : {
1697 'field-orderings' : {
1698 'default' : [
1699 'Idx', 'switch', 'cookie',
1700 'byteCount', 'packetCount',
1701 'actions', 'dataLayerSource', 'dataLayerDestination',
1702 'flow-brief',
1703 ],
1704 'scoped' : [
1705 'Idx', 'cookie',
1706 'byteCount', 'packetCount',
1707 'actions', 'dataLayerSource', 'dataLayerDestination',
1708 'flow-brief',
1709
1710 ],
1711 'brief' : [ 'Idx', 'switch', 'cookie', 'dataLayerSource', 'dataLayerDestination',
1712 'networkSource', 'networkDestination', 'networkProtocol',
1713 'transportSource', 'transportDestination'],
1714 'default' : [ 'Idx', 'switch', 'byteCount', 'packetCount', 'durationSeconds',
1715 'cookie', 'inputPort', 'dataLayerSource', 'dataLayerDestination',
1716 'dataLayerType', 'networkSource', 'networkDestination', 'networkProtocol',
1717 'transportSource', 'transportDestination'],
1718 'scoped' : [ 'Idx', 'switch', 'byteCount', 'packetCount', 'durationSeconds',
1719 'cookie', 'inputPort', 'dataLayerSource', 'dataLayerDestination',
1720 'dataLayerType', 'networkSource', 'networkDestination', 'networkProtocol',
1721 'transportSource', 'transportDestination'],
1722 'details' : [ 'Idx', 'switch', 'byteCount', 'packetCount', 'durationSeconds',
1723 'cookie', 'hardTimeout', 'idleTimeout', 'priority', 'tableId', 'inputPort',
1724 'dataLayerSource', 'dataLayerDestination', 'dataLayerType', 'dataLayerVirtualLan',
1725 'dataLayerVirtualLanPriorityCodePoint', 'networkSource', 'networkDestination',
1726 'networkProtocol', 'transportSource', 'transportDestination',
1727 'networkTypeOfService', 'actions'],
1728 'vns_flow': [ 'Idx', 'dataLayerSource', 'dataLayerDestination', 'dataLayerVirtualLan', 'dataLayerType'],
1729 'summary' : [ 'Idx', 'vnsName', 'vnsFlowCnt', 'flowEntryCnt'],
1730 },
1731 'fields': {
1732 'switch' : { 'verbose-name' : 'Switch',
1733 'formatter' : fmtcnv.replace_switch_with_alias
1734 },
1735 'flow-brief' : {
1736 'verbose-name' : 'Match',
1737 'formatter' : fmtcnv.realtime_flow_brief,
1738 },
1739 'flow-timeout' : {
1740 'verbose-name' : 'H/I',
1741 'formatter' : realtime_flow_timeout,
1742 },
1743 'byteCount' : { 'verbose-name': 'Bytes',
1744 'primary_key':True
1745 },
1746 'packetCount' : { 'verbose-name' : 'Packets'
1747 },
1748 'cookie' : { 'verbose-name' : 'Author',
1749 'formatter' : fmtcnv.decode_flow_cookie,
1750 },
1751 'durationSeconds' : { 'verbose-name' : 'Dur(s)'
1752 },
1753 'durationNanoseconds' : { 'verbose-name' : 'Dur(ns)'
1754 },
1755 'hardTimeout' : { 'verbose-name' : 'Hard Timeout',
1756 'formatter' : fmtcnv.convert_signed_short_to_unsigned
1757 },
1758 'idleTimeout' : { 'verbose-name' : 'Idle Timeout',
1759 'formatter' : fmtcnv.convert_signed_short_to_unsigned
1760 },
1761 'length' : { 'verbose-name' : 'Length'
1762 },
1763 'priority' : { 'verbose-name' : 'Priority',
1764 'formatter' : fmtcnv.convert_signed_short_to_unsigned
1765 },
1766 'tableId' : { 'verbose-name' : 'Table' },
1767 'wildcards' : { 'verbose-name' : 'Wildcards',
1768 'formatter' : fmtcnv.convert_integer_to_bitmask
1769 },
1770 'dataLayerSource' : { 'verbose-name' : 'Src MAC',
1771 'formatter' : fmtcnv.replace_host_with_alias
1772 },
1773 'dataLayerDestination' : { 'verbose-name' : 'Dst MAC',
1774 'formatter' : fmtcnv.replace_host_with_alias
1775 },
1776 'dataLayerType' : { 'verbose-name' : 'Ether Type',
1777 'formatter' : fmtcnv.decode_ether_type
1778 },
1779 'dataLayerVirtualLan' : { 'verbose-name' : 'VLAN ID',
1780 'formatter' : fmtcnv.convert_signed_short_to_unsigned
1781 },
1782 'dataLayerVirtualLanPriorityCodePoint' : { 'verbose-name' : 'VLAN PCP'
1783 },
1784 'inputPort' : { 'verbose-name' : 'In Port',
1785 'formatter' : fmtcnv.decode_openflow_port
1786 },
1787 'networkSource' : { 'verbose-name' : 'Src IP'
1788 },
1789 'networkDestination' : { 'verbose-name' : 'Dst IP'
1790 },
1791 'networkSourceMaskLen' : { 'verbose-name' : 'Src IP Bits'
1792 },
1793 'networkDestinationMaskLen' : { 'verbose-name' : 'Dst IP Bits'
1794 },
1795 'networkProtocol' : { 'verbose-name' : 'Protocol',
1796 'formatter' : fmtcnv.decode_network_protocol
1797 },
1798 'networkTypeOfService' : { 'verbose-name' : 'TOS Bits'
1799 },
1800 'transportSource' : { 'verbose-name' : 'Src Port',
1801 'formatter' : fmtcnv.decode_src_port
1802 },
1803 'transportDestination' : { 'verbose-name' : 'Dst Port',
1804 'formatter' : fmtcnv.decode_dst_port
1805 },
1806 'actions' : { 'verbose-name' : 'Actions',
1807 'formatter' : fmtcnv.decode_actions
1808 },
1809 'vnsName' : { 'verbose-name' : 'VNS'
1810 },
1811 'vnsFlowCnt' : { 'verbose-name' : 'Flows'
1812 },
1813 'flowEntryCnt' : { 'verbose-name' : 'Flow-Entries'
1814 },
1815 }
1816 },
1817}
1818
1819REALTIME_TABLE_IP_FLOW_FORMAT = {
1820 'realtime_table_ip_flow' : {
1821 'field-orderings' : {
1822 'default' : [
1823 'Idx', 'cookie',
1824 'byteCount', 'packetCount','priority',
1825 'networkDestination',
1826 'flow-brief','actions'
1827 ],
1828 'scoped' : [
1829 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
1830 'cookie','priority',
1831 'networkDestination', 'actions'
1832 ],
1833 'brief' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
1834 'cookie','priority',
1835 'networkDestination', 'actions'
1836 ],
1837 'default' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
1838 'cookie','priority',
1839 'networkDestination', 'actions'
1840 ],
1841 'scoped' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
1842 'cookie','priority',
1843 'networkDestination', 'actions'
1844 ],
1845 'details' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
1846 'cookie','priority'
1847 'networkDestination', 'actions'
1848 ],
1849 #'vns_flow': [ 'Idx', 'dataLayerSource', 'dataLayerDestination', 'dataLayerVirtualLan', 'dataLayerType'],
1850 #'summary' : [ 'Idx', 'vnsName', 'vnsFlowCnt', 'flowEntryCnt'],
1851 },
1852 'fields': {
1853 'switch' : { 'verbose-name' : 'Switch',
1854 'formatter' : fmtcnv.replace_switch_with_alias
1855 },
1856 'flow-brief' : {
1857 'verbose-name' : 'Match',
1858 'formatter' : fmtcnv.realtime_flow_brief,
1859 },
1860 'flow-timeout' : {
1861 'verbose-name' : 'H/I',
1862 'formatter' : realtime_flow_timeout,
1863 },
1864 'byteCount' : { 'verbose-name': 'Bytes',
1865 'primary_key':True
1866 },
1867 'packetCount' : { 'verbose-name' : 'Packets'
1868 },
1869 'cookie' : { 'verbose-name' : 'Cookie'#,
1870 #'formatter' : fmtcnv.decode_flow_cookie,
1871 },
1872 'durationSeconds' : { 'verbose-name' : 'Dur(s)'
1873 },
1874 'durationNanoseconds' : { 'verbose-name' : 'Dur(ns)'
1875 },
1876 'hardTimeout' : { 'verbose-name' : 'Hard Timeout',
1877 'formatter' : fmtcnv.convert_signed_short_to_unsigned
1878 },
1879 'idleTimeout' : { 'verbose-name' : 'Idle Timeout',
1880 'formatter' : fmtcnv.convert_signed_short_to_unsigned
1881 },
1882 'length' : { 'verbose-name' : 'Length'
1883 },
1884 'priority' : { 'verbose-name' : 'Priority',
1885 'formatter' : fmtcnv.convert_signed_short_to_unsigned
1886 },
1887 'tableId' : { 'verbose-name' : 'Table' },
1888 'wildcards' : { 'verbose-name' : 'Wildcards',
1889 'formatter' : fmtcnv.convert_integer_to_bitmask
1890 },
1891 'dataLayerSource' : { 'verbose-name' : 'Src MAC',
1892 'formatter' : fmtcnv.replace_host_with_alias
1893 },
1894 'dataLayerDestination' : { 'verbose-name' : 'Dst MAC',
1895 'formatter' : fmtcnv.replace_host_with_alias
1896 },
1897 'dataLayerType' : { 'verbose-name' : 'Ether Type',
1898 'formatter' : fmtcnv.decode_ether_type
1899 },
1900 'dataLayerVirtualLan' : { 'verbose-name' : 'VLAN ID',
1901 'formatter' : fmtcnv.convert_signed_short_to_unsigned
1902 },
1903 'dataLayerVirtualLanPriorityCodePoint' : { 'verbose-name' : 'VLAN PCP'
1904 },
1905 'inputPort' : { 'verbose-name' : 'In Port',
1906 'formatter' : fmtcnv.decode_openflow_port
1907 },
1908 'networkSource' : { 'verbose-name' : 'Src IP'
1909 },
1910 'networkDestination' : { 'verbose-name' : 'Dst IP'
1911 },
1912 'networkSourceMaskLen' : { 'verbose-name' : 'Src IP Bits'
1913 },
1914 'networkDestinationMaskLen' : { 'verbose-name' : 'Dst IP Bits'
1915 },
1916 'networkProtocol' : { 'verbose-name' : 'Protocol',
1917 'formatter' : fmtcnv.decode_network_protocol
1918 },
1919 'networkTypeOfService' : { 'verbose-name' : 'TOS Bits'
1920 },
1921 'transportSource' : { 'verbose-name' : 'Src Port',
1922 'formatter' : fmtcnv.decode_src_port
1923 },
1924 'transportDestination' : { 'verbose-name' : 'Dst Port',
1925 'formatter' : fmtcnv.decode_dst_port
1926 },
1927 'actions' : { 'verbose-name' : 'Instructions',
1928 },
1929 'vnsName' : { 'verbose-name' : 'VNS'
1930 },
1931 'vnsFlowCnt' : { 'verbose-name' : 'Flows'
1932 },
1933 'flowEntryCnt' : { 'verbose-name' : 'Flow-Entries'
1934 },
1935 }
1936 },
1937}
1938
1939
1940
1941REALTIME_TABLE_MPLS_FLOW_FORMAT = {
1942 'realtime_table_mpls_flow' : {
1943 'field-orderings' : {
1944 'default' : [
1945 'Idx', 'priority',
1946 'byteCount', 'packetCount',
1947 'mplsLabel','mplsBos','mplsTc',
1948 'flow-brief', 'actions'
1949 ],
1950 'scoped' : [
1951 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
1952 'priority',
1953 'mplsLabel','mplsBos','mplsTc','actions'
1954 ],
1955 'brief' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
1956 'priority',
1957 'mplsLabel','mplsBos','mplsTc','actions'
1958 ],
1959 'default' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
1960 'priority',
1961 'mplsLabel','mplsBos','mplsTc','actions'
1962 ],
1963 'scoped' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
1964 'priority',
1965 'mplsLabel','mplsBos','mplsTc','actions'
1966 ],
1967 'details' : [ 'Idx', 'byteCount', 'packetCount', 'durationSeconds',
1968 'priority',
1969 'mplsLabel','mplsBos','mplsTc','actions'
1970 ],
1971 #'vns_flow': [ 'Idx', 'dataLayerSource', 'dataLayerDestination', 'dataLayerVirtualLan', 'dataLayerType'],
1972 #'summary' : [ 'Idx', 'vnsName', 'vnsFlowCnt', 'flowEntryCnt'],
1973 },
1974 'fields': {
1975 'switch' : { 'verbose-name' : 'Switch',
1976 'formatter' : fmtcnv.replace_switch_with_alias
1977 },
1978 'flow-brief' : {
1979 'verbose-name' : 'Match',
1980 'formatter' : fmtcnv.realtime_flow_brief,
1981 },
1982 'flow-timeout' : {
1983 'verbose-name' : 'H/I',
1984 'formatter' : realtime_flow_timeout,
1985 },
1986 'byteCount' : { 'verbose-name': 'Bytes',
1987 'primary_key':True
1988 },
1989 'packetCount' : { 'verbose-name' : 'Packets'
1990 },
1991 'cookie' : { 'verbose-name' : 'Cookie',
1992 #'formatter' : fmtcnv.decode_flow_cookie,
1993 },
1994 'durationSeconds' : { 'verbose-name' : 'Dur(s)'
1995 },
1996 'durationNanoseconds' : { 'verbose-name' : 'Dur(ns)'
1997 },
1998 'hardTimeout' : { 'verbose-name' : 'Hard Timeout',
1999 'formatter' : fmtcnv.convert_signed_short_to_unsigned
2000 },
2001 'idleTimeout' : { 'verbose-name' : 'Idle Timeout',
2002 'formatter' : fmtcnv.convert_signed_short_to_unsigned
2003 },
2004 'length' : { 'verbose-name' : 'Length'
2005 },
2006 'priority' : { 'verbose-name' : 'Priority',
2007 'formatter' : fmtcnv.convert_signed_short_to_unsigned
2008 },
2009 'tableId' : { 'verbose-name' : 'Table' },
2010 'wildcards' : { 'verbose-name' : 'Wildcards',
2011 'formatter' : fmtcnv.convert_integer_to_bitmask
2012 },
2013 'dataLayerSource' : { 'verbose-name' : 'Src MAC',
2014 'formatter' : fmtcnv.replace_host_with_alias
2015 },
2016 'dataLayerDestination' : { 'verbose-name' : 'Dst MAC',
2017 'formatter' : fmtcnv.replace_host_with_alias
2018 },
2019 'dataLayerType' : { 'verbose-name' : 'Ether Type',
2020 'formatter' : fmtcnv.decode_ether_type
2021 },
2022 'dataLayerVirtualLan' : { 'verbose-name' : 'VLAN ID',
2023 'formatter' : fmtcnv.convert_signed_short_to_unsigned
2024 },
2025 'dataLayerVirtualLanPriorityCodePoint' : { 'verbose-name' : 'VLAN PCP'
2026 },
2027 'inputPort' : { 'verbose-name' : 'In Port',
2028 'formatter' : fmtcnv.decode_openflow_port
2029 },
2030 'networkSource' : { 'verbose-name' : 'Src IP'
2031 },
2032 'networkDestination' : { 'verbose-name' : 'Dst IP'
2033 },
2034 'networkSourceMaskLen' : { 'verbose-name' : 'Src IP Bits'
2035 },
2036 'networkDestinationMaskLen' : { 'verbose-name' : 'Dst IP Bits'
2037 },
2038 'networkProtocol' : { 'verbose-name' : 'Protocol',
2039 'formatter' : fmtcnv.decode_network_protocol
2040 },
2041 'networkTypeOfService' : { 'verbose-name' : 'TOS Bits'
2042 },
2043 'transportSource' : { 'verbose-name' : 'Src Port',
2044 'formatter' : fmtcnv.decode_src_port
2045 },
2046 'transportDestination' : { 'verbose-name' : 'Dst Port',
2047 'formatter' : fmtcnv.decode_dst_port
2048 },
2049 'actions' : { 'verbose-name' : 'Instructions'
2050 },
2051 'vnsName' : { 'verbose-name' : 'VNS'
2052 },
2053 'vnsFlowCnt' : { 'verbose-name' : 'Flows'
2054 },
2055 'flowEntryCnt' : { 'verbose-name' : 'Flow-Entries'
2056 },
2057 'mplsTc' : { 'verbose-name' : 'MPLS TC'
2058 },
2059 'mplsLabel' : { 'verbose-name' : 'MPLS Label'
2060 },
2061 'mplsBos' : { 'verbose-name' : 'MPLS BOS'
2062 },
2063 }
2064 },
2065}
2066
2067
2068
2069
2070REALTIME_TABLE_ACL_FLOW_FORMAT = {
2071 'realtime_table_acl_flow' : {
2072 'field-orderings' : {
2073 'default' : [ 'Idx','byteCount', 'packetCount', 'durationSeconds',
2074 'cookie','priority', 'inputPort', 'dataLayerSource', 'dataLayerDestination',
2075 'dataLayerType', 'networkSource', 'networkDestination', 'networkProtocol',
2076 'transportSource', 'transportDestination''mplsLabel','actions'],
2077 'scoped' : [ 'Idx','byteCount', 'packetCount', 'durationSeconds',
2078 'cookie','priority', 'inputPort', 'dataLayerSource', 'dataLayerDestination',
2079 'dataLayerType', 'networkSource', 'networkDestination', 'networkProtocol',
2080 'transportSource', 'transportDestination','actions'],
2081 },
2082 'fields': {
2083 'switch' : { 'verbose-name' : 'Switch',
2084 'formatter' : fmtcnv.replace_switch_with_alias
2085 },
2086 'flow-brief' : {
2087 'verbose-name' : 'Match',
2088 'formatter' : fmtcnv.realtime_flow_brief,
2089 },
2090 'flow-timeout' : {
2091 'verbose-name' : 'H/I',
2092 'formatter' : realtime_flow_timeout,
2093 },
2094 'byteCount' : { 'verbose-name': 'Bytes',
2095 'primary_key':True
2096 },
2097 'packetCount' : { 'verbose-name' : 'Packets'
2098 },
2099 'cookie' : { 'verbose-name' : 'Cookie',
2100 #'formatter' : fmtcnv.decode_flow_cookie,
2101 },
2102 'durationSeconds' : { 'verbose-name' : 'Dur(s)'
2103 },
2104 'durationNanoseconds' : { 'verbose-name' : 'Dur(ns)'
2105 },
2106 'hardTimeout' : { 'verbose-name' : 'Hard Timeout',
2107 'formatter' : fmtcnv.convert_signed_short_to_unsigned
2108 },
2109 'idleTimeout' : { 'verbose-name' : 'Idle Timeout',
2110 'formatter' : fmtcnv.convert_signed_short_to_unsigned
2111 },
2112 'length' : { 'verbose-name' : 'Length'
2113 },
2114 'priority' : { 'verbose-name' : 'Priority',
2115 'formatter' : fmtcnv.convert_signed_short_to_unsigned
2116 },
2117 'tableId' : { 'verbose-name' : 'Table' },
2118 'wildcards' : { 'verbose-name' : 'Wildcards',
2119 'formatter' : fmtcnv.convert_integer_to_bitmask
2120 },
2121 'dataLayerSource' : { 'verbose-name' : 'Src MAC',
2122 'formatter' : fmtcnv.replace_host_with_alias
2123 },
2124 'dataLayerDestination' : { 'verbose-name' : 'Dst MAC',
2125 'formatter' : fmtcnv.replace_host_with_alias
2126 },
2127 'dataLayerType' : { 'verbose-name' : 'EthType',
2128 'formatter' : fmtcnv.decode_ether_type
2129 },
2130 'dataLayerVirtualLan' : { 'verbose-name' : 'VLAN ID',
2131 'formatter' : fmtcnv.convert_signed_short_to_unsigned
2132 },
2133 'dataLayerVirtualLanPriorityCodePoint' : { 'verbose-name' : 'VLAN PCP'
2134 },
2135 'inputPort' : { 'verbose-name' : 'In Port',
2136 'formatter' : fmtcnv.decode_openflow_port
2137 },
2138 'networkSource' : { 'verbose-name' : 'Src IP'
2139 },
2140 'networkDestination' : { 'verbose-name' : 'Dst IP'
2141 },
2142 'networkSourceMaskLen' : { 'verbose-name' : 'Src IP Bits'
2143 },
2144 'networkDestinationMaskLen' : { 'verbose-name' : 'Dst IP Bits'
2145 },
2146 'networkProtocol' : { 'verbose-name' : 'Protocol',
2147 'formatter' : fmtcnv.decode_network_protocol
2148 },
2149 'networkTypeOfService' : { 'verbose-name' : 'TOS Bits'
2150 },
2151 'transportSource' : { 'verbose-name' : 'Src Port',
2152 'formatter' : fmtcnv.decode_src_port
2153 },
2154 'transportDestination' : { 'verbose-name' : 'Dst Port',
2155 'formatter' : fmtcnv.decode_dst_port
2156 },
2157 'actions' : { 'verbose-name' : 'Instructions'
2158 },
2159 'vnsName' : { 'verbose-name' : 'VNS'
2160 },
2161 'vnsFlowCnt' : { 'verbose-name' : 'Flows'
2162 },
2163 'flowEntryCnt' : { 'verbose-name' : 'Flow-Entries'
2164 },
2165 'mplsTc' : { 'verbose-name' : 'MPLS TC'
2166 },
2167 'mplsLabel' : { 'verbose-name' : 'MPLS LABEL'
2168 },
2169 'mplsBos' : { 'verbose-name' : 'MPLS BOS'
2170 },
2171 }
2172 },
2173}
2174
2175
2176REALTIME_AGGREGATE_FORMAT = {
2177 'realtime_aggregate' : {
2178 'field-orderings' : {
2179 'default' : [ 'Idx', 'switch', 'flowCount', 'byteCount', 'packetCount' ],
2180 'scoped' : [ 'Idx', 'flowCount', 'byteCount', 'packetCount' ],
2181 'brief' : [ 'Idx', 'switch', 'flowCount', 'byteCount', 'packetCount' ],
2182 },
2183 'fields': {
2184 'switch' : { 'verbose-name' : 'Switch',
2185 'formatter' : fmtcnv.replace_switch_with_alias
2186 },
2187 'length' : { 'verbose-name': 'Length'
2188 },
2189 'flowCount' : { 'verbose-name' : 'Flows'
2190 },
2191 'byteCount' : { 'verbose-name' : 'Bytes'
2192 },
2193 'packetCount' : { 'verbose-name' : 'Packets'
2194 },
2195 }
2196 },
2197}
2198
2199
2200REALTIME_DESC_FORMAT = {
2201 'realtime_desc' : {
2202 'field-orderings' : {
2203 'default' : [ 'Idx', 'switch', 'serialNumber', 'manufacturerDescription',
2204 'hardwareDescription', 'datapathDescription',
2205 'softwareDescription' ],
2206 'scoped' : [ 'Idx', 'serialNumber', 'manufacturerDescription',
2207 'hardwareDescription', 'datapathDescription',
2208 'softwareDescription' ],
2209 'brief' : [ 'Idx', 'switch', 'serialNumber', 'manufacturerDescription',
2210 'hardwareDescription', 'datapathDescription',
2211 'softwareDescription' ],
2212 },
2213 'fields': {
2214 'switch' : { 'verbose-name' : 'Switch',
2215 'formatter' : fmtcnv.replace_switch_with_alias
2216 },
2217 'softwareDescription' : { 'verbose-name': 'SW Version'
2218 },
2219 'datapathDescription' : { 'verbose-name' : 'Model'
2220 },
2221 'hardwareDescription' : { 'verbose-name' : 'Make'
2222 },
2223 'manufacturerDescription' : { 'verbose-name' : 'Vendor'
2224 },
2225 'serialNumber' : { 'verbose-name' : 'Serial #'
2226 },
2227 }
2228 },
2229}
2230
2231
2232REALTIME_PORT_FORMAT = {
2233 'realtime_port' : {
2234 'field-orderings' : {
2235 'default' : [ 'Idx', 'switch', 'portNumber','portStatus', 'receiveBytes',
2236 'receivePackets', 'receiveErrors', 'receiveDropped',
2237 'receiveCRCErrors', 'receiveOverrunErrors',
2238 'receiveFrameErrors', 'transmitBytes',
2239 'transmitPackets', 'transmitErrors',
2240 'transmitDropped', 'collisions' ],
2241 'details' : [ 'Idx', 'switch', 'portNumber','portStatus', 'receiveBytes',
2242 'receivePackets', 'receiveErrors', 'receiveDropped',
2243 'receiveCRCErrors', 'receiveOverrunErrors',
2244 'receiveFrameErrors', 'transmitBytes',
2245 'transmitPackets', 'transmitErrors',
2246 'transmitDropped', 'collisions' ],
2247 'scoped' : [ 'Idx', 'portNumber','portStatus', 'receiveBytes',
2248 'receivePackets', 'receiveErrors', 'receiveDropped',
2249 'receiveCRCErrors', 'receiveOverrunErrors',
2250 'receiveFrameErrors', 'transmitBytes',
2251 'transmitPackets', 'transmitErrors',
2252 'transmitDropped', 'collisions' ],
2253 'brief' : [ 'Idx', 'switch', 'portNumber','portStatus',
2254 'receiveBytes', 'receivePackets', 'receiveErrors',
2255 'transmitBytes', 'transmitPackets', 'transmitErrors',
2256 ]
2257 },
2258 'fields': {
2259 'switch' : { 'verbose-name' : 'Switch',
2260 'formatter' : fmtcnv.replace_switch_with_alias
2261 },
2262 'receiveBytes' : { 'verbose-name' : 'Rcv Bytes',
2263 'formatter' : fmtcnv.decode_port_counter
2264 },
2265 'receivePackets' : { 'verbose-name' : 'Rcv Pkts',
2266 'formatter' : fmtcnv.decode_port_counter
2267 },
2268 'receiveErrors' : { 'verbose-name' : 'Rcv Errs',
2269 'formatter' : fmtcnv.decode_port_counter
2270 },
2271 'receiveDropped' : { 'verbose-name' : 'Rcv Dropped',
2272 'formatter' : fmtcnv.decode_port_counter
2273 },
2274 'receiveCRCErrors' : { 'verbose-name' : 'Rcv CRC',
2275 'formatter' : fmtcnv.decode_port_counter
2276 },
2277 'receiveOverrunErrors' : { 'verbose-name' : 'Rcv Overruns',
2278 'formatter' : fmtcnv.decode_port_counter
2279 },
2280 'receiveFrameErrors' : { 'verbose-name' : 'Rcv Frame Errs',
2281 'formatter' : fmtcnv.decode_port_counter
2282 },
2283 'transmitBytes' : { 'verbose-name' : 'Xmit Bytes',
2284 'formatter' : fmtcnv.decode_port_counter
2285 },
2286 'transmitPackets' : { 'verbose-name' : 'Xmit Pkts',
2287 'formatter' : fmtcnv.decode_port_counter
2288 },
2289 'transmitErrors' : { 'verbose-name' : 'Xmit Errs',
2290 'formatter' : fmtcnv.decode_port_counter
2291 },
2292 'transmitDropped' : { 'verbose-name' : 'Xmit Dropped',
2293 'formatter' : fmtcnv.decode_port_counter
2294 },
2295 'collisions' : { 'verbose-name' : 'Collisions',
2296 'formatter' : fmtcnv.decode_port_counter
2297 },
2298 'portNumber' : { 'verbose-name' : 'OF Port #',
2299 'formatter' : fmtcnv.decode_openflow_port
2300 },
2301 'length' : { 'verbose-name' : 'Length'
2302 },
2303 'portStatus' : { 'verbose-name' : 'Status'
2304 },
2305 }
2306
2307 },
2308}
2309
2310
2311REALTIME_GROUP_FORMAT = {
2312 'realtime_group' : {
2313 'field-orderings' : {
2314 'default' : [ 'Idx', 'grouptype','groupid' , 'totalpktcnt', 'totalbytecnt',
2315 'bucketpktcnt', 'bucketbytecnt',
2316 'setsrcmac', 'setdstmac',
2317 'pushMplslabel', 'setBos',
2318 'COPY_TTL_OUT','DEC_MPLS_TTL','outport','goToGroup',
2319 ],
2320 'scoped' : [ 'Idx', 'grouptype','groupid','totalpktcnt', 'totalbytecnt',
2321 'bucketpktcnt', 'bucketbytecnt',
2322 'setsrcmac', 'setdstmac',
2323 'pushMplsLabel','setBos',
2324 'COPY_TTL_OUT','DEC_MPLS_TTL','outport','goToGroup',
2325 ],
2326 },
2327 'fields': {
2328 'groupid' : { 'verbose-name' : 'Group Id',
2329 },
2330 'grouptype' : { 'verbose-name' : 'Group Type',
2331 },
2332 'totalpktcnt' : { 'verbose-name' : 'Pkts',
2333 'formatter' : fmtcnv.decode_port_counter
2334 },
2335 'totalbytecnt' : { 'verbose-name' : 'Bytes',
2336 'formatter' : fmtcnv.decode_port_counter
2337 },
2338 'bucketpktcnt' : { 'verbose-name' : 'Bucket Pkts',
2339 'formatter' : fmtcnv.decode_port_counter
2340 },
2341 'bucketbytecnt' : { 'verbose-name' : 'Bucket Bytes',
2342 'formatter' : fmtcnv.decode_port_counter
2343 },
2344 'setsrcmac' : { 'verbose-name' : 'Set Src Mac',
2345 },
2346 'setdstmac' : { 'verbose-name' : 'Set Dst Mac',
2347 },
2348 'pushMplsLabel' : { 'verbose-name' : 'Push Mpls',
2349 },
2350 'setBos' : { 'verbose-name' : 'Set Bos',
2351 },
2352 'outport' : { 'verbose-name' : 'Outport',
2353 },
2354 'goToGroup' : { 'verbose-name' : 'Group',
2355 },
2356 'COPY_TTL_OUT' : { 'verbose-name' : 'COPY TTL',
2357 },
2358 'DEC_MPLS_TTL' : { 'verbose-name' : 'Dec Mpls TTL',
2359 },
2360 }
2361 },
2362}
2363
2364
2365REALTIME_TABLE_FORMAT = {
2366 'realtime_table' : {
2367 'field-orderings' : {
2368 'default' : [ 'Idx', 'switch', 'name', 'tableId', 'wildcards',
2369 'maximumEntries', 'lookupCount', 'matchedCount', 'activeCount' ],
2370 'scoped' : [ 'Idx','name', 'tableId', 'wildcards',
2371 'maximumEntries', 'lookupCount', 'matchedCount', 'activeCount' ],
2372 'brief' : [ 'Idx', 'switch', 'name', 'tableId', 'wildcards',
2373 'maximumEntries', 'lookupCount', 'matchedCount', 'activeCount' ],
2374 },
2375 'fields': {
2376 'switch' : { 'verbose-name' : 'Switch',
2377 'formatter' : fmtcnv.replace_switch_with_alias
2378 },
2379 'wildcards' : { 'verbose-name': 'Wildcards'
2380 },
2381 'matchedCount' : { 'verbose-name' : '# Matched'
2382 },
2383 'maximumEntries' : { 'verbose-name' : 'Maximum Entries'
2384 },
2385 'name' : { 'verbose-name' : 'Name'
2386 },
2387 'activeCount' : { 'verbose-name' : '# Active'
2388 },
2389 'length' : { 'verbose-name' : 'Length'
2390 },
2391 'tableId' : { 'verbose-name' : 'Table ID'
2392 },
2393 'lookupCount' : { 'verbose-name' : '# Lookups'
2394 },
2395 }
2396 },
2397}
2398
2399SHOW_TUNNEL_FORMAT = {
2400 'show_tunnel' : {
2401 'field-orderings' : {
Srikanth Vavilapallib5c3ca52014-12-15 15:59:33 -08002402 'default' : [ 'Idx', 'tunnelId', 'policies','tunnelset','tunnelPath','labelStack',],
2403 'details' : [ 'Idx', 'tunnelId', 'policies','tunnelset','tunnelPath','labelStack', 'dpidGroup',],
Srikanth Vavilapalli1725e492014-12-01 17:50:52 -08002404 },
2405 'fields': {
2406 'tunnelId' : { 'verbose-name' : 'Id',
2407 },
Srikanth Vavilapallib5c3ca52014-12-15 15:59:33 -08002408 'tunnelset' : { 'verbose-name' : 'tunnelset',
2409 },
2410 'dpidGroup' : { 'verbose-name' : 'Dpid(Node Id)/Group',
2411 },
2412 'labelStack' : { 'verbose-name' : 'Label Stack [Outer-->Inner]',
2413 },
2414 'tunnelPath' : { 'verbose-name' : 'Tunnel Path [Head-->Tail]',
2415 },
2416 }
2417 },
2418}
2419
2420SHOW_TUNNELSET_FORMAT = {
2421 'show_tunnelset' : {
2422 'field-orderings' : {
2423 'default' : [ 'Idx', 'tunnelsetId', 'policies','tunnelId','tunnelPath','labelStack',],
2424 'details' : [ 'Idx', 'tunnelsetId', 'policies','tunnelId','tunnelPath','labelStack', 'dpidGroup',],
2425 },
2426 'fields': {
2427 'tunnelsetId' : { 'verbose-name' : 'Id',
2428 },
2429 'tunnelId' : { 'verbose-name' : 'tunnelId',
2430 },
2431 'tunnelset' : { 'verbose-name' : 'tunnelset',
2432 },
Srikanth Vavilapalli1725e492014-12-01 17:50:52 -08002433 'dpidGroup' : { 'verbose-name' : 'Dpid(Node Id)/Group',
2434 },
2435 'labelStack' : { 'verbose-name' : 'Label Stack [Outer-->Inner]',
2436 },
2437 'tunnelPath' : { 'verbose-name' : 'Tunnel Path [Head-->Tail]',
2438 },
2439 }
2440 },
2441}
2442
2443SHOW_POLICY_FORMAT = {
2444 'show_policy' : {
2445 'field-orderings' : {
2446 'default' : [ 'Idx', 'policyId', 'policyType','priority','dstMacAddress','srcMacAddress',
2447 'etherType','dstIpAddress' ,'ipProtocolNumber','srcIpAddress', 'dstTcpPortNumber',
2448 'srcTcpPortNumber','tunnelId'
2449 ]
2450 },
2451 'fields': {
2452 'policyId' : { 'verbose-name' : 'Policy Id',
2453 },
2454 'policyType' : { 'verbose-name': 'Policy Type',
2455 },
2456 'dstMacAddress' : { 'verbose-name': 'Dst Mac',
2457 },
2458 'srcMacAddress' : { 'verbose-name': 'Src Mac',
2459 },
2460 'dstIpAddress' : { 'verbose-name': 'Dst IP',
2461 },
2462 'srcIpAddress' : { 'verbose-name': 'Src IP',
2463 },
2464 'dstTcpPortNumber' : { 'verbose-name': 'Dst TcpPort',
2465 },
2466 'srcTcpPortNumber' : { 'verbose-name': 'Src TcpPort',
2467 },
2468 'etherType' : { 'verbose-name': 'Ether Type',
2469 },
2470
2471 'ipProtocolNumber' : { 'verbose-name': 'IP Protocol',
2472 },
2473 'tunnelId' : { 'verbose-name': 'Tunnel Used',
2474 },
2475
2476 }
2477 },
2478}
2479
2480
2481
2482REALTIME_FEATURES_FORMAT = {
2483 'realtime_features' : {
2484 'field-orderings' : {
2485 'default' : [ 'Idx', 'switch', 'portNumber', 'name', 'hardwareAddress',
2486 'config', 'state', 'currentFeatures', 'advertisedFeatures',
2487 'supportedFeatures', 'peerFeatures'],
2488 'scoped' : [ 'Idx', 'portNumber', 'name', 'hardwareAddress',
2489 'config', 'state', 'currentFeatures', 'advertisedFeatures',
2490 'supportedFeatures', 'peerFeatures'],
2491 'brief' : [ 'Idx', 'switch', 'portNumber', 'name',
2492 'currentFeatures', 'advertisedFeatures',
2493 'supportedFeatures', 'peerFeatures'],
2494 },
2495 'fields': {
2496 'switch' : { 'verbose-name' : 'Switch',
2497 'formatter' : fmtcnv.replace_switch_with_alias
2498 },
2499 'portNumber' : { 'verbose-name': 'OF Port #',
2500 'formatter' : fmtcnv.decode_openflow_port
2501 },
2502 'hardwareAddress' : { 'verbose-name' : 'HW Mac Address'
2503 },
2504 'name' : { 'verbose-name' : 'Name'
2505 },
2506 'config' : { 'verbose-name' : 'Config',
2507 'formatter' : fmtcnv.decode_port_config
2508 },
2509 'state' : { 'verbose-name' : 'State',
2510 'formatter' : fmtcnv.decode_port_up_down
2511 },
2512 'stp-state' : { 'verbose-name' : 'STP State',
2513 'formatter' : fmtcnv.decode_port_stp_state
2514 },
2515 'currentFeatures' : { 'verbose-name' : 'Current',
2516 'formatter' : fmtcnv.decode_port_features
2517 },
2518 'advertisedFeatures' : { 'verbose-name' : 'Advertised',
2519 'formatter' : fmtcnv.decode_port_features
2520 },
2521 'supportedFeatures' : { 'verbose-name' : 'Supported',
2522 'formatter' : fmtcnv.decode_port_features
2523 },
2524 'peerFeatures' : { 'verbose-name' : 'Peer',
2525 'formatter' : fmtcnv.decode_port_features
2526 },
2527 }
2528 },
2529}
2530
2531
2532REALTIME_QUEUE_FORMAT = {
2533 'realtime_queue' : {
2534 'field-orderings' : {
2535 'default' : [ 'Idx', 'switch', 'portNumber',
2536 'queueId', 'transmitBytes', 'transmitPackets', 'transmitErrors',
2537 ],
2538 'scoped' : [ 'Idx', 'portNumber',
2539 'queueId', 'transmitBytes', 'transmitPackets', 'transmitErrors',
2540 ],
2541 'brief' : [ 'Idx', 'switch', 'portNumber',
2542 'queueId', 'transmitBytes', 'transmitPackets', 'transmitErrors',
2543 ],
2544 },
2545
2546 'fields' : {
2547 'switch' : { 'verbose-name' : 'Switch',
2548 'formatter' : fmtcnv.replace_switch_with_alias
2549 },
2550 'portNumber' : { 'verbose-name': 'OF Port #',
2551 'formatter' : fmtcnv.decode_openflow_port
2552 },
2553 'queueId' : { 'verbose-name' : 'Queue ID',
2554 },
2555 'transmitBytes' : { 'verbose-name' : 'Xmit Bytes'
2556 },
2557 'transmitPackets' : { 'verbose-name' : 'Xmit Pkts'
2558 },
2559 'transmitErrors' : { 'verbose-name' : 'Xmit Errors'
2560 },
2561 }
2562 },
2563}
2564
2565
2566
2567
2568ROUTER_FORMAT = {
2569 'router' : {
2570 'field-orderings' : {
2571 'default' : ['Idx','dpid','name', 'routerIP','routerMac','isEdgeRouter','nodeSId'
2572 ],
2573 },
2574 'fields': {
2575 'dpid' : { 'verbose-name' : 'Router DPID',
2576 #'formatter' : fmtcnv.eprint_switch_and_alias,
2577 },
2578 'name' : { 'verbose-name' : 'Router Name',
2579 #'formatter' : fmtcnv.decode_port_counter
2580 },
2581 'routerIP' : { 'verbose-name' : 'Router IP',
2582 },
2583 'routerMac' : { 'verbose-name' : 'Router Mac',
2584 #'formatter' : fmtcnv.decode_port_counter
2585 },
2586 'isEdgeRouter' : { 'verbose-name' : 'Edge Router',
2587 #'formatter' : fmtcnv.decode_port_counter
2588 },
2589 'nodeSId' : { 'verbose-name' : 'Node SId',
2590 #'formatter' : fmtcnv.decode_port_counter
2591 },
2592 }
2593 },
2594}
2595
2596#adjacency
2597ROUTER_ADJACENCY_FORMAT= {
2598 'router_adjacency' : {
2599 'field-orderings' : {
2600 'default' : [ 'Idx', 'adjacencySid', 'ports'],
2601 'scoped' : [ 'Idx', 'adjacencySid', 'ports'],
2602 },
2603 'fields': {
2604 'adjacencySid' : { 'verbose-name' : 'Adjacency Sid(s)',
2605 },
2606
2607 },
2608
2609 },
2610}
2611
2612ROUTER_PORT_FORMAT = {
2613 'router_port' : {
2614 'field-orderings' : {
2615 'default' : [ 'Idx', 'name', 'portNo', 'subnetIp','adjacency'],
2616 'scoped' : [ 'Idx', 'name', 'portNo', 'subnetIp','adjacency'],
2617 },
2618 'fields': {
2619 'adjacency' : { 'verbose-name' : 'Adjacency Sid(s)',
2620 },
2621 'portNo' : { 'verbose-name' : 'Port #',
2622 },
2623 'subnetIp' : { 'verbose-name' : 'Subnet',
2624 },
2625
2626 },
2627 }
2628}
2629
2630"""
2631SWITCH_CLUSTER_FORMAT = {
2632 'switch-cluster' : {
2633 'field-orderings' : {
2634 'default' : [ 'Idx', 'cluster-id', 'switches', ],
2635 },
2636 'fields' : {
2637 'cluster-id' : { 'formatter' : fmtcnv.print_cluster_id,
2638 },
2639 'switches' : { 'formatter' : fmtcnv.print_switches
2640 },
2641 }
2642 },
2643}
2644
2645BROADCAST_DOMAIN_FORMAT = {
2646 'external-ports' : {
2647 'field-orderings' : {
2648 'default' : [ 'Idx', 'ports', ],
2649 },
2650 'fields' : {
2651 'ports' : { 'verbose-name': 'Switch Ports',
2652 'formatter' : fmtcnv.print_switch_port_list,
2653 },
2654 }
2655 },
2656}
2657
2658TECH_SUPPORT_CONFIG_FORMAT = {
2659 'tech-support-config' : {
2660 'field-orderings' : {
2661 'default' : [ 'cmd-type',
2662 'cmd'
2663 ],
2664 },
2665 },
2666}
2667
2668
2669VERSION_FORMAT = {
2670 'version' : {
2671 'field-orderings' : {
2672 'details' : [ 'controller' ]
2673 },
2674
2675 'fields' : {
2676 'controller' : {
2677 'verbose-name' : 'Controller version',
2678 }
2679 }
2680 },
2681}
2682
2683
2684SYSTEM_CLOCK_FORMAT = {
2685 'system-clock' : {
2686 'field-orderings' : {
2687 'default' : [ 'time' ],
2688 'details' : [ 'time', 'tz' ]
2689 },
2690
2691 'fields' : {
2692 'time' : {
2693 },
2694 'tz' : { 'verbose-name' : 'Timezone'
2695 },
2696 },
2697 },
2698}
2699"""