Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dockers/docker-dhcp-server/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ RUN apt-get update && \
build-essential \
kea-dhcp4-server

RUN mkdir -p /var/run/kea
RUN mkdir -p /run/kea /var/log/kea /var/lib/kea && chmod 750 /run/kea

RUN pip3 install psutil

Expand Down
3 changes: 2 additions & 1 deletion dockers/docker-dhcp-server/docker_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# Generate supervisord config file
mkdir -p /etc/supervisor/conf.d/
# Generate kea folder
mkdir -p /etc/kea/
mkdir -p /etc/kea/ /run/kea /var/log/kea /var/lib/kea
chmod 750 /run/kea
udp_server_ip=$(ip -j -4 addr list lo scope host | jq -r -M '.[0].addr_info[0].local')
hostname=$(hostname)

Expand Down
4 changes: 2 additions & 2 deletions dockers/docker-dhcp-server/kea-dhcp4-init.conf
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"lease-database": {
"type": "memfile",
"persist": true,
"name": "/tmp/kea-lease.csv",
"name": "/var/lib/kea/kea-lease.csv",
"lfc-interval": 3600
},
"subnet4": [],
Expand All @@ -19,7 +19,7 @@
"name": "kea-dhcp4",
"output_options": [
{
"output": "/tmp/kea-dhcp.log",
"output": "/var/log/kea/kea-dhcp4.log",
"pattern": "%-5p %m\n"
}
],
Expand Down
2 changes: 1 addition & 1 deletion dockers/docker-dhcp-server/kea-dhcp4.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"name": "kea-dhcp4",
"output_options": [
{
"output": "/var/log/kea-dhcp.log",
"output": "/var/log/kea/kea-dhcp4.log",
"pattern": "%-5p %m\n"
}
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
SMART_SWITCH_CHECKER = ["DpusTableEventChecker", "MidPlaneTableEventChecker"]
LEASE_UPDATE_SCRIPT_PATH = "/etc/kea/lease_update.sh"
DEFAULT_LEASE_TIME = 900
DEFAULT_LEASE_PATH = "/tmp/kea-lease.csv"
DEFAULT_LEASE_PATH = "/var/lib/kea/kea-lease.csv"
KEA_DHCP4_CONF_TEMPLATE_PATH = "/usr/share/sonic/templates/kea-dhcp4.conf.j2"
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
DHCP_OPTION_FILE = f"{SCRIPT_DIR}/dhcp_option.csv"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from dhcp_utilities.common.utils import is_smart_switch

DHCP_SERVER_IPV4_LEASE = "DHCP_SERVER_IPV4_LEASE"
KEA_LEASE_FILE_PATH = "/tmp/kea-lease.csv"
KEA_LEASE_FILE_PATH = "/var/lib/kea/kea-lease.csv"
DEFAULE_LEASE_UPDATE_INTERVAL = 2 # unit: sec


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

KEA_DHCP4_CONFIG = "/etc/kea/kea-dhcp4.conf"
KEA_DHCP4_PROC_NAME = "kea-dhcp4"
KEA_LEASE_FILE_PATH = "/tmp/kea-lease.csv"
KEA_LEASE_FILE_PATH = "/var/lib/kea/kea-lease.csv"
DHCPSERVD_READY_FLAG = "/tmp/dhcpservd_ready"
REDIS_SOCK_PATH = "/var/run/redis/redis.sock"
DHCP_SERVER_IPV4_SERVER_IP = "DHCP_SERVER_IPV4_SERVER_IP"
Expand Down
2 changes: 1 addition & 1 deletion src/sonic-dhcp-utilities/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@ def mock_parse_port_map_alias(scope="function"):
new_callable=PropertyMock), \
patch.object(DhcpServCfgGenerator, "lease_update_script_path", return_value="/etc/kea/lease_update.sh",
new_callable=PropertyMock), \
patch.object(DhcpServCfgGenerator, "lease_path", return_value="/tmp/kea-lease.csv", new_callable=PropertyMock):
patch.object(DhcpServCfgGenerator, "lease_path", return_value="/var/lib/kea/kea-lease.csv", new_callable=PropertyMock):
yield mock_map
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
"name": "kea-dhcp4",
"output_options": [
{
"output": "/var/log/kea-dhcp.log",
"output": "/var/log/kea/kea-dhcp4.log",
"pattern": "%-5p %m\n"
}
],
Expand Down
10 changes: 5 additions & 5 deletions src/sonic-dhcp-utilities/tests/test_dhcp_cfggen.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"lease-database": {
"type": "memfile",
"persist": True,
"name": "/tmp/kea-lease.csv",
"name": "/var/lib/kea/kea-lease.csv",
"lfc-interval": 3600
},
"subnet4": [
Expand Down Expand Up @@ -97,7 +97,7 @@
"name": "kea-dhcp4",
"output_options": [
{
"output": "/var/log/kea-dhcp.log",
"output": "/var/log/kea/kea-dhcp4.log",
"pattern": "%-5p %m\n"
}
],
Expand Down Expand Up @@ -151,7 +151,7 @@
"lease-database": {
"type": "memfile",
"persist": True,
"name": "/tmp/kea-lease.csv",
"name": "/var/lib/kea/kea-lease.csv",
"lfc-interval": 3600
},
"subnet4": [
Expand All @@ -161,7 +161,7 @@
"name": "kea-dhcp4",
"output_options": [
{
"output": "/var/log/kea-dhcp.log",
"output": "/var/log/kea/kea-dhcp4.log",
"pattern": "%-5p %m\n"
}
],
Expand Down Expand Up @@ -270,7 +270,7 @@
{"name": "sonic-host:etp11", "condition": "substring(relay4[1].hex, -16, 16) == 'sonic-host:etp11'"}
],
"lease_update_script_path": "/etc/kea/lease_update.sh",
"lease_path": "/tmp/kea-lease.csv",
"lease_path": "/var/lib/kea/kea-lease.csv",
"customized_options": {
"option223": {
"id": "223",
Expand Down
4 changes: 2 additions & 2 deletions src/sonic-dhcp-utilities/tests/test_smart_switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"lease-database": {
"type": "memfile",
"persist": True,
"name": "/tmp/kea-lease.csv",
"name": "/var/lib/kea/kea-lease.csv",
"lfc-interval": 3600
},
"subnet4": [
Expand Down Expand Up @@ -76,7 +76,7 @@
"name": "kea-dhcp4",
"output_options": [
{
"output": "/var/log/kea-dhcp.log",
"output": "/var/log/kea/kea-dhcp4.log",
"pattern": "%-5p %m\n"
}
],
Expand Down
Loading