Skip to content

Commit 1d69fbc

Browse files
[YANG] DHCPv4 Relay Yang Model (#22338)
Why I did it Yang model for new DHCPv4 Relay design. See following PR for details: Signed-off-by: Ashutosh Agrawal <[email protected]>
1 parent e2e53e9 commit 1d69fbc

File tree

7 files changed

+543
-0
lines changed

7 files changed

+543
-0
lines changed

src/sonic-yang-models/doc/Configuration.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
* [Device Metadata](#device-metadata)
3232
* [Device neighbor metada](#device-neighbor-metada)
3333
* [DHCP_RELAY](#dhcp_relay)
34+
* [DHCPV4_RELAY](#dhcpv4_relay)
3435
* [DHCP Server IPV4](#dhcp_server_ipv4)
3536
* [BMP](#bmp)
3637
* [DSCP_TO_TC_MAP](#dscp_to_tc_map)
@@ -1138,6 +1139,28 @@ instance is supported in SONiC.
11381139

11391140
```
11401141

1142+
### DHCPV4_RELAY
1143+
1144+
```
1145+
{
1146+
"DHCPV4_RELAY": {
1147+
"Vlan1000": {
1148+
"dhcpv4_servers": [
1149+
"192.168.0.1",
1150+
"192.168.0.2"
1151+
],
1152+
"server_vrf": "Vrf_RED",
1153+
"source_interface": "Loopback0",
1154+
"link_selection": "enable",
1155+
"vrf_selection": "enable",
1156+
"server_id_override": "enable",
1157+
"agent_relay_mode": "append",
1158+
"max_hop_count": 10
1159+
}
1160+
}
1161+
1162+
```
1163+
11411164
### BMP
11421165
BMP related configuration are defined in **bgp_neighbor_table**,**bgp_rib_in_table**, **bgp_rib_out_table** tables.
11431166

src/sonic-yang-models/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
'sonic-device_neighbor.yang',
4646
'sonic-device_neighbor_metadata.yang',
4747
'sonic-dhcp-server.yang',
48+
'sonic-dhcpv4-relay.yang',
4849
'sonic-dhcpv6-relay.yang',
4950
'sonic-dns.yang',
5051
'sonic-events-bgp.yang',

src/sonic-yang-models/tests/files/sample_config_db.json

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2142,6 +2142,36 @@
21422142
"interface_id": "true"
21432143
}
21442144
},
2145+
"DHCPV4_RELAY": {
2146+
"Vlan111": {
2147+
"dhcpv4_servers": [
2148+
"10.222.72.116"
2149+
],
2150+
"server_vrf": "Vrf_blue",
2151+
"source_interface": "Loopback0",
2152+
"link_selection": "enable",
2153+
"vrf_selection": "enable",
2154+
"server_id_override": "enable",
2155+
"agent_relay_mode": "forward_untouched",
2156+
"max_hop_count": "4"
2157+
},
2158+
"Vlan222": {
2159+
"dhcpv4_servers": [
2160+
"10.222.72.116",
2161+
"10.222.82.226"
2162+
]
2163+
},
2164+
"Vlan777": {
2165+
"dhcpv4_servers": [
2166+
"10.222.82.226"
2167+
],
2168+
"source_interface": "Loopback0",
2169+
"link_selection": "enable",
2170+
"vrf_selection": "disable",
2171+
"server_id_override": "disable",
2172+
"agent_relay_mode": "discard"
2173+
}
2174+
},
21452175
"DHCP_SERVER_IPV4": {
21462176
"Vlan100": {
21472177
"gateway": "100.1.1.1",
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"DHCPv4_RELAY_VALID_FORMAT_BASE": {
3+
"desc": "Add dhcpv4 relay with minimum config."
4+
},
5+
"DHCPv4_RELAY_WITH_MULTIPLE_SERVERS": {
6+
"desc": "Add dhcpv4 relay with multiple servers."
7+
},
8+
"DHCPv4_RELAY_WITH_SERVER_VRF": {
9+
"desc": "Add dhcpv4 relay with server VRF and required options."
10+
},
11+
"DHCPv4_RELAY_WITH_LINK_SELECT": {
12+
"desc": "Add dhcpv4 relay with link-select option enabled."
13+
},
14+
"DHCPv4_RELAY_WITH_AGENT_RELAY_MODE_DISCARD": {
15+
"desc": "Add dhcpv4 relay with minimum config."
16+
},
17+
"DHCPv4_RELAY_WITH_VALID_MAX_HOP_CNT": {
18+
"desc": "Add dhcpv4 relay with valid max_hop_cnt."
19+
},
20+
"DHCPv4_RELAY_WITH_MISSING_SERVER_IP": {
21+
"desc": "Add dhcpv4 relay with missing server_ip.",
22+
"eStrKey": "MinElements"
23+
},
24+
"DHCPv4_RELAY_WITH_SERVER_VRF_AND_MISSING_LINK_SELECT_OPTION": {
25+
"desc": "Add dhcpv4 relay with server_vrf and missing link-selection option.",
26+
"eStrKey": "Must"
27+
},
28+
"DHCPv4_RELAY_WITH_SERVER_VRF_AND_MISSING_VRF_SELECT_OPTION": {
29+
"desc": "Add dhcpv4 relay with server_vrf and missing vrf-selection option.",
30+
"eStrKey": "Must"
31+
},
32+
"DHCPv4_RELAY_WITH_SERVER_VRF_AND_MISSING_SERVER_OVERRIDE_OPTION": {
33+
"desc": "Add dhcpv4 relay with server_vrf and missing lserver-override option.",
34+
"eStrKey": "Must"
35+
},
36+
"DHCPv4_RELAY_WITH_SERVER_VRF_AND_MISSING_SOURCE_INTERFACE_OPTION": {
37+
"desc": "Add dhcpv4 relay with server_vrf and missing source-interface option.",
38+
"eStrKey": "Must"
39+
}
40+
}

0 commit comments

Comments
 (0)