Skip to content

Commit

Permalink
[show ip interface] Add support for 'alias' interface naming mode (so…
Browse files Browse the repository at this point in the history
  • Loading branch information
jleveque authored Mar 27, 2019
1 parent 5f1de81 commit 98cdebb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions show/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ def name_to_alias(self, interface_name):
if interface_name == port_name:
return self.port_dict[port_name]['alias']

click.echo("Invalid interface {}".format(interface_name))
raise click.Abort()
# interface_name not in port_dict. Just return interface_name
return interface_name

def alias_to_name(self, interface_alias):
"""Return SONiC interface name if vendor
Expand All @@ -91,8 +91,8 @@ def alias_to_name(self, interface_alias):
if interface_alias == self.port_dict[port_name]['alias']:
return port_name

click.echo("Invalid interface {}".format(interface_alias))
raise click.Abort()
# interface_alias not in port_dict. Just return interface_alias
return interface_alias


# Global Config object
Expand Down Expand Up @@ -902,7 +902,12 @@ def interfaces():
oper = get_if_oper_state(iface)
else:
oper = "down"

if get_interface_mode() == "alias":
iface = iface_alias_converter.name_to_alias(iface)

data.append([iface, ifaddresses[0][1], admin + "/" + oper])

for ifaddr in ifaddresses[1:]:
data.append(["", ifaddr[1], ""])

Expand Down

0 comments on commit 98cdebb

Please sign in to comment.