|
1 | 1 | from sonic_py_common import daemon_base
|
2 | 2 | from sonic_py_common import multi_asic
|
| 3 | +from sonic_py_common.interface import backplane_prefix, inband_prefix, recirc_prefix |
3 | 4 | from swsscommon import swsscommon
|
4 | 5 |
|
5 | 6 | SELECT_TIMEOUT_MSECS = 1000
|
@@ -88,6 +89,11 @@ def logical_port_name_to_physical_port_list(self, port_name):
|
88 | 89 | else:
|
89 | 90 | return None
|
90 | 91 |
|
| 92 | +def validate_port(port): |
| 93 | + if port.startswith((backplane_prefix(), inband_prefix(), recirc_prefix())): |
| 94 | + return False |
| 95 | + return True |
| 96 | + |
91 | 97 | def subscribe_port_config_change():
|
92 | 98 | sel = swsscommon.Select()
|
93 | 99 | asic_context = {}
|
@@ -138,6 +144,8 @@ def handle_port_update_event(sel, asic_context, stop_event, logger, port_change_
|
138 | 144 | (key, op, fvp) = port_tbl.pop()
|
139 | 145 | if not key:
|
140 | 146 | break
|
| 147 | + if not validate_port(key): |
| 148 | + continue |
141 | 149 | fvp = dict(fvp) if fvp is not None else {}
|
142 | 150 | if 'index' not in fvp:
|
143 | 151 | fvp['index'] = '-1'
|
@@ -177,6 +185,8 @@ def read_port_config_change(asic_context, port_mapping, logger, port_change_even
|
177 | 185 | (key, op, fvp) = port_tbl.pop()
|
178 | 186 | if not key:
|
179 | 187 | break
|
| 188 | + if not validate_port(key): |
| 189 | + continue |
180 | 190 | if op == swsscommon.SET_COMMAND:
|
181 | 191 | fvp = dict(fvp)
|
182 | 192 | if 'index' not in fvp:
|
@@ -218,6 +228,8 @@ def get_port_mapping():
|
218 | 228 | config_db = daemon_base.db_connect("CONFIG_DB", namespace=namespace)
|
219 | 229 | port_table = swsscommon.Table(config_db, swsscommon.CFG_PORT_TABLE_NAME)
|
220 | 230 | for key in port_table.getKeys():
|
| 231 | + if not validate_port(key): |
| 232 | + continue |
221 | 233 | _, port_config = port_table.get(key)
|
222 | 234 | port_config_dict = dict(port_config)
|
223 | 235 | port_change_event = PortChangeEvent(key, port_config_dict['index'], asic_id, PortChangeEvent.PORT_ADD)
|
|
0 commit comments