Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[config/main.py]Fixed - added a validation such that delete portchann… #445

Merged
merged 1 commit into from
Jan 28, 2019

Conversation

madhupalu
Copy link
Contributor

…el or portchannel members only when it is configured (#277)

commit d7f6154 (HEAD -> azure-277, origin/azure-277)
Author: madhu Pal madhupa@aviznetworks.com
Date: Fri Jan 25 16:58:10 2019 +0000

[config/main.py]Fixed - added a validation such that delete portchannel or portchannel members only when it is configured (#277)

Signed-off by : madhupa@aviznetworks.com

- What I did
Added validation logic such that, delete port channel/port channel members only if the it is configured and exists in configDB.
- How I did it
Fixed config/main.py by checking whether the portchannel or portchannelmember exists in portchannel/portchannelmember table before delete it.
- How to verify it
BEFORE FIX
There is no Error message while delete non existing portchannel/portchannel member
ex1: config portchannel del PortChannel0019
ex2:config portchannel member del PortChannel0019 Ethernet40
Executed without any error message to the user that the portchannel/members are not configured etc.
AFTER FIX
delete portchannel which is not configured
config portchannel del
Ex1:
root@sonic:/home/admin# config portchannel del PortChannel0019
Usage: config portchannel del [OPTIONS] <portchannel_name>
Error: PortChannel0019 is not configured

delete portchannel member which doesn't configured
root@sonic:/home/admin# config portchannel member del PortChannel009 Ethernet80
Usage: config portchannel member del [OPTIONS] <portchannel_name> <port_name>

Error: Ethernet80 is not part of PortChannel009

- Previous command output (if the output of a command-line utility has changed)

- New command output (if the output of a command-line utility has changed)

-->

…el or portchannel members only when it is configured (sonic-net#277)
@prsunny prsunny merged commit dc5d5c4 into sonic-net:master Jan 28, 2019
db.set_entry('PORTCHANNEL_MEMBER', (portchannel_name, port_name), None)
db.set_entry('PORTCHANNEL_MEMBER', portchannel_name + '|' + port_name, None)

if len(db.get_entry('PORTCHANNEL_MEMBER', portchannel_name + '|' + port_namee)) != 0:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

port_namee ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you. I have addressed it and updated the pull request.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@madhupalu, i'll revert this change. Can you create a new PR that fixes this?

prsunny added a commit that referenced this pull request Jan 30, 2019
…ortchannel or portchannel members only when it is configured (#277) (#445)"

This reverts commit dc5d5c4.
prsunny added a commit that referenced this pull request Jan 30, 2019
…ortchannel or portchannel members only when it is configured (#277) (#445)" (#452)

This reverts commit dc5d5c4.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants