diff --git a/src/south/sonic/goldstone/south/sonic/interfaces.py b/src/south/sonic/goldstone/south/sonic/interfaces.py index 760eea8d..0840e7bb 100644 --- a/src/south/sonic/goldstone/south/sonic/interfaces.py +++ b/src/south/sonic/goldstone/south/sonic/interfaces.py @@ -473,9 +473,35 @@ async def event_handler(self): "if-name": ifname, "oper-status": self.get_oper_status(ifname), } + self.ufd_handler(ifname, oper_status) self.send_notification(eventname, notif) self.sonic.notif_if[ifname] = oper_status + def ufd_handler(self, ifname, oper_status): + downlinks = self.get_downlinks(ifname) + + if not downlinks: + return + + if oper_status == "down": + for port in downlinks: + self.sonic.set_config_db(port, "admin_status", "down") + elif oper_status == "up": + for port in downlinks: + downlink_admin_status = self.get_running_data( + f"/goldstone-interfaces:interfaces/interface[name='{port}']/config/admin-status", + None, + ) + if downlink_admin_status == "UP": + self.sonic.set_config_db(port, "admin_status", "up") + + def get_downlinks(self, ifname): + ufd_list = self.get_ufd() + for data in ufd_list: + uplinks = data.get("config", {}).get("uplink", []) + if ifname in uplinks: + return list(data.get("config", {}).get("downlink", [])) + def clear_counters(self, xpath, input_params, event, priv): logger.debug( f"clear_counters: xpath: {xpath}, input: {input}, event: {event}, priv: {priv}"