[dhcp_server] add config dhcp server enable (#17605)

* add config dhcp_server enable

* fix bug

* fix bug

* fix bug

* fix bug
This commit is contained in:
Xichen96
2024-01-04 05:39:39 +08:00
committed by GitHub
parent 7011e00eba
commit ffe292a021
5 changed files with 45 additions and 1 deletions

View File

@@ -116,6 +116,19 @@ def dhcp_server_ipv4_del(db, dhcp_interface):
ctx.fail("Dhcp interface %s does not exist in config db".format(dhcp_interface))
@dhcp_server_ipv4.command(name="enable")
@click.argument("dhcp_interface", required=True)
@clicommon.pass_db
def dhcp_server_ipv4_enable(db, dhcp_interface):
ctx = click.get_current_context()
dbconn = db.db
key = "DHCP_SERVER_IPV4|" + dhcp_interface
if dbconn.exists("CONFIG_DB", key):
dbconn.set("CONFIG_DB", key, "state", "enabled")
else:
ctx.fail("Failed to enable, dhcp interface %s does not exist".format(dhcp_interface))
def register(cli):
# cli.add_command(dhcp_server)
pass