mirror of
https://github.com/Telecominfraproject/ols-nos.git
synced 2025-11-01 18:48:05 +00:00
[dhcp_server] Add dhcpservd to dhcp_server container (#16560)
Why I did it Part implementation of dhcp_server. HLD: sonic-net/SONiC#1282. Add dhcpservd to dhcp_server container. How I did it Add installing required pkg (psutil) in Dockerfile. Add copying required file to container in Dockerfile (kea-dhcp related and dhcpservd related) Add critical_process and supervisor config. 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 Build image with setting INCLUDE_DHCP_SERVER to y and enabled dhcp_server feature after installed image, container start as expected. Enter container and found that all processes defined in supervisor configuration running as expected. Kill processes defined in critical_processes, container exist.
This commit is contained in:
@@ -1,5 +1,21 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
# Generate supervisord config file
|
||||
mkdir -p /etc/supervisor/conf.d/
|
||||
# Generate kea folder
|
||||
mkdir -p /etc/kea/
|
||||
udp_server_ip=$(ip -j -4 addr list lo scope host | jq -r -M '.[0].addr_info[0].local')
|
||||
hostname=$(hostname)
|
||||
# Generate the following files from templates:
|
||||
# port-to-alias name map
|
||||
sonic-cfggen -d -t /usr/share/sonic/templates/rsyslog.conf.j2 \
|
||||
-a "{\"udp_server_ip\": \"$udp_server_ip\", \"hostname\": \"$hostname\"}" \
|
||||
> /etc/rsyslog.conf
|
||||
sonic-cfggen -d -t /usr/share/sonic/templates/port-name-alias-map.txt.j2,/tmp/port-name-alias-map.txt
|
||||
|
||||
# Make the script that waits for all interfaces to come up executable
|
||||
chmod +x /etc/kea/lease_update.sh /usr/bin/start.sh
|
||||
# The docker container should start this script as PID 1, so now that supervisord is
|
||||
# properly configured, we exec /usr/local/bin/supervisord so that it runs as PID 1 for the
|
||||
# duration of the container's lifetime
|
||||
|
||||
Reference in New Issue
Block a user