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

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

Signed-off-by: Longxiang Lyu <lolv@microsoft.com>

* Fix typo

Signed-off-by: Longxiang Lyu <lolv@microsoft.com>

* Fix UT

Signed-off-by: Longxiang Lyu <lolv@microsoft.com>

---------

Signed-off-by: Longxiang Lyu <lolv@microsoft.com>
This commit is contained in:
Longxiang Lyu 2023-07-26 01:03:36 +08:00 committed by GitHub
parent 104ae5d185
commit 47742dfc2c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 62 additions and 6 deletions

View File

@ -1098,12 +1098,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 {