File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
src/sonic-py-common/sonic_py_common Expand file tree Collapse file tree 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():
163163 In a multi asic platform, each ASIC is in a Linux Namespace.
164164 This method returns list of all the Namespace present on the device
165165
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()
169168
170169 Returns:
171170 List of the namespaces present in the system
@@ -281,6 +280,17 @@ def is_port_internal(port_name, namespace=None):
281280 return False
282281
283282
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+
284294def is_port_channel_internal (port_channel , namespace = None ):
285295
286296 if not is_multi_asic ():
You can’t perform that action at this time.
0 commit comments