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 all 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 @@ -167,6 +167,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
7 changes: 6 additions & 1 deletion src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
"VLAN_INTERFACE": {
"Vlan111": {
"nat_zone": "0",
"static_anycast_gateway": "true",
"loopback_action": "forward",
"ipv6_use_link_local_only": "disable"
},
Expand Down Expand Up @@ -1838,6 +1839,11 @@
"interface_id": "true"
}
},
"SAG": {
Copy link
Collaborator

Choose a reason for hiding this comment

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

duplicate SAG entry?

"GLOBAL": {
"gateway_mac": "00:11:22:33:44:55"
}
},
"SCHEDULER": {
"TEST@0": {
"cbs": "256",
Expand Down Expand Up @@ -1893,7 +1899,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;
}
}
}
}
}
31 changes: 20 additions & 11 deletions src/sonic-yang-models/yang-models/sonic-vlan.yang
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module sonic-vlan {

yang-version 1.1;

yang-version 1.1;
namespace "http://github.com/sonic-net/sonic-vlan";
prefix vlan;

Expand Down Expand Up @@ -36,6 +36,10 @@ module sonic-vlan {

description "VLAN yang Module for SONiC OS";

revision 2023-02-13 {
description "Add SAG support";
}

revision 2021-04-22 {
description "Modify Vlan Member to include PortChannel along with Port";
}
Expand Down Expand Up @@ -102,17 +106,22 @@ module sonic-vlan {
}
}

leaf loopback_action {
description "Packet action when a packet ingress and gets routed on the same IP interface";
type stypes:loopback_action;
}

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;
}

leaf ipv6_use_link_local_only {
description "Enable/Disable IPv6 link local address on vlan interface";
type stypes:mode-status;
default disable;
}


leaf loopback_action {
description "Packet action when a packet ingress and gets routed on the same IP interface";
type stypes:loopback_action;
}
}
/* end of VLAN_INTERFACE_LIST */

Expand Down Expand Up @@ -252,10 +261,10 @@ module sonic-vlan {
type stypes:vlan_tagging_mode;
}
}
/* end of list VLAN_MEMBER_LIST */
/* end of list VLAN_MEMBER_LIST */
}
/* end of container VLAN_MEMBER */
/* end of container VLAN_MEMBER */
}
/* end of container sonic-vlan */
/* end of container sonic-vlan */
}
/* end of module sonic-vlan */