[yang] Add support for smart switch in dhcp_server_ipv4 (#17320)
This commit is contained in:
parent
b9e90c2901
commit
a25b9d8ecb
@ -4,7 +4,7 @@
|
|||||||
},
|
},
|
||||||
"DHCP_SERVER_IPV4_WITH_INVALID_VLAN": {
|
"DHCP_SERVER_IPV4_WITH_INVALID_VLAN": {
|
||||||
"desc": "Configure vlan-id in DHCP_SERVER_IPV4 table which is invalid.",
|
"desc": "Configure vlan-id in DHCP_SERVER_IPV4 table which is invalid.",
|
||||||
"eStrKey" : "Pattern"
|
"eStrKey" : "InvalidValue"
|
||||||
},
|
},
|
||||||
"DHCP_SERVER_IPV4_INCORRECT_GATEWAY": {
|
"DHCP_SERVER_IPV4_INCORRECT_GATEWAY": {
|
||||||
"desc": "Add gateway which is not in correct ip-prefix format.",
|
"desc": "Add gateway which is not in correct ip-prefix format.",
|
||||||
@ -22,6 +22,10 @@
|
|||||||
"desc": "Configure wrong value for mode.",
|
"desc": "Configure wrong value for mode.",
|
||||||
"eStrKey": "InvalidValue"
|
"eStrKey": "InvalidValue"
|
||||||
},
|
},
|
||||||
|
"DHCP_SERVER_IPV4_WITH_NON_EXIST_BRIDGE": {
|
||||||
|
"desc": "Configure bridge in DHCP_SERVER_IPV4 table which does not exist in MID_PLANE_BRIDGE table.",
|
||||||
|
"eStrKey": "InvalidValue"
|
||||||
|
},
|
||||||
"DHCP_SREVER_IPV4_NON_EXIST_OPTION": {
|
"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.",
|
"desc": "Configure option in DHCP_SERVER_IPV4 table which does not exist in DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS table.",
|
||||||
"eStrKey": "LeafRef"
|
"eStrKey": "LeafRef"
|
||||||
@ -35,6 +39,10 @@
|
|||||||
"eStrKey": "InvalidValue",
|
"eStrKey": "InvalidValue",
|
||||||
"eStr": ["type"]
|
"eStr": ["type"]
|
||||||
},
|
},
|
||||||
|
"DHCP_SERVER_IPV4_PORT_WITH_NO_EXIST_PORT": {
|
||||||
|
"desc": "Configure DHCP port in DHCP_SERVER_IPV4_PORT table which is no exist.",
|
||||||
|
"eStrKey": "InvalidValue"
|
||||||
|
},
|
||||||
"DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS_TYPE_VALID_VALUE_TEXT": {
|
"DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS_TYPE_VALID_VALUE_TEXT": {
|
||||||
"desc": "Add text type of DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS."
|
"desc": "Add text type of DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS."
|
||||||
},
|
},
|
||||||
|
@ -1,5 +1,13 @@
|
|||||||
{
|
{
|
||||||
"DHCP_SERVER_IPV4_VALID_FORMAT": {
|
"DHCP_SERVER_IPV4_VALID_FORMAT": {
|
||||||
|
"sonic-smart-switch:sonic-smart-switch": {
|
||||||
|
"sonic-smart-switch:MID_PLANE_BRIDGE": {
|
||||||
|
"GLOBAL": {
|
||||||
|
"bridge": "bridge_midplane",
|
||||||
|
"ip_prefix": "169.254.200.254/24"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"sonic-portchannel:sonic-portchannel": {
|
"sonic-portchannel:sonic-portchannel": {
|
||||||
"sonic-portchannel:PORTCHANNEL": {
|
"sonic-portchannel:PORTCHANNEL": {
|
||||||
"PORTCHANNEL_LIST": [
|
"PORTCHANNEL_LIST": [
|
||||||
@ -38,6 +46,14 @@
|
|||||||
"option60"
|
"option60"
|
||||||
],
|
],
|
||||||
"state": "enabled"
|
"state": "enabled"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "bridge_midplane",
|
||||||
|
"gateway": "169.254.200.254",
|
||||||
|
"lease_time": 3600,
|
||||||
|
"mode": "PORT",
|
||||||
|
"netmask": "255.255.255.0",
|
||||||
|
"state": "enabled"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@ -164,6 +180,30 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"DHCP_SERVER_IPV4_WITH_NON_EXIST_BRIDGE": {
|
||||||
|
"sonic-smart-switch:sonic-smart-switch": {
|
||||||
|
"sonic-smart-switch:MID_PLANE_BRIDGE": {
|
||||||
|
"GLOBAL": {
|
||||||
|
"bridge": "bridge_midplane",
|
||||||
|
"ip_prefix": "169.254.200.254/24"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sonic-dhcp-server-ipv4:sonic-dhcp-server-ipv4": {
|
||||||
|
"sonic-dhcp-server-ipv4:DHCP_SERVER_IPV4": {
|
||||||
|
"DHCP_SERVER_IPV4_LIST": [
|
||||||
|
{
|
||||||
|
"name": "non_exist_bridge_midplane",
|
||||||
|
"gateway": "192.168.0.1",
|
||||||
|
"lease_time": 3600,
|
||||||
|
"mode": "PORT",
|
||||||
|
"netmask": "255.255.255.0",
|
||||||
|
"state": "enabled"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"DHCP_SREVER_IPV4_NON_EXIST_OPTION": {
|
"DHCP_SREVER_IPV4_NON_EXIST_OPTION": {
|
||||||
"sonic-dhcp-server-ipv4:sonic-dhcp-server-ipv4": {
|
"sonic-dhcp-server-ipv4:sonic-dhcp-server-ipv4": {
|
||||||
"sonic-dhcp-server-ipv4:DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS": {
|
"sonic-dhcp-server-ipv4:DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS": {
|
||||||
@ -248,6 +288,41 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"DHCP_SERVER_IPV4_PORT_WITH_NO_EXIST_PORT": {
|
||||||
|
"sonic-smart-switch:sonic-smart-switch": {
|
||||||
|
"sonic-smart-switch:MID_PLANE_BRIDGE": {
|
||||||
|
"GLOBAL": {
|
||||||
|
"bridge": "bridge_midplane",
|
||||||
|
"ip_prefix": "169.254.200.254/24"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"sonic-dhcp-server-ipv4:sonic-dhcp-server-ipv4": {
|
||||||
|
"sonic-dhcp-server-ipv4:DHCP_SERVER_IPV4": {
|
||||||
|
"DHCP_SERVER_IPV4_LIST": [
|
||||||
|
{
|
||||||
|
"name": "bridge_midplane",
|
||||||
|
"gateway": "169.254.200.254",
|
||||||
|
"lease_time": 3600,
|
||||||
|
"mode": "PORT",
|
||||||
|
"netmask": "255.255.255.0",
|
||||||
|
"state": "enabled"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"sonic-dhcp-server-ipv4:DHCP_SERVER_IPV4_PORT": {
|
||||||
|
"DHCP_SERVER_IPV4_PORT_LIST": [
|
||||||
|
{
|
||||||
|
"name": "bridge_midplane",
|
||||||
|
"port": "non_exit_dpu",
|
||||||
|
"ips": [
|
||||||
|
"169.254.200.1"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS_TYPE_VALID_VALUE_TEXT": {
|
"DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS_TYPE_VALID_VALUE_TEXT": {
|
||||||
"sonic-dhcp-server-ipv4:sonic-dhcp-server-ipv4": {
|
"sonic-dhcp-server-ipv4:sonic-dhcp-server-ipv4": {
|
||||||
"sonic-dhcp-server-ipv4:DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS": {
|
"sonic-dhcp-server-ipv4:DHCP_SERVER_IPV4_CUSTOMIZED_OPTIONS": {
|
||||||
|
@ -27,6 +27,10 @@ module sonic-dhcp-server-ipv4 {
|
|||||||
prefix lag;
|
prefix lag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
import sonic-smart-switch {
|
||||||
|
prefix smartswitch;
|
||||||
|
}
|
||||||
|
|
||||||
description "DHCP_SERVER_IPV4 YANG module for SONiC OS";
|
description "DHCP_SERVER_IPV4 YANG module for SONiC OS";
|
||||||
|
|
||||||
revision 2023-07-19 {
|
revision 2023-07-19 {
|
||||||
@ -46,6 +50,7 @@ module sonic-dhcp-server-ipv4 {
|
|||||||
|
|
||||||
leaf name {
|
leaf name {
|
||||||
description "Interface name for DHCP server";
|
description "Interface name for DHCP server";
|
||||||
|
type union {
|
||||||
// Comment VLAN leaf reference here until libyang back-links issue is resolved and use VLAN string pattern
|
// Comment VLAN leaf reference here until libyang back-links issue is resolved and use VLAN string pattern
|
||||||
// type leafref {
|
// type leafref {
|
||||||
// path "/vlan:sonic-vlan/vlan:VLAN/vlan:VLAN_LIST/vlan:name";
|
// path "/vlan:sonic-vlan/vlan:VLAN/vlan:VLAN_LIST/vlan:name";
|
||||||
@ -53,6 +58,10 @@ module sonic-dhcp-server-ipv4 {
|
|||||||
type string {
|
type string {
|
||||||
pattern 'Vlan([0-9]{1,3}|[1-3][0-9]{3}|[4][0][0-8][0-9]|[4][0][9][0-4])';
|
pattern 'Vlan([0-9]{1,3}|[1-3][0-9]{3}|[4][0][0-8][0-9]|[4][0][9][0-4])';
|
||||||
}
|
}
|
||||||
|
type leafref {
|
||||||
|
path "/smartswitch:sonic-smart-switch/smartswitch:MID_PLANE_BRIDGE/smartswitch:GLOBAL/smartswitch:bridge";
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
leaf gateway {
|
leaf gateway {
|
||||||
@ -204,7 +213,7 @@ module sonic-dhcp-server-ipv4 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
leaf port {
|
leaf port {
|
||||||
description "Interface under vlan";
|
description "Interface under DHCP interface";
|
||||||
type union {
|
type union {
|
||||||
type leafref {
|
type leafref {
|
||||||
path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name";
|
path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name";
|
||||||
@ -212,6 +221,9 @@ module sonic-dhcp-server-ipv4 {
|
|||||||
type leafref {
|
type leafref {
|
||||||
path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name";
|
path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name";
|
||||||
}
|
}
|
||||||
|
type leafref {
|
||||||
|
path "/smartswitch:sonic-smart-switch/smartswitch:DPUS/smartswitch:DPUS_LIST/smartswitch:midplane_interface";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user