Skip to content
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

[202012][vlan] Refresh dhcpv6_relay config while adding/deleting a vlan (#2660) #2668

Merged
merged 1 commit into from
Feb 10, 2023

Conversation

yaqiangz
Copy link
Contributor

Why I did

Cherry-pick and resolve conflicts of this PR: #2660
Currently, add/del a vlan doesn't change related dhcpv6_relay config, which is incorrect.

How I did it

  1. Add dhcp_relay table init entry while adding vlan
  2. Delete dhcp_relay related config while deleting vlan
  3. Add unitest

How to verify it

  1. By unitest
===================================================================================================================== test session starts ======================================================================================================================
platform linux -- Python 3.9.2, pytest-6.0.2, py-1.10.0, pluggy-0.13.0 -- /usr/bin/python3
cachedir: .pytest_cache
rootdir: /sonic/src/sonic-utilities, configfile: pytest.ini
plugins: pyfakefs-5.0.0, cov-2.10.1
collected 2171 items  

tests/vlan_test.py::TestVlan::test_show_vlan PASSED                                                                                                                                                                                                      [ 71%]
tests/vlan_test.py::TestVlan::test_show_vlan_brief PASSED                                                                                                                                                                                                [ 72%]
tests/vlan_test.py::TestVlan::test_show_vlan_brief_verbose PASSED                                                                                                                                                                                        [ 72%]
tests/vlan_test.py::TestVlan::test_show_vlan_brief_in_alias_mode PASSED                                                                                                                                                                                  [ 72%]
tests/vlan_test.py::TestVlan::test_show_vlan_brief_explicit_proxy_arp_disable PASSED                                                                                                                                                                     [ 72%]
tests/vlan_test.py::TestVlan::test_show_vlan_config PASSED                                                                                                                                                                                               [ 72%]
tests/vlan_test.py::TestVlan::test_show_vlan_config_in_alias_mode PASSED                                                                                                                                                                                 [ 72%]
tests/vlan_test.py::TestVlan::test_config_vlan_add_vlan_with_invalid_vlanid PASSED                                                                                                                                                                       [ 72%]
tests/vlan_test.py::TestVlan::test_config_vlan_add_vlan_with_exist_vlanid PASSED                                                                                                                                                                         [ 72%]
tests/vlan_test.py::TestVlan::test_config_vlan_del_vlan_with_invalid_vlanid PASSED                                                                                                                                                                       [ 72%]
tests/vlan_test.py::TestVlan::test_config_vlan_del_vlan_with_nonexist_vlanid PASSED                                                                                                                                                                      [ 72%]
tests/vlan_test.py::TestVlan::test_config_vlan_add_member_with_invalid_vlanid PASSED                                                                                                                                                                     [ 72%]
tests/vlan_test.py::TestVlan::test_config_vlan_add_member_with_nonexist_vlanid PASSED                                                                                                                                                                    [ 72%]
tests/vlan_test.py::TestVlan::test_config_vlan_add_exist_port_member PASSED                                                                                                                                                                              [ 72%]
tests/vlan_test.py::TestVlan::test_config_vlan_add_nonexist_port_member PASSED                                                                                                                                                                           [ 72%]
tests/vlan_test.py::TestVlan::test_config_vlan_add_nonexist_portchannel_member PASSED                                                                                                                                                                    [ 72%]
tests/vlan_test.py::TestVlan::test_config_vlan_add_portchannel_member PASSED                                                                                                                                                                             [ 72%]
tests/vlan_test.py::TestVlan::test_config_vlan_add_rif_portchannel_member PASSED                                                                                                                                                                         [ 72%]
tests/vlan_test.py::TestVlan::test_config_vlan_with_vxlanmap_del_vlan PASSED                                                                                                                                                                             [ 72%]
tests/vlan_test.py::TestVlan::test_config_vlan_del_vlan PASSED                                                                                                                                                                                           [ 72%]
tests/vlan_test.py::TestVlan::test_config_vlan_del_nonexist_vlan_member PASSED                                                                                                                                                                           [ 72%]
tests/vlan_test.py::TestVlan::test_config_add_del_vlan_and_vlan_member PASSED                                                                                                                                                                            [ 72%]
tests/vlan_test.py::TestVlan::test_config_add_del_vlan_and_vlan_member_in_alias_mode PASSED                                                                                                                                                              [ 73%]
tests/vlan_test.py::TestVlan::test_config_vlan_proxy_arp_with_nonexist_vlan_intf_table PASSED                                                                                                                                                            [ 73%]
tests/vlan_test.py::TestVlan::test_config_vlan_proxy_arp_with_nonexist_vlan_intf PASSED                                                                                                                                                                  [ 73%]
tests/vlan_test.py::TestVlan::test_config_vlan_proxy_arp_enable PASSED                                                                                                                                                                                   [ 73%]
tests/vlan_test.py::TestVlan::test_config_vlan_proxy_arp_disable PASSED                                                                                                                                                                                  [ 73%]
tests/vlan_test.py::TestVlan::test_config_2_untagged_vlan_on_same_interface PASSED                                                                                                                                                                       [ 73%]
tests/vlan_test.py::TestVlan::test_config_set_router_port_on_member_interface PASSED                                                                                                                                                                     [ 73%]
tests/vlan_test.py::TestVlan::test_config_vlan_add_member_of_portchannel PASSED                                                                                                                                                                          [ 73%]
tests/vlan_test.py::TestVlan::test_config_add_del_vlan_dhcp_relay[ipv4] PASSED                                                                                                                                                                           [ 73%]
tests/vlan_test.py::TestVlan::test_config_add_del_vlan_dhcp_relay[ipv6] PASSED                                                                                                                                                                           [ 73%]


----------- coverage: platform linux, python 3.9.2-final-0 -----------
Name                                                Stmts   Miss Branch BrPart  Cover
-------------------------------------------------------------------------------------
utilities_common/dhcp_relay_util.py                    15      2      2      1    82%
-------------------------------------------------------------------------------------
TOTAL                                               39535  11393  14040   2014    68%
  1. install whl and run cli
admin@bjw-can-720dt-2:~$ sonic-db-cli CONFIG_DB hgetall "DHCP_RELAY|Vlan1001"
{}
admin@bjw-can-720dt-2:~$ sudo config vlan add 1001
admin@bjw-can-720dt-2:~$ sonic-db-cli CONFIG_DB hgetall "DHCP_RELAY|Vlan1001"
{'vlanid': '1001'}
admin@bjw-can-720dt-2:~$ sudo config vlan del 1001
Restarting DHCP relay service...
admin@bjw-can-720dt-2:~$ sonic-db-cli CONFIG_DB hgetall "DHCP_RELAY|Vlan1001"
{}

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)

…c-net#2660)

What I did
Currently, add/del a vlan doesn't change related dhcpv6_relay config, which is incorrect.

How I did it
1. Add dhcp_relay table init entry while adding vlan
2. Delete dhcp_relay related config while deleting vlan
3. Add unitest

How to verify it
1. By unitest
2. install whl and run cli

Signed-off-by: Yaqiang Zhu <yaqiangzhu@microsoft.com>
@yaqiangz yaqiangz merged commit 274184e into sonic-net:202012 Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants