diff --git a/scripts/route_check.py b/scripts/route_check.py index 8beaf42c8b41..fdbdd0a5f866 100755 --- a/scripts/route_check.py +++ b/scripts/route_check.py @@ -47,6 +47,7 @@ import traceback from swsscommon import swsscommon +from utilities_common import chassis APPL_DB_NAME = 'APPL_DB' ASIC_DB_NAME = 'ASIC_DB' @@ -348,6 +349,9 @@ def filter_out_local_interfaces(keys): local_if_lst = {'eth0', 'docker0'} local_if_lo = [r'tun0', r'lo', r'Loopback\d+'] + chassis_local_intfs = chassis.get_chassis_local_interfaces() + local_if_lst.update(set(chassis_local_intfs)) + db = swsscommon.DBConnector(APPL_DB_NAME, 0) tbl = swsscommon.Table(db, 'ROUTE_TABLE') diff --git a/utilities_common/chassis.py b/utilities_common/chassis.py new file mode 100644 index 000000000000..1283bca580f7 --- /dev/null +++ b/utilities_common/chassis.py @@ -0,0 +1,18 @@ +import os +from sonic_py_common import device_info + +def get_chassis_local_interfaces(): + lst = [] + platform = device_info.get_platform() + chassisdb_conf=os.path.join('/usr/share/sonic/device/', platform, "chassisdb.conf") + if os.path.exists(chassisdb_conf): + lines=[] + with open(chassisdb_conf, 'r') as f: + lines = f.readlines() + for line in lines: + line = line.strip() + if "chassis_internal_intfs" in line: + data = line.split("=") + lst = data[1].split(",") + return lst + return lst