Skip to content

Commit 827fcee

Browse files
authored
[chassis][routecheck]filter out the chassis internal interfaces (#1798)
1 parent 4d732c6 commit 827fcee

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

scripts/route_check.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import traceback
4848

4949
from swsscommon import swsscommon
50+
from utilities_common import chassis
5051

5152
APPL_DB_NAME = 'APPL_DB'
5253
ASIC_DB_NAME = 'ASIC_DB'
@@ -348,6 +349,9 @@ def filter_out_local_interfaces(keys):
348349
local_if_lst = {'eth0', 'docker0'}
349350
local_if_lo = [r'tun0', r'lo', r'Loopback\d+']
350351

352+
chassis_local_intfs = chassis.get_chassis_local_interfaces()
353+
local_if_lst.update(set(chassis_local_intfs))
354+
351355
db = swsscommon.DBConnector(APPL_DB_NAME, 0)
352356
tbl = swsscommon.Table(db, 'ROUTE_TABLE')
353357

utilities_common/chassis.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import os
2+
from sonic_py_common import device_info
3+
4+
def get_chassis_local_interfaces():
5+
lst = []
6+
platform = device_info.get_platform()
7+
chassisdb_conf=os.path.join('/usr/share/sonic/device/', platform, "chassisdb.conf")
8+
if os.path.exists(chassisdb_conf):
9+
lines=[]
10+
with open(chassisdb_conf, 'r') as f:
11+
lines = f.readlines()
12+
for line in lines:
13+
line = line.strip()
14+
if "chassis_internal_intfs" in line:
15+
data = line.split("=")
16+
lst = data[1].split(",")
17+
return lst
18+
return lst

0 commit comments

Comments
 (0)