@@ -61,61 +61,63 @@ class CRC_count_Check(aetest.Testcase):
61
61
def setup (self , dev ):
62
62
#Setup has been marked for looping in Common Setup(create_testcases) with the argument dev
63
63
#dev is the list of devices in the current testbed
64
+ self .dev = dev
64
65
log .info (banner (f"Gathering Interface Information from { dev .name } " ))
65
66
self .interface_info = dev .learn ('interface' )
66
67
67
-
68
68
list_of_interfaces = self .interface_info .info .keys ()
69
- mega_dict = {}
70
- mega_dict [dev .name ] = {}
71
- mega_tabular = []
72
- passing = 0
69
+ self . mega_dict = {}
70
+ self . mega_dict [dev .name ] = {}
71
+ self . mega_tabular = []
72
+ self . passing = 0
73
73
74
74
75
75
for ints , props in self .interface_info .info .items ():
76
76
counters = props .get ('counters' )
77
77
if counters :
78
78
smaller_tabular = []
79
79
if 'in_crc_errors' in counters :
80
- mega_dict [dev .name ][ints ] = counters ['in_crc_errors' ]
80
+ self . mega_dict [dev .name ][ints ] = counters ['in_crc_errors' ]
81
81
smaller_tabular .append (dev .name )
82
82
smaller_tabular .append (ints )
83
83
smaller_tabular .append (str (counters ['in_crc_errors' ]))
84
84
if counters ['in_crc_errors' ]:
85
85
smaller_tabular .append ('Failed' )
86
- passing = 1
86
+ self . passing = 1
87
87
else :
88
88
smaller_tabular .append ('Passed' )
89
89
90
90
else :
91
- mega_dict [dev .name ][ints ] = None
91
+ self . mega_dict [dev .name ][ints ] = None
92
92
smaller_tabular .append (dev .name )
93
93
smaller_tabular .append (ints )
94
94
smaller_tabular .append ('N/A' )
95
95
smaller_tabular .append ('N/A' )
96
- mega_tabular .append (smaller_tabular )
97
- mega_tabular .append (['-' * sum (len (i ) for i in smaller_tabular )])
96
+ self . mega_tabular .append (smaller_tabular )
97
+ self . mega_tabular .append (['-' * sum (len (i ) for i in smaller_tabular )])
98
98
99
99
#pass megadict to interface test function
100
- self .parent .parameters .update (mega = mega_dict [dev .name ])
100
+ #self.parent.parameters.update(mega=mega_dict[dev.name])
101
+ #self.megadictname=self.mega_dict[dev.name])
101
102
#pass megatable list to table_display test function
102
- self .parent .parameters .update (megatable = mega_tabular )
103
- #pass passing variable to table_display function in order indicate pass or fail - 0=pass 1=fail
104
- self .parent .parameters .update (passing = passing )
103
+ # self.parent.parameters.update(megatable=self. mega_tabular)
104
+ #pass self. passing variable to table_display function in order indicate pass or fail - 0=pass 1=fail
105
+ # self.parent.parameters.update(passing=self. passing)
105
106
106
107
aetest .loop .mark (self .interface_check , intf = list_of_interfaces )
107
108
108
109
# create table and display. Test fails if variable 'passing' = 1.
109
110
# which means there are some CRC errors
110
111
@aetest .test
111
112
def table_display (self ):
112
- log .info (tabulate (self .parent .parameters ['megatable' ],
113
+ #log.info(tabulate(self.parent.parameters['megatable'],
114
+ log .info (tabulate (self .mega_tabular ,
113
115
headers = ['Device' , 'Interface' ,
114
116
'CRC Errors Counter' ,
115
117
'Passed/Failed' ],
116
118
tablefmt = 'orgtbl' ))
117
119
118
- if self .parent . parameters [ ' passing' ] == 1 :
120
+ if self .passing == 1 :
119
121
self .failed ('Some interfaces have CRC errors' )
120
122
else :
121
123
self .passed
@@ -125,7 +127,8 @@ def table_display(self):
125
127
def interface_check (self , intf ):
126
128
# This test has been marked for loop. intf is the looping argument (list of interfaces)
127
129
# Thus this test is run for each interface in the intf list.
128
- for int , errors in self .parent .parameters ['mega' ].items ():
130
+ #for int, errors in self.parent.parameters['mega'].items():
131
+ for int , errors in self .mega_dict [self .dev .name ].items ():
129
132
if errors :
130
133
self .failed (f'Interface { int } has crc errors { errors } ' )
131
134
else :
@@ -157,4 +160,4 @@ def disconnect(self):
157
160
158
161
159
162
if __name__ == '__main__' : # pragma: no cover
160
- aetest .main ()
163
+ aetest .main ()
0 commit comments