blob: 523ece137b2ab1078bb61d1e1a7262f0044e804e [file] [log] [blame]
Srikanth Vavilapalli1725e492014-12-01 17:50:52 -08001#
2# Copyright (c) 2010,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
17# sdnsh - The Controller Shell
18# module: climodelinfo.py
19#
20# This module contains classes that help fill out more of the CLI's model
21# this will do a merge with the model_info_list object that is generated
22# directly from the django models
23#
24# the motivation is that commands/objects that are not based in the
25# model should be able to take advantage of functions like prettyprint
26# or completion
27#
28# also, this lets us add info to the model that is CLI-specific.
29# In that respect, it is a lot like a django html view where the
30# columns are presented in a certain order in tables, and attributes
31# are grouped together in fieldsets
32
33# field-orderings must have a 'default' entry variants for brief/verbose
34
35# LOOK!
36# - sort hints for show running
37# - justification for columns
38# - have proper class for obj_type_info ?
39
40import model_info_list # load the automatically generated model definitions from the controller
41import base64
42import struct
43import re
44import doctest
45
46onos=1
47class CliModelInfo():
48 # so the model is accessible from the formatter functions
49 singleton = None
50
51
52 django_model_dict = {}
53 complete_obj_type_info_dict = {}
54
55
56 def __init__(self):
57 CliModelInfo.singleton = self
58 self.django_model_dict = dict(model_info_list.model_info_dict)
59 self.complete_obj_type_info_dict = dict(self.django_model_dict)
60
61 # Clean up the tables for the user field
62
63 # merge from additional_model_info_dict
64
65 # LOOK! should be able to do this by implementing a recursive deep copy/update
66 for obj_type in self.additional_model_info_dict.keys():
67 # if a new obj_type, just copy it
68 if not obj_type in self.complete_obj_type_info_dict:
69 self.complete_obj_type_info_dict[obj_type] = dict(self.additional_model_info_dict[obj_type])
70 else:
71 # if an existing obj_type, then go through keys (we know it's a dict)
72 for obj_info in self.additional_model_info_dict[obj_type].keys():
73 if not obj_info in self.complete_obj_type_info_dict[obj_type]:
74 if obj_info == 'field-orderings':
75 self.complete_obj_type_info_dict[obj_type][obj_info] = dict(self.additional_model_info_dict[obj_type][obj_info])
76 else:
77 # shallow copy
78 self.complete_obj_type_info_dict[obj_type][obj_info] = self.additional_model_info_dict[obj_type][obj_info]
79 else:
80 if obj_info == "fields":
81 model_fields = self.complete_obj_type_info_dict[obj_type]['fields']
82 addl_fields = self.additional_model_info_dict[obj_type]['fields']
83
84 # both objects have fields - be intelligent
85 for f in addl_fields.keys():
86 if not f in model_fields:
87 model_fields[f] = dict(addl_fields[f])
88 else:
89 for attr in addl_fields[f].keys():
90 model_fields[f][attr] = addl_fields[f][attr]
91 #print self.complete_obj_type_info_dict
92
93 def add_type_info(self, name, type_info):
94 self.complete_obj_type_info_dict[name] = type_info
95
96 def get_complete_obj_type_info_dict(self):
97 return self.complete_obj_type_info_dict
98
99 def get_fields_to_print(self, obj_type, field_ordering='default'):
100 fields_to_print = []
101 obj_type_info = self.complete_obj_type_info_dict.get(obj_type, None)
102 if obj_type_info:
103 if 'field-orderings' in obj_type_info:
104 fields_to_print = obj_type_info['field-orderings'].get(field_ordering, [])
105 if len(fields_to_print) == 0: # either no field-orderings or couldn't find specific
106 fields_to_print = obj_type_info['fields'].keys()
107 return fields_to_print
108
109 def get_field_info(self, obj_type, field_name):
110 obj_type_info = self.complete_obj_type_info_dict.get(obj_type, None)
111 return obj_type_info['fields'].get(field_name, None)
112
113 # LOOK! Refactor - Should we merge this with model_info_list?
114 #if (onos == 1):
115 # do nothing
116 # additional_model_info_dict = {}
117 #elif (onos==2):
118 if (onos == 1):
119 additional_model_info_dict = {
120 'switches' : {
121 # switches are now directly fetched via rest api.
122 # 'has_rest_model' isn't set
123 # for this table.
124 # XXX perhaps these types of descriptions need to be
125 # in a file other than climodelinfo?
126 'source' : 'user-config',
127 'source' : 'display',
128 'url' : 'switches',
129 'config-obj-type' : 'switch-config',
130
131 'fields' : {
132 'dpid' : {
133 'edit' : False,
134 'max_length': 32,
135 'null': False,
136 'primary_key': True,
137 'type': 'CharField',
138 'edit' : False,
139 },
140 'active' : {
141 'edit' : False
142 },
143 'core-switch' : {
144 'edit' : False,
145 },
146 'connected-since' : {
147 'edit' : False
148 },
149 'capabilities' : {
150 'edit' : False
151 },
152 'actions' : {
153 'edit' : False
154 },
155 'ip-address' : {
156 'edit' : False
157 },
158 'socket-address' : {
159 'edit' : False
160 },
161 'buffers' : {
162 'edit' : False
163 },
164 'controller' : {
165 'edit' : False,
166 },
167 'tables' : {
168 'edit' : False
169 },
170 'switch-alias' : {
171 'help_text' : 'Switch alias for DPID',
172 'edit' : False,
173 },
174 'tunnels' : {
175 'edit' : False,
176 },
177 'tunnel-supported' : {
178 'edit' : False,
179 },
180 'tunnel-termination' : {
181 'edit' : False,
182 },
183 'tunnel-active' : {
184 'edit' : False,
185 },
186 'dp-desc' : {
187 'edit' : False,
188 },
189 'hw-desc' : {
190 'edit' : False,
191 },
192 'sw-desc' : {
193 'edit' : False,
194 },
195 'serial-num' : {
196 'edit' : False,
197 },
198 }
199 },
200 'interfaces' : {
201 # switches are now directly fetched via rest api.
202 # 'has_rest_model' isn't set
203 # for this table.
204 # XXX perhaps these types of descriptions need to be
205 # in a file other than climodelinfo?
206 'source' : 'display',
207 'url' : 'switches',
208 'config-obj-type' : 'switch-interface-config',
209
210 'fields' : {
211 'id' : {
212 'edit' : False,
213 'max_length': 48,
214 'null': False,
215 'primary_key': True,
216 'type' : 'compound-key',
217 'edit' : False,
218 'help_text' : '#!dpid',
219 'compound_key_fields': [ 'dpid' ]
220 },
221 'dpid' : {
222 #'type' : 'ForeignKey',
223 #'rel_field_name' : 'dpid',
224 #'rel_obj_type' : 'switch',
225 },
226 'name' : {
227 },
228 'number' : {
229 },
230 'config' : {
231 },
232 'state' : {
233 },
234 'current-features' : {
235 },
236 'advertised-features' : {
237 },
238 'supported-features' : {
239 },
240 'peer-features' : {
241 },
242 }
243 },
244
245
246 'switch-config' : {
247 'source' : 'debug-only',
248 },
249
250
251 'tunnel-config' : {
252 'source' : 'user-config',
253 'source' : 'display',
254 'url' : 'tunnel-config',
255 'config-obj-type' : 'tunnel-config',
256
257 'fields' : {
258 'tunnel-id' : {
259 'edit' : False,
260 'max_length': 32,
261 'null': False,
262 'primary_key': True,
263 'type': 'CharField',
264 'edit' : False,
265 },
266 },
267 },
Srikanth Vavilapallib5c3ca52014-12-15 15:59:33 -0800268
269 'tunnelset-config' : {
270 'source' : 'user-config',
271 'source' : 'display',
272 'url' : 'tunnelset-config',
273 'config-obj-type' : 'tunnelset-config',
274
275 'fields' : {
276 'tunnelset-id' : {
277 'edit' : False,
278 'max_length': 32,
279 'null': False,
280 'primary_key': True,
281 'type': 'CharField',
282 'edit' : False,
283 },
284 },
285 },
Srikanth Vavilapalli1725e492014-12-01 17:50:52 -0800286
287 'policy-config' : {
288 'source' : 'user-config',
289 'source' : 'display',
290 'url' : 'policy-config',
291 'config-obj-type' : 'policy-config',
292
293 'fields' : {
294 'policy-id' : {
295 'edit' : False,
296 'max_length': 32,
297 'null': False,
298 'primary_key': True,
299 'type': 'CharField',
300 'edit' : False,
301 },
302 },
303 },
304
305 'switch-alias' : {
306 'source' : 'user-config',
307 'cascade_delete' : True,
308 },
309
310
311 'switch-interface-config' : {
312 'source' : 'debug-only',
313 'cascade_delete' : True,
314
315 'fields' : {
316 'broadcast' : { 'edit' : False
317 },
318 'name' : { 'edit' : False
319 },
320 'mode' : {
321 'edit' : False
322 },
323 },
324 },
325
326
327 'host-alias' : {
328 'source' : 'user-config',
329 'cascade_delete' : True,
330 'fields' : {
331 }
332 },
333
334
335 'link' : {
336 'source' : 'switch',
337
338 'fields' : {
339 'link-type' : {
340 'type' : 'CharField'
341 },
342 }
343 },
344
345
346 'port' : {
347 'source' : 'debug-only',
348
349 'fields' : {
350 'switch' : {
351 },
352 'number' : {
353 },
354 'config' : {
355 },
356 'state' : {
357 },
358 'current-features' : {
359 },
360 'advertised-features' : {
361 },
362 'supported-features' : {
363 },
364 'peer-features' : {
365 },
366 }
367 },
368
369 'switch-interfaces' : {
370 'source' : 'switch',
371
372 'fields' : {
373 'Idx' : {
374 'edit' : False,
375 'type' : 'CharField'
376 },
377 'id' : {
378 'primary_key': True,
379 # format's out of the sorting business
380 # 'sort' : 'tail-integer',
381 },
382 'switch' : {
383 },
384 'name' : {
385 'type' : 'CharField',
386 'max_length' : 32,
387 },
388 'hardware-address' : {
389 },
390 'config' : {
391 },
392 'state' : {
393 },
394 'stp-state' : {
395 },
396 'current-features' : {
397 },
398 'advertised-features' : {
399 },
400 'supported-features' : {
401 },
402 'peer-features' : {
403 },
404 'receiveBytes' : {
405 },
406 'receivePackets' : {
407 },
408 'receiveErrors' : {
409 },
410 'transmitBytes' : {
411 },
412 'transmitPackets' : {
413 },
414 'transmitErrors' : {
415 },
416 },
417 },
418
419 'controller_switches' : {
420 'source' : 'user-config',
421
422 'fields' : {
423 'dpid' : { 'primary_key' : True,
424 },
425 }
426 },
427
428 'host-config' : {
429 'source' : 'show',
430 'url' : 'device',
431
432 'fields' : {
433 'Idx' : {
434 'edit' : False,
435 'type' : 'CharField'
436 },
437 'mac' : {
438 'json_serialize_string': True,
439 'max_length': 17,
440 'null': False,
441 'type': 'CharField',
442 'edit' : False,
443 },
444 'vendor' : {
445 'edit' : False,
446 },
447 'ips' : {
448 'edit' : False
449 },
450 'attachment-points' : {
451 'edit' : False
452 },
453 'tag' : {
454 'edit' : False
455 },
456 'host-alias' : { 'help_text' : 'Host alias',
457 'edit' : False,
458 },
459 'last-seen' : {
460 'help_text': 'Last time a packet was seen by the controller',
461 'json_serialize_string': True,
462 'null': True,
463 'type': 'DateTimeField',
464 },
465 },
466 },
467
468 'host': {
469 # hosts are now directly fetched via rest api. 'has_rest_model' isn't set
470 # for this table.
471 # XXX perhaps these types of descriptions need to be
472 # in a file other than climodelinfo?
473 'source' : 'user-config',
474 'source' : 'display',
475 'url' : 'device',
476 'config-obj-type' : 'host-config',
477
478 'fields': {
479 'mac' : {
480 'json_serialize_string': True,
481 'max_length': 17,
482 'null': False,
483 'primary_key': True,
484 'type': 'CharField',
485 'edit' : False,
486 },
487 'vlan' : {
488 'help_text' : 'VLAN Associated with host',
489 'json_serialize_string': False,
490 'null' : True,
491 'type' : 'IntegerField',
492 'edit' : False,
493 'searchable' : True,
494 },
495 'dpid' : {
496 'edit' : False,
497 'type' : 'ForeignKey',
498 'rel_field_name' : 'dpid',
499 'rel_obj_type' : 'switches',
500 },
501 'ipv4' : {
502 'edit' : False,
503 },
504 # Attachment point isn't searchable
505 #'attachment-points' : {
506 #'edit' : False
507 #},
508 'last-seen' : {
509 'help_text': 'Last time a packet was seen by the controller',
510 'json_serialize_string': True,
511 'null': True,
512 'type': 'DateTimeField',
513 },
514 },
515 },
516
517
518 'host-attachment-point' : {
519 # directly fetched via rest api.
520 # 'has_rest_model' isn't set for this table.
521 'source' : 'controller',
522 'url' : 'device',
523
524 'fields': {
525 'mac' : {
526 'json_serialize_string': True,
527 'null': True,
528 'rel_field_name': 'mac',
529 'rel_obj_type': 'host',
530 'type': 'ForeignKey',
531 },
532 'vlan' : {
533 'help_text': 'VLAN Associated with host',
534 'json_serialize_string': False,
535 'null': True,
536 'type': 'IntegerField',
537 'edit' : False,
538 'searchable' : True,
539 },
540 'id' : {
541 'help_text': '#|mac|dpid|ingress-port',
542 'json_serialize_string': True,
543 'max_length': 64,
544 'null': False,
545 'primary_key': True,
546 'type': 'CharField',
547 },
548 'dpid' : { 'json_serialize_string': True,
549 'null': True,
550 'rel_field_name': 'dpid',
551 'rel_obj_type': 'switch',
552 'type': 'ForeignKey',
553 },
554 'ingress-port' : {
555 'help_text': 'Open flow port number of ingress port',
556 'json_serialize_string': False,
557 'null': True,
558 'type': 'IntegerField',
559 },
560 'status' : {
561 'help_text': 'Error description, blank mean no error ',
562 'json_serialize_string': True,
563 'max_length': 64,
564 'null': True,
565 'type': 'CharField',
566 },
567 'last-seen' : {
568 'help_text': 'Last time a packet was seen by the controller',
569 'json_serialize_string': True,
570 'null': True,
571 'type': 'DateTimeField',
572 },
573 'ipv4' : { # added to enable searching
574 'edit' : False,
575 'searchable' : True,
576 },
577 },
578 },
579
580 'host-network-address': {
581 # directly fetched via rest api.
582 # 'has_rest_model' isn't set for this table.
583 'source' : 'switch',
584 'url' : 'device',
585
586 'fields': {
587 'mac' : { 'json_serialize_string': True,
588 'null': True,
589 'rel_field_name': 'mac',
590 'rel_obj_type': 'host',
591 'type': 'ForeignKey',
592 'edit' : False,
593 },
594 'vlan' : {
595 'help_text': 'VLAN Associated with host',
596 'json_serialize_string': False,
597 'null': True,
598 'type': 'IntegerField',
599 'edit' : False,
600 'searchable' : True,
601 },
602 'id' : {
603 'help_text': '#|mac|ipv4',
604 'json_serialize_string': True,
605 'max_length': 64,
606 'null': False,
607 'primary_key': True,
608 'type': 'CharField',
609 },
610 'ip-address': {
611 'help_text': 'IP Address of host',
612 'json_serialize_string': True,
613 'max_length': 15,
614 'null': True,
615 'type': 'CharField',
616 'edit' : False,
617 },
618 'last-seen' : {
619 'help_text': 'Last time a packet was seen by the controller',
620 'json_serialize_string': True,
621 'null': True,
622 'type': 'DateTimeField',
623 },
624 'ipv4' : { # added to enable searching
625 'max_length': 15,
626 'null': True,
627 'type': 'CharField',
628 'edit' : False,
629 },
630 'dpid' : {
631 'edit' : False,
632 'searchable' : True,
633 },
634 },
635 }
636 }
637 else:
638 additional_model_info_dict = {
639 'flow-entry' : {
640 'source' : 'user-config',
641 'update-alias' : ['switch', 'port'],
642 },
643
644
645 'feature' : {
646 'source' : 'debug-only',
647
648 'fields' : {
649 'netvirt-feature' : {
650 'edit' : False},
651 'static-flow-pusher-feature' : {
652 'edit' : False },
653 'performance-monitor-feature' : {
654 'edit' : False},
655 }
656 },
657
658
659 'system-interfaces' : {
660 'source' : '',
661
662 'fields' : {
663 'name' : {
664 'type' : 'CharField' },
665 'addr' : {
666 'type' : 'CharField' },
667 'peer' : {
668 'type' : 'CharField' },
669 'netmask' : {
670 'type' : 'CharField' },
671 'broadcast' : {
672 'type' : 'CharField' },
673 }
674 },
675
676
677 'switch-cluster' : {
678 'source' : 'user-config',
679
680 'fields' : {
681 'cluster-id' : {
682 'primary_key': True
683 },
684 'switches' : {
685 },
686 }
687 },
688
689 'switches' : {
690 # switches are now directly fetched via rest api.
691 # 'has_rest_model' isn't set
692 # for this table.
693 # XXX perhaps these types of descriptions need to be
694 # in a file other than climodelinfo?
695 'source' : 'user-config',
696 'source' : 'display',
697 'url' : 'switches',
698 'config-obj-type' : 'switch-config',
699
700 'fields' : {
701 'dpid' : {
702 'edit' : False,
703 'max_length': 32,
704 'null': False,
705 'primary_key': True,
706 'type': 'CharField',
707 'edit' : False,
708 },
709 'active' : {
710 'edit' : False
711 },
712 'core-switch' : {
713 'edit' : False,
714 },
715 'connected-since' : {
716 'edit' : False
717 },
718 'capabilities' : {
719 'edit' : False
720 },
721 'actions' : {
722 'edit' : False
723 },
724 'ip-address' : {
725 'edit' : False
726 },
727 'socket-address' : {
728 'edit' : False
729 },
730 'buffers' : {
731 'edit' : False
732 },
733 'controller' : {
734 'edit' : False,
735 },
736 'tables' : {
737 'edit' : False
738 },
739 'switch-alias' : {
740 'help_text' : 'Switch alias for DPID',
741 'edit' : False,
742 },
743 'tunnels' : {
744 'edit' : False,
745 },
746 'tunnel-supported' : {
747 'edit' : False,
748 },
749 'tunnel-termination' : {
750 'edit' : False,
751 },
752 'tunnel-active' : {
753 'edit' : False,
754 },
755 'dp-desc' : {
756 'edit' : False,
757 },
758 'hw-desc' : {
759 'edit' : False,
760 },
761 'sw-desc' : {
762 'edit' : False,
763 },
764 'serial-num' : {
765 'edit' : False,
766 },
767 }
768 },
769
770 'interfaces' : {
771 # switches are now directly fetched via rest api.
772 # 'has_rest_model' isn't set
773 # for this table.
774 # XXX perhaps these types of descriptions need to be
775 # in a file other than climodelinfo?
776 'source' : 'display',
777 'url' : 'switches',
778 'config-obj-type' : 'switch-interface-config',
779
780 'fields' : {
781 'id' : {
782 'edit' : False,
783 'max_length': 48,
784 'null': False,
785 'primary_key': True,
786 'type' : 'compound-key',
787 'edit' : False,
788 'help_text' : '#!dpid',
789 'compound_key_fields': [ 'dpid' ]
790 },
791 'dpid' : {
792 #'type' : 'ForeignKey',
793 #'rel_field_name' : 'dpid',
794 #'rel_obj_type' : 'switch',
795 },
796 'name' : {
797 },
798 'number' : {
799 },
800 'config' : {
801 },
802 'state' : {
803 },
804 'current-features' : {
805 },
806 'advertised-features' : {
807 },
808 'supported-features' : {
809 },
810 'peer-features' : {
811 },
812 }
813 },
814
815
816 'switch-config' : {
817 'source' : 'debug-only',
818 },
819
820
821 'switch-alias' : {
822 'source' : 'user-config',
823 'cascade_delete' : True,
824 },
825
826
827 'switch-interface-config' : {
828 'source' : 'debug-only',
829 'cascade_delete' : True,
830
831 'fields' : {
832 'broadcast' : { 'edit' : False
833 },
834 'name' : { 'edit' : False
835 },
836 'mode' : {
837 'edit' : False
838 },
839 },
840 },
841
842
843 'host-alias' : {
844 'source' : 'user-config',
845 'cascade_delete' : True,
846 },
847
848
849 'link' : {
850 'source' : 'switch',
851
852 'fields' : {
853 'link-type' : {
854 'type' : 'CharField'
855 },
856 }
857 },
858
859
860 'port' : {
861 'source' : 'debug-only',
862
863 'fields' : {
864 'switch' : {
865 },
866 'number' : {
867 },
868 'config' : {
869 },
870 'state' : {
871 },
872 'current-features' : {
873 },
874 'advertised-features' : {
875 },
876 'supported-features' : {
877 },
878 'peer-features' : {
879 },
880 }
881 },
882
883 'switch-interfaces' : {
884 'source' : 'switch',
885
886 'fields' : {
887 'Idx' : {
888 'edit' : False,
889 'type' : 'CharField'
890 },
891 'id' : {
892 'primary_key': True,
893 # format's out of the sorting business
894 # 'sort' : 'tail-integer',
895 },
896 'switch' : {
897 },
898 'name' : {
899 'type' : 'CharField',
900 'max_length' : 32,
901 },
902 'hardware-address' : {
903 },
904 'config' : {
905 },
906 'state' : {
907 },
908 'stp-state' : {
909 },
910 'current-features' : {
911 },
912 'advertised-features' : {
913 },
914 'supported-features' : {
915 },
916 'peer-features' : {
917 },
918 'receiveBytes' : {
919 },
920 'receivePackets' : {
921 },
922 'receiveErrors' : {
923 },
924 'transmitBytes' : {
925 },
926 'transmitPackets' : {
927 },
928 'transmitErrors' : {
929 },
930 },
931 },
932
933 'config' : {
934 'source' : 'user-config',
935
936 'fields' : {
937 'name' : { 'primary_key': True },
938 'version' : { },
939 'length' : { },
940 'timestamp': { },
941 },
942 },
943
944 'controller_switches' : {
945 'source' : 'user-config',
946
947 'fields' : {
948 'dpid' : { 'primary_key' : True,
949 },
950 }
951 },
952
953 'test-pktin-route' : {
954 'source' : 'debug-only',
955
956 'fields' : {
957 'cluster' : {
958 },
959 'hop' : {
960 },
961 'dpid' : {
962 },
963 'inPort' : {
964 },
965 'outPort': {
966 },
967 },
968 },
969
970
971 'performance-data' : {
972 'source' : 'debug-only' ,
973
974 'fields' : {
975 'Pkts' : {
976 },
977 'CompName' : {
978 },
979 'StartTime': {
980 },
981 }
982 },
983
984
985 'flow-cache-counters' : {
986 'source' : 'sdnplatform',
987 'field-orderings' : {
988 'details' : [
989 'applName',
990 'maxFlows',
991 'activeCnt',
992 'inactiveCnt',
993 'addCnt',
994 'delCnt',
995 'activatedCnt',
996 'deactivatedCnd',
997 'cacheHitCnt',
998 'missCnt',
999 'flowModRemovalMsgLossCnt',
1000 'notStoredFullCnt',
1001 'fcObjFreedCnt',
1002 'unknownOperCnt',
1003 'flowCacheAlmostFull',
1004 ],
1005
1006 },
1007
1008 'fields' : {
1009 'applName' : {
1010 },
1011 'maxFlows' : {
1012 },
1013 'activeCnt' : {
1014 },
1015 'inactiveCnt' : {
1016 },
1017 'addCnt' : {
1018 },
1019 'delCnt' : {
1020 },
1021 'activatedCnt' : {
1022 },
1023 'deactivatedCnd' : {
1024 },
1025 'cacheHitCnt' : {
1026 },
1027 'missCnt' : {
1028 },
1029 'flowModRemovalMsgLossCnt' : {
1030 },
1031 'notStoredFullCnt' : {
1032 },
1033 'fcObjFreedCnt' : {
1034 },
1035 'unknownOperCnt' : {
1036 },
1037 'flowCacheAlmostFull' : {
1038 },
1039 },
1040 },
1041
1042
1043 'flow-cache' : {
1044 'source' : 'debug-only',
1045
1046 'fields' : {
1047 'Source-Switch' : {
1048 },
1049 'InputPort' : {
1050 },
1051 'SrcMAC' : {
1052 },
1053 'DestMAC' : {
1054 },
1055 'EtherType' : {
1056 },
1057 'Protocol' : {
1058 },
1059 'SrcPort' : {
1060 },
1061 'DstPort' : {
1062 },
1063 'Time' : {
1064 },
1065 }
1066 },
1067
1068
1069 'ev-hist-topology-switch' : {
1070 'source' : 'debug-only',
1071
1072 'fields' : {
1073 'Idx' : {
1074 'primary_key' : True,
1075 },
1076 'Time' : {
1077 },
1078 'Switch' : {
1079 },
1080 'Port' : {
1081 },
1082 'IpAddr' : {
1083 },
1084 'Action' : {
1085 },
1086 'Reason' : {
1087 },
1088 'State' : {
1089 },
1090 }
1091 },
1092
1093
1094 'ev-hist-topology-cluster' : {
1095 'source' : 'debug-only',
1096
1097 'fields' : {
1098 'Time' : {
1099 'primary_key' : False,
1100 },
1101 'Switch' : {
1102 },
1103 'Action' : {
1104 },
1105 'Reason' : {
1106 },
1107 'State' : {
1108 },
1109 }
1110 },
1111
1112
1113 'ev-hist-topology-link' : {
1114 'source' : 'debug-only',
1115
1116 'fields' : {
1117 'Time' : {
1118 'primary_key' : False,
1119 },
1120 'Source-Switch' : {
1121 },
1122 'Dest-Switch' : {
1123 },
1124 'SrcPort' : {
1125 },
1126 'DstPort' : {
1127 },
1128 'SrcPortState' : {
1129 },
1130 'DstPortState' : {
1131 },
1132 'Action' : {
1133 },
1134 'Reason' : {
1135 },
1136 'State' : {
1137 },
1138 }
1139 },
1140
1141
1142 'ev-hist-attachment-point' : {
1143 'source' : 'debug-only',
1144
1145 'fields' : {
1146 'Time_ns' : {
1147 'primary_key' : False,
1148 },
1149 'Host' : {
1150 },
1151 'Switch' : {
1152 },
1153 'Port' : {
1154 },
1155 'VLAN' : {
1156 },
1157 'Action' : {
1158 },
1159 'Reason' : {
1160 },
1161 }
1162 },
1163
1164
1165 'ev-hist-packet-in' : {
1166 'source' : 'debug-only',
1167
1168 'fields' : {
1169 'Time' : {'primary_key' : False,
1170 },
1171 'wildcards' : {
1172 },
1173 'dataLayerSource' : {
1174 },
1175 'dataLayerDestination' : {
1176 },
1177 'dataLayerType' : {
1178 },
1179 'dataLayerVirtualLan' : {
1180 },
1181 'dataLayerVirtualLanPriorityCodePoint' : {
1182 },
1183 'inputSwitch' : {
1184 },
1185 'inputPort' : {
1186 },
1187 'networkSource' : {
1188 },
1189 'networkDestination' : {
1190 },
1191 'networkSourceMaskLen' : {
1192 },
1193 'networkDestinationMaskLen' : {
1194 },
1195 'networkProtocol' : {
1196 },
1197 'networkTypeOfService' : {
1198 },
1199 'transportSource' : {
1200 },
1201 'transportDestination' : {
1202 },
1203 'Action ' : {
1204 },
1205 'Reason' : {
1206 },
1207 }
1208 },
1209
1210
1211 'vns-definition' : {
1212 'source' : 'user-config',
1213 'source' : 'show',
1214 'cascade_delete' : True,
1215 'show-this' : [
1216 ['vns-definition', 'default'],
1217 ['vns-interface-rule', 'vns-config' ],
1218 ],
1219
1220 'fields' : {
1221 'active' : {
1222 'edit' : False,
1223 },
1224 'priority' : {
1225 'edit' : False,
1226 },
1227 'arp-mode' : {
1228 'edit' : False,
1229 },
1230 'dhcp-mode' : {
1231 'edit' : False,
1232 },
1233 'dhcp-ip' : {
1234 'edit' : False,
1235 },
1236 'broadcast' : {
1237 'edit' : False,
1238 },
1239 }
1240 },
1241
1242
1243 'vns-interface-rule' : {
1244 'source' : 'debug-only',
1245 'cascade_delete' : True,
1246 'title' : 'VNS Interface Rules',
1247
1248 'fields': {
1249 'rule' : {
1250 'type' : 'CharField',
1251 'max_length' : 32,
1252 },
1253 'vns' : {
1254 },
1255 'mac' : { 'edit' : False,
1256 },
1257 'tags' : {
1258 'type' : 'CharField',
1259 'max_length' : 32,
1260 },
1261 'active' : { 'edit' : False },
1262 'allow-multiple' : { 'edit' : False },
1263 'vlan-tag-on-egress' : { 'edit' : False },
1264 'description' : { 'edit' : False },
1265 'ip-subnet' : { 'edit' : False },
1266 'ports' : { 'edit' : False },
1267 'priority' : { 'edit' : False },
1268 'rule' : { 'edit' : False },
1269 'switch' : { 'edit' : False },
1270 'tags' : { 'edit' : False },
1271 'vlans' : { 'edit' : False },
1272 }
1273 },
1274
1275
1276 'display-vns-interface' : {
1277 'source' : 'user-config',
1278 'cascade_delete' : True,
1279
1280 'fields': {
1281 'id' : {
1282 'edit' : False,
1283 'type' : 'CharField',
1284 },
1285 'rule' : {
1286 'edit' : False,
1287 'type' : 'CharField',
1288 },
1289 'mac' : {
1290 'type' : 'CharField',
1291 'max_length' : 32,
1292 'edit' : False },
1293 'vlan' : {
1294 'type' : 'Charfield',
1295 'max_length' : 32,
1296 'edit' : False },
1297 'ips' : {
1298 'type' : 'CharField',
1299 'max_length' : 32,
1300 'edit' : False },
1301 'attachment-points' : {
1302 'type' : 'CharField',
1303 'max_length' : 32,
1304 'edit' : False },
1305 'last-seen' : { 'edit' : False,
1306 }
1307 }
1308 },
1309
1310
1311 'vns-interface-display' : {
1312 'source' : 'user-config',
1313 'cascade_delete' : True,
1314
1315 'fields': {
1316 'id' : {
1317 'edit' : False,
1318 'type' : 'CharField',
1319 },
1320 'rule' : {
1321 'edit' : False,
1322 'type' : 'CharField',
1323 },
1324 'mac' : {
1325 'type' : 'CharField',
1326 'max_length' : 32,
1327 'edit' : False },
1328 'vlan' : {
1329 'type' : 'Charfield',
1330 'max_length' : 32,
1331 'edit' : False },
1332 'ips' : {
1333 'type' : 'CharField',
1334 'max_length' : 32,
1335 'edit' : False },
1336 'attachment-points' : {
1337 'type' : 'CharField',
1338 'max_length' : 32,
1339 'edit' : False },
1340 'last-seen' : { 'edit' : False,
1341 }
1342 }
1343 },
1344
1345
1346 'vns-access-list': {
1347 'source' : 'user-config',
1348 'cascade_delete' : True,
1349
1350 'fields' : {
1351 'name' : {
1352 'edit' : False,
1353 'cascade_delete' : True
1354 },
1355 }
1356 },
1357
1358
1359 'vns-access-list-entry': {
1360 'source' : 'user-config',
1361 'cascade_delete' : True,
1362
1363 'fields' : {
1364 #
1365 # vns-acl-entry fields are a bit uncommon. the action and type
1366 # can only be configured via the create portion of the command,
1367 # while many other fields requre specific validation so that
1368 # alternate values can be replaced for some keywords
1369 #
1370 # the values of the 'validate' field is the name of the
1371 # def to call (in the bigSh class)
1372 #
1373 'vns-access-list' : {
1374 },
1375 'rule' : {
1376 'cascade_delete' : True,
1377 'sort' : 'integer'
1378 },
1379 'action' : {
1380 'edit' : False
1381 },
1382 'type' : {
1383 'edit' : False
1384 },
1385 'src-ip' : {
1386 },
1387 'src-ip-mask' : {
1388 },
1389 'dst-ip' : {
1390 },
1391 'dst-ip-mask' : {
1392 },
1393 'src-tp-port-op' : {
1394 },
1395 'src-tp-port' : {
1396 },
1397 'dst-tp-port-op' : {
1398 },
1399 'dst-tp-port' : {
1400 },
1401 'icmp-type' : {
1402 },
1403 'ether-type' : {
1404 },
1405 }
1406 },
1407
1408
1409 'vns-interface-access-list': {
1410 'source' : 'user-config',
1411 'cascade_delete' : True,
1412
1413 'fields' : {
1414 'vns' : {
1415 'type' : 'CharField',
1416 'max_length' : 32
1417 },
1418 'vns-interface-name' : {
1419 'type' : 'CharField',
1420 'max_length' : 32
1421 },
1422 'name' : {
1423 'type' : 'CharField',
1424 'max_length' : 32
1425 },
1426 }
1427 },
1428
1429
1430 'tag' : {
1431 'source' : 'user-config',
1432 'source' : 'switch',
1433 },
1434
1435
1436 'tag-mapping' : {
1437 'source' : 'user-config',
1438 'source' : 'switch',
1439
1440 'fields' : {
1441 'type' : {
1442 },
1443 'host' : {
1444 },
1445 }
1446 },
1447
1448
1449 'syncd-config' : {
1450 'source' : 'debug-only',
1451 },
1452
1453 'syncd-progress-info' : {
1454 'source' : 'debug-only',
1455 },
1456
1457 'syncd-transport-config' : {
1458 'source' : 'debug-only',
1459 },
1460
1461 'statd-config' : {
1462 'source' : 'debug-only',
1463 },
1464
1465 'statdropd-config' : {
1466 'source' : 'debug-only',
1467 },
1468
1469 'statdropd-progress-info' : {
1470 'source' : 'debug-only',
1471 },
1472
1473 'tech-support-config' : {
1474 },
1475
1476 'tunnel-details' : {
1477 'source' : 'switch',
1478
1479 'fields' : {
1480 'dpid' : {
1481 'primary_key': True,
1482 },
1483 'localTunnelIPAddr' : {
1484 },
1485 'tunnelPorts' : {
1486 },
1487 },
1488 },
1489
1490
1491 'controller-summary' : {
1492 'source' : 'switch',
1493
1494 'fields' : {
1495 '# Access Control Lists' : {
1496 },
1497 '# VNS Interfaces' : {
1498 },
1499 '# hosts' : {
1500 },
1501 '# VNSes' : {
1502 },
1503 '# attachment points' : {
1504 },
1505 '# inter-switch links' : {
1506 },
1507 '# IP Addresses' : {
1508 },
1509 '# VNS Interfaces with ACL applied' : {
1510 },
1511 },
1512 },
1513
1514
1515 'switch-interface-alias' : {
1516 'source' : 'commands',
1517 'cascade_delete' : True,
1518
1519 'fields' : {
1520 'id' : {
1521 }
1522 }
1523 },
1524
1525
1526 'host-config' : {
1527 'source' : 'show',
1528 'url' : 'device',
1529
1530 'fields' : {
1531 'Idx' : {
1532 'edit' : False,
1533 'type' : 'CharField'
1534 },
1535 'mac' : {
1536 'json_serialize_string': True,
1537 'max_length': 17,
1538 'null': False,
1539 'type': 'CharField',
1540 'edit' : False,
1541 },
1542 'vendor' : {
1543 'edit' : False,
1544 },
1545 'ips' : {
1546 'edit' : False
1547 },
1548 'attachment-points' : {
1549 'edit' : False
1550 },
1551 'tag' : {
1552 'edit' : False
1553 },
1554 'host-alias' : { 'help_text' : 'Host alias',
1555 'edit' : False,
1556 },
1557 'last-seen' : {
1558 'help_text': 'Last time a packet was seen by the controller',
1559 'json_serialize_string': True,
1560 'null': True,
1561 'type': 'DateTimeField',
1562 },
1563 },
1564 },
1565
1566 'host': {
1567 # hosts are now directly fetched via rest api. 'has_rest_model' isn't set
1568 # for this table.
1569 # XXX perhaps these types of descriptions need to be
1570 # in a file other than climodelinfo?
1571 'source' : 'user-config',
1572 'source' : 'display',
1573 'url' : 'device',
1574 'config-obj-type' : 'host-config',
1575
1576 'fields': {
1577 'mac' : {
1578 'json_serialize_string': True,
1579 'max_length': 17,
1580 'null': False,
1581 'primary_key': True,
1582 'type': 'CharField',
1583 'edit' : False,
1584 },
1585 'address-space' : {
1586 'edit' : False,
1587 'type' : 'ForeignKey',
1588 'rel_field_name' : 'name',
1589 'rel_obj_type' : 'address-space',
1590 },
1591 'vlan' : {
1592 'help_text' : 'VLAN Associated with host',
1593 'json_serialize_string': False,
1594 'null' : True,
1595 'type' : 'IntegerField',
1596 'edit' : False,
1597 'searchable' : True,
1598 },
1599 'dpid' : {
1600 'edit' : False,
1601 'type' : 'ForeignKey',
1602 'rel_field_name' : 'dpid',
1603 'rel_obj_type' : 'switches',
1604 },
1605 'ipv4' : {
1606 'edit' : False,
1607 },
1608 # Attachment point isn't searchable
1609 #'attachment-points' : {
1610 #'edit' : False
1611 #},
1612 'last-seen' : {
1613 'help_text': 'Last time a packet was seen by the controller',
1614 'json_serialize_string': True,
1615 'null': True,
1616 'type': 'DateTimeField',
1617 },
1618 },
1619 },
1620
1621
1622 'host-attachment-point' : {
1623 # directly fetched via rest api.
1624 # 'has_rest_model' isn't set for this table.
1625 'source' : 'controller',
1626 'url' : 'device',
1627
1628 'fields': {
1629 'mac' : {
1630 'json_serialize_string': True,
1631 'null': True,
1632 'rel_field_name': 'mac',
1633 'rel_obj_type': 'host',
1634 'type': 'ForeignKey',
1635 },
1636 'vlan' : {
1637 'help_text': 'VLAN Associated with host',
1638 'json_serialize_string': False,
1639 'null': True,
1640 'type': 'IntegerField',
1641 'edit' : False,
1642 'searchable' : True,
1643 },
1644 'id' : {
1645 'help_text': '#|mac|dpid|ingress-port',
1646 'json_serialize_string': True,
1647 'max_length': 64,
1648 'null': False,
1649 'primary_key': True,
1650 'type': 'CharField',
1651 },
1652 'dpid' : { 'json_serialize_string': True,
1653 'null': True,
1654 'rel_field_name': 'dpid',
1655 'rel_obj_type': 'switch',
1656 'type': 'ForeignKey',
1657 },
1658 'ingress-port' : {
1659 'help_text': 'Open flow port number of ingress port',
1660 'json_serialize_string': False,
1661 'null': True,
1662 'type': 'IntegerField',
1663 },
1664 'status' : {
1665 'help_text': 'Error description, blank mean no error ',
1666 'json_serialize_string': True,
1667 'max_length': 64,
1668 'null': True,
1669 'type': 'CharField',
1670 },
1671 'last-seen' : {
1672 'help_text': 'Last time a packet was seen by the controller',
1673 'json_serialize_string': True,
1674 'null': True,
1675 'type': 'DateTimeField',
1676 },
1677 'ipv4' : { # added to enable searching
1678 'edit' : False,
1679 'searchable' : True,
1680 },
1681 },
1682 },
1683
1684 'host-network-address': {
1685 # directly fetched via rest api.
1686 # 'has_rest_model' isn't set for this table.
1687 'source' : 'switch',
1688 'url' : 'device',
1689
1690 'fields': {
1691 'mac' : { 'json_serialize_string': True,
1692 'null': True,
1693 'rel_field_name': 'mac',
1694 'rel_obj_type': 'host',
1695 'type': 'ForeignKey',
1696 'edit' : False,
1697 },
1698 'vlan' : {
1699 'help_text': 'VLAN Associated with host',
1700 'json_serialize_string': False,
1701 'null': True,
1702 'type': 'IntegerField',
1703 'edit' : False,
1704 'searchable' : True,
1705 },
1706 'id' : {
1707 'help_text': '#|mac|ipv4',
1708 'json_serialize_string': True,
1709 'max_length': 64,
1710 'null': False,
1711 'primary_key': True,
1712 'type': 'CharField',
1713 },
1714 'ip-address': {
1715 'help_text': 'IP Address of host',
1716 'json_serialize_string': True,
1717 'max_length': 15,
1718 'null': True,
1719 'type': 'CharField',
1720 'edit' : False,
1721 },
1722 'last-seen' : {
1723 'help_text': 'Last time a packet was seen by the controller',
1724 'json_serialize_string': True,
1725 'null': True,
1726 'type': 'DateTimeField',
1727 },
1728 'ipv4' : { # added to enable searching
1729 'max_length': 15,
1730 'null': True,
1731 'type': 'CharField',
1732 'edit' : False,
1733 },
1734 'dpid' : {
1735 'edit' : False,
1736 'searchable' : True,
1737 },
1738 },
1739 },
1740
1741 'host-vns-interface' : {
1742 # directly fetched via rest api.
1743 # 'has_rest_model' isn't set for this table.
1744 'source' : 'controller',
1745 'url' : 'vns/device-interface',
1746 'cascade_delete' : True,
1747
1748 'field-orderings' : {
1749 'default' : [ 'Idx', 'vns', 'host', 'ips', ],
1750 'vns-config' : [ 'Idx', 'host', 'ips', ]
1751 },
1752 'fields' : {
1753 'id' : {
1754 'compound_key_fields': [
1755 'vns',
1756 'vlan',
1757 'mac',
1758 'interface'
1759 ],
1760 'help_text': '#|host|interface',
1761 'json_serialize_string': False,
1762 'null': False,
1763 'primary_key': True,
1764 'type': 'compound-key',
1765 },
1766 'address-space' : {
1767 'json_serialize_string': True,
1768 'null': False,
1769 'rel_field_name': 'mac',
1770 'rel_obj_type': 'host',
1771 'type': 'ForeignKey',
1772 'edit' : False,
1773 },
1774 'vlan' : {
1775 'type' : 'CharField',
1776 'max_length' : 32,
1777 'edit' : False
1778 },
1779 'mac' : {
1780 'json_serialize_string': True,
1781 'null': False,
1782 'rel_field_name': 'mac',
1783 'rel_obj_type': 'host',
1784 'type': 'ForeignKey',
1785 'edit' : False,
1786 },
1787 'interface': {
1788 'json_serialize_string': True,
1789 'null': False,
1790 'rel_field_name': 'id',
1791 'rel_obj_type': 'vns-interface',
1792 'type': 'ForeignKey',
1793 },
1794 'ips' : {
1795 'type' : 'CharField',
1796 'max_length' : 32,
1797 'edit' : False
1798 },
1799 }
1800 },
1801
1802 'vns-interface' : {
1803 # directly fetched via rest api.
1804 # 'has_rest_model' isn't set for this table.
1805 'source' : 'controller',
1806 'url' : 'vns/interface',
1807
1808 'field-orderings' : {
1809 'default' : ['Idx', 'vns', 'interface', 'rule', 'last-seen', ],
1810 'vns-config' : ['Idx', 'interface', 'rule', 'last-seen', ]
1811 },
1812 'fields' : {
1813 'id' : {
1814 'compound_key_fields': [ 'vns',
1815 'interface'],
1816 'help_text': '#|vns|interface',
1817 'json_serialize_string': False,
1818 'null': False,
1819 'primary_key': True,
1820 'type': 'compound-key',
1821 },
1822 'vns' : {
1823 'json_serialize_string': True,
1824 'null': False,
1825 'rel_field_name': 'id',
1826 'rel_obj_type': 'vns-definition',
1827 'type': 'ForeignKey',
1828 },
1829 'interface' : {
1830 'json_serialize_string': True,
1831 'max_length': 32,
1832 'null': False,
1833 'type': 'CharField',
1834 },
1835 'rule' : { 'json_serialize_string': True,
1836 'null': True,
1837 'rel_field_name': 'id',
1838 'rel_obj_type': 'vns-interface-rule',
1839 'type': 'ForeignKey',
1840 },
1841 'last-seen' : {
1842 'help_text': 'Last time a packet was seen by the controller on this interface',
1843 'json_serialize_string': True,
1844 'null': True,
1845 'type': 'DateTimeField',
1846 },
1847 }
1848 }
1849
1850 # done.
1851 }