Skip to content

Commit 56878db

Browse files
committed
Rename sub-test cases for easier filtering
1 parent e25e6a4 commit 56878db

File tree

1 file changed

+44
-44
lines changed

1 file changed

+44
-44
lines changed

tests/test_nhg.py

+44-44
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ def delete_nhg():
188188
# Test scenario:
189189
# - create a NHG and assert a NHG object doesn't get added to ASIC DB
190190
# - delete a NHG and assert the newly created one is created in ASIC DB and its SAI ID changed
191-
def test_temporary_group_promotion():
191+
def temporary_group_promotion_test():
192192
# Add a new next hop group - it should create a temporary one instead
193193
prev_nhgs = self.asic_db.get_keys(self.ASIC_NHG_STR)
194194
nhg_index, _ = create_temp_nhg()
@@ -221,7 +221,7 @@ def test_temporary_group_promotion():
221221

222222
# Test scenario:
223223
# - update an existing NHG and assert the update is performed
224-
def test_group_update():
224+
def group_update_test():
225225
# Update a group
226226
binary = self.gen_valid_binary()
227227
nhg_fvs = self.gen_nhg_fvs(binary)
@@ -239,7 +239,7 @@ def test_group_update():
239239

240240
# Test scenario:
241241
# - create and delete a NHG while the ASIC DB is full and assert nothing changes
242-
def test_create_delete_temporary():
242+
def create_delete_temporary_test():
243243
# Create a new temporary group
244244
nhg_index, _ = create_temp_nhg()
245245
time.sleep(1)
@@ -257,7 +257,7 @@ def test_create_delete_temporary():
257257
# - create a temporary NHG
258258
# - update the NHG with a different number of members
259259
# - delete a NHG and assert the new one is added and it has the updated number of members
260-
def test_update_temporary_group():
260+
def update_temporary_group_test():
261261
# Create a new temporary group
262262
nhg_index, binary = create_temp_nhg()
263263

@@ -294,7 +294,7 @@ def test_update_temporary_group():
294294
# - create a temporary NHG and update the route to point to it, asserting the route's SAI NHG ID changes
295295
# - update the temporary NHG to contain completely different members and assert the SAI ID changes
296296
# - delete a NHG and assert the temporary NHG is promoted and its SAI ID also changes
297-
def test_route_nhg_update():
297+
def route_nhg_update_test():
298298
# Add a route
299299
nhg_index = gen_nhg_index(self.first_valid_nhg)
300300
rt_fvs = swsscommon.FieldValuePairs([('nexthop_group', nhg_index)])
@@ -369,7 +369,7 @@ def test_route_nhg_update():
369369
# Test scenario:
370370
# - create a temporary NHG containing labeled NHs and assert a new NH is added to represent the group
371371
# - delete a NHG and assert the temporary NHG is promoted and all its NHs are added
372-
def test_labeled_nhg_temporary_promotion():
372+
def labeled_nhg_temporary_promotion_test():
373373
# Create a next hop group that contains labeled NHs that do not exist
374374
# in NeighOrch
375375
self.asic_nhs_count = len(self.asic_db.get_keys(self.ASIC_NHS_STR))
@@ -398,7 +398,7 @@ def test_labeled_nhg_temporary_promotion():
398398
# Test scenario:
399399
# - update route to own its NHG and assert no new NHG is added
400400
# - remove a NHG and assert the temporary NHG is promoted and added to ASIC DB
401-
def test_back_compatibility():
401+
def back_compatibility_test():
402402
# Update the route with a RouteOrch's owned NHG
403403
binary = self.gen_valid_binary()
404404
nhg_fvs = self.gen_nhg_fvs(binary)
@@ -421,7 +421,7 @@ def test_back_compatibility():
421421
# - update the NHG to all invalid NHs again and assert the update is not performed and thus it has the same SAI
422422
# ID
423423
# - delete the temporary NHG
424-
def test_invalid_temporary():
424+
def invalid_temporary_test():
425425
# Create a temporary NHG that contains only NHs that do not exist
426426
nhg_fvs = swsscommon.FieldValuePairs([('nexthop', '10.0.0.21,10.0.0.23'),
427427
('ifname', 'Ethernet40,Ethernet44')])
@@ -474,14 +474,14 @@ def test_invalid_temporary():
474474
self.nhg_count += 1
475475
self.asic_db.wait_for_n_keys(self.ASIC_NHG_STR, self.MAX_ECMP_COUNT)
476476

477-
test_temporary_group_promotion()
478-
test_group_update()
479-
test_create_delete_temporary()
480-
test_update_temporary_group()
481-
test_route_nhg_update()
482-
test_labeled_nhg_temporary_promotion()
483-
test_back_compatibility()
484-
test_invalid_temporary()
477+
temporary_group_promotion_test()
478+
group_update_test()
479+
create_delete_temporary_test()
480+
update_temporary_group_test()
481+
route_nhg_update_test()
482+
labeled_nhg_temporary_promotion_test()
483+
back_compatibility_test()
484+
invalid_temporary_test()
485485

486486
# Cleanup
487487

@@ -865,7 +865,7 @@ def test_nhgorch_labeled_nhs(self, dvs, testlog):
865865
# - remove the weights from the first NHG and change the labels, leaving one NH unlabeled; assert one NH is
866866
# deleted
867867
# - delete the first NHG and perform cleanup
868-
def test_mainline_labeled_nhs():
868+
def mainline_labeled_nhs_test():
869869
# Add a group containing labeled weighted NHs
870870
fvs = swsscommon.FieldValuePairs([('nexthop', '10.0.0.1,10.0.0.3'),
871871
('mpls_nh', 'push1,push3'),
@@ -954,7 +954,7 @@ def test_mainline_labeled_nhs():
954954
# - update the NHG by changing the first NH's label and assert a new NH is created
955955
# - remove the route and assert that only one (now unreferenced) NH is removed
956956
# - remove the NHG and perform cleanup
957-
def test_routeorch_nhgorch_interop():
957+
def routeorch_nhgorch_interop_test():
958958
# Create a route with labeled NHs
959959
fvs = swsscommon.FieldValuePairs([('nexthop', '10.0.0.1,10.0.0.3'),
960960
('mpls_nh', 'push1,push3'),
@@ -1007,13 +1007,13 @@ def test_routeorch_nhgorch_interop():
10071007

10081008
self.init_test(dvs, 2)
10091009

1010-
test_mainline_labeled_nhs()
1011-
test_routeorch_nhgorch_interop()
1010+
mainline_labeled_nhs_test()
1011+
routeorch_nhgorch_interop_test()
10121012

10131013
def test_nhgorch_excp_group_cases(self, dvs, testlog):
10141014
# Test scenario:
10151015
# - remove a NHG that does not exist and assert the number of NHGs in ASIC DB remains the same
1016-
def test_remove_inexistent_nhg():
1016+
def remove_inexistent_nhg_test():
10171017
# Remove a group that does not exist
10181018
self.nhg_ps._del("group1")
10191019
time.sleep(1)
@@ -1022,7 +1022,7 @@ def test_remove_inexistent_nhg():
10221022
# Test scenario:
10231023
# - create a NHG with a member which does not exist and assert no NHG is created
10241024
# - update the NHG to contain all valid members and assert the NHG is created and it has 2 members
1025-
def test_nhg_members_validation():
1025+
def nhg_members_validation_test():
10261026
# Create a next hop group with a member that does not exist - should fail
10271027
fvs = swsscommon.FieldValuePairs([('nexthop', '10.0.0.1,10.0.0.3,10.0.0.63'),
10281028
("ifname", "Ethernet0,Ethernet4,Ethernet124")])
@@ -1048,7 +1048,7 @@ def test_nhg_members_validation():
10481048
# - create a new NHG and assert it and its members are being created
10491049
# - update the route to point to the new NHG and assert the first NHG is now deleted as it's not referenced
10501050
# anymore
1051-
def test_remove_referenced_nhg():
1051+
def remove_referenced_nhg_test():
10521052
# Add a route referencing the new group
10531053
fvs = swsscommon.FieldValuePairs([('nexthop_group', 'group1')])
10541054
self.rt_ps.set('2.2.2.0/24', fvs)
@@ -1081,7 +1081,7 @@ def test_remove_referenced_nhg():
10811081
# - update the route created in `test_remove_referenced_nhg` to own the NHG with the same details as the
10821082
# previous one and assert a new NHG and 2 new NHGMs are added
10831083
# - update the route to point back to the original NHG and assert the routeOrch's owned NHG is deleted
1084-
def test_routeorch_nhgorch_interop():
1084+
def routeorch_nhgorch_interop_test():
10851085
rt_id = self.get_route_id('2.2.2.0/24')
10861086
assert rt_id is not None
10871087

@@ -1113,7 +1113,7 @@ def test_routeorch_nhgorch_interop():
11131113
# Test scenario:
11141114
# - create a new NHG with the same details as the previous NHG and assert a new NHG and 2 new NHGMs are created
11151115
# - update the route to point to the new NHG and assert its SAI NHG ID changes
1116-
def test_identical_nhgs():
1116+
def identical_nhgs_test():
11171117
rt_id = self.get_route_id('2.2.2.0/24')
11181118
assert rt_id is not None
11191119

@@ -1135,7 +1135,7 @@ def test_identical_nhgs():
11351135

11361136
# Test scenario:
11371137
# - create a route referencing a NHG that does not exist and assert it is not created
1138-
def test_create_route_inexistent_nhg():
1138+
def create_route_inexistent_nhg_test():
11391139
# Add a route with a NHG that does not exist
11401140
fvs = swsscommon.FieldValuePairs([('nexthop_group', 'group3')])
11411141
self.rt_ps.set('2.2.3.0/24', fvs)
@@ -1147,12 +1147,12 @@ def test_create_route_inexistent_nhg():
11471147

11481148
self.init_test(dvs, 3)
11491149

1150-
test_remove_inexistent_nhg()
1151-
test_nhg_members_validation()
1152-
test_remove_referenced_nhg()
1153-
test_routeorch_nhgorch_interop()
1154-
test_identical_nhgs()
1155-
test_create_route_inexistent_nhg()
1150+
remove_inexistent_nhg_test()
1151+
nhg_members_validation_test()
1152+
remove_referenced_nhg_test()
1153+
routeorch_nhgorch_interop_test()
1154+
identical_nhgs_test()
1155+
create_route_inexistent_nhg_test()
11561156

11571157
# Cleanup
11581158

@@ -1169,7 +1169,7 @@ def test_create_route_inexistent_nhg():
11691169
def test_nhgorch_nh_group(self, dvs, testlog):
11701170
# Test scenario:
11711171
# - create NHG 'group1' and assert it is being added to ASIC DB along with its members
1172-
def test_create_nhg():
1172+
def create_nhg_test():
11731173
# create next hop group in APPL DB
11741174
fvs = swsscommon.FieldValuePairs([('nexthop', '10.0.0.1,10.0.0.3,10.0.0.5'),
11751175
("ifname", "Ethernet0,Ethernet4,Ethernet8")])
@@ -1186,7 +1186,7 @@ def test_create_nhg():
11861186
# Test scenario:
11871187
# - create a route pointing to `group1` and assert it is being added to ASIC DB and pointing to its SAI ID
11881188
# - delete the route and assert it is being removed
1189-
def test_create_route_nhg():
1189+
def create_route_nhg_test():
11901190
# create route in APPL DB
11911191
fvs = swsscommon.FieldValuePairs([("nexthop_group", "group1")])
11921192
self.rt_ps.set("2.2.2.0/24", fvs)
@@ -1209,7 +1209,7 @@ def test_create_route_nhg():
12091209
# - bring the links down one by one and assert the group1's members are subsequently removed and the group
12101210
# still exists
12111211
# - bring the liks up one by one and assert the group1's members are subsequently added back
1212-
def test_link_flap():
1212+
def link_flap_test():
12131213
# bring links down one-by-one
12141214
for i in [0, 1, 2]:
12151215
self.flap_intf(i, 'down')
@@ -1231,7 +1231,7 @@ def test_link_flap():
12311231
# assert it'll only have a member added in ASIC DB
12321232
# - bring the link back up and assert the missing 2 members of `group1` and `group2` are added
12331233
# - remove `group2` and assert it and its members are removed
1234-
def test_validate_invalidate_group_member():
1234+
def validate_invalidate_group_member_test():
12351235
# Bring an interface down
12361236
self.flap_intf(1, 'down')
12371237

@@ -1275,7 +1275,7 @@ def test_validate_invalidate_group_member():
12751275
# - update `group1` to contain the invalid NH and assert it remains only with the unremoved members
12761276
# - configure the invalid NH's interface and assert `group2` gets created and `group1`'s NH is added
12771277
# - delete `group` and assert it is being removed
1278-
def test_inexistent_group_member():
1278+
def inexistent_group_member_test():
12791279
# Create group2 with a NH that does not exist
12801280
fvs = swsscommon.FieldValuePairs([('nexthop', '10.0.0.3,10.0.0.63'),
12811281
("ifname", "Ethernet4,Ethernet124")])
@@ -1315,7 +1315,7 @@ def test_inexistent_group_member():
13151315
# - update `group1` to have 4 members and assert they are all added
13161316
# - update `group1` to have only 1 member and assert the other 3 are removed
13171317
# - update `group1` to have 2 members and assert a new one is added
1318-
def test_update_nhgm_count():
1318+
def update_nhgm_count_test():
13191319
# Update the NHG, adding two new members
13201320
fvs = swsscommon.FieldValuePairs([('nexthop', '10.0.0.1,10.0.0.3,10.0.0.5,10.0.0.7'),
13211321
("ifname", "Ethernet0,Ethernet4,Ethernet8,Ethernet12")])
@@ -1337,12 +1337,12 @@ def test_update_nhgm_count():
13371337

13381338
self.init_test(dvs, 4)
13391339

1340-
test_create_nhg()
1341-
test_create_route_nhg()
1342-
test_link_flap()
1343-
test_validate_invalidate_group_member()
1344-
test_inexistent_group_member()
1345-
test_update_nhgm_count()
1340+
create_nhg_test()
1341+
create_route_nhg_test()
1342+
link_flap_test()
1343+
validate_invalidate_group_member_test()
1344+
inexistent_group_member_test()
1345+
update_nhgm_count_test()
13461346

13471347
# Cleanup
13481348

0 commit comments

Comments
 (0)