122
122
class Portstat (object ):
123
123
def __init__ (self , namespace , display_option ):
124
124
self .db = None
125
+ self .namespace = namespace
126
+ self .display_option = display_option
125
127
self .multi_asic = multi_asic_util .MultiAsic (display_option , namespace )
126
128
if device_info .is_supervisor ():
127
129
self .db = SonicV2Connector (use_unix_socket_path = False )
@@ -132,7 +134,8 @@ def get_cnstat_dict(self):
132
134
self .cnstat_dict ['time' ] = datetime .datetime .now ()
133
135
self .ratestat_dict = OrderedDict ()
134
136
if device_info .is_supervisor ():
135
- self .collect_stat_from_lc ()
137
+ if device_info .is_voq_chassis () or (self .namespace is None and self .display_option != 'all' ):
138
+ self .collect_stat_from_lc ()
136
139
else :
137
140
self .collect_stat ()
138
141
return self .cnstat_dict , self .ratestat_dict
@@ -405,7 +408,9 @@ def cnstat_print(self, cnstat_dict, ratestat_dict, intf_list, use_json, print_al
405
408
print (table_as_json (table , header ))
406
409
else :
407
410
print (tabulate (table , header , tablefmt = 'simple' , stralign = 'right' ))
408
- if (multi_asic .is_multi_asic () or device_info .is_chassis ()) and not use_json :
411
+ if device_info .is_voq_chassis ():
412
+ return
413
+ elif (multi_asic .is_multi_asic () or device_info .is_packet_chassis ()) and not use_json :
409
414
print ("\n Reminder: Please execute 'show interface counters -d all' to include internal links\n " )
410
415
411
416
def cnstat_intf_diff_print (self , cnstat_new_dict , cnstat_old_dict , intf_list ):
@@ -668,5 +673,7 @@ def cnstat_diff_print(self, cnstat_new_dict, cnstat_old_dict,
668
673
print (table_as_json (table , header ))
669
674
else :
670
675
print (tabulate (table , header , tablefmt = 'simple' , stralign = 'right' ))
671
- if (multi_asic .is_multi_asic () or device_info .is_chassis ()) and not use_json :
676
+ if device_info .is_voq_chassis ():
677
+ return
678
+ elif (multi_asic .is_multi_asic () or device_info .is_packet_chassis ()) and not use_json :
672
679
print ("\n Reminder: Please execute 'show interface counters -d all' to include internal links\n " )
0 commit comments