Skip to content

[VLAN] Do not allow to delete a VLAN with members #1420

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

Merged
merged 1 commit into from
Feb 24, 2021

Conversation

deran1980
Copy link
Contributor

@deran1980 deran1980 commented Feb 10, 2021

Signed-off-by: allas [email protected]

What I did

In vlan.py , function del_vlan added validation if there is no members assigned to this VLAN. If there are members - the execution of this command is failed with error on the screen.

How I did it

Added validation of the VLAN_MEMBER_CFG_TABLE with the key VLAN_ID. If there are entries with this VLAN_ID - print error:
VLAN ID {} can not be removed. First remove all members assigned to this VLAN.
User should remove all members assigned to this VLAN, and after that he can delete vlan.

How to verify it

sudo config vlan add 200
sudo config vlan member add 200 Ethernet0
sudo config vlan del 200
In this case - you will see error as there are members assigned to this VLAN

sudo config vlan member del 200 Ethernet0
sudo config vlan del 200
Will pass.

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)

@liat-grozovik liat-grozovik changed the title [vlan] Vlan deletion is not allowed when there are members assigned t… [vlan] Do not allow to delete a vlan with members Feb 10, 2021
@liat-grozovik
Copy link
Collaborator

@allas-nvidia please add to the description the error when such delete is aborted.
is there a dependency on sonic-mgmt vlan test? in case the test assumes it can be deleted without deleting members first.

@liat-grozovik liat-grozovik changed the title [vlan] Do not allow to delete a vlan with members [VLAN] Do not allow to delete a VLAN with members Feb 10, 2021
@liat-grozovik
Copy link
Collaborator

rested this please

@liat-grozovik
Copy link
Collaborator

@deran1980 please fix the conflicts and lets make sure it passes tests

@deran1980
Copy link
Contributor Author

@liat-grozovik Conflict is solved. VLAN tests checked and passed.

@liat-grozovik
Copy link
Collaborator

retest this please

@liat-grozovik
Copy link
Collaborator

retest this please

@liat-grozovik liat-grozovik merged commit eb64ecf into sonic-net:master Feb 24, 2021
anand-kumar-subramanian pushed a commit to anand-kumar-subramanian/sonic-utilities that referenced this pull request Mar 2, 2021
…o this VLAN. (sonic-net#1420)

- What I did
In vlan.py , function del_vlan added validation if there is no members assigned to this VLAN. If there are members - the execution of this command is failed with error on the screen.

- How I did it
Added validation of the VLAN_MEMBER_CFG_TABLE with the key VLAN_ID. If there are entries with this VLAN_ID - print error:
VLAN ID {} can not be removed. First remove all members assigned to this VLAN.
User should remove all members assigned to this VLAN, and after that he can delete vlan.

- How to verify it
sudo config vlan add 200
sudo config vlan member add 200 Ethernet0
sudo config vlan del 200
In this case - you will see error as there are members assigned to this VLAN

sudo config vlan member del 200 Ethernet0
sudo config vlan del 200
Will pass.

Signed-off-by: allas <[email protected]>
yxieca pushed a commit that referenced this pull request Mar 3, 2021
…o this VLAN. (#1420)

- What I did
In vlan.py , function del_vlan added validation if there is no members assigned to this VLAN. If there are members - the execution of this command is failed with error on the screen.

- How I did it
Added validation of the VLAN_MEMBER_CFG_TABLE with the key VLAN_ID. If there are entries with this VLAN_ID - print error:
VLAN ID {} can not be removed. First remove all members assigned to this VLAN.
User should remove all members assigned to this VLAN, and after that he can delete vlan.

- How to verify it
sudo config vlan add 200
sudo config vlan member add 200 Ethernet0
sudo config vlan del 200
In this case - you will see error as there are members assigned to this VLAN

sudo config vlan member del 200 Ethernet0
sudo config vlan del 200
Will pass.

Signed-off-by: allas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants