Skip to content

Commit 3223ca0

Browse files
authored
[dhcp_server] Add config_db monitor and customize options for dhcpservd (#17051)
Why I did it Add config_db monitor and customize options for dhcpservd. HLD: sonic-net/SONiC#1282 Work item tracking Microsoft ADO (number only): 25600859 How I did it Add support to customize unassigned DHCP options. Current support type: binary, boolean, ipv4-address, string, uint8, uint16, uint32 Add db config change monitor for dhcpservd How to verify it Unit tests in sonic-dhcp-server all passed
1 parent 6820579 commit 3223ca0

File tree

19 files changed

+1761
-486
lines changed

19 files changed

+1761
-486
lines changed

dockers/docker-dhcp-server/kea-dhcp4.conf.j2

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,17 @@
11
{%- set default_lease_time = 900 -%}
22
{
33
"Dhcp4": {
4+
{%- if customized_options %}
5+
"option-def": [
6+
{%- for option_name, config in customized_options.items() %}
7+
{
8+
"name": "{{ option_name }}",
9+
"code": {{ config["id"] }},
10+
"type": "{{ config["type"] }}"
11+
}{% if not loop.last %},{% endif %}
12+
{%- endfor %}
13+
],
14+
{%- endif %}
415
"hooks-libraries": [
516
{
617
"library": "/usr/local/lib/kea/hooks/libdhcp_run_script.so",
@@ -44,6 +55,13 @@
4455
{%- endfor%}
4556
],
4657
"option-data": [
58+
{%- for option_name, config in subnet_info["customized_options"].items() %}
59+
{
60+
"name": "{{ option_name }}",
61+
"data": "{{ config["value"] }}",
62+
"always-send": {{ config["always_send"] }}
63+
},
64+
{%- endfor %}
4765
{
4866
"name": "routers",
4967
"data": "{{ subnet_info["gateway"] if "gateway" in subnet_info else subnet_info["server_id"] }}"

0 commit comments

Comments
 (0)