[YANG]: Add support for dual ToR attributes (#9698)

Fixes #9561
Fixes #9570 
Fixes #9563
Partial fix for #9556 

#### Why I did it
- Attributes for dual ToR configs lack YANG model support

#### How I did it
- Extend YANG tests to cover dual ToR use cases
- Extend YANG model to cover dual ToR use cases
- Reduce the default log level to warning so only test failures are printed

#### How to verify it
- Run the YANG model unit tests
This commit is contained in:
Lawrence Lee 2022-01-10 12:24:51 -08:00 committed by GitHub
parent 58c5bb6513
commit 8e6b194b17
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 276 additions and 6 deletions

View File

@ -60,6 +60,27 @@
},
"DEVICE_METADATA_CORRECT_CLOUDTYPE_REGION_CONFIG": {
"desc": "Verifying cloudtype and region configuration."
}
},
"DEVICE_METADATA_VALID_SUBTYPE": {
"desc": "Verifying valid subtype value"
},
"DEVICE_METADATA_INVALID_SUBTYPE": {
"desc": "Verifying invalid subtype value",
"eStrKey": "Pattern"
},
"DEVICE_METADATA_VALID_PEER_SWITCH": {
"desc": "Verifying valid peer switch hostname"
},
"DEVICE_METADATA_INVALID_PEER_SWITCH": {
"desc": "Verifying test fails with hostname that is too long",
"eStrKey": "Range"
},
"DEVICE_METADATA_VALID_STORAGE_DEVICE": {
"desc": "Verifying valid storage device value"
},
"DEVICE_METADATA_INVALID_STORAGE_DEVICE": {
"desc": "Verifying invalid storage device value",
"eStrKey": "InvalidValue"
}
}

View File

@ -66,5 +66,12 @@
"desc": "PORT_INVALID_TPID_TEST invalid tpid value failure.",
"eStrKey" : "Pattern",
"eStr": ["0x8100|0x9100|0x9200|0x88a8|0x88A8"]
},
"PORT_VALID_MUX_CABLE_TEST": {
"desc": "PORT_VALID_MUX_CABLE_TEST no failure."
},
"PORT_INVALID_MUX_CABLE_TEST": {
"desc": "PORT_INVALID_MUX_CABLE_TEST non-boolean values, expect fail",
"eStrKey": "InvalidValue"
}
}

View File

@ -56,5 +56,23 @@
},
"DHCPV6_SERVER_VALID_FORMAT": {
"desc": "Add dhcpv6_server in correct format."
},
"INVALID_VLAN_MAC": {
"desc": "VLAN with invalid MAC address",
"eStrKey": "Pattern"
},
"VLAN_INTERFACE_VALID_GRAT_ARP": {
"desc": "VLAN_INTERFACE with valid grat_arp value"
},
"VLAN_INTERFACE_VALID_PROXY_ARP": {
"desc": "VLAN_INTERFACE with valid proxy_arp value"
},
"VLAN_INTERFACE_INVALID_GRAT_ARP": {
"desc": "VLAN_INTERFACE with invalid grat_arp value",
"eStrKey": "Pattern"
},
"VLAN_INTERFACE_INVALID_PROXY_ARP": {
"desc": "VLAN_INTERFACE with invalid proxy_arp value",
"eStrKey": "Pattern"
}
}

View File

@ -159,5 +159,59 @@
}
}
}
},
"DEVICE_METADATA_VALID_SUBTYPE": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"subtype": "DualToR"
}
}
}
},
"DEVICE_METADATA_INVALID_SUBTYPE": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"subtype": "FakeSubtype"
}
}
}
},
"DEVICE_METADATA_VALID_PEER_SWITCH": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"peer_switch": "peer_01_hostname"
}
}
}
},
"DEVICE_METADATA_INVALID_PEER_SWITCH": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"peer_switch": "this_super_duper_long_hostname_is_too_long_according_to_RFC_1035"
}
}
}
},
"DEVICE_METADATA_VALID_STORAGE_DEVICE": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"storage_device": "true"
}
}
}
},
"DEVICE_METADATA_INVALID_STORAGE_DEVICE": {
"sonic-device_metadata:sonic-device_metadata": {
"sonic-device_metadata:DEVICE_METADATA": {
"sonic-device_metadata:localhost": {
"storage_device": "yes"
}
}
}
}
}

View File

@ -275,5 +275,44 @@
]
}
}
},
"PORT_VALID_MUX_CABLE_TEST": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"name": "Ethernet8",
"alias": "eth8",
"lanes": "65",
"speed": 50000,
"mux_cable": "true"
},
{
"name": "Ethernet12",
"alias": "eth12",
"lanes": "6",
"speed": 50000,
"mux_cable": "false"
}
]
}
}
},
"PORT_INVALID_MUX_CABLE_TEST": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"name": "Ethernet8",
"alias": "eth8",
"lanes": "65",
"speed": 50000,
"mux_cable": "enabled"
}
]
}
}
}
}

View File

@ -21,7 +21,8 @@
"10.186.72.66"
],
"mtu": "9100",
"name": "Vlan200"
"name": "Vlan200",
"mac": "00:aa:bb:cc:dd:ee"
}
]
}
@ -524,5 +525,94 @@
]
}
}
},
"INVALID_VLAN_MAC": {
"sonic-vlan:sonic-vlan": {
"sonic-vlan:VLAN": {
"VLAN_LIST": [
{
"admin_status": "up",
"name": "Vlan1000",
"mac": "12345678"
}
]
}
}
},
"VLAN_INTERFACE_VALID_GRAT_ARP": {
"sonic-vlan:sonic-vlan": {
"sonic-vlan:VLAN": {
"VLAN_LIST": [
{
"name": "Vlan1000"
},
{
"name": "Vlan2000"
}
]
},
"sonic-vlan:VLAN_INTERFACE": {
"VLAN_INTERFACE_LIST": [
{
"name": "Vlan1000",
"grat_arp": "enabled"
},
{
"name": "Vlan2000",
"grat_arp": "disabled"
}
]
}
}
},
"VLAN_INTERFACE_VALID_PROXY_ARP": {
"sonic-vlan:sonic-vlan": {
"sonic-vlan:VLAN": {
"VLAN_LIST": [
{
"name": "Vlan1000"
},
{
"name": "Vlan2000"
}
]
},
"sonic-vlan:VLAN_INTERFACE": {
"VLAN_INTERFACE_LIST": [
{
"name": "Vlan1000",
"proxy_arp": "enabled"
},
{
"name": "Vlan2000",
"proxy_arp": "disabled"
}
]
}
}
},
"VLAN_INTERFACE_INVALID_GRAT_ARP": {
"sonic-vlan:sonic-vlan": {
"sonic-vlan:VLAN_INTERFACE": {
"VLAN_INTERFACE_LIST": [
{
"name": "Vlan1000",
"grat_arp": "true"
}
]
}
}
},
"VLAN_INTERFACE_INVALID_PROXY_ARP": {
"sonic-vlan:sonic-vlan": {
"sonic-vlan:VLAN_INTERFACE": {
"VLAN_INTERFACE_LIST": [
{
"name": "Vlan1000",
"proxy_arp": "true"
}
]
}
}
}
}

View File

@ -56,9 +56,7 @@ module sonic-device_metadata {
}
leaf hostname {
type string {
length 1..255;
}
type stypes:hostname;
}
leaf platform {
@ -128,6 +126,20 @@ module sonic-device_metadata {
leaf region {
type string;
}
leaf subtype {
type string {
pattern "DualToR";
}
}
leaf peer_switch {
type stypes:hostname;
}
leaf storage_device {
type boolean;
}
}
/* end of container localhost */
}

View File

@ -138,6 +138,10 @@ module sonic-port{
type stypes:tpid_type;
}
leaf mux_cable {
type boolean;
}
} /* end of list PORT_LIST */
} /* end of container PORT */

View File

@ -9,6 +9,10 @@ module sonic-vlan {
prefix inet;
}
import ietf-yang-types {
prefix yang;
}
import sonic-types {
prefix stypes;
}
@ -85,6 +89,18 @@ module sonic-vlan {
enum disable;
}
}
leaf grat_arp {
type string {
pattern "enabled|disabled";
}
}
leaf proxy_arp {
type string {
pattern "enabled|disabled";
}
}
}
/* end of VLAN_INTERFACE_LIST */
@ -184,6 +200,10 @@ module sonic-vlan {
leaf admin_status {
type stypes:admin_status;
}
leaf mac {
type yang:mac-address;
}
}
/* end of VLAN_LIST */
}

View File

@ -229,9 +229,14 @@ module sonic-types {
}
}
typedef hostname {
type string {
length 1..63;
}
}
/* Required for CVL */
{% if yang_model_type == "cvl" %}
/* Required for CVL */
container operation {
description
"This definition is used internally by CVL and