[config/main.py]Fixed - added a validation such that delete portchann… #445
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
…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
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)
-->