Skip to content

[EVPN-MH] Add EVPN-MH YANG model support#27543

Open
tahmed-dev wants to merge 11 commits into
sonic-net:masterfrom
tahmed-dev:tahmed/evpn-mh-yang-models-20260526
Open

[EVPN-MH] Add EVPN-MH YANG model support#27543
tahmed-dev wants to merge 11 commits into
sonic-net:masterfrom
tahmed-dev:tahmed/evpn-mh-yang-models-20260526

Conversation

@tahmed-dev
Copy link
Copy Markdown
Contributor

Why I did it

Split the EVPN-MH YANG model updates from Barry Friedman's EVPN-MH sonic-buildimage PR into a focused PR that can be reviewed independently from FRR patches and other build/package updates.

Work item tracking
  • Microsoft ADO (number only):

How I did it

Cherry-picked the YANG/model-related changes from Barry's PR onto current sonic-buildimage master and kept the scope limited to src/sonic-yang-models.

This PR includes:

  • EVPN-MH YANG model definitions
  • EVPN-related PortChannel model updates
  • Static anycast gateway YANG model support
  • CVL/YANG test data updates for EVPN-MH, PortChannel, VLAN, and static anycast gateway
  • Configuration documentation updates
  • A follow-up whitespace cleanup for the touched documentation section

How to verify it

  • Verified the branch is clean.
  • Verified all commits include Signed-off-by lines.
  • Ran strict whitespace validation against current master:
    • git -c core.whitespace=blank-at-eol,blank-at-eof,space-before-tab,cr-at-eol diff --check github/master...HEAD
  • Verified touched JSON test/config samples parse successfully with Python json.load().
  • Verified src/sonic-yang-models/setup.py compiles with python3 -m py_compile.

Which release branch to backport (provide reason below if selected)

  • 202305
  • 202311
  • 202405
  • 202411
  • 202505
  • 202511

Tested branch (Please provide the tested image version)

  • master — local validation only; no full image built

Description for the changelog

Add EVPN-MH and static anycast gateway YANG model support.

Link to config_db schema for YANG module changes

https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-models/doc/Configuration.md#vxlan_evpn_nvo

A picture of a cute animal (not mandatory but encouraged)

tbgowda and others added 7 commits May 26, 2026 04:02
Signed-off-by: tbgowda <24815472+tbgowda@users.noreply.github.com>
(cherry picked from commit 2976b4d)
Signed-off-by: Tamer Ahmed <tamerahmed@microsoft.com>
Signed-off-by: tbgowda <24815472+tbgowda@users.noreply.github.com>
(cherry picked from commit d1e656e)
Signed-off-by: Tamer Ahmed <tamerahmed@microsoft.com>
Signed-off-by: tbgowda <24815472+tbgowda@users.noreply.github.com>
(cherry picked from commit d661445)
Signed-off-by: Tamer Ahmed <tamerahmed@microsoft.com>
Signed-off-by: tbgowda <24815472+tbgowda@users.noreply.github.com>
(cherry picked from commit 00998d9)
Signed-off-by: Tamer Ahmed <tamerahmed@microsoft.com>
(cherry picked from commit 9657053)
Signed-off-by: Tamer Ahmed <tamerahmed@microsoft.com>
(cherry picked from commit a5077bc)
Signed-off-by: Tamer Ahmed <tamerahmed@microsoft.com>
Signed-off-by: Tamer Ahmed <tamerahmed@microsoft.com>
Copilot AI review requested due to automatic review settings May 26, 2026 11:53
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR introduces new YANG models and schema updates to support Static Anycast Gateway (SAG), adds an EVPN YANG model, and extends the PortChannel model with an optional LACP system MAC, along with corresponding documentation and YANG model validation test fixtures.

Changes:

  • Add sonic-static-anycast-gateway.yang and related tests/config samples.
  • Add sonic-evpn.yang and related tests/config samples, and include it in YANG validation list.
  • Extend existing VLAN and PortChannel YANG models with new leaves and update docs/sample CONFIG_DB accordingly.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 10 comments.

Show a summary per file
File Description
src/sonic-yang-models/yang-models/sonic-vlan.yang Adds VLAN interface static_anycast_gateway leaf and revision entry.
src/sonic-yang-models/yang-models/sonic-static-anycast-gateway.yang New SAG YANG module defining global gateway MAC.
src/sonic-yang-models/yang-models/sonic-portchannel.yang Adds PortChannel system_mac leaf and revision entry.
src/sonic-yang-models/yang-models/sonic-evpn.yang New EVPN YANG module (ES and global MH configuration).
src/sonic-yang-models/tests/yang_model_tests/tests_config/vlan.json Adds VLAN static anycast gateway validation test configs.
src/sonic-yang-models/tests/yang_model_tests/tests_config/static_anycast_gateway.json Adds SAG test configs for valid/invalid MAC.
src/sonic-yang-models/tests/yang_model_tests/tests_config/portchannel.json Adds PortChannel system MAC validation test configs.
src/sonic-yang-models/tests/yang_model_tests/tests_config/evpn.json Adds EVPN validation test configs.
src/sonic-yang-models/tests/yang_model_tests/tests/vlan.json Registers VLAN static anycast gateway tests and expected failures.
src/sonic-yang-models/tests/yang_model_tests/tests/static_anycast_gateway.json Registers SAG tests and expected failures.
src/sonic-yang-models/tests/yang_model_tests/tests/portchannel.json Registers PortChannel system MAC tests and expected failures.
src/sonic-yang-models/tests/yang_model_tests/tests/evpn.json Registers EVPN tests and expected failures.
src/sonic-yang-models/tests/files/sample_config_db.json Updates sample CONFIG_DB with SAG, EVPN entries, VLAN static anycast flag, and PortChannel system MAC.
src/sonic-yang-models/setup.py Adds new YANG modules to validation list.
src/sonic-yang-models/doc/Configuration.md Adds SAG section and fixes some formatting/whitespace.

Comment on lines +146 to +147
type boolean;
default false;
"VLAN_INTERFACE_LIST": [
{
"name": "Vlan100",
"static_anycast_gateway": "true"
"VLAN_INTERFACE": {
"Vlan111": {
"nat_zone": "0",
"static_anycast_gateway": "true",
Comment on lines +10 to +14
"eStr": "Invalid use of 'AUTO' with Type 0 ESI or a manual ESI w/ AUTO type in not empty"
},
"EVPN_INVALID_TYPE_3_W_MANUAL_ESI": {
"desc": "Invalid Type 3 ES Configuration w/ Manual ESI",
"eStr": "Invalid use of 'AUTO' with Type 0 ESI or a manual ESI w/ AUTO type in not empty"
Comment on lines +67 to +68
leaf esi {
type string {
Comment on lines +74 to +83
pattern "AUTO|([a-fA-F0-9]{1,2}:){9}[a-fA-F0-9]{1,2}" {
error-message "Provided ESI is not valid";
error-app-tag esi-invalid;
}
}
}

leaf type {
type esi-type;
}
Comment on lines +99 to +103
must "(type = 'TYPE_0_OPERATOR_CONFIGURED' and esi != 'AUTO') or
(type != 'TYPE_0_OPERATOR_CONFIGURED' and esi = 'AUTO')" {
error-message "Invalid use of 'AUTO' with Type 0 ESI or a manual ESI w/ AUTO type";
error-app-tag auto-esi-type-invalid;
}
Comment on lines +24 to +31
revision 2024-05-08 {
description
"First revision.";
}

revision 2024-06-14 {
description
"Add global EVPN Multihoming configuration.";
```

### SAG
The SAG table defines the global mac address configureation for static-anycast-gateway.
Comment on lines +3 to +6
"desc": "Configure a entry in SAG table."
},
"SAG_GLOBAL_WITH_INVALID_MAC_TEST": {
"desc": "Configure a invalid MAC address format in SAG table.",
r12f
r12f previously approved these changes May 26, 2026
Address Copilot review feedback on PR sonic-net#27543:

- sonic-evpn.yang: mark 'esi' and 'type' leafs as mandatory so the 'must' constraint compares against present nodes (avoids XPath empty-node-set ambiguity); reorder revisions to reverse-chronological order.

- tests/evpn.json: align expected eStr with the YANG error-message (drop stray 'in not empty').

- sample_config_db.json, tests_config/vlan.json: encode 'static_anycast_gateway' as a JSON boolean (true) to match the YANG 'boolean' leaf.

- doc/Configuration.md: fix 'configureation' typo.

- tests/static_anycast_gateway.json: fix 'a entry' / 'a invalid' grammar.

Signed-off-by: Tamer Ahmed <tamerahmed@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

PR sonic-net#27543 follow-up: SONiC's config_db encodes boolean leafs as
lowercase strings ("true"/"false"), not native JSON booleans, because
sonic_yang_ext.py converts every value via str(val). A real JSON boolean
becomes Python True, which str() renders as "True" (capital T), which
libyang rejects as an invalid YANG boolean.

Revert sample_config_db.json and tests_config/vlan.json to use the
string "true" form to match the existing SONiC convention and fix the
BuildVS/Build broadcom/mellanox/vpp failures in PR sonic-net#27543.

Signed-off-by: Tamer Ahmed <tamerahmed@microsoft.com>
Copilot AI review requested due to automatic review settings May 27, 2026 18:29
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 10 comments.

Comment on lines +146 to +147
type boolean;
default false;
"VLAN_INTERFACE_LIST": [
{
"name": "Vlan100",
"static_anycast_gateway": "true"
Comment on lines +24 to +29
revision 2024-06-14 {
description
"Add global EVPN Multihoming configuration.";
}

revision 2024-05-08 {
Comment on lines +19 to +29
container sonic-static-anycast-gateway {
container SAG {
container GLOBAL {
description "Global static anycast gateway configuration";

leaf gateway_mac {
type yang:mac-address;
}
}
}
}

leaf default_key {
type string {
length 1..128;
Comment on lines +93 to +104
"sonic-interface:sonic-interface": {
"sonic-interface:INTERFACE": {
"INTERFACE_LIST": [
{
"name": "Ethernet10"
},
{
"name": "Ethernet11"
}
]
}
},
Comment on lines +107 to +118
"EVPN_ETHERNET_SEGMENT_LIST": [
{
"ifname": "Ethernet10",
"esi": "AUTO",
"type": "TYPE_3_MAC_BASED"
},
{
"ifname": "Ethernet11",
"esi": "AUTO",
"type": "TYPE_0_OPERATOR_CONFIGURED"
}
]
Comment on lines +2787 to +2788
### SAG
The SAG table defines the global mac address configuration for static-anycast-gateway.
Comment on lines 83 to 87
* [Versions](#versions)
* [VLAN](#vlan)
* [VLAN_MEMBER](#vlan_member)
* [SAG](#sag)
* [VNET](#vnet)
}

leaf system_mac {
description "LACP System MAC";
tahmed-dev added a commit to bdfriedman/sonic-buildimage that referenced this pull request May 27, 2026
Address Copilot review feedback on PR sonic-net#27543:

- sonic-evpn.yang: mark 'esi' and 'type' leafs as mandatory so the 'must' constraint compares against present nodes (avoids XPath empty-node-set ambiguity); reorder revisions to reverse-chronological order.

- tests/evpn.json: align expected eStr with the YANG error-message (drop stray 'in not empty').

- sample_config_db.json, tests_config/vlan.json: encode 'static_anycast_gateway' as a JSON boolean (true) to match the YANG 'boolean' leaf.

- doc/Configuration.md: fix 'configureation' typo.

- tests/static_anycast_gateway.json: fix 'a entry' / 'a invalid' grammar.

Signed-off-by: Tamer Ahmed <tamerahmed@microsoft.com>
tahmed-dev added a commit to bdfriedman/sonic-buildimage that referenced this pull request May 27, 2026
PR sonic-net#27543 follow-up: SONiC's config_db encodes boolean leafs as
lowercase strings ("true"/"false"), not native JSON booleans, because
sonic_yang_ext.py converts every value via str(val). A real JSON boolean
becomes Python True, which str() renders as "True" (capital T), which
libyang rejects as an invalid YANG boolean.

Revert sample_config_db.json and tests_config/vlan.json to use the
string "true" form to match the existing SONiC convention and fix the
BuildVS/Build broadcom/mellanox/vpp failures in PR sonic-net#27543.

Signed-off-by: Tamer Ahmed <tamerahmed@microsoft.com>
- sonic-vlan.yang: switch static_anycast_gateway leaf to stypes:boolean_type
  so it matches the quoted string encoding used in CONFIG_DB and the YANG
  validation tests.
- sonic-evpn.yang: update revision dates to 2026-05-26/2026-05-27 (no longer
  backdated) and restrict EVPN_MH_GLOBAL_LIST.default_key to the literal
  pattern "default" to match the singleton CONFIG_DB key semantics.
- sonic-portchannel.yang: expand the system_mac description to clarify when
  and why it is used (MC-LAG / EVPN multihoming) and the default behavior
  when unset.
- evpn.json (tests_config): drop the unused sonic-interface:INTERFACE blocks
  from EVPN test inputs since sonic-evpn.yang does not import or reference
  sonic-interface.

Signed-off-by: Tamer Ahmed <tamerahmed@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

… eStrKey

After switching static_anycast_gateway from YANG 'boolean' to
'stypes:boolean_type' (a string pattern), libyang now reports
'Unsatisfied pattern' instead of 'Invalid value' when an out-of-range
value such as 'enabled' is supplied. Update the test's expected error
key from 'InvalidValue' to 'Pattern' to match the new type.

Signed-off-by: Tamer Ahmed <tamerahmed@microsoft.com>
Copilot AI review requested due to automatic review settings May 27, 2026 20:26
@mssonicbld
Copy link
Copy Markdown
Collaborator

/azp run Azure.sonic-buildimage

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.

description "Global static anycast gateway configuration";

leaf gateway_mac {
type yang:mac-address;
Comment on lines +26 to +33
"Add global EVPN Multihoming configuration.";
}

revision 2026-05-26 {
description
"First revision.";
}

Comment on lines +96 to +105
{
"ifname": "Ethernet10",
"esi": "AUTO",
"type": "TYPE_3_MAC_BASED"
},
{
"ifname": "Ethernet11",
"esi": "AUTO",
"type": "TYPE_0_OPERATOR_CONFIGURED"
}
* AUTO (Anything but Type 0)
* 00:01:02:03:04:05:06:07:08:09 (Only Type 0)
*/
pattern "AUTO|([a-fA-F0-9]{1,2}:){9}[a-fA-F0-9]{1,2}" {
Comment on lines 83 to 87
* [Versions](#versions)
* [VLAN](#vlan)
* [VLAN_MEMBER](#vlan_member)
* [SAG](#sag)
* [VNET](#vnet)
Comment on lines +3272 to +3278
"EVPN_ETHERNET_SEGMENT": {
"Ethernet120": {
"type": "TYPE_0_OPERATOR_CONFIGURED",
"esi": "00:01:02:03:04:05:06:07:08:FF",
"df_pref": "12012"
}
},
Comment on lines +111 to +118
list EVPN_MH_GLOBAL_LIST {
key "default_key";

leaf default_key {
type string {
pattern "default";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants