Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@
'toposort==1.6',
'www-authenticate==0.9.2',
'xmltodict==0.12.0',
'lazy-object-proxy',
],
setup_requires= [
'pytest-runner',
Expand Down
5 changes: 3 additions & 2 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import re

import click
import lazy_object_proxy
import utilities_common.cli as clicommon
from sonic_py_common import multi_asic
import utilities_common.multi_asic as multi_asic_util
Expand Down Expand Up @@ -126,8 +127,8 @@ def run_command(command, display_cmd=False, return_cmd=False):
if rc != 0:
sys.exit(rc)

# Global class instance for SONiC interface name to alias conversion
iface_alias_converter = clicommon.InterfaceAliasConverter()
# Lazy global class instance for SONiC interface name to alias conversion
iface_alias_converter = lazy_object_proxy.Proxy(clicommon.GetInterfaceAliasConverter)

#
# Display all storm-control data
Expand Down
8 changes: 6 additions & 2 deletions utilities_common/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import click
import json
import lazy_object_proxy
import netaddr

from natsort import natsorted
Expand Down Expand Up @@ -183,8 +184,11 @@ def alias_to_name(self, interface_alias):
# interface_alias not in port_dict. Just return interface_alias
return interface_alias if sub_intf_sep_idx == -1 else interface_alias + VLAN_SUB_INTERFACE_SEPARATOR + vlan_id

# Global class instance for SONiC interface name to alias conversion
iface_alias_converter = InterfaceAliasConverter()
def GetInterfaceAliasConverter():
return InterfaceAliasConverter()

# Lazy global class instance for SONiC interface name to alias conversion
iface_alias_converter = lazy_object_proxy.Proxy(GetInterfaceAliasConverter)

def get_interface_naming_mode():
mode = os.getenv('SONIC_CLI_IFACE_MODE')
Expand Down