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