Skip to content

Commit 2490591

Browse files
w1ndaparmarkj
authored andcommitted
[dhcp_server] test ip assignment with single and range ip configuration (sonic-net#12427)
What is the motivation for this PR? To make sure dhcp server has the capability for usage. How did you do it? In this PR, first, we write common function to construct DHCP packet, parse VLAN configuration, parse port mapping and send packet and verify packet. second, we add cases for ip assignment with single ip configuration. last, we add case for ip assignment with range ip configuration. How did you verify/test it? Run tests on Arista-720DT-G48S4 and Nokia-7215 mx topo.
1 parent b1931af commit 2490591

File tree

2 files changed

+486
-0
lines changed

2 files changed

+486
-0
lines changed

tests/dhcp_server/conftest.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
from tests.common.utilities import wait_until
33
from tests.common.helpers.assertions import pytest_assert as py_assert
44
from tests.common.helpers.assertions import pytest_require as py_require
5+
<<<<<<< HEAD
56
from dhcp_server_test_common import clean_dhcp_server_config
7+
=======
8+
>>>>>>> [dhcp_server] test ip assignment with single and range ip configuration (#12427)
69

710
DHCP_RELAY_CONTAINER_NAME = "dhcp_relay"
811
DHCP_SERVER_CONTAINER_NAME = "dhcp_server"
@@ -22,15 +25,23 @@ def dhcp_server_setup_teardown(duthost):
2225
def is_supervisor_subprocess_running(duthost, container_name, app_name):
2326
return "RUNNING" in duthost.shell(f"docker exec {container_name} supervisorctl status {app_name}")["stdout"]
2427
py_assert(
28+
<<<<<<< HEAD
2529
wait_until(120, 1, 1,
30+
=======
31+
wait_until(20, 1, 1,
32+
>>>>>>> [dhcp_server] test ip assignment with single and range ip configuration (#12427)
2633
is_supervisor_subprocess_running,
2734
duthost,
2835
DHCP_SERVER_CONTAINER_NAME,
2936
"dhcp-server-ipv4:kea-dhcp4"),
3037
'feature dhcp_server is enabled but container is not running'
3138
)
3239
py_assert(
40+
<<<<<<< HEAD
3341
wait_until(120, 1, 1,
42+
=======
43+
wait_until(30, 1, 1,
44+
>>>>>>> [dhcp_server] test ip assignment with single and range ip configuration (#12427)
3445
is_supervisor_subprocess_running,
3546
duthost,
3647
DHCP_RELAY_CONTAINER_NAME,
@@ -44,6 +55,7 @@ def is_supervisor_subprocess_running(duthost, container_name, app_name):
4455
duthost.shell("config feature state dhcp_server disabled", module_ignore_errors=True)
4556
duthost.shell("sudo systemctl restart dhcp_relay.service")
4657
duthost.shell("docker rm dhcp_server", module_ignore_errors=True)
58+
<<<<<<< HEAD
4759

4860

4961
@pytest.fixture(scope="function", autouse=True)
@@ -52,3 +64,5 @@ def clean_dhcp_server_config_after_test(duthost):
5264
yield
5365

5466
clean_dhcp_server_config(duthost)
67+
=======
68+
>>>>>>> [dhcp_server] test ip assignment with single and range ip configuration (#12427)

0 commit comments

Comments
 (0)