Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SAG SONiC Yang #9018

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ def run(self):
'./yang-models/sonic-vlan-sub-interface.yang',
'./yang-models/sonic-warm-restart.yang',
'./yang-models/sonic-lldp.yang',
'./yang-models/sonic-static-anycast-gateway.yang',
'./yang-models/sonic-scheduler.yang',
'./yang-models/sonic-wred-profile.yang',
'./yang-models/sonic-queue.yang',
Expand Down
9 changes: 7 additions & 2 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@
},
"VLAN_INTERFACE": {
"Vlan111": {
"nat_zone": "0"
"nat_zone": "0",
"static_anycast_gateway": "true"
},
"Vlan777": {},
"Vlan111|2a04:5555:45:6709::1/64": {
Expand Down Expand Up @@ -1242,6 +1243,11 @@
"enabled": "true"
}
},
"SAG": {
"GLOBAL": {
"gateway_mac": "00:11:22:33:44:55"
}
},
"FEATURE": {
"bgp": {
"auto_restart": "enabled",
Expand Down Expand Up @@ -1359,7 +1365,6 @@
"wred_red_enable": "true"
}
},

"QUEUE": {
"Ethernet0|0": {
"scheduler": "TEST@0",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"SAG_GLOBAL_MAC_TEST": {
"desc": "Configure a entry in SAG table."
},
"SAG_GLOBAL_WITH_INVALID_MAC_TEST": {
"desc": "Configure a invalid MAC address format in SAG table.",
"eStrKey" : "Pattern"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@
"VLAN_INTERFACE_VALID_NAT_ZONE_RANGE": {
"desc": "Configure valid value for nat zone."
},
"VLAN_INTERFACE_VALID_STATIC_ANYCAST_GATEWAY": {
"desc": "Configure valid value for static anycast gateway"
},
"VLAN_INTERFACE_INVALID_STATIC_ANYCAST_GATEWAY": {
"desc": "Configure invalid value for static anycast gateway",
"eStrKey": "InvalidValue"
},
"DHCP_SERVER_VALID_FORMAT": {
"desc": "Add dhcp_server in correct format."
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"SAG_GLOBAL_MAC_TEST": {
"sonic-static-anycast-gateway:sonic-static-anycast-gateway": {
"sonic-static-anycast-gateway:SAG": {
"sonic-static-anycast-gateway:GLOBAL": {
"gateway_mac": "00:11:22:33:44:55"
}
}
}
},
"SAG_GLOBAL_WITH_INVALID_MAC_TEST": {
"sonic-static-anycast-gateway:sonic-static-anycast-gateway": {
"sonic-static-anycast-gateway:SAG": {
"sonic-static-anycast-gateway:GLOBAL": {
"gateway_mac": "001122334455"
}
}
}
}
}
104 changes: 104 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan.json
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,110 @@
}
}
},
"VLAN_INTERFACE_VALID_STATIC_ANYCAST_GATEWAY": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"mtu": 9000,
"lanes": "1",
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"sonic-vlan:sonic-vlan": {
"sonic-vlan:VLAN": {
"VLAN_LIST": [
{
"description": "vlan_nat",
"name": "Vlan100"
}
]
},
"sonic-vlan:VLAN_MEMBER": {
"VLAN_MEMBER_LIST": [
{
"port": "Ethernet0",
"tagging_mode": "tagged",
"name": "Vlan100"
}
]
},
"sonic-vlan:VLAN_INTERFACE": {
"VLAN_INTERFACE_IPPREFIX_LIST": [
{
"family": "IPv4",
"ip-prefix": "10.0.0.1/24",
"scope": "global",
"name": "Vlan100"
}
],
"VLAN_INTERFACE_LIST": [
{
"name": "Vlan100",
"static_anycast_gateway": "true"
}
]
}
}
},
"VLAN_INTERFACE_INVALID_STATIC_ANYCAST_GATEWAY": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
"PORT_LIST": [
{
"admin_status": "up",
"alias": "eth0",
"description": "Ethernet0",
"mtu": 9000,
"lanes": "1",
"name": "Ethernet0",
"speed": 25000
}
]
}
},
"sonic-vlan:sonic-vlan": {
"sonic-vlan:VLAN": {
"VLAN_LIST": [
{
"description": "vlan_nat",
"name": "Vlan100"
}
]
},
"sonic-vlan:VLAN_MEMBER": {
"VLAN_MEMBER_LIST": [
{
"port": "Ethernet0",
"tagging_mode": "tagged",
"name": "Vlan100"
}
]
},
"sonic-vlan:VLAN_INTERFACE": {
"VLAN_INTERFACE_IPPREFIX_LIST": [
{
"family": "IPv4",
"ip-prefix": "10.0.0.1/24",
"scope": "global",
"name": "Vlan100"
}
],
"VLAN_INTERFACE_LIST": [
{
"name": "Vlan100",
"static_anycast_gateway": "enabled"
}
]
}
}
},
"DHCP_SERVER_VALID_FORMAT": {
"sonic-port:sonic-port": {
"sonic-port:PORT": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
module sonic-static-anycast-gateway {

yang-version 1.1;

namespace "http://github.com/Azure/sonic-static-anycast-gateway";
prefix sag;

import ietf-yang-types {
prefix yang;
}

description "SAG yang Module for SONiC OS";

revision 2021-10-20 {
description
"Initial version";
}

container sonic-static-anycast-gateway {
container SAG {
container GLOBAL {
description "Global static anycast gateway configuration";

leaf gateway_mac {
type yang:mac-address;
}
}
}
}
}
8 changes: 7 additions & 1 deletion src/sonic-yang-models/yang-models/sonic-vlan.yang
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ module sonic-vlan {
}
}

leaf static_anycast_gateway {
description "Enable/disable static anycast gateway for the vlan interface";
superchild marked this conversation as resolved.
Show resolved Hide resolved
type boolean;
default false;
}
Copy link
Collaborator

@qiluo-msft qiluo-msft Jan 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

    [](http://example.com/codeflow?start=0&length=8)

Mixing spaces and tabs in this file. #Closed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Already unified indentation to spaces and aligned format


leaf grat_arp {
type string {
pattern "enabled|disabled";
Expand Down Expand Up @@ -158,7 +164,7 @@ module sonic-vlan {
list VLAN_LIST {

key "name";

leaf name {
type string {
pattern 'Vlan([0-9]{1,3}|[1-3][0-9]{3}|[4][0][0-8][0-9]|[4][0][9][0-4])';
Expand Down