From bfd2130b51d003696c97de035cf2189ed079755b Mon Sep 17 00:00:00 2001 From: Nikola Dancejic Date: Tue, 31 Jan 2023 17:58:21 +0000 Subject: [PATCH 1/4] [test_mux] add sleep in test_NH What I did: added sleep after adding/removing neighbors in test_NH Why I did it: resolve PR failures due to timing issues between adding/deleting neighbors and them being present in the asic_db Signed-off-by: Nikola Dancejic --- tests/test_mux.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/test_mux.py b/tests/test_mux.py index 9cb14997ca..b9d2bf6a9d 100644 --- a/tests/test_mux.py +++ b/tests/test_mux.py @@ -551,6 +551,7 @@ def create_and_test_NH_routes(self, appdb, asicdb, dvs, dvs_route, mac): self.set_mux_state(appdb, "Ethernet0", "active") self.add_neighbor(dvs, neigh_ip, mac) self.add_neighbor(dvs, neigh_ipv6, mac) + time.sleep(1) dvs.runcmd( "vtysh -c \"configure terminal\" -c \"ip route " + nh_route + " " + neigh_ip + "\"" @@ -572,6 +573,7 @@ def create_and_test_NH_routes(self, appdb, asicdb, dvs, dvs_route, mac): self.del_neighbor(dvs, neigh_ip) self.del_neighbor(dvs, neigh_ipv6) + time.sleep(1) self.check_nexthop_in_asic_db(asicdb, rtkeys[0], True) self.check_nexthop_in_asic_db(asicdb, rtkeys_ipv6[0], True) @@ -582,6 +584,7 @@ def create_and_test_NH_routes(self, appdb, asicdb, dvs, dvs_route, mac): self.add_neighbor(dvs, neigh_ip, mac) self.add_neighbor(dvs, neigh_ipv6, mac) + time.sleep(1) self.check_nexthop_in_asic_db(asicdb, rtkeys[0]) self.check_nexthop_in_asic_db(asicdb, rtkeys_ipv6[0]) dvs.runcmd( From 190754a79f1553f018966dd7132574fceaea0fd1 Mon Sep 17 00:00:00 2001 From: Nikola Dancejic Date: Tue, 31 Jan 2023 23:46:39 +0000 Subject: [PATCH 2/4] waiting for asic entries Signed-off-by: Nikola Dancejic --- tests/test_mux.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tests/test_mux.py b/tests/test_mux.py index b9d2bf6a9d..77ef0eb848 100644 --- a/tests/test_mux.py +++ b/tests/test_mux.py @@ -551,7 +551,8 @@ def create_and_test_NH_routes(self, appdb, asicdb, dvs, dvs_route, mac): self.set_mux_state(appdb, "Ethernet0", "active") self.add_neighbor(dvs, neigh_ip, mac) self.add_neighbor(dvs, neigh_ipv6, mac) - time.sleep(1) + asicdb.wait_for_entry(self.ASIC_NEIGH_TABLE, neigh_ip) + asicdb.wait_for_entry(self.ASIC_NEIGH_TABLE, neigh_ipv6) dvs.runcmd( "vtysh -c \"configure terminal\" -c \"ip route " + nh_route + " " + neigh_ip + "\"" @@ -561,6 +562,7 @@ def create_and_test_NH_routes(self, appdb, asicdb, dvs, dvs_route, mac): " " + neigh_ipv6 + "\"" ) apdb.wait_for_entry("ROUTE_TABLE", nh_route) + rtkeys = dvs_route.check_asicdb_route_entries([nh_route]) rtkeys_ipv6 = dvs_route.check_asicdb_route_entries([nh_route_ipv6]) self.check_nexthop_in_asic_db(asicdb, rtkeys[0]) @@ -573,7 +575,9 @@ def create_and_test_NH_routes(self, appdb, asicdb, dvs, dvs_route, mac): self.del_neighbor(dvs, neigh_ip) self.del_neighbor(dvs, neigh_ipv6) - time.sleep(1) + asicdb.wait_for_deleted_entry(self.ASIC_NEIGH_TABLE, neigh_ip) + asicdb.wait_for_deleted_entry(self.ASIC_NEIGH_TABLE, neigh_ipv6) + self.check_nexthop_in_asic_db(asicdb, rtkeys[0], True) self.check_nexthop_in_asic_db(asicdb, rtkeys_ipv6[0], True) @@ -584,7 +588,9 @@ def create_and_test_NH_routes(self, appdb, asicdb, dvs, dvs_route, mac): self.add_neighbor(dvs, neigh_ip, mac) self.add_neighbor(dvs, neigh_ipv6, mac) - time.sleep(1) + asicdb.wait_for_entry(self.ASIC_NEIGH_TABLE, neigh_ip) + asicdb.wait_for_entry(self.ASIC_NEIGH_TABLE, neigh_ipv6) + self.check_nexthop_in_asic_db(asicdb, rtkeys[0]) self.check_nexthop_in_asic_db(asicdb, rtkeys_ipv6[0]) dvs.runcmd( From 81d1f4099bd4d87c0d3b277c38bf428495d42bf3 Mon Sep 17 00:00:00 2001 From: Nikola Dancejic Date: Thu, 2 Feb 2023 21:35:56 +0000 Subject: [PATCH 3/4] fixing errors Signed-off-by: Nikola Dancejic --- tests/test_mux.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/tests/test_mux.py b/tests/test_mux.py index 77ef0eb848..7ed51f1fb4 100644 --- a/tests/test_mux.py +++ b/tests/test_mux.py @@ -551,8 +551,6 @@ def create_and_test_NH_routes(self, appdb, asicdb, dvs, dvs_route, mac): self.set_mux_state(appdb, "Ethernet0", "active") self.add_neighbor(dvs, neigh_ip, mac) self.add_neighbor(dvs, neigh_ipv6, mac) - asicdb.wait_for_entry(self.ASIC_NEIGH_TABLE, neigh_ip) - asicdb.wait_for_entry(self.ASIC_NEIGH_TABLE, neigh_ipv6) dvs.runcmd( "vtysh -c \"configure terminal\" -c \"ip route " + nh_route + " " + neigh_ip + "\"" @@ -562,6 +560,7 @@ def create_and_test_NH_routes(self, appdb, asicdb, dvs, dvs_route, mac): " " + neigh_ipv6 + "\"" ) apdb.wait_for_entry("ROUTE_TABLE", nh_route) + apdb.wait_for_entry("ROUTE_TABLE", nh_route_ipv6) rtkeys = dvs_route.check_asicdb_route_entries([nh_route]) rtkeys_ipv6 = dvs_route.check_asicdb_route_entries([nh_route_ipv6]) @@ -575,8 +574,8 @@ def create_and_test_NH_routes(self, appdb, asicdb, dvs, dvs_route, mac): self.del_neighbor(dvs, neigh_ip) self.del_neighbor(dvs, neigh_ipv6) - asicdb.wait_for_deleted_entry(self.ASIC_NEIGH_TABLE, neigh_ip) - asicdb.wait_for_deleted_entry(self.ASIC_NEIGH_TABLE, neigh_ipv6) + apdb.wait_for_deleted_entry(self.APP_NEIGH_TABLE, neigh_ip) + apdb.wait_for_deleted_entry(self.APP_NEIGH_TABLE, neigh_ipv6) self.check_nexthop_in_asic_db(asicdb, rtkeys[0], True) self.check_nexthop_in_asic_db(asicdb, rtkeys_ipv6[0], True) @@ -588,8 +587,8 @@ def create_and_test_NH_routes(self, appdb, asicdb, dvs, dvs_route, mac): self.add_neighbor(dvs, neigh_ip, mac) self.add_neighbor(dvs, neigh_ipv6, mac) - asicdb.wait_for_entry(self.ASIC_NEIGH_TABLE, neigh_ip) - asicdb.wait_for_entry(self.ASIC_NEIGH_TABLE, neigh_ipv6) + apdb.wait_for_entry(self.APP_NEIGH_TABLE, neigh_ip) + apdb.wait_for_entry(self.APP_NEIGH_TABLE, neigh_ipv6) self.check_nexthop_in_asic_db(asicdb, rtkeys[0]) self.check_nexthop_in_asic_db(asicdb, rtkeys_ipv6[0]) @@ -609,8 +608,12 @@ def create_and_test_NH_routes(self, appdb, asicdb, dvs, dvs_route, mac): "vtysh -c \"configure terminal\" -c \"no ipv6 route " + nh_route_ipv6 + " " + neigh_ipv6 + "\"" ) + apdb.wait_for_deleted_entry("ROUTE_TABLE", nh_route) + apdb.wait_for_deleted_entry("ROUTE_TABLE", nh_route_ipv6) self.del_neighbor(dvs, neigh_ip) self.del_neighbor(dvs, neigh_ipv6) + apdb.wait_for_deleted_entry(self.APP_NEIGH_TABLE, neigh_ip) + apdb.wait_for_deleted_entry(self.APP_NEIGH_TABLE, neigh_ipv6) def get_expected_sai_qualifiers(self, portlist, dvs_acl): expected_sai_qualifiers = { From 9230dfd5e196537245517f7147f17071aaddc413 Mon Sep 17 00:00:00 2001 From: Nikola Dancejic Date: Fri, 3 Feb 2023 17:05:49 +0000 Subject: [PATCH 4/4] fixing more errors Signed-off-by: Nikola Dancejic --- tests/test_mux.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/tests/test_mux.py b/tests/test_mux.py index 7ed51f1fb4..8313980130 100644 --- a/tests/test_mux.py +++ b/tests/test_mux.py @@ -576,19 +576,19 @@ def create_and_test_NH_routes(self, appdb, asicdb, dvs, dvs_route, mac): self.del_neighbor(dvs, neigh_ipv6) apdb.wait_for_deleted_entry(self.APP_NEIGH_TABLE, neigh_ip) apdb.wait_for_deleted_entry(self.APP_NEIGH_TABLE, neigh_ipv6) + asicdb.wait_for_deleted_entry(self.ASIC_NEIGH_TABLE, neigh_ip) + asicdb.wait_for_deleted_entry(self.ASIC_NEIGH_TABLE, neigh_ip) self.check_nexthop_in_asic_db(asicdb, rtkeys[0], True) self.check_nexthop_in_asic_db(asicdb, rtkeys_ipv6[0], True) # Set state to active, learn neighbor again self.set_mux_state(appdb, "Ethernet0", "active") - self.check_nexthop_in_asic_db(asicdb, rtkeys[0], True) - self.check_nexthop_in_asic_db(asicdb, rtkeys_ipv6[0], True) self.add_neighbor(dvs, neigh_ip, mac) self.add_neighbor(dvs, neigh_ipv6, mac) - apdb.wait_for_entry(self.APP_NEIGH_TABLE, neigh_ip) - apdb.wait_for_entry(self.APP_NEIGH_TABLE, neigh_ipv6) + self.check_neigh_in_asic_db(asicdb, neigh_ip) + self.check_neigh_in_asic_db(asicdb, neigh_ipv6) self.check_nexthop_in_asic_db(asicdb, rtkeys[0]) self.check_nexthop_in_asic_db(asicdb, rtkeys_ipv6[0]) @@ -608,12 +608,8 @@ def create_and_test_NH_routes(self, appdb, asicdb, dvs, dvs_route, mac): "vtysh -c \"configure terminal\" -c \"no ipv6 route " + nh_route_ipv6 + " " + neigh_ipv6 + "\"" ) - apdb.wait_for_deleted_entry("ROUTE_TABLE", nh_route) - apdb.wait_for_deleted_entry("ROUTE_TABLE", nh_route_ipv6) self.del_neighbor(dvs, neigh_ip) self.del_neighbor(dvs, neigh_ipv6) - apdb.wait_for_deleted_entry(self.APP_NEIGH_TABLE, neigh_ip) - apdb.wait_for_deleted_entry(self.APP_NEIGH_TABLE, neigh_ipv6) def get_expected_sai_qualifiers(self, portlist, dvs_acl): expected_sai_qualifiers = {