[action] [PR:4247] [EVPN-MH] Add CLI commands for EVPN VXLAN Multihoming configuration#380
Merged
Merged
Conversation
#### Why I did it
This PR adds CLI commands to configure and monitor EVPN VXLAN Multihoming (EVPN-MH) feature in SONiC. These commands enable network operators to:
- Configure global EVPN-MH parameters (startup delay, MAC/neighbor hold times)
- Configure EVPN Ethernet Segments on LAG/PortChannel interfaces
- Set Designated Forwarder (DF) preference for load distribution
- Display EVPN ES, ES-EVI, and L2 nexthop information
This complements the EVPN-MH infrastructure added in sonic-swss and sonic-swss-common.
##### Work item tracking
- Microsoft ADO **(number only)**:
#### How I did it
**Global EVPN-MH Configuration** (evpn_mh.py):
1. **`config evpn-mh startup-delay <0-3600>`** - Configure EVPN-MH startup delay (default: 300s)
- Determines how long to wait before declaring local Ethernet Segments as up after system boot
- Prevents premature traffic forwarding during initialization
- Valid range: 0-3600 seconds
2. **`config evpn-mh mac-holdtime <0-86400>`** - Configure MAC hold time (default: 1080s)
- Duration to retain remote MAC entries after EVPN route withdrawal
- Allows for graceful handling of temporary connectivity issues
- Valid range: 0-86400 seconds
3. **`config evpn-mh neigh-holdtime <0-86400>`** - Configure neighbor hold time (default: 1080s)
- Duration to retain neighbor entries after EVPN route withdrawal
- Valid range: 0-86400 seconds
**Interface-level EVPN-ES Configuration** (main.py):
4. **`config interface evpn-esi add <interface> <esi>`** - Add EVPN Ethernet Segment Identifier
- Supports two ESI types:
- **Type 0 (Manual)**: `00:XX:XX:XX:XX:XX:XX:XX:XX:XX` - Operator-configured 10-byte ESI
- First byte must be 0x00 (Type 0)
- Validates against reserved ESIs (all zeros, all FFs)
- Prevents duplicate manual ESI across interfaces
- **Type 3 (MAC-based)**: `auto-system-mac` - Auto-generated from system MAC
- Uses port ID derived from interface name
- Leverages `system_mac` from PORTCHANNEL table if configured
- Integrates with FRR via vtysh commands
- Stores configuration in CONFIG_DB `EVPN_ETHERNET_SEGMENT` table
5. **`config interface evpn-esi del <interface>`** - Remove EVPN Ethernet Segment configuration
- Removes from CONFIG_DB
- Cleans up FRR configuration (es-id, es-sys-mac, es-df-pref)
6. **`config interface evpn-df-pref <interface> <1-65535>`** - Set DF preference
- Controls Designated Forwarder election priority (higher value = higher preference)
- Default: 32767
- Valid range: 1-65535
- Updates both CONFIG_DB and FRR configuration
**Show Commands** (evpn.py):
7. **`show evpn`** - Display general EVPN information
8. **`show evpn es [<esi>]`** - Display Ethernet Segment information
- Optional ESI parameter to show specific ES details
9. **`show evpn es-evi [<vni>]`** - Display Ethernet Segment per EVI information
- Optional VNI parameter to filter by specific VLAN/VNI
10. **`show evpn es-evi detail`** - Show detailed ES-EVI information
11. **`show evpn l2-nh`** - Display L2 nexthop groups for EVPN all-active ES
All show commands leverage FRR's `show evpn` commands via `bgp_util.run_bgp_show_command()`.
**Testing** (210+ test cases):
- config_evpn_mh_test.py - Global EVPN-MH configuration tests
- Startup delay validation (boundary values, valid/invalid inputs)
- MAC holdtime validation
- Neighbor holdtime validation
- config_int_evpn_test.py - Interface EVPN-ES configuration tests
- Manual ESI configuration (Type 0)
- MAC-based ESI configuration (Type 3)
- ESI validation (reserved ESI rejection, format validation, duplicate detection)
- DF preference configuration
- Configuration add/delete operations
- Error handling and edge cases
**Helper Functions**:
- `is_reserved_esi()` - Validates against reserved ESI values
- `parse_esi_input()` - Parses and validates ESI input (Type 0 vs Type 3)
- `port_id_from_if_name()` - Extracts numeric port ID from interface name
- `check_if_same_manual_esi_exists()` - Prevents duplicate manual ESI configuration
- `run_vtysh_command()` - Wraps vtysh execution for FRR integration
**Files Changed**:
- evpn_mh.py - New file (109 lines)
- main.py - Added 199 lines for interface EVPN commands
- evpn.py - New file (67 lines)
- main.py - Added 2 lines to register EVPN command group
- config_evpn_mh_test.py - New file (104 lines)
- config_int_evpn_test.py - New file (230 lines)
**Total**: +711 lines across 6 files
#### How to verify it
**Global EVPN-MH Configuration**:
```bash
# Configure global EVPN-MH parameters
config evpn-mh startup-delay 600
config evpn-mh mac-holdtime 2000
config evpn-mh neigh-holdtime 2000
# Verify in CONFIG_DB
redis-cli -n 4 HGETALL "EVPN_MH_GLOBAL|default"
```
**Interface EVPN-ES Configuration**:
```bash
# Configure Type 0 (manual) ESI on PortChannel
config interface evpn-esi add PortChannel1 00:01:02:03:04:05:06:07:08:09
# Configure Type 3 (MAC-based) ESI
config interface evpn-esi add PortChannel2 auto-system-mac
# Set DF preference
config interface evpn-df-pref PortChannel1 50000
# Verify in CONFIG_DB
redis-cli -n 4 HGETALL "EVPN_ETHERNET_SEGMENT|PortChannel1"
# Verify in FRR
vtysh -c "show running-config" | grep -A 5 "interface PortChannel1"
# Delete ESI
config interface evpn-esi del PortChannel1
```
**Show Commands**:
```bash
# Display EVPN information
show evpn
show evpn es
show evpn es 00:01:02:03:04:05:06:07:08:09
show evpn es-evi
show evpn es-evi 1000
show evpn es-evi detail
show evpn l2-nh
```
**Run Unit Tests**:
```bash
pytest tests/config_evpn_mh_test.py -v
pytest tests/config_int_evpn_test.py -v
```
#### Which release branch to backport (provide reason below if selected)
- [ ] 202305
- [ ] 202311
- [ ] 202405
- [ ] 202411
- [ ] 202505
- [ ] 202511
#### Tested branch (Please provide the tested image version)
- [ ] <!-- image version 1 -->
- [ ] <!-- image version 2 -->
#### Description for the changelog
Add CLI commands for EVPN VXLAN Multihoming: global EVPN-MH configuration, interface Ethernet Segment (ESI) configuration, DF preference settings, and EVPN show commands
#### Link to config_db schema for YANG model changes
Updates required for:
- New table: `EVPN_MH_GLOBAL` - Global EVPN-MH configuration
- `startup_delay`: 0-3600 (default: 300)
- `mac_holdtime`: 0-86400 (default: 1080)
- `neigh_holdtime`: 0-86400 (default: 1080)
- New table: `EVPN_ETHERNET_SEGMENT` - Per-interface ES configuration
- `esi`: 10-byte ESI string (e.g., "00:01:02:03:04:05:06:07:08:09") or "AUTO"
- `type`: "TYPE_0_OPERATOR_CONFIGURED" or "TYPE_3_MAC_BASED"
- `df_pref`: 1-65535 (default: 32767)
YANG model updates should be submitted to sonic-yang-models repository.
#### Depends on
- sonic-swss-common PR: [Add L2 nexthop group table and raw netlink message handling support]
- sonic-swss PR: [EVPN-MH infrastructure and orchestration agents]
- FRR: EVPN MH support (available in FRR 8.x+)
---
**Key Features**:
✅ Global EVPN-MH parameter configuration
✅ Type 0 (manual) and Type 3 (MAC-based) ESI support
✅ DF preference configuration for load balancing
✅ FRR integration via vtysh
✅ CONFIG_DB persistence
✅ Comprehensive validation and error handling
✅ 210+ unit test cases
✅ Show commands for monitoring EVPN state
Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
Collaborator
Author
|
Original PR: sonic-net/sonic-utilities#4247 |
Collaborator
Author
|
/azp run |
Merged
8 tasks
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why I did it
This PR adds CLI commands to configure and monitor EVPN VXLAN Multihoming (EVPN-MH) feature in SONiC. These commands enable network operators to:
This complements the EVPN-MH infrastructure added in sonic-swss and sonic-swss-common.
Work item tracking
How I did it
Global EVPN-MH Configuration (evpn_mh.py):
config evpn-mh startup-delay <0-3600>- Configure EVPN-MH startup delay (default: 300s)config evpn-mh mac-holdtime <0-86400>- Configure MAC hold time (default: 1080s)config evpn-mh neigh-holdtime <0-86400>- Configure neighbor hold time (default: 1080s)Interface-level EVPN-ES Configuration (main.py):
4.
config interface evpn-esi add <interface> <esi>- Add EVPN Ethernet Segment Identifier00:XX:XX:XX:XX:XX:XX:XX:XX:XX- Operator-configured 10-byte ESIauto-system-mac- Auto-generated from system MACsystem_macfrom PORTCHANNEL table if configuredEVPN_ETHERNET_SEGMENTtableconfig interface evpn-esi del <interface>- Remove EVPN Ethernet Segment configurationconfig interface evpn-df-pref <interface> <1-65535>- Set DF preferenceShow Commands (evpn.py):
7.
show evpn- Display general EVPN information8.
show evpn es [<esi>]- Display Ethernet Segment informationshow evpn es-evi [<vni>]- Display Ethernet Segment per EVI informationshow evpn es-evi detail- Show detailed ES-EVI informationshow evpn l2-nh- Display L2 nexthop groups for EVPN all-active ESAll show commands leverage FRR's
show evpncommands viabgp_util.run_bgp_show_command().Testing (210+ test cases):
config_evpn_mh_test.py - Global EVPN-MH configuration tests
config_int_evpn_test.py - Interface EVPN-ES configuration tests
Helper Functions:
is_reserved_esi()- Validates against reserved ESI valuesparse_esi_input()- Parses and validates ESI input (Type 0 vs Type 3)port_id_from_if_name()- Extracts numeric port ID from interface namecheck_if_same_manual_esi_exists()- Prevents duplicate manual ESI configurationrun_vtysh_command()- Wraps vtysh execution for FRR integrationFiles Changed:
Total: +711 lines across 6 files
How to verify it
Global EVPN-MH Configuration:
Interface EVPN-ES Configuration:
Show Commands:
# Display EVPN information show evpn show evpn es show evpn es 00:01:02:03:04:05:06:07:08:09 show evpn es-evi show evpn es-evi 1000 show evpn es-evi detail show evpn l2-nhRun Unit Tests:
Which release branch to backport (provide reason below if selected)
Tested branch (Please provide the tested image version)
Description for the changelog
Add CLI commands for EVPN VXLAN Multihoming: global EVPN-MH configuration, interface Ethernet Segment (ESI) configuration, DF preference settings, and EVPN show commands
Link to config_db schema for YANG model changes
Updates required for:
New table:
EVPN_MH_GLOBAL- Global EVPN-MH configurationstartup_delay: 0-3600 (default: 300)mac_holdtime: 0-86400 (default: 1080)neigh_holdtime: 0-86400 (default: 1080)New table:
EVPN_ETHERNET_SEGMENT- Per-interface ES configurationesi: 10-byte ESI string (e.g., "00:01:02:03:04:05:06:07:08:09") or "AUTO"type: "TYPE_0_OPERATOR_CONFIGURED" or "TYPE_3_MAC_BASED"df_pref: 1-65535 (default: 32767)YANG model updates should be submitted to sonic-yang-models repository.
Depends on
Key Features:
✅ Global EVPN-MH parameter configuration
✅ Type 0 (manual) and Type 3 (MAC-based) ESI support
✅ DF preference configuration for load balancing
✅ FRR integration via vtysh
✅ CONFIG_DB persistence
✅ Comprehensive validation and error handling
✅ 210+ unit test cases
✅ Show commands for monitoring EVPN state
Signed-off-by: Sonic Build Admin sonicbld@microsoft.com