From e04bb436eabe135eca2482852dc492599432d44b Mon Sep 17 00:00:00 2001 From: Stephen Sun <5379172+stephenxs@users.noreply.github.com> Date: Wed, 2 Nov 2022 10:05:29 +0800 Subject: [PATCH] Fix vs test issue: failed to remove vlan due to referenced by vlan interface (#2504) *Fix: remove vlan interface before removing the vlan itself --- tests/dvslib/dvs_vlan.py | 4 ++++ tests/test_vlan.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/tests/dvslib/dvs_vlan.py b/tests/dvslib/dvs_vlan.py index ad024a2f63ac..578a197465c3 100644 --- a/tests/dvslib/dvs_vlan.py +++ b/tests/dvslib/dvs_vlan.py @@ -46,6 +46,10 @@ def remove_vlan_member(self, vlanID, interface): member = "Vlan{}|{}".format(vlanID, interface) self.config_db.delete_entry("VLAN_MEMBER", member) + def remove_vlan_interface(self, vlanID): + vlan = "Vlan{}".format(vlanID) + self.config_db.delete_entry("VLAN_INTERFACE", vlan) + def check_app_db_vlan_fields(self, fvs, admin_status="up", mtu="9100"): assert fvs.get("admin_status") == admin_status assert fvs.get("mtu") == mtu diff --git a/tests/test_vlan.py b/tests/test_vlan.py index 25adc1e69767..28d3de3a2959 100644 --- a/tests/test_vlan.py +++ b/tests/test_vlan.py @@ -459,6 +459,7 @@ def arp_accept_disabled(): wait_for_result(arp_accept_disabled, PollingConfig(), "IPv4 arp_accept not disabled") + self.dvs_vlan.remove_vlan_interface(vlan) self.dvs_vlan.remove_vlan(vlan) self.dvs_vlan.get_and_verify_vlan_ids(0) @@ -487,6 +488,7 @@ def proxy_arp_disabled(): wait_for_result(proxy_arp_disabled, PollingConfig(), 'IPv4 proxy_arp or proxy_arp_pvlan not disabled') + self.dvs_vlan.remove_vlan_interface(vlan) self.dvs_vlan.remove_vlan(vlan) self.dvs_vlan.get_and_verify_vlan_ids(0)