Validations checks while creating and deleting a Portchannel#1326
Merged
prsunny merged 3 commits intosonic-net:masterfrom Jan 20, 2021
Merged
Validations checks while creating and deleting a Portchannel#1326prsunny merged 3 commits intosonic-net:masterfrom
prsunny merged 3 commits intosonic-net:masterfrom
Conversation
Signed-off-by: Akhilesh Samineni <akhilesh.samineni@broadcom.com>
Signed-off-by: Akhilesh Samineni <akhilesh.samineni@broadcom.com>
Contributor
Author
|
Retest this please. |
7 similar comments
Contributor
Author
|
Retest this please. |
Contributor
Author
|
Retest this please. |
Contributor
Author
|
Retest this please. |
Contributor
Author
|
Retest this please. |
Contributor
Author
|
Retest this please. |
Contributor
Author
|
Retest this please. |
Contributor
Author
|
Retest this please. |
Contributor
Author
|
@lguohan Please review the changes. |
Contributor
|
Does #1328 supersedes this PR? |
Contributor
Author
Contributor
Author
prsunny
approved these changes
Jan 20, 2021
anand-kumar-subramanian
pushed a commit
to anand-kumar-subramanian/sonic-utilities
that referenced
this pull request
Mar 2, 2021
…et#1326) Added below validation checks when a portchannel is created by the user: 1 if a given portchannel name is valid or not 2 if a given portchannel name is already created by user (exists in CONFIG_DB) Added below validation checks when a portchannel is attempted for deletion by the user: 1 if a given portchannel name is valid or not 2 if a given portchannel name exists in exists in CONFIG_DB or not (throw an error if it does not exist) Signed-off-by: Akhilesh Samineni <akhilesh.samineni@broadcom.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Added below validation checks when a portchannel is created by the user:
1 if a given portchannel name is valid or not
2 if a given portchannel name is already created by user (exists in CONFIG_DB)
Added below validation checks when a portchannel is attempted for deletion by the user:
1 if a given portchannel name is valid or not
2 if a given portchannel name exists in exists in CONFIG_DB or not (throw an error if it does not exist)
More details :
Issue 1 : Creating a invalid Portchannel name
If we create a portchannel with invalid name, it gets added to CONFIG_DB, like below
root@sonic:/home/admin# config portchannel add PortChan001
root@sonic:/home/admin#
root@sonic:/home/admin# sonic-db-cli CONFIG_DB keys *PORTCHANNEL*
PORTCHANNEL|PortChan001
root@sonic:/home/admin#
Fix: Added a PortChannel name validation check, like below
root@sonic:/home/admin# config portchannel add PortChan001
Usage: config portchannel add [OPTIONS] <portchannel_name>
Error: PortChan001 is invalid!, name should have prefix 'PortChannel' and suffix '<0-9999>'
root@sonic:/home/admin#
Issue 2 : Creating a same PortChannel again and deleting the portchannel which is not exists
If we create a same portchannel again, it is allowing, like below
root@sonic:/home/admin# config portchannel add PortChannel0001
root@sonic:/home/admin#
root@sonic:/home/admin# sonic-db-cli CONFIG_DB keys *PORTCHANNEL*
PORTCHANNEL|PortChannel0001
root@sonic:/home/admin#
root@sonic:/home/admin# config portchannel add PortChannel0001
root@sonic:/home/admin#
root@sonic:/home/admin# sonic-db-cli CONFIG_DB keys *PORTCHANNEL*
PORTCHANNEL|PortChannel0001
root@sonic:/home/admin#
If we delete a portchannel which is not exists, it is allowing
root@sonic:/home/admin# sonic-db-cli CONFIG_DB keys *PORTCHANNEL*
PORTCHANNEL|PortChannel0001
root@sonic:/home/admin#
root@sonic:/home/admin# config portchannel del PortChannel0002
root@sonic:/home/admin#
Fix : Added a validation check like given portchannel exists in CONFIG_DB or not
While creating a portchannel
root@sonic:/home/admin# config portchannel add PortChannel0001
root@sonic:/home/admin#
root@sonic:/home/admin# sonic-db-cli CONFIG_DB keys *PORTCHANNEL*
PORTCHANNEL|PortChannel0001
root@sonic:/home/admin#
root@sonic:/home/admin# config portchannel add PortChannel0001
Usage: config portchannel add [OPTIONS] <portchannel_name>
Error: PortChannel0001 already exists!
root@sonic:/home/admin#
While deleting a portchannel
root@sonic:/home/admin# sonic-db-cli CONFIG_DB keys *PORTCHANNEL*
PORTCHANNEL|PortChannel0001
root@sonic:/home/admin#
root@sonic:/home/admin# config portchannel del PortChannel0002
Usage: config portchannel del [OPTIONS] <portchannel_name>
Error: PortChannel0002 is not present.
root@sonic:/home/admin#
Signed-off-by: Akhilesh Samineni akhilesh.samineni@broadcom.com