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 Srv6 static config HLD #1860

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 21 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
ed6c1c2
init draft of srv6_static_config_hld.md
BYGX-wcr Nov 28, 2024
cb0a83d
add description for bgpcfgd changes and enrich the high-level picture
BYGX-wcr Nov 29, 2024
2301048
add doc/srv6/images/SRv6_bgpcfgd.png
BYGX-wcr Nov 29, 2024
100b3fc
refine YANG model definition and add UT test cases
BYGX-wcr Nov 30, 2024
7758034
update contents
BYGX-wcr Nov 30, 2024
906d87a
enrich UT cases and bgpcfgd changes' description
BYGX-wcr Dec 2, 2024
793e255
add arg_len back for completeness and add one more UT case
BYGX-wcr Dec 2, 2024
633fae3
add standard YANG model for srv6
BYGX-wcr Dec 4, 2024
c6f49cb
change uint16 to uint8 in YANG model
BYGX-wcr Dec 4, 2024
13720b9
remove uA; define enum for actions; set default vrf value
BYGX-wcr Dec 5, 2024
bd92ca2
remove uA test cases
BYGX-wcr Dec 6, 2024
098a038
add a note about the new FRR CLI
BYGX-wcr Dec 10, 2024
5fb2d75
add a table for supported behaviors
BYGX-wcr Dec 11, 2024
833483b
add dscp mode field in the SRV6_MY_SID_TABLE
BYGX-wcr Dec 12, 2024
3a8f49b
remove vrf field and add constraint for dscp_mode field
BYGX-wcr Dec 12, 2024
d0fcc74
move the complete definition of yang model to sonic-yang-models dir
BYGX-wcr Dec 13, 2024
21420cc
add vrf parameter back and remove uDT6
BYGX-wcr Dec 16, 2024
078dd6e
fix the YANG model rep
BYGX-wcr Dec 16, 2024
53c80e0
update the CONFIG_DB to use two tables
BYGX-wcr Dec 20, 2024
41d0cf2
remove the _TABLE suffix of the table names
BYGX-wcr Dec 22, 2024
81cc67d
supplement the missing prefix attribute of the SRV6_MY_LOCATORS table
BYGX-wcr Dec 22, 2024
fb20b35
Optimize the text
BYGX-wcr Dec 26, 2024
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
Binary file added doc/srv6/images/SRv6_bgpcfgd.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
188 changes: 188 additions & 0 deletions doc/srv6/srv6_static_config_hld.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,188 @@
# Static Configuration of SRv6 in SONiC HLD

# Table of Contents

- [Revision](#revision)
- [Definition/Abbreviation](#definitionabbreviation)
- [About This Manual](#about-this-manual)
- [1 Introuduction and Scope](#1-introuduction-and-scope)
- [2 Feature Requirements](#2-feature-requirements)
- [2.1 Functional Requirements](#21-functional-requirements)
- [2.2 Configuration and Managment Requirements](#22-configuration-and-management-requirements)
- [2.3 Warm Boot Requirements](#23-warm-boot-requirements)
- [3 Feature Design](#3-feature-design)
- [3.1 New Table in ConfigDB](#31-new-table-in-configdb)
- [3.2 Bgpcfgd Changes](#32-bgpcfgd-changes)
- [3.3 YANG Model](#33-yang-model)
- [4 Unit Test](#4-unit-test)
- [5 References ](#5-references)

# Revision

| Rev | Date | Author | Change Description |
| :--: | :-------: | :------------------------: | :---------------------: |
| 0.1 | 12/5/2024 | Changrong Wu | Initial version |
| 0.2 | 12/20/2024 | Changrong Wu | Update to use two tables per SONiC Routing WG discussion |


# Definition/Abbreviation

### Table 1: Abbreviations

| ****Term**** | ****Meaning**** |
| -------- | ----------------------------------------- |
| BGP | Border Gateway Protocol |
| SID | Segment Identifier |
| SRv6 | Segment Routing IPv6 |
| SDN | Software Defined Network |
| uSID | Micro Segment |
| VRF | Virtual Routing and Forwarding |

# About this Manual

This document provides general information about the design of the enhancements in SONiC to support static configuration of Segmentation Routing over IPv6 protocol, which is crucial for SRv6 SDN deployment (without usage of BGP).
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are we adding support only for end-point behaviors? how about steering the traffic to SRv6 at the head-end?

Copy link
Author

Choose a reason for hiding this comment

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

Yes. Right now, we only intend to add support for end-point behaviors because the traffic steering is done on the NICs in our use scenarios.

Copy link

Choose a reason for hiding this comment

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

Nit:
s/Segmentation Routing/Segment Routing


# 1 Introuduction and Scope

This document describes the high-level design of the new features in SONiC to support SRv6 SDN.
The new features include the addtion of a new table in CONFIG_DB to enable configuration of SRv6 and the enhancement of bgpcfgd to program FRR with input from CONFIG_DB.
Besides, this document also define new YANG model specification and unit-test cases used to validate the aforementioned features.

Note: frrcfgd in SONiC is also able to program SRv6 configurations to FRR but it is designed for scenarios where BGP is used to propagate SRv6 SIDs. SONiC users can choose either bgpcfgd or frrcfgd to program FRR configurations according to their own use cases freely.


# 2 Feature Requirements

## 2.1 Functional Requirements

Provide ability to statically configure SRv6 SIDs for block IDs, locators and local functions from CONFIG_DB.

## 2.2 Configuration and Management Requirements

1. User should be able to statically configure block length, locator length and function length for SRv6.

2. User should be able to statically configure a number of SIDs/uSIDs for the local functions of the switch.

## 2.3 Warm Boot Requirements

Warm reboot is intended to be supported for planned system warm reboot.



# 3 Feature Design

At the time of writing this document, FRR has been able to program the SRv6 related tables in APPL_DB through fpmsyncd.
However, there is still one gap preventing SONiC being utilized for SRv6 SDN deployment.
Specifically, there is no mechamism in SONiC allowing SDN controllers or users to directly add configuration for SRv6 without involving BGP.

In this document, we define two new tables in CONFIG_DB, i.e. **SRV6_MY_LOCATORS** and **SRV6_MY_SIDS**, which serves as the configuration source of SRv6 in SONiC.
Then, we design a new SRv6 Manager module in bgpcfgd to subscribe to the two tables and compile changes in CONFIG_DB to changes in the configurations of FRR (Note: the new SRv6 Manager relies on the new configuration CLI brought in by [FRR PR#16894](https://github.com/FRRouting/frr/pull/16894)).
To verify the correctness of the aforementioned flow, we also define the corresponding YANG model specification.
The workflow of the new mechanism is shown in the following diagram.

![Static SRv6 Config flow](images/SRv6_bgpcfgd.png)

The design details of each step is described in the following subsections.

## 3.1 New Table in ConfigDB

**SRV6_MY_LOCATORS**

Description: New table to hold the locators configured to the node.

Schema:

```
; New table
; holds SRv6 locators configured to the local node.

key = SRV6_MY_LOCATORS|locator_name
; field = value
prefix = locator_prefix ; ipv6 address that represents the locator, which is also the IPv6 prefix for all SIDs under the locator
block_len = blen ; bit length of block portion in address, default 32
node_len = nlen ; bit length of node ID portion in address, default 16
func_len = flen ; bit length of function portion in address, default 16
arg_len = alen ; bit length of argument portion in address, default 0
vrf = VRF_TABLE.key ; the VRF that the locator belongs to, default "default"
```


**SRV6_MY_SIDS**

Description: New table to hold local SID definition and SID to behavior mapping.

Schema:

```
; New table
; holds local SID to behavior mapping, allow 1:1 or n:1 mapping

key = SRV6_MY_SIDS|ipv6address
; field = value
locator = locator_name ; the name of the locator that the SID belongs to
action = behavior ; behaviors defined for the SID, default uN
vrf = VRF_TABLE.key ; Optional, VRF name for decapsulation actions, default "default", only applicable to uDT4/uDT46/uDT6 actions
dscp_mode = dscp_decap_mode ; Optional, the parameter that specifies how the node should handle DSCP bits when it performs decapsulation, default "uniform", only applicable to uDT4/uDT46/uDT6 actions

For example:
"SRV6_MY_SIDS" : {
"FCBB:BBBB:20::" : {
"action": "uN"
},
"FCBB:BBBB:20:F1::" : {
"action": "uDT46",
}
}
```

Since SONiC and SAI do not have full support for every SRv6 behaviors, we plan to add supported SRv6 behaviors in the system gradually.
The current list of supported SRv6 behaviors allowed to be define in CONFIG_DB is as follows:

| Alias | SRv6 Behaviors |
| :------ | :----- |
| uN | End with NEXT-CSID |
| uDT46 | End.DT46 with CSID |

## 3.2 Bgpcfgd changes
Copy link
Collaborator

@venkatmahalingam venkatmahalingam Dec 11, 2024

Choose a reason for hiding this comment

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

We're already using frrcfgd for SRv6, I would suggest to use frrcfgd for static SRv6 also for consistency, if there is any reason to use bpgcfgd, please state here.

Copy link
Author

Choose a reason for hiding this comment

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

Hi Venkatsen,

The primary reason is that we don't use frrcfgd in our daily operations. Since bgpcfgd has been leveraged to do static route configuration, we think it is not inappropriate to use bgpcfgd for static SRv6 configuration.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Should we discuss it in Routing WG? @BYGX-wcr @venkatmahalingam @lguohan

Copy link
Collaborator

@venkatmahalingam venkatmahalingam Dec 11, 2024

Choose a reason for hiding this comment

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

Yes, it would be helpful for the WG to understand/aware the new changes coming in for static SRv6.

Copy link
Author

Choose a reason for hiding this comment

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

Azure Networking has an event tonight starting at 6pm so I am unable to join this week's routing WG meeting. May we discuss this in next week's routing WG meeting? I can start an email thread about this topic. @venkatmahalingam, may you share your email address with me?

Copy link
Collaborator

Choose a reason for hiding this comment

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


Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please capture the FRR configuration sample. It would be good if you can provide sonic field to FRR configuration mapping.

Copy link
Author

Choose a reason for hiding this comment

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

There is still some ongoing discussion on the details of the new FRR configuration CLI. We'd better add the config sample and mapping later.

To enable automatic programming SRv6 configurations from CONFIG_DB to FRR, we need to add a new module in bgpcfgd to watch changes in **SRV6_MY_LOCATORS** and **SRV6_MY_SIDS** and compile the corresponding changes in FRR's configurations.
Following the naming convention of modules in bgpcfgd, we call this new module SRv6 Manager.
The new SRv6 Manager are supposed to verify the validity of the configuration entries coming from the CONFIG_DB.
If it gets an invalid configuration input, it should log the event in the syslog and not compile the configuration into FRR.

## 3.3 YANG Model
The simplified version of the YANG model is defined below.
```
module: sonic-srv6
+--rw sonic-srv6
+--rw SRV6_MY_LOCATORS_LIST* [locator_name]
+--rw locator_name string
+--rw block_len? uint8
+--rw node_len? uint8
+--rw func_len? uint8
+--rw arg_len? uint8
+--rw vrf? union
+--rw SRV6_MY_SIDS_LIST* [ip_address]
+--rw ip_address inet:ipv6-address
+--rw locator -> /srv6:sonic-srv6/SRV6_MY_SIDS/SRV6_MY_SIDS_LIST/locator_name
+--rw action? enumeration
+--rw vrf? union
+--rw dscp_mode? enumeration
```
Refer to [sonic-yang-models](https://github.com/sonic-net/sonic-buildimage/tree/master/src/sonic-yang-models) for the YANG model defined with standard IETF syntax.

## 4 Unit Test

|Test Cases | Test Result |
| :------ | :----- |
|add config for a SID with uN action in CONFIG_DB | verify the locator config entry is created in FRR config|
|add config for a SID with uDT46 action in CONFIG_DB | verify the opcode config entry is created in FRR config with default VRF|
|(Negative case) add config for a SID without action in CONFIG_DB | verify that the configuration did not get into FRR config |
|(Negative case) add config for a SID with an unsupported action in CONFIG_DB | verify that the configuration did not get into FRR config |
|delete config for a SID with uN action in CONFIG_DB | verify the locator config entry is deleted in FRR config|
|delete config for a SID with uDT46 action in CONFIG_DB | verify the opcode config entry for the uDT46 action is deleted in FRR config|

Copy link
Contributor

Choose a reason for hiding this comment

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

@BYGX-wcr : can we add some failure UT case also. What will happen if bgpcfgd gets exception and exited ? I assume bgp/swss/syncd docker restart and everything should get reprommed but lets add the test case to confirm.

Copy link
Author

Choose a reason for hiding this comment

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

Do you mean when bgpcfgd restarts, the SRv6 manager should retrieve all existing MY_SID config from CONFIG_DB and program them to FRR?


## 5 References