[config] Fix issues on config remove_portchannel #1206
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.
- What I did
Fixed the behaviour of
config portchannel del
commandIn current remove_portchannel code, it didn't check whether the portchannel is configured with an ip address before delete, as a result, it messed up the redis config db.
Also in current code, it didn't remove the PortChannel interface under PORTCHANNEL_INTERFACE when deleting, so also leaving junk when deleting PortChannel
- How I did it
In addition to previous implemented portchannel member check code, now it also checks if the ip is configured on portchannel.
If the IP is configured the delete process is aborted.
While deleting now it will also delete the interface under PORTCHANNEL_INTERFACE.
- How to verify it
As You can see the PortChannel's IP address and Portchannel under PORTCHANNEL_INTERFACE still exists.
- 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)