Add yang model definition for VOQ_INBAND_INTERFACE (#12306) (#12493)

Cherry-pick #12306 to 202205 branch

Why I did it
Add yang model definition for VOQ_INBAND_INTERFACE defined and implemented for VOQ chassis. HLD for voq-inband-interface is included in https://github.com/sonic-net/SONiC/blob/master/doc/voq/voq_hld.md

How I did it
Added yang model definition, unit tests, sample config and documentation for the table

How to verify it
Validated config tree generation using "pyang -Vf tree -p /usr/local/share/yang/modules/ietf ./yang-models/sonic-voq-inband-interface.yang"

Built the below python-wheels to validate unit tests and other changes
target/python-wheels/bullseye/sonic_yang_mgmt-1.0-py3-none-any.whl
target/python-wheels/bullseye/sonic_yang_models-1.0-py3-none-any.whl
target/python-wheels/bullseye/sonic_config_engine-1.0-py3-none-any.whl
This commit is contained in:
tjchadaga 2022-10-27 10:14:03 -07:00 committed by GitHub
parent 19aaa0961f
commit 55d4d3f170
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 226 additions and 18 deletions

View File

@ -50,11 +50,6 @@
<VlanInterfaces/>
<IPInterfaces/>
<VoqInbandInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
<a:VoqInbandInterface>
<Name>Vlan3094</Name>
<Type>Vlan</Type>
<a:PrefixStr>1.1.1.1/24</a:PrefixStr>
</a:VoqInbandInterface>
<a:VoqInbandInterface>
<Name>Ethernet-IB0</Name>
<Type>port</Type>

View File

@ -913,19 +913,6 @@ class TestCfgGen(TestCase):
utils.to_dict("{'lanes': '6,7', 'fec': 'rs', 'alias': 'Ethernet1/1', 'index': '1', 'role': 'Ext', 'speed': '100000', 'macsec': 'macsec-profile', 'description': 'Ethernet1/1', 'mtu': '9100', 'tpid': '0x8100', 'pfc_asym': 'off'}")
)
def test_minigraph_voq_inband_interface_vlan(self):
argument = "-j {} -m {} -p {} --var-json VOQ_INBAND_INTERFACE".format(self.macsec_profile, self.sample_graph_voq, self.voq_port_config)
output = self.run_script(argument)
output_dict = utils.to_dict(output.strip())
self.assertDictEqual(
output_dict['Vlan3094'],
{'inband_type': 'Vlan'}
)
self.assertDictEqual(
output_dict['Vlan3094|1.1.1.1/24'],
{}
)
def test_minigraph_voq_inband_interface_port(self):
argument = "-j {} -m {} -p {} --var-json VOQ_INBAND_INTERFACE".format(self.macsec_profile, self.sample_graph_voq, self.voq_port_config)
output = self.run_script(argument)

View File

@ -50,6 +50,7 @@ Table of Contents
* [Versions](#versions)
* [VLAN](#vlan)
* [VLAN_MEMBER](#vlan_member)
* [VOQ Inband Interface](#voq-inband-interface)
* [Virtual router](#virtual-router)
* [WRED_PROFILE](#wred_profile)
* [PASSWORD_HARDENING](#password_hardening)
@ -1470,6 +1471,20 @@ channel name as object key, and tagging mode as attributes.
}
```
### VOQ INBAND INTERFACE
VOQ_INBAND_INTERFACE holds the name of the inband system port dedicated for cpu communication. At this time, only inband_type of "port" is supported
```
"VOQ_INBAND_INTERFACE": {
"Ethernet-IB0": {
"inband_type": "port"
},
"Ethernet-IB0|3.3.3.1/32": {},
"Ethernet-IB0|3333::3:5/128": {}
}
```
### Virtual router
The virtual router table allows to insert or update a new virtual router

View File

@ -134,6 +134,7 @@ setup(
'./yang-models/sonic-types.yang',
'./yang-models/sonic-versions.yang',
'./yang-models/sonic-vlan.yang',
'./yang-models/sonic-voq-inband-interface.yang',
'./yang-models/sonic-vrf.yang',
'./yang-models/sonic-mclag.yang',
'./yang-models/sonic-vlan-sub-interface.yang',

View File

@ -1805,6 +1805,14 @@
}
},
"VOQ_INBAND_INTERFACE": {
"Ethernet-IB0": {
"inband_type": "port"
},
"Ethernet-IB0|3.3.3.1/32": {},
"Ethernet-IB0|3333::3:5/128": {}
},
"PASSW_HARDENING": {
"POLICIES": {
"state": "enabled",

View File

@ -0,0 +1,25 @@
{
"VOQ_INBAND_INTERFACE_TEST": {
"desc": "Configure voq inband interface"
},
"VOQ_INBAND_INTERFACE_WRONG_PATTERN_FOR_INTERFACE_NAME_TEST": {
"desc": "Configure incorrect interface name in VOQ_INBAND_INTERFACE table",
"eStrKey" : "Pattern",
"eStr": ["Ethernet-IB[0-9]+"]
},
"VOQ_INBAND_INTERFACE_DEFAULT_INBAND_TYPE_TEST": {
"desc": "Configure voq_inband_interface with default inband type"
},
"VOQ_INBAND_INTERFACE_INVALID_INBAND_TYPE_TEST": {
"desc": "Configure incorrect inband type",
"eStrKey": "Pattern"
},
"VOQ_INBAND_INTERFACE_IP_PREFIX_PORT_NON_EXISTING_LEAF_TEST": {
"desc": "Configure ip prefix on voq-inband-interface with non-existing reference",
"eStrKey": "LeafRef"
},
"VOQ_INBAND_INTERFACE_IP_PREFIX_EMPTY_STRING_TEST": {
"desc": "Configure ip prefix voq-inband-interface with empty ip prefix",
"eStrKey": "InvalidValue"
}
}

View File

@ -0,0 +1,121 @@
{
"VOQ_INBAND_INTERFACE_TEST": {
"sonic-voq-inband-interface:sonic-voq-inband-interface" : {
"sonic-voq-inband-interface:VOQ_INBAND_INTERFACE": {
"VOQ_INBAND_INTERFACE_LIST": [
{
"name": "Ethernet-IB0",
"inband_type": "port"
}
],
"VOQ_INBAND_INTERFACE_IPPREFIX_LIST": [
{
"name": "Ethernet-IB0",
"ip-prefix": "3.3.3.1/32"
},
{
"name": "Ethernet-IB0",
"ip-prefix": "3333::3:5/128"
}
]
}
}
},
"VOQ_INBAND_INTERFACE_WRONG_PATTERN_FOR_INTERFACE_NAME_TEST": {
"sonic-voq-inband-interface:sonic-voq-inband-interface" : {
"sonic-voq-inband-interface:VOQ_INBAND_INTERFACE": {
"VOQ_INBAND_INTERFACE_LIST": [
{
"name": "Ethernet-0IB",
"inband_type": "port"
}
],
"VOQ_INBAND_INTERFACE_IPPREFIX_LIST": [
{
"name": "Ethernet-0IB",
"ip-prefix": "3.3.3.1/32"
},
{
"name": "Ethernet-0IB",
"ip-prefix": "3333::3:5/128"
}
]
}
}
},
"VOQ_INBAND_INTERFACE_DEFAULT_INBAND_TYPE_TEST": {
"sonic-voq-inband-interface:sonic-voq-inband-interface" : {
"sonic-voq-inband-interface:VOQ_INBAND_INTERFACE": {
"VOQ_INBAND_INTERFACE_LIST": [
{
"name": "Ethernet-IB0"
}
],
"VOQ_INBAND_INTERFACE_IPPREFIX_LIST": [
{
"name": "Ethernet-IB0",
"ip-prefix": "3.3.3.1/32"
}
]
}
}
},
"VOQ_INBAND_INTERFACE_INVALID_INBAND_TYPE_TEST": {
"sonic-voq-inband-interface:sonic-voq-inband-interface" : {
"sonic-voq-inband-interface:VOQ_INBAND_INTERFACE": {
"VOQ_INBAND_INTERFACE_LIST": [
{
"name": "Ethernet-IB0",
"inband_type": "System-port"
}
],
"VOQ_INBAND_INTERFACE_IPPREFIX_LIST": [
{
"name": "Ethernet-IB0",
"ip-prefix": "3.3.3.1/32"
}
]
}
}
},
"VOQ_INBAND_INTERFACE_IP_PREFIX_PORT_NON_EXISTING_LEAF_TEST": {
"sonic-voq-inband-interface:sonic-voq-inband-interface" : {
"sonic-voq-inband-interface:VOQ_INBAND_INTERFACE": {
"VOQ_INBAND_INTERFACE_LIST": [
{
"name": "Ethernet-IB0",
"inband_type": "port"
}
],
"VOQ_INBAND_INTERFACE_IPPREFIX_LIST": [
{
"name": "Ethernet-IB0",
"ip-prefix": "3.3.3.1/32"
},
{
"name": "Ethernet-IB1",
"ip-prefix": "3333::3:5/128"
}
]
}
}
},
"VOQ_INBAND_INTERFACE_IP_PREFIX_EMPTY_STRING_TEST": {
"sonic-voq-inband-interface:sonic-voq-inband-interface" : {
"sonic-voq-inband-interface:VOQ_INBAND_INTERFACE": {
"VOQ_INBAND_INTERFACE_LIST": [
{
"name": "Ethernet-IB0",
"inband_type": "port"
}
],
"VOQ_INBAND_INTERFACE_IPPREFIX_LIST": [
{
"name": "Ethernet-IB0",
"ip-prefix": ""
}
]
}
}
}
}

View File

@ -0,0 +1,56 @@
module sonic-voq-inband-interface {
namespace "http://github.com/sonic-net/sonic-voq-inband-interface";
prefix voq-inband-intf;
yang-version 1.1;
import sonic-types {
prefix stypes;
}
organization
"SONiC";
contact
"SONiC";
description
"SONIC BGP Internal Neighbor for voq chassis platforms";
revision 2022-10-06 {
description
"Initial revision.";
}
container sonic-voq-inband-interface {
container VOQ_INBAND_INTERFACE {
description "VOQ inband interface in VOQ Chassis";
list VOQ_INBAND_INTERFACE_LIST {
key "name";
leaf name {
type string {
pattern "Ethernet-IB[0-9]+";
}
}
leaf inband_type {
description "Type of inband interface";
type string {
pattern "port|Port";
}
default "port";
}
}
list VOQ_INBAND_INTERFACE_IPPREFIX_LIST {
description "Prefix for VOQ_INBAND_INTERFACE";
key "name ip-prefix";
leaf name {
type leafref {
path "../../VOQ_INBAND_INTERFACE_LIST/name";
}
}
leaf ip-prefix {
type stypes:sonic-ip-prefix;
}
}
}
}
}