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

[dhcp_server] Add support for smart switch in dhcprelayd #17779

Merged
merged 2 commits into from
Jan 16, 2024

Conversation

yaqiangz
Copy link
Contributor

@yaqiangz yaqiangz commented Jan 15, 2024

Why I did it

Add support for smart switch in dhcprelayd

Work item tracking
  • Microsoft ADO (number only): 26437270

How I did it

  1. Add checker support for smart switch and add related UTs
    1.1 Only enable FEATURE table checker when dhcprelayd init
    1.2 In function refresh_dhcrelay, enable or disable VLAN/MID_PLANE table checkers as needed.
    1.3 When dhcp_server feature state change, do changes for checkers:

    • disable -> enabled: Should enable DHCP_SERVER_IPV4 checker
    • enabled -> enabled: Refer to refresh_dhcrelay in 1.2
    • enabled -> disabled: Should disable
    • disabled -> disabled: not need to update
  2. Extract function _proceed_with_check_res in function wait to let UT cover it.

How to verify it

UTs passed

collected 430 items                                                                                                                                                                                                                                                                      

tests/test_dhcp_cfggen.py ......................                                                                                                                                                                                                                                   [  5%]
tests/test_dhcp_db_monitor.py ...............................................................................................................................................                                                                                                      [ 38%]
tests/test_dhcp_lease.py .....                                                                                                                                                                                                                                                     [ 39%]
tests/test_dhcprelayd.py ................................................................................................................................................................                                                                                          [ 76%]
tests/test_dhcpservd.py .......                                                                                                                                                                                                                                                    [ 78%]
tests/test_smart_switch.py .......................................................                                                                                                                                                                                                 [ 91%]
tests/test_utils.py ......................................                                                                                                                                                                                                                         [100%]

----------- coverage: platform linux, python 3.9.2-final-0 -----------
Name                                      Stmts   Miss Branch BrPart     Cover   Missing
----------------------------------------------------------------------------------------
dhcp_utilities/dhcpservd/dhcpservd.py        67      4     14      0    92.59%   91-98
dhcp_utilities/dhcpservd/dhcp_lease.py       95      3     30      4    94.40%   57->59, 59, 60->61, 61, 74->76, 112->134, 153
dhcp_utilities/dhcpservd/dhcp_cfggen.py     242      6    104      1    97.98%   250-254, 342->344, 344
dhcp_utilities/common/utils.py               78      1     42      1    98.33%   129->134, 134
dhcp_utilities/dhcprelayd/dhcprelayd.py     212      3     74      1    98.60%   102->90, 119-124
----------------------------------------------------------------------------------------
TOTAL                                       984     17    358      7    98.06%

2 files skipped due to complete coverage.

Required test coverage of 80.0% reached. Total coverage: 98.06%

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

@yaqiangz yaqiangz force-pushed the master_ss_dhcprelayd branch from 508386c to 4bc4a45 Compare January 15, 2024 07:03
@yaqiangz yaqiangz marked this pull request as ready for review January 15, 2024 07:05
@yaqiangz yaqiangz requested a review from lguohan as a code owner January 15, 2024 07:05
@yaqiangz yaqiangz force-pushed the master_ss_dhcprelayd branch from 4bc4a45 to 2640ee1 Compare January 15, 2024 07:07
@yaqiangz yaqiangz requested a review from Blueve January 15, 2024 08:25
@yaqiangz yaqiangz force-pushed the master_ss_dhcprelayd branch from 137e931 to 326b969 Compare January 15, 2024 10:53
@yaqiangz yaqiangz force-pushed the master_ss_dhcprelayd branch from 326b969 to 9d4a8bb Compare January 15, 2024 11:20
@yaqiangz yaqiangz requested a review from Blueve January 15, 2024 11:22
@yaqiangz
Copy link
Contributor Author

@yxieca Could you please help to merge this PR?

@yxieca yxieca merged commit 36e111a into sonic-net:master Jan 16, 2024
18 checks passed
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.

3 participants