[yang]: Support VLAN alias (#9615)

Why I did it
Config db schema generated by minigraph can’t pass yang validation, and there's no 'alias' field in yang model.
Minigraph parser supports 'alias' field for VLAN.

How I did it
Add 'alias' field to sonic-vlan.yang

How to verify it
Build sonic-yang-models.
Run command 'sonic-cfggen -m xxx.xml --print-data', and run yang validation.

Signed-off-by: Gang Lv ganglv@microsoft.com
This commit is contained in:
ganglv 2022-01-06 02:27:29 +08:00 committed by Judy Joseph
parent 3c20bd8441
commit c875cc65f5
3 changed files with 52 additions and 17 deletions

View File

@ -1,29 +1,32 @@
{
"VALID_VLAN": {
"desc": "Configure VLAN table."
},
"VLAN_INTERFACE_IPPREFIX_MUST_CONDITION_FALSE": {
"desc": "Vlan Interface Ip-prefix must condition failure.",
"eStrKey" : "Must"
"desc": "Vlan Interface Ip-prefix must condition failure.",
"eStrKey" : "Must"
},
"INCORRECT_VLAN_NAME": {
"desc": "INCORRECT VLAN_NAME FIELD IN VLAN TABLE.",
"eStrKey" : "Pattern",
"eStr": ["Vlan"]
"desc": "INCORRECT VLAN_NAME FIELD IN VLAN TABLE.",
"eStrKey" : "Pattern",
"eStr": ["Vlan"]
},
"WRONG_FAMILY_WITH_IP_PREFIX": {
"desc": "Configure Wrong family with ip-prefix for VLAN_Interface Table",
"eStrKey" : "Must"
"desc": "Configure Wrong family with ip-prefix for VLAN_Interface Table",
"eStrKey" : "Must"
},
"DHCP_SERVER_INCORRECT_FORMAT": {
"desc": "Add dhcp_server which is not in correct ip-prefix format.",
"eStrKey" : "InvalidValue",
"eStr": ["dhcp_servers"]
"desc": "Add dhcp_server which is not in correct ip-prefix format.",
"eStrKey" : "InvalidValue",
"eStr": ["dhcp_servers"]
},
"DHCPV6_SERVER_INCORRECT_FORMAT": {
"desc": "Add dhcpv6_server which is not in correct ipv6-address format.",
"eStrKey" : "Pattern"
},
"VLAN_WITH_NON_EXIST_PORT": {
"desc": "Configure a member port in VLAN_MEMBER table which does not exist.",
"eStrKey" : "InvalidValue"
"desc": "Configure a member port in VLAN_MEMBER table which does not exist.",
"eStrKey" : "InvalidValue"
},
"VLAN_WITH_PORTCHANNEL_MEMBER": {
"desc": "Configure a PortChannel as a member of Vlan."
@ -33,13 +36,13 @@
"eStrKey" : "InvalidValue"
},
"VLAN_MEMEBER_WITH_NON_EXIST_VLAN": {
"desc": "Configure vlan-id in VLAN_MEMBER table which does not exist in VLAN table.",
"eStrKey" : "LeafRef"
"desc": "Configure vlan-id in VLAN_MEMBER table which does not exist in VLAN table.",
"eStrKey" : "LeafRef"
},
"TAGGING_MODE_WRONG_VALUE": {
"desc": "Configure wrong value for tagging_mode.",
"eStrKey" : "InvalidValue",
"eStr": ["tagging_mode"]
"desc": "Configure wrong value for tagging_mode.",
"eStrKey" : "InvalidValue",
"eStr": ["tagging_mode"]
},
"VLAN_INTERFACE_WRONG_NAT_ZONE_RANGE": {
"desc": "Configure wrong value for nat zone.",

View File

@ -1,4 +1,32 @@
{
"VALID_VLAN": {
"sonic-vlan:sonic-vlan": {
"sonic-vlan:VLAN": {
"VLAN_LIST": [
{
"admin_status": "up",
"alias": "first_vlan",
"description": "server_vlan",
"dhcp_servers": [
"10.186.72.56"
],
"mtu": "9100",
"name": "Vlan100"
},
{
"admin_status": "up",
"alias": "second_vlan",
"description": "server_vlan",
"dhcp_servers": [
"10.186.72.66"
],
"mtu": "9100",
"name": "Vlan200"
}
]
}
}
},
"INCORRECT_VLAN_NAME": {
"sonic-vlan:sonic-vlan": {
"sonic-vlan:VLAN": {

View File

@ -155,6 +155,10 @@ module sonic-vlan {
}
}
leaf alias {
type string;
}
leaf description {
type string {
length 1..255;