From 89eb3401b12ad33d0499706df8f3868ffd47c07b Mon Sep 17 00:00:00 2001 From: Yurii Lisovskyi Date: Fri, 15 Sep 2023 16:54:22 +0300 Subject: [PATCH] Remove unnecessary adding BPs to default VLAN on init (#193) Signed-off-by: Yurii Lisovskyi --- common/sai_npu.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/common/sai_npu.py b/common/sai_npu.py index edb69c46..6f51bf16 100644 --- a/common/sai_npu.py +++ b/common/sai_npu.py @@ -207,11 +207,14 @@ def set_sku_mode(self, sku): # Remove existing ports num_ports = len(self.dot1q_bp_oids) for idx in range(num_ports): - self.remove_vlan_member(self.default_vlan_oid, self.dot1q_bp_oids[idx]) - self.remove(self.dot1q_bp_oids[idx]) - oid = self.get(self.port_oids[idx], ["SAI_PORT_ATTR_PORT_SERDES_ID"]).oid() - if oid != "oid:0x0": + oid = self.get_vlan_member(self.default_vlan_oid, self.dot1q_bp_oids[idx]) + if oid: self.remove(oid) + self.remove(self.dot1q_bp_oids[idx]) + status, data = self.get(self.port_oids[idx], ["SAI_PORT_ATTR_PORT_SERDES_ID"], do_assert=False) + serdes_oid = data.oid() + if status == "SAI_STATUS_SUCCESS" and serdes_oid != "oid:0x0": + self.remove(serdes_oid) self.remove(self.port_oids[idx]) self.port_oids.clear() self.dot1q_bp_oids.clear()