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 dhcpservd to dhcp_server container #16560

Merged
merged 32 commits into from
Oct 20, 2023

Conversation

yaqiangz
Copy link
Contributor

@yaqiangz yaqiangz commented Sep 14, 2023

Depends on: #16548

Why I did it

Part implementation of dhcp_server. HLD: sonic-net/SONiC#1282.
Add dhcpservd to dhcp_server container.

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

How I did it

  1. Add installing required pkg (psutil) in Dockerfile.
  2. Add copying required file to container in Dockerfile (kea-dhcp related and dhcpservd related)
  3. Add critical_process and supervisor config.
  4. Add support for generating kea config (only in dhcpservd.py) and updating lease table (in dhcpservd.py and lease_update.sh)

How to verify it

  1. Build image with setting INCLUDE_DHCP_SERVER to y and enabled dhcp_server feature after installed image, container start as expected.
  2. Enter container and found that all processes defined in supervisor configuration running as expected.
  3. Kill processes defined in critical_processes, container exist.

unit test

========================================== test session starts ==========================================
platform linux -- Python 3.9.2, pytest-6.0.2, py-1.10.0, pluggy-0.13.0
rootdir: /sonic/src/sonic-dhcpservd, configfile: setup.cfg, testpaths: tests
plugins: pyfakefs-5.2.4, cov-2.10.1
collected 26 items                                                                                      

tests/test_dhcp_cfggen.py .........                                                               [ 34%]
tests/test_dhcp_lease.py .....                                                                    [ 53%]
tests/test_dhcp_server_utils.py ........                                                          [ 84%]
tests/test_dhcpservd.py ....                                                                      [100%]Clearing the cache


----------- coverage: platform linux, python 3.9.2-final-0 -----------
Name                             Stmts   Miss Branch BrPart     Cover   Missing
-------------------------------------------------------------------------------
dhcpservd/dhcp_cfggen.py           170     16     72      1    92.98%   49-66, 149-153, 239->241, 241
dhcpservd/dhcp_server_utils.py      37      3     14      0    94.12%   35, 55-56
dhcpservd/dhcp_lease.py             96      3     30      4    94.44%   59->61, 61, 62->63, 63, 75->77, 113->135, 154
dhcpservd/dhcpservd.py              31      1      4      0    97.14%   49
-------------------------------------------------------------------------------
TOTAL                              334     23    120      5    93.83%

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

========================================== slowest 5 durations ==========================================

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_test_package_manager branch 2 times, most recently from 554ee4a to eb61847 Compare September 18, 2023 12:29
@yaqiangz yaqiangz force-pushed the master_test_package_manager branch 2 times, most recently from b08f6a7 to 07522fe Compare September 19, 2023 17:23
@yaqiangz yaqiangz force-pushed the master_test_package_manager branch 3 times, most recently from d49ca88 to 8d634d8 Compare September 20, 2023 05:32
@yaqiangz yaqiangz force-pushed the master_test_package_manager branch from 8d634d8 to 874c8bf Compare September 20, 2023 08:38
@yaqiangz yaqiangz force-pushed the master_test_package_manager branch from 00fe447 to aec1b00 Compare September 20, 2023 15:14
@yaqiangz yaqiangz force-pushed the master_test_package_manager branch from 1f9dfa0 to fad0cbc Compare September 21, 2023 02:37
@yaqiangz yaqiangz changed the title [test] Just want to build [dhcp_server] Add dhcpservd to dhcp_server container Oct 17, 2023
@yaqiangz yaqiangz force-pushed the master_test_package_manager branch from b4d725d to 791ac16 Compare October 17, 2023 07:48
@yaqiangz yaqiangz force-pushed the master_test_package_manager branch from 791ac16 to c25f436 Compare October 17, 2023 07:59
@yaqiangz yaqiangz marked this pull request as ready for review October 17, 2023 08:08
@yaqiangz yaqiangz force-pushed the master_test_package_manager branch 2 times, most recently from 538abb8 to e6a04a4 Compare October 17, 2023 08:37
@yaqiangz yaqiangz force-pushed the master_test_package_manager branch from e6a04a4 to 3e695c0 Compare October 17, 2023 08:41
@yaqiangz yaqiangz force-pushed the master_test_package_manager branch 2 times, most recently from 6ea3915 to 1463b8f Compare October 17, 2023 09:12
@yaqiangz yaqiangz force-pushed the master_test_package_manager branch from 1463b8f to 357e364 Compare October 17, 2023 09:14
@yaqiangz
Copy link
Contributor Author

/azpw run Azure.sonic-buildimage

@mssonicbld
Copy link
Collaborator

/AzurePipelines run Azure.sonic-buildimage

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@yaqiangz
Copy link
Contributor Author

@yxieca Could you pls help to merge this PR?

@yxieca yxieca merged commit 73dd38a into sonic-net:master Oct 20, 2023
16 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.

4 participants