From 6415e4d5632a278cc285c93ba6a09b8eecb357df Mon Sep 17 00:00:00 2001 From: Yaqiang Zhu Date: Tue, 28 Jan 2025 00:58:32 +0800 Subject: [PATCH] [yang][dhcp_server] Make gateway in dhcp_server to be an un-mandatory config (#21475) Why I did it DHCP default route shoule be an optional config to DHCP client Work item tracking Microsoft ADO (number only): 30877295 How I did it Make the configuration to be optional in yang model How to verify it UTs --- .../tests/dhcp_server_ipv4.json | 4 - .../tests_config/dhcp_server_ipv4.json | 82 ------------------- .../yang-models/sonic-dhcp-server-ipv4.yang | 1 - 3 files changed, 87 deletions(-) diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/dhcp_server_ipv4.json b/src/sonic-yang-models/tests/yang_model_tests/tests/dhcp_server_ipv4.json index 13da6d717a3d..3e7829b41b08 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/dhcp_server_ipv4.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/dhcp_server_ipv4.json @@ -66,10 +66,6 @@ "desc": "Configure both ip and ranges in DHCP_SERVER_IPV4_RANGE_RANGES", "eStr": ["Statement of 'ips' and 'ranges' cannot both exist"] }, - "DHCP_SERVER_IPV4_GATEWAY_ABSENT": { - "desc": "Missing gateway in DHCP_SERVER_IPV4", - "eStrKey" : "Mandatory" - }, "DHCP_SERVER_IPV4_LEASE_TIME_ABSENT": { "desc": "Missing lease_time in DHCP_SERVER_IPV4", "eStrKey" : "Mandatory" diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/dhcp_server_ipv4.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/dhcp_server_ipv4.json index 42e03c647227..f0c790491afa 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/dhcp_server_ipv4.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/dhcp_server_ipv4.json @@ -481,88 +481,6 @@ } } }, - "DHCP_SERVER_IPV4_GATEWAY_ABSENT": { - "sonic-portchannel:sonic-portchannel": { - "sonic-portchannel:PORTCHANNEL": { - "PORTCHANNEL_LIST": [ - { - "name": "PortChannel1" - } - ] - } - }, - "sonic-port:sonic-port": { - "sonic-port:PORT": { - "PORT_LIST": [ - { - "admin_status": "up", - "alias": "etp1", - "description": "Ethernet0", - "mtu": 9000, - "lanes": "1", - "name": "Ethernet0", - "speed": 25000, - "mode" : "trunk" - } - ] - } - }, - "sonic-dhcp-server-ipv4:sonic-dhcp-server-ipv4": { - "sonic-dhcp-server-ipv4:DHCP_SERVER_IPV4": { - "DHCP_SERVER_IPV4_LIST": [ - { - "name": "Vlan1000", - "lease_time": 3600, - "mode": "PORT", - "netmask": "255.255.255.0", - "customized_options": [ - "option60" - ], - "state": "enabled" - } - ] - }, - "sonic-dhcp-server-ipv4:DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS": { - "DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS_LIST": [ - { - "name": "option60", - "id": 60, - "type": "string", - "value": "dummy_value" - } - ] - }, - "sonic-dhcp-server-ipv4:DHCP_SERVER_IPV4_RANGE": { - "DHCP_SERVER_IPV4_RANGE_LIST": [ - { - "name": "range1", - "range": [ - "192.168.0.2", - "192.168.0.3" - ] - } - ] - }, - "sonic-dhcp-server-ipv4:DHCP_SERVER_IPV4_PORT": { - "DHCP_SERVER_IPV4_PORT_LIST": [ - { - "name": "Vlan1000", - "port": "Ethernet0", - "ranges": [ - "range1" - ] - }, - { - "name": "Vlan1000", - "port": "PortChannel1", - "ips": [ - "192.168.0.4" - ] - } - ] - } - } - }, "DHCP_SERVER_IPV4_LEASE_TIME_ABSENT": { "sonic-portchannel:sonic-portchannel": { "sonic-portchannel:PORTCHANNEL": { diff --git a/src/sonic-yang-models/yang-models/sonic-dhcp-server-ipv4.yang b/src/sonic-yang-models/yang-models/sonic-dhcp-server-ipv4.yang index 5a3605d70108..d3aa89862686 100644 --- a/src/sonic-yang-models/yang-models/sonic-dhcp-server-ipv4.yang +++ b/src/sonic-yang-models/yang-models/sonic-dhcp-server-ipv4.yang @@ -66,7 +66,6 @@ module sonic-dhcp-server-ipv4 { leaf gateway { description "Gateway IP for DHCP server"; - mandatory true; type inet:ipv4-address; }