Skip to content

Commit

Permalink
[config/main.py] addressed review comments and fixed indent issue wit…
Browse files Browse the repository at this point in the history
…h remove_portchannel

Signed-off-by: madhu Pal <madhupa@aviznetworks.com>
  • Loading branch information
madhupalu committed Mar 7, 2019
1 parent b3a5e7b commit 33b0979
Showing 1 changed file with 3 additions and 15 deletions.
18 changes: 3 additions & 15 deletions config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ def remove_portchannel(ctx, portchannel_name):
keys = [(k,v) for k,v in db.get_table('PORTCHANNEL_MEMBER') if k == portchannel_name]
for k in keys:
db.set_entry('PORTCHANNEL_MEMBER', k, None)
db.set_entry('PORTCHANNEL', portchannel_name, None)
db.set_entry('PORTCHANNEL', portchannel_name, None)
else:
ctx.fail("{} is not configured".format(portchannel_name))

Expand All @@ -481,13 +481,7 @@ def add_portchannel_member(ctx, portchannel_name, port_name):

members = port_channel.get('members', [])
if port_name in members:
if get_interface_naming_mode() == "alias":
port_name = interface_name_to_alias(port_name)
if port_name is None:
ctx.fail("'port_name' is None!")
ctx.fail("{} is already a member of {}".format(port_name, portchannel_name))
else:
ctx.fail("{} is already a member of {}".format(port_name, portchannel_name))
ctx.fail("{} is already a member of {}".format(port_name, portchannel_name))

members.append(port_name)
port_channel['members'] = members
Expand All @@ -513,13 +507,7 @@ def del_portchannel_member(ctx, portchannel_name, port_name):

members = port_channel.get('members', [])
if port_name not in members:
if get_interface_naming_mode() == "alias":
port_name = interface_name_to_alias(port_name)
if port_name is None:
ctx.fail("'port_name' is None!")
ctx.fail("{} is not a member of {}".format(port_name, portchannel_name))
else:
ctx.fail("{} is not a member of {}".format(port_name, portchannel_name))
ctx.fail("{} is not a member of {}".format(port_name, portchannel_name))

members.remove(port_name)
if len(members) == 0:
Expand Down

0 comments on commit 33b0979

Please sign in to comment.