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 @@ -135,9 +135,8 @@ def get_namespaces_from_linux():
135
135
In a multi asic platform, each ASIC is in a Linux Namespace.
136
136
This method returns list of all the Namespace present on the device
137
137
138
- Note: It is preferable to use this function can be used only
139
- when the config_db is not available.
140
- When configdb is available use get_all_namespaces()
138
+ Note: It is preferable to use this function only when config_db is not
139
+ available. When configdb is available use get_all_namespaces()
141
140
142
141
Returns:
143
142
List of the namespaces present in the system
@@ -253,6 +252,17 @@ def is_port_internal(port_name, namespace=None):
253
252
return False
254
253
255
254
255
+ def get_external_ports (port_names , namespace = None ):
256
+ external_ports = set ()
257
+ ports_config = get_port_table (namespace )
258
+ for port in port_names :
259
+ if port in ports_config :
260
+ if (PORT_ROLE not in ports_config [port ] or
261
+ ports_config [port ][PORT_ROLE ] == EXTERNAL_PORT ):
262
+ external_ports .add (port )
263
+ return external_ports
264
+
265
+
256
266
def is_port_channel_internal (port_channel , namespace = None ):
257
267
258
268
if not is_multi_asic ():
You can’t perform that action at this time.
0 commit comments