summaryrefslogtreecommitdiff
path: root/smoketest
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-01-19 20:11:50 +0100
committerGitHub <noreply@github.com>2024-01-19 20:11:50 +0100
commit9bde591e387ff64ce300f966c758195e87f618a6 (patch)
treeb65dfbad41fe5a1287666ef383afea3af7d12fa6 /smoketest
parent5c6d4b17d90cdfdf1541d81fb081575c54b168a7 (diff)
parentc7b6484dc975cbbe9c916a8d51f5b87728625502 (diff)
downloadvyos-1x-9bde591e387ff64ce300f966c758195e87f618a6.tar.gz
vyos-1x-9bde591e387ff64ce300f966c758195e87f618a6.zip
Merge pull request #2853 from c-po/sagitta
dhcp: T5952: validate duplicate MAC and IP address in static-mappings incl. smoketests
Diffstat (limited to 'smoketest')
-rwxr-xr-xsmoketest/scripts/cli/test_service_dhcp-server.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/smoketest/scripts/cli/test_service_dhcp-server.py b/smoketest/scripts/cli/test_service_dhcp-server.py
index 91ae901cd..9e8196d7a 100755
--- a/smoketest/scripts/cli/test_service_dhcp-server.py
+++ b/smoketest/scripts/cli/test_service_dhcp-server.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2020-2021 VyOS maintainers and contributors
+# Copyright (C) 2020-2024 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -203,12 +203,19 @@ class TestServiceDHCPServer(VyOSUnitTestSHIM.TestCase):
client_base += 1
# cannot have mappings with duplicate IP addresses
+ self.cli_set(pool + ['static-mapping', 'dupe1', 'mac-address', '00:50:00:00:fe:ff'])
+ self.cli_set(pool + ['static-mapping', 'dupe1', 'ip-address', inc_ip(subnet, 10)])
with self.assertRaises(ConfigSessionError):
- self.cli_set(pool + ['static-mapping', 'dupe1', 'mac', '00:50:00:00:00:01'])
- self.cli_set(pool + ['static-mapping', 'dupe1', 'ip-address', inc_ip(subnet, 10)])
self.cli_commit()
self.cli_delete(pool + ['static-mapping', 'dupe1'])
+ # cannot have mappings with duplicate MAC addresses
+ self.cli_set(pool + ['static-mapping', 'dupe2', 'mac-address', '00:50:00:00:00:10'])
+ self.cli_set(pool + ['static-mapping', 'dupe2', 'ip-address', inc_ip(subnet, 120)])
+ with self.assertRaises(ConfigSessionError):
+ self.cli_commit()
+ self.cli_delete(pool + ['static-mapping', 'dupe2'])
+
# commit changes
self.cli_commit()