File tree 1 file changed +13
-3
lines changed
src/sonic-py-common/sonic_py_common
1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -163,9 +163,8 @@ def get_namespaces_from_linux():
163
163
In a multi asic platform, each ASIC is in a Linux Namespace.
164
164
This method returns list of all the Namespace present on the device
165
165
166
- Note: It is preferable to use this function can be used only
167
- when the config_db is not available.
168
- When configdb is available use get_all_namespaces()
166
+ Note: It is preferable to use this function only when config_db is not
167
+ available. When configdb is available use get_all_namespaces()
169
168
170
169
Returns:
171
170
List of the namespaces present in the system
@@ -281,6 +280,17 @@ def is_port_internal(port_name, namespace=None):
281
280
return False
282
281
283
282
283
+ def get_external_ports (port_names , namespace = None ):
284
+ external_ports = set ()
285
+ ports_config = get_port_table (namespace )
286
+ for port in port_names :
287
+ if port in ports_config :
288
+ if (PORT_ROLE not in ports_config [port ] or
289
+ ports_config [port ][PORT_ROLE ] == EXTERNAL_PORT ):
290
+ external_ports .add (port )
291
+ return external_ports
292
+
293
+
284
294
def is_port_channel_internal (port_channel , namespace = None ):
285
295
286
296
if not is_multi_asic ():
You can’t perform that action at this time.
0 commit comments