Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[yang][dhcp_server] Add dhcp_server_ipv4 yang model #15955

Merged
merged 8 commits into from
Aug 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Table of Contents
* [Device Metadata](#device-metadata)
* [Device neighbor metada](#device-neighbor-metada)
* [DHCP_RELAY](#dhcp_relay)
* [DHCP Server IPV4](#dhcp_server_ipv4)
* [DSCP_TO_TC_MAP](#dscp_to_tc_map)
* [FG_NHG](#fg_nhg)
* [FG_NHG_MEMBER](#fg_nhg_member)
Expand Down Expand Up @@ -986,6 +987,50 @@ instance is supported in SONiC.

```

### DHCP_SERVER_IPV4
IPV4 DHPC Server related configuration are defined in **DHCP_SERVER_IPV4**, **DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS**, **DHCP_SERVER_IPV4_RANGE**, **DHCP_SERVER_IPV4_PORT** tables.
```
{
"DHCP_SERVER_IPV4": {
"Vlan100": {
"gateway": "100.1.1.1",
"lease_time": 3600,
"mode": "PORT",
"netmask": "255.255.255.0",
"customized_options": [
"option60"
],
"state": "enabled"
}
},
"DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS": {
"option60": {
"id": 60,
"type": "text",
"value": "dummy_value"
}
},
"DHCP_SERVER_IPV4_RANGE": {
"range1": {
"ip_start": "100.1.1.3",
"ip_end": "100.1.1.5"
}
},
"DHCP_SERVER_IPV4_PORT": {
"Vlan100|PortChannel0003": {
"ips": [
"100.1.1.10"
]
},
"Vlan100|PortChannel2": {
"ranges": [
"range1"
]
}
}
}
```

### DSCP_TO_TC_MAP
```
{
Expand Down
1 change: 1 addition & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ def run(self):
'./yang-models/sonic-dscp-fc-map.yang',
'./yang-models/sonic-exp-fc-map.yang',
'./yang-models/sonic-dscp-tc-map.yang',
'./yang-models/sonic-dhcp-server-ipv4.yang',
'./yang-models/sonic-dot1p-tc-map.yang',
'./yang-models/sonic-storm-control.yang',
'./yang-models/sonic-tc-priority-group-map.yang',
Expand Down
39 changes: 39 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1880,6 +1880,45 @@
"interface_id": "true"
}
},
"DHCP_SERVER_IPV4": {
"Vlan100": {
"gateway": "100.1.1.1",
"lease_time": "3600",
"mode": "PORT",
"netmask": "255.255.255.0",
"customized_options": [
"option60"
],
"state": "enabled"
}
},
"DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS": {
"option60": {
"id": "60",
"type": "text",
"value": "dummy_value"
}
},
"DHCP_SERVER_IPV4_RANGE": {
"range1": {
"range": [
"100.1.1.3",
"100.1.1.5"
]
}
},
"DHCP_SERVER_IPV4_PORT": {
"Vlan100|Ethernet0": {
"ips": [
"100.1.1.10"
]
},
"Vlan100|Ethernet1": {
"ranges": [
"range1"
]
}
},
"SCHEDULER": {
"TEST@0": {
"cbs": "256",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
{
"DHCP_SERVER_IPV4_VALID_FORMAT": {
"desc": "Add dhcp_server_ipv4 in correct format."
},
"DHCP_SERVER_IPV4_WITH_NON_EXIST_VLAN": {
"desc": "Configure vlan-id in DHCP_SERVER_IPV4 table which does not exist in VLAN table.",
"eStrKey": "LeafRef"
},
"DHCP_SERVER_IPV4_INCORRECT_GATEWAY": {
"desc": "Add gateway which is not in correct ip-prefix format.",
"eStrKey": "Pattern"
},
"DHCP_SERVER_IPV4_INCORRECT_NETMASK": {
"desc": "Add netmask which is not in correct ip-prefix format.",
"eStrKey": "Pattern"
},
"DHCP_SERVER_IPV4_STATE_WRONG_VALUE": {
"desc": "Configure wrong value for state.",
"eStrKey": "InvalidValue"
},
"DHCP_SERVER_IPV4_MODE_WRONG_VALUE": {
"desc": "Configure wrong value for mode.",
"eStrKey": "InvalidValue"
},
"DHCP_SREVER_IPV4_NON_EXIST_OPTION": {
"desc": "Configure option in DHCP_SERVER_IPV4 table which does not exist in DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS table.",
"eStrKey": "LeafRef"
},
"DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS_TYPE_WRONG_VALUE": {
"desc": "Configure wrong value for type.",
"eStrKey": "InvalidValue",
"eStr": ["type"]
},
"DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS_TYPE_VALID_VALUE_TEXT": {
"desc": "Add text type of DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS."
},
"DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS_TYPE_VALID_VALUE_IPV4_ADDRESS": {
"desc": "Add ipv4-address type of DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS."
},
"DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS_TYPE_VALID_VALUE_UINT8": {
"desc": "Add uint8 type of DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS."
},
"DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS_TYPE_VALID_VALUE_UINT16": {
"desc": "Add uint16 type of DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS."
},
"DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS_TYPE_VALID_VALUE_UINT32": {
"desc": "Add uint32 type of DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS."
},
"DHCP_SERVER_IPV4_RANGE_INVALID_END": {
"desc": "Configure wrong end ip of range.",
"eStrKey": "Pattern"
},
"DHCP_SERVER_IPV4_RANGE_RANGES_WITH_IP": {
"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"
},
"DHCP_SERVER_IPV4_MODE_ABSENT": {
"desc": "Missing mode in DHCP_SERVER_IPV4",
"eStrKey" : "Mandatory"
},
"DHCP_SERVER_IPV4_NETMASK_ABSENT": {
"desc": "Missing netmask in DHCP_SERVER_IPV4",
"eStrKey" : "Mandatory"
},
"DHCP_SERVER_IPV4_STATE_ABSENT": {
"desc": "Missing state in DHCP_SERVER_IPV4",
"eStrKey" : "Mandatory"
},
"DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS_ID_ABSENT": {
"desc": "Missing id in DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS",
"eStrKey" : "Mandatory"
},
"DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS_VALUE_ABSENT": {
"desc": "Missing value in DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS",
"eStrKey" : "Mandatory"
},
"DHCP_SERVER_IPV4_RANGE_RANGE_ABSENT": {
"desc": "Missing ranges in DHCP_SERVER_IPV4_RANGE",
"eStrKey": "Must"
},
"DHCP_SERVER_IPV4_RANGE_SINGLE_IP": {
"desc": "Single ip in DHCP_SERVER_IPV4_RANGE"
},
"DHCP_SERVER_IPV4_RANGE_THREE_IP": {
"desc": "Three ips in DHCP_SERVER_IPV4_RANGE",
"eStrKey": "Must"
}
}
Loading