-
Notifications
You must be signed in to change notification settings - Fork 666
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
Fix for Switch Port Modes and VLAN CLI Enhancement #3108
Conversation
@qiluo-msft can you please help review this PR! |
Could you provide which PR fixed "nonavailability of YANG Model"? |
Please see YANG PR |
@gechiang & @theasianpianist Can you please help review this PR. Thanks! |
@gechiang @venkatmahalingam @theasianpianist can you all pls help review this PR. Thanks |
@click.argument('port', metavar='<port>', required=True) | ||
@click.option('-m', '--multiple', is_flag=True, help="Add Multiple Vlan(s) in Range or in Comma separated list") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note that --multiple flag is required as we did not add our new functionality to the existing command to keep intact the existing VLAN behavior/command.
@@ -74,57 +99,74 @@ def delete_db_entry(entry_name, db_connector, db_name): | |||
|
|||
|
|||
@vlan.command('del') | |||
@click.argument('vid', metavar='<vid>', required=True, type=int) | |||
@click.argument('vid', metavar='<vid>', required=True) | |||
@click.option('-m', '--multiple', is_flag=True, help="Add Multiple Vlan(s) in Range or in Comma separated list") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note mutliple_vlan_parser will handle vlan(single, comma separated, range) on that list. This vid is exisiting behavior of VLANs. We don't modify existing behavior and added our proposed changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need the --multiple
flag if the parser can already handle all possible inputs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note that --multiple flag is required as we did not add our new functionality to the existing command to keep intact the existing VLAN behavior/command.
@theasianpianist , could you check the reply and signoff if looks good? |
@theasianpianist can you please check responses and sign off this PR if you agree. |
@qiluo-msft can you pls help merge this PR, it's approved by reviewers. |
@qiluo-msft Can you please help merge this PR! Thanks |
@sabakram , could you please confirm if all the previous CLI commands works exactly as expected and no compatibility issue? We have external scripts using these commands and a new image with this change should not break those old commands. Can you confirm? |
Yes, it is confirmed that all previous CLI commands works as expected and no compatibility issue. We only provide these new commands and switchport modes. The utilities PR was reverted earlier due to issues in rollback. Now since YANG model has been merged. We have tested with latest master and GCU rollbacked successfully. Please see below running behavior of these commands |
@qiluo-msft can you pls help merge this PR, thanks. |
elif not is_port: | ||
port_data = config_db.get_entry('PORTCHANNEL',port) | ||
|
||
if "mode" not in port_data: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sabakram , I suspect this line break backward compatibility.
It will wrongly treat a port as routed when 'mode' is not present even though it pass the check in
Line 297:
if (is_port and clicommon.is_port_router_interface(db.cfgdb, port)) or \
(not is_port and clicommon.is_pc_router_interface(db.cfgdb, port)): # TODO: MISSING CONSTRAINT IN YANG MODEL
ctx.fail("{} is in routed mode!\nUse switchport mode command to change port mode".format(port))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @wen587 ,
We are already looking into backward compatibility issues for that we have removed all changes in db_migrator where we remove this default mode routed behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @sabakram , I think not only in db_migrator. But also in vlan config commands.
In sonic-mgmt, the test tests/generic_config_updater/test_dhcp_relay.py
fail with new vlan config commands.
The Ethernet4 was treated as routed mode whereas it was not before.
Please check below error message.
"results": [{"cmd": "config vlan add 108", "cmd_with_timeout": "", "err_msg": "", "rc": 0, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": [], "timeout": 0}, {"cmd": "config interface ip add Vlan108 192.168.8.1/24", "cmd_with_timeout": "", "err_msg": "", "rc": 0, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": [], "timeout": 0}, {"cmd": "config vlan add 109", "cmd_with_timeout": "", "err_msg": "", "rc": 0, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": [], "timeout": 0}, {"cmd": "config interface ip add Vlan109 192.168.9.1/24", "cmd_with_timeout": "", "err_msg": "", "rc": 0, "stderr": "", "stderr_lines": [], "stdout": "", "stdout_lines": [], "timeout": 0}, {"cmd": "config vlan member add 108 Ethernet4", "cmd_with_timeout": "", "err_msg": "", "rc": 2, "stderr": "Usage: config vlan member add [OPTIONS] port\nTry "config vlan member add -h" for help.\n\nError: Ethernet4 is in routed mode!\nUse switchport mode command to change port mode\n", "stderr_lines": ["Usage: config vlan member add [OPTIONS] port", "Try "config vlan member add -h" for help.", "", "Error: Ethernet4 is in routed mode!", "Use switchport mode command to change port mode"], "stdout": "", "stdout_lines": [], "timeout": 0}, {"cmd": "config vlan member add 109 Ethernet4", "cmd_with_timeout": "", "err_msg": "", "rc": 2, "stderr": "Usage: config vlan member add [OPTIONS] port\nTry "config vlan member add -h" for help.\n\nError: Ethernet4 is in routed mode!\nUse switchport mode command to change port mode\n", "stderr_lines": ["Usage: config vlan member add [OPTIONS] port", "Try "config vlan member add -h" for help.", "", "Error: Ethernet4 is in routed mode!", "Use switchport mode command to change port mode"]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@wen587 Hi,
Okay we also remove this check from vlan config to avoid this failure in GCU
#### What I did This PR is Fixture for #3108 The PR was reverted due to backward compatibility issues. As per new suggestions, removed db migrator changes from this new change along with vlan.py & switchport.py changes To Fix issues as per suggestions removed default mode from YANG model and removed minigraph changes: #### How I did it 1. Removed Db migrator changes from code. 2. Modified Vlan.py & Switchport.py changes #### How to verify it New commands have been added in Command-Reference.md All the syntax and examples have been added there and they can be verified by running the specific command
This PR is Fixture for sonic-net#3108 The PR was reverted due to backward compatibility issues. As per new suggestions, removed db migrator changes from this new change along with vlan.py & switchport.py changes To Fix issues as per suggestions removed default mode from YANG model and removed minigraph changes: 1. Removed Db migrator changes from code. 2. Modified Vlan.py & Switchport.py changes New commands have been added in Command-Reference.md All the syntax and examples have been added there and they can be verified by running the specific command
What I did
This PR is Fixture for PR#2419. The original code PR was reverted due to nonavailability of YANG Model. The code provided by this PR is exactly same as reviewed & approved by reveiwers.
To Fix issues we break the code in three PR as per suggestions:
1. yang models without must condition
2. sonic-config-engine
3. sonic-utilities-fix
How I did it
Code logic added in original PR is added again with new PR to resolve issue
How to verify it
New commands have been added in Command-Reference.md All the syntax and examples have been added there and they can be verified by running the specific command