Skip to content

Commit 3ae044a

Browse files
What I did:
Implemented recursive nexthop group enhancement in Orchagent (NhgOrch). They have been proposed in: sonic-net/SONiC#1636 Why I did it: These changes are required to handle a new field - "nexthop_group" in the App DB NEXT_HOP_GROUP_TABLE. Such nexthop groups are called recursive nexthop groups. This field contains the list of member (singleton) nexthop groups. Such recursive nexthop groups are represented by NEXT_HOP_GROUP objects.
1 parent 6776a5f commit 3ae044a

1 file changed

Lines changed: 18 additions & 17 deletions

File tree

tests/test_nhg.py

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,22 +1550,6 @@ def create_route_inexistent_nhg_test():
15501550
self.asic_db.wait_for_n_keys(self.ASIC_NHGM_STR, self.asic_nhgms_count)
15511551

15521552
def test_nhgorch_nh_group(self, dvs, testlog):
1553-
# Test scenario:
1554-
# - create NHG 'group1' and assert it is being added to ASIC DB along with its members
1555-
def create_nhg_test():
1556-
# create next hop group in APPL DB
1557-
fvs = swsscommon.FieldValuePairs([('nexthop', '10.0.0.1,10.0.0.3,10.0.0.5'),
1558-
("ifname", "Ethernet0,Ethernet4,Ethernet8")])
1559-
self.nhg_ps.set("group1", fvs)
1560-
1561-
# check if group was propagated to ASIC DB
1562-
self.asic_db.wait_for_n_keys(self.ASIC_NHG_STR, self.asic_nhgs_count + 1)
1563-
assert self.nhg_exists('group1')
1564-
1565-
# check if members were propagated to ASIC DB
1566-
self.asic_db.wait_for_n_keys(self.ASIC_NHGM_STR, self.asic_nhgms_count + 3)
1567-
assert len(self.get_nhgm_ids('group1')) == 3
1568-
15691553
# Test scenario:
15701554
# - create recursive nhg - rec_grp1 with two members - grp1 and grp2 only one of which exists
15711555
# - create singleton nhg grp2 and check if the rec_grp1 is updated with both the members
@@ -1617,7 +1601,7 @@ def create_recursive_nhg_test():
16171601

16181602
# check that the group was not propagated to ASIC DB
16191603
self.asic_db.wait_for_n_keys(self.ASIC_NHG_STR, self.asic_nhgs_count + 1)
1620-
assert self.nhg_exists('rec_grp2')
1604+
assert not self.nhg_exists('rec_grp2')
16211605

16221606
self.nhg_ps._del("rec_grp2")
16231607
self.nhg_ps._del("rec_grp1")
@@ -1627,6 +1611,22 @@ def create_recursive_nhg_test():
16271611
self.asic_db.wait_for_n_keys(self.ASIC_NHG_STR, self.asic_nhgs_count)
16281612
self.asic_db.wait_for_n_keys(self.ASIC_NHGM_STR, self.asic_nhgms_count)
16291613

1614+
# Test scenario:
1615+
# - create NHG 'group1' and assert it is being added to ASIC DB along with its members
1616+
def create_nhg_test():
1617+
# create next hop group in APPL DB
1618+
fvs = swsscommon.FieldValuePairs([('nexthop', '10.0.0.1,10.0.0.3,10.0.0.5'),
1619+
("ifname", "Ethernet0,Ethernet4,Ethernet8")])
1620+
self.nhg_ps.set("group1", fvs)
1621+
1622+
# check if group was propagated to ASIC DB
1623+
self.asic_db.wait_for_n_keys(self.ASIC_NHG_STR, self.asic_nhgs_count + 1)
1624+
assert self.nhg_exists('group1')
1625+
1626+
# check if members were propagated to ASIC DB
1627+
self.asic_db.wait_for_n_keys(self.ASIC_NHGM_STR, self.asic_nhgms_count + 3)
1628+
assert len(self.get_nhgm_ids('group1')) == 3
1629+
16301630
# Test scenario:
16311631
# - create a route pointing to `group1` and assert it is being added to ASIC DB and pointing to its SAI ID
16321632
# - delete the route and assert it is being removed
@@ -1781,6 +1781,7 @@ def update_nhgm_count_test():
17811781

17821782
self.init_test(dvs, 4)
17831783

1784+
create_recursive_nhg_test()
17841785
create_nhg_test()
17851786
create_route_nhg_test()
17861787
link_flap_test()

0 commit comments

Comments
 (0)