@@ -30,10 +30,10 @@ def test_connectivity(self, vct):
30
30
31
31
def test_voq_switch (self , vct ):
32
32
"""Test VOQ switch objects configuration.
33
-
33
+
34
34
This test validates configuration of switch creation objects required for
35
35
VOQ switches. The switch_type, max_cores and switch_id attributes configuration
36
- are verified. For the System port config list, it is verified that all the
36
+ are verified. For the System port config list, it is verified that all the
37
37
configured system ports are avaiable in the asic db by checking the count.
38
38
"""
39
39
@@ -54,58 +54,58 @@ def test_voq_switch(self, vct):
54
54
55
55
cfg_max_cores = metatbl .get ("max_cores" )
56
56
assert cfg_max_cores != "" , "Got error in getting max_cores from CONFIG_DB DEVICE_METADATA"
57
-
57
+
58
58
cfgspkeys = config_db .get_keys ("SYSTEM_PORT" )
59
59
sp_count = len (cfgspkeys )
60
60
61
61
asic_db = dvs .get_asic_db ()
62
62
keys = asic_db .get_keys ("ASIC_STATE:SAI_OBJECT_TYPE_SWITCH" )
63
63
switch_oid_key = keys [0 ]
64
-
64
+
65
65
switch_entry = asic_db .get_entry ("ASIC_STATE:SAI_OBJECT_TYPE_SWITCH" , switch_oid_key )
66
66
67
67
value = switch_entry .get ("SAI_SWITCH_ATTR_TYPE" )
68
68
assert value == "SAI_SWITCH_TYPE_VOQ" , "Switch type is not VOQ"
69
-
69
+
70
70
value = switch_entry .get ("SAI_SWITCH_ATTR_SWITCH_ID" )
71
71
assert value == cfg_switch_id , "VOQ switch id is invalid"
72
-
72
+
73
73
value = switch_entry .get ("SAI_SWITCH_ATTR_MAX_SYSTEM_CORES" )
74
74
assert value == cfg_max_cores , "Max system cores is invalid"
75
-
75
+
76
76
value = switch_entry .get ("SAI_SWITCH_ATTR_SYSTEM_PORT_CONFIG_LIST" )
77
77
assert value != "" , "Empty system port config list"
78
78
# Convert the spcfg string to dictionary
79
79
spcfg = ast .literal_eval (value )
80
80
assert spcfg ['count' ] == sp_count , "Number of systems ports configured is invalid"
81
-
81
+
82
82
def test_chassis_app_db_sync (self , vct ):
83
83
"""Test chassis app db syncing.
84
-
84
+
85
85
This test is for verifying the database sync mechanism. With the virtual chassis
86
86
setup, it is verified that at least one database entry is synced from line card to
87
87
supervisor card. An interface entry is used as sample database entry for verification
88
88
of syncing mechanism.
89
89
"""
90
-
90
+
91
91
dvss = vct .dvss
92
92
for name in dvss .keys ():
93
93
if name .startswith ("supervisor" ):
94
94
dvs = dvss [name ]
95
95
chassis_app_db = DVSDatabase (swsscommon .CHASSIS_APP_DB , dvs .redis_chassis_sock )
96
96
keys = chassis_app_db .get_keys ("SYSTEM_INTERFACE" )
97
97
assert len (keys ), "No chassis app db syncing is done"
98
-
98
+
99
99
def test_chassis_system_interface (self , vct ):
100
100
"""Test RIF record creation in ASIC_DB for remote interfaces.
101
-
101
+
102
102
This test verifies RIF programming in ASIC_DB for remote interface. The orchagent
103
103
creates RIF record for system port interfaces from other line cards. It is verified
104
104
by retrieving a RIF record from local ASIC_DB that corresponds to a remote system port
105
- and checking that the switch id of that remote system port does not match the local asic
105
+ and checking that the switch id of that remote system port does not match the local asic
106
106
switch id.
107
107
"""
108
-
108
+
109
109
dvss = vct .dvss
110
110
for name in dvss .keys ():
111
111
dvs = dvss [name ]
@@ -116,11 +116,11 @@ def test_chassis_system_interface(self, vct):
116
116
cfg_switch_type = metatbl .get ("switch_type" )
117
117
118
118
# Test only for line cards
119
- if cfg_switch_type == "voq" :
119
+ if cfg_switch_type == "voq" :
120
120
lc_switch_id = metatbl .get ("switch_id" )
121
121
assert lc_switch_id != "" , "Got error in getting switch_id from CONFIG_DB DEVICE_METADATA"
122
122
if lc_switch_id == "0" :
123
- # Testing in Linecard1, In Linecard1 there will be RIF for Ethernet12 from Linecard3
123
+ # Testing in Linecard1, In Linecard1 there will be RIF for Ethernet12 from Linecard3
124
124
# Note: Tesing can be done in any linecard for RIF of any system port interface.
125
125
# Here testing is done on linecard with switch id 0
126
126
asic_db = dvs .get_asic_db ()
@@ -151,14 +151,15 @@ def test_chassis_system_interface(self, vct):
151
151
152
152
def test_chassis_system_neigh (self , vct ):
153
153
"""Test neigh record creation and syncing to chassis app db.
154
-
154
+
155
155
This test validates that:
156
156
(i) Local neighbor entry is created with encap index
157
157
(ii) Local neighbor is synced to chassis ap db with assigned encap index
158
158
TODO: (iii) Remote neighbor entry is created in ASIC_DB with received encap index
159
159
"""
160
160
161
161
dvss = vct .dvss
162
+ print ("name {}" .format (dvss .keys ()))
162
163
for name in dvss .keys ():
163
164
dvs = dvss [name ]
164
165
@@ -168,61 +169,63 @@ def test_chassis_system_neigh(self, vct):
168
169
cfg_switch_type = metatbl .get ("switch_type" )
169
170
170
171
# Neighbor record verifiation done in line card
171
- if cfg_switch_type == "voq" :
172
+ if cfg_switch_type == "voq" :
172
173
lc_switch_id = metatbl .get ("switch_id" )
173
174
assert lc_switch_id != "" , "Got error in getting switch_id from CONFIG_DB DEVICE_METADATA"
174
175
if lc_switch_id == "0" :
175
176
176
177
# Add a static neighbor
178
+ _ , res = dvs .runcmd (['sh' , "-c" , "ip neigh show" ])
177
179
_ , res = dvs .runcmd (['sh' , "-c" , "ip neigh add 10.8.101.2 lladdr 00:01:02:03:04:05 dev Ethernet0" ])
178
180
assert res == "" , "Error configuring static neigh"
179
181
180
182
asic_db = dvs .get_asic_db ()
181
183
neighkeys = asic_db .get_keys ("ASIC_STATE:SAI_OBJECT_TYPE_NEIGHBOR_ENTRY" )
182
184
assert len (neighkeys ), "No neigh entries in ASIC_DB"
183
-
185
+
184
186
# Check for presence of the neighbor in ASIC_DB
185
187
test_neigh = ""
186
188
for nkey in neighkeys :
187
189
ne = ast .literal_eval (nkey )
188
190
if ne ['ip' ] == '10.8.101.2' :
189
191
test_neigh = nkey
190
192
break
191
-
193
+
192
194
assert test_neigh != "" , "Neigh not found in ASIC_DB"
193
-
195
+
194
196
# Check for presence of encap index, retrieve and store it for sync verification
195
- test_neigh_entry = asic_db .get_entry ("ASIC_STATE:SAI_OBJECT_TYPE_NEIGHBOR_ENTRY" , test_neigh )
197
+ test_neigh_entry = asic_db .wait_for_entry ("ASIC_STATE:SAI_OBJECT_TYPE_NEIGHBOR_ENTRY" , test_neigh )
196
198
encap_index = test_neigh_entry .get ("SAI_NEIGHBOR_ENTRY_ATTR_ENCAP_INDEX" )
197
199
assert encap_index != "" , "VOQ encap index is not programmed in ASIC_DB"
198
-
200
+
199
201
break
200
-
201
- # Verify neighbor record syncing with encap index
202
+
203
+ # Verify neighbor record syncing with encap index
202
204
dvss = vct .dvss
203
205
for name in dvss .keys ():
204
206
if name .startswith ("supervisor" ):
205
207
dvs = dvss [name ]
206
208
chassis_app_db = DVSDatabase (swsscommon .CHASSIS_APP_DB , dvs .redis_chassis_sock )
209
+ chassis_app_db .wait_for_n_keys ("SYSTEM_NEIGH" , 1 )
207
210
sysneighkeys = chassis_app_db .get_keys ("SYSTEM_NEIGH" )
208
- assert len ( sysneighkeys ), "No system neighbor entries in chassis app db"
209
-
211
+
212
+ print ( sysneighkeys )
210
213
test_sysneigh = ""
211
214
for sysnk in sysneighkeys :
212
215
sysnk_tok = sysnk .split ("|" )
213
216
assert len (sysnk_tok ) == 3 , "Invalid system neigh key in chassis app db"
214
217
if sysnk_tok [2 ] == "10.8.101.2" :
215
218
test_sysneigh = sysnk
216
219
break
217
-
220
+
218
221
assert test_sysneigh != "" , "Neigh is not sync-ed to chassis app db"
219
-
220
- test_sysneigh_entry = chassis_app_db .get_entry ("SYSTEM_NEIGH" , test_sysneigh )
222
+
223
+ test_sysneigh_entry = chassis_app_db .get_entry ("SYSTEM_NEIGH" , test_sysneigh )
221
224
sys_neigh_encap_index = test_sysneigh_entry .get ("encap_index" )
222
225
assert sys_neigh_encap_index != "" , "System neigh in chassis app db does not have encap index"
223
-
226
+
224
227
assert encap_index == sys_neigh_encap_index , "Encap index not sync-ed correctly"
225
-
228
+
226
229
break
227
230
228
231
# Add Dummy always-pass test at end as workaroud
0 commit comments