[YANG][vlan-sub-interface] Add vlan field (#15838) (#16469)

* [YANG][vlan-sub-interface] Add `vlan` field



* Fix typo



* Fix UT



---------

Signed-off-by: Longxiang Lyu <lolv@microsoft.com>
Co-authored-by: Longxiang Lyu <35479537+lolyu@users.noreply.github.com>
This commit is contained in:
mssonicbld 2023-09-07 07:09:40 +08:00 committed by GitHub
parent 86b4d38bd3
commit 95f9f44958
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 62 additions and 6 deletions

View File

@ -996,12 +996,14 @@
"Ethernet12.10|10.0.1.56/31": {},
"Ethernet12.10|fc00::1:71/126": {},
"Po0003.10": {
"admin_status": "up"
"admin_status": "up",
"vlan": "10"
},
"Po0003.10|10.0.1.58/31": {},
"Po0003.10|fc00::1:75/126": {},
"Eth120.10": {
"admin_status": "up"
"admin_status": "up",
"vlan": "10"
},
"Eth120.10|10.0.1.60/31": {},
"Eth120.10|fc00::1:79/126": {}

View File

@ -55,5 +55,9 @@
"desc": "INCORRECT LOOPBACK ACTION IN VLAN_SUB_INTERFACE TABLE.",
"eStrKey" : "Pattern",
"eStr": ["drop|forward"]
},
"VLAN_SUB_INTERFACE_SHORT_NAME_FORMAT_VLAN_CHECK_MUST_CONDITION_FALSE_TEST": {
"desc": "Configure valid short name format vlan sub interface vlan must check condition false.",
"eStrKey": "Must"
}
}

View File

@ -36,7 +36,8 @@
"sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": {
"VLAN_SUB_INTERFACE_LIST": [
{
"name": "Eth8.10"
"name": "Eth8.10",
"vlan": 10
}
],
"VLAN_SUB_INTERFACE_IPPREFIX_LIST": [
@ -132,7 +133,8 @@
"sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": {
"VLAN_SUB_INTERFACE_LIST": [
{
"name": "Eth8.10"
"name": "Eth8.10",
"vlan": 10
}
],
"VLAN_SUB_INTERFACE_IPPREFIX_LIST": [
@ -164,7 +166,8 @@
"sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": {
"VLAN_SUB_INTERFACE_LIST": [
{
"name": "Po0001.10"
"name": "Po0001.10",
"vlan": 10
}
],
"VLAN_SUB_INTERFACE_IPPREFIX_LIST": [
@ -305,7 +308,8 @@
"sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": {
"VLAN_SUB_INTERFACE_LIST": [
{
"name": "Po0002.10"
"name": "Po0002.10",
"vlan": 10
}
],
"VLAN_SUB_INTERFACE_IPPREFIX_LIST": [
@ -533,5 +537,37 @@
]
}
}
},
"VLAN_SUB_INTERFACE_SHORT_NAME_FORMAT_VLAN_CHECK_MUST_CONDITION_FALSE_TEST": {
"sonic-vlan-sub-interface:sonic-vlan-sub-interface": {
"sonic-vlan-sub-interface:VLAN_SUB_INTERFACE": {
"VLAN_SUB_INTERFACE_LIST": [
{
"name": "Eth8.10"
}
],
"VLAN_SUB_INTERFACE_IPPREFIX_LIST": [
{
"name": "Eth8.10",
"ip-prefix": "10.0.0.1/30"
}
]
}
},
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"name": "Ethernet8",
"admin_status": "up",
"alias": "Ethernet8/1",
"description": "Ethernet8",
"lanes": "45,46,47,48",
"mtu": 9000,
"speed": 100000
}
]
}
}
}
}

View File

@ -37,6 +37,14 @@ module sonic-vlan-sub-interface {
description "VLAN_SUB_INTERFACE part of config_db.json with vrf";
// encap vlan is mandatory for short name subinterfaces
must "(substring-before(name, '.') = /port:sonic-port/port:PORT/port:PORT_LIST/port:name) or " +
"(substring-before(name, '.') = /lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name) or " +
"vlan"
{
error-message "Must condition not satisfied, no encap vlan provided for short-name format vlan sub interface";
}
key "name";
leaf name {
@ -70,6 +78,12 @@ module sonic-vlan-sub-interface {
description "Packet action when a packet ingress and gets routed on the same IP interface";
type stypes:loopback_action;
}
leaf vlan {
type uint16 {
range 1..4094;
}
}
}
list VLAN_SUB_INTERFACE_IPPREFIX_LIST {