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

[YANG] Add srv6 yang model and unit tests #21175

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
19 changes: 19 additions & 0 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# SONiC Configuration Database Manual


**Table of Contents**

* [Introduction](#introduction)
Expand Down Expand Up @@ -92,6 +93,7 @@
* [RADIUS](#radius)
* [Static DNS](#static-dns)
* [ASIC_SENSORS](#asic_sensors)
* [SRv6](#srv6)
* [For Developers](#for-developers)
* [Generating Application Config by Jinja2 Template](#generating-application-config-by-jinja2-template)
* [Incremental Configuration by Subscribing to ConfigDB](#incremental-configuration-by-subscribing-to-configdb)
Expand Down Expand Up @@ -2884,6 +2886,23 @@ The DNS_NAMESERVER table introduces static DNS nameservers configuration.
}
```

### SRv6

The **SRV6_MY_SID_TABLE** introduces Segment Routing over IPv6 configuration.
An example is as follows:
```
{
"SRV6_MY_SID_TABLE" : {
"FCBB:BBBB:20::" : {
"action": "uN"
},
"FCBB:BBBB:20:F1::" : {
"action": "uDT46"
}
}
}
```

### FIPS

The FIPS table introduces FIPS configuration.
Expand Down
36 changes: 36 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/srv6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"SRV6_VALID": {
"desc": "Valid config"
},
"SRV6_MY_LOCATOR_INVALID_FUNC_LEN": {
"desc": "A locator configured with invalid func_len",
"eStrKey" : "Must"
},
"SRV6_MY_LOCATOR_INVALID_VRF": {
"desc": "A locator configured with an invalid VRF name",
"eStrKey" : "InvalidValue",
"eStr": ["vrf"]
},
"SRV6_MY_SID_INVALID_LOCATOR": {
"desc": "A SID configured with invalid locator identifier",
"eStrKey" : "LeafRef"
},
"SRV6_MY_SID_INVALID_IP_ADDR": {
"desc": "A SID configured with invalid IPv6 address",
"eStrKey" : "Pattern"
},
"SRV6_MY_SID_UNMATCHED_IP_ADDR": {
"desc": "A SID configured with an IPv6 Address that does not match with the prefix of the locator",
"eStrKey" : "Must"
},
"SRV6_MY_SID_INVALID_ACTION": {
"desc": "A SID configured with invalid action",
"eStrKey" : "InvalidValue",
"eStr": ["action"]
},
"SRV6_MY_SID_DSCP_MODE_WITH_UN": {
"desc": "A SID configured with dscp_mode and uN action",
"eStrKey" : "When",
"eStr": ["action"]
}
}
213 changes: 213 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests_config/srv6.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
{
"SRV6_VALID": {
"sonic-srv6:sonic-srv6": {
"sonic-srv6:SRV6_MY_LOCATORS": {
"SRV6_MY_LOCATORS_LIST": [
{
"locator_name": "MAIN",
"prefix": "FCBB:BBBB:20::"
}
]
},
"sonic-srv6:SRV6_MY_SIDS": {
"SRV6_MY_SIDS_LIST": [
{
"ip_address": "FCBB:BBBB:20::",
"locator": "MAIN",
"action": "uN"
},
{
"ip_address": "FCBB:BBBB:20:F1::",
"locator": "MAIN",
"action": "uDT46"
}
]
}
}
},
"SRV6_MY_LOCATOR_INVALID_FUNC_LEN": {
"sonic-srv6:sonic-srv6": {
"sonic-srv6:SRV6_MY_LOCATORS": {
"SRV6_MY_LOCATORS_LIST": [
{
"locator_name": "MAIN",
"prefix": "FCBB:BBBB:20::",
"func_len": 127
}
]
},
"sonic-srv6:SRV6_MY_SIDS": {
"SRV6_MY_SIDS_LIST": [
{
"ip_address": "FCBB:BBBB:20::",
"locator": "MAIN",
"action": "uN"
},
{
"ip_address": "FCBB:BBBB:20:F1::",
"locator": "MAIN",
"action": "uDT46"
}
]
}
}
},
"SRV6_MY_LOCATOR_INVALID_VRF": {
"sonic-srv6:sonic-srv6": {
"sonic-srv6:SRV6_MY_LOCATORS": {
"SRV6_MY_LOCATORS_LIST": [
{
"locator_name": "MAIN",
"prefix": "FCBB:BBBB:20::",
"vrf": "Vrf1"
}
]
},
"sonic-srv6:SRV6_MY_SIDS": {
"SRV6_MY_SIDS_LIST": [
{
"ip_address": "FCBB:BBBB:20::",
"locator": "MAIN",
"action": "uN"
},
{
"ip_address": "FCBB:BBBB:20:F1::",
"locator": "MAIN",
"action": "uDT46"
}
]
}
}
},
"SRV6_MY_SID_INVALID_LOCATOR": {
"sonic-srv6:sonic-srv6": {
"sonic-srv6:SRV6_MY_LOCATORS": {
"SRV6_MY_LOCATORS_LIST": [
{
"locator_name": "MAIN",
"prefix": "FCBB:BBBB:20::"
}
]
},
"sonic-srv6:SRV6_MY_SIDS": {
"SRV6_MY_SIDS_LIST": [
{
"ip_address": "FCBB:BBBB:20::",
"locator": "None",
"action": "uN"
},
{
"ip_address": "FCBB:BBBB:20:F1::",
"locator": "MAIN",
"action": "uDT46"
}
]
}
}
},
"SRV6_MY_SID_INVALID_IP_ADDR": {
"sonic-srv6:sonic-srv6": {
"sonic-srv6:SRV6_MY_LOCATORS": {
"SRV6_MY_LOCATORS_LIST": [
{
"locator_name": "MAIN",
"prefix": "FCBB:BBBB:20::"
}
]
},
"sonic-srv6:SRV6_MY_SIDS": {
"SRV6_MY_SIDS_LIST": [
{
"ip_address": "FCBB:BBBB:200001::",
"locator": "MAIN",
"action": "uN"
},
{
"ip_address": "FCBB:BBBB:20:F1::",
"locator": "MAIN",
"action": "uDT46"
}
]
}
}
},
"SRV6_MY_SID_UNMATCHED_IP_ADDR": {
"sonic-srv6:sonic-srv6": {
"sonic-srv6:SRV6_MY_LOCATORS": {
"SRV6_MY_LOCATORS_LIST": [
{
"locator_name": "MAIN",
"prefix": "FCBB:BBBB:20::"
}
]
},
"sonic-srv6:SRV6_MY_SIDS": {
"SRV6_MY_SIDS_LIST": [
{
"ip_address": "FCBB:BBBB:21::",
"locator": "MAIN",
"action": "uN"
},
{
"ip_address": "FCBB:BBBB:20:F1::",
"locator": "MAIN",
"action": "uDT46"
}
]
}
}
},
"SRV6_MY_SID_INVALID_ACTION": {
"sonic-srv6:sonic-srv6": {
"sonic-srv6:SRV6_MY_LOCATORS": {
"SRV6_MY_LOCATORS_LIST": [
{
"locator_name": "MAIN",
"prefix": "FCBB:BBBB:20::"
}
]
},
"sonic-srv6:SRV6_MY_SIDS": {
"SRV6_MY_SIDS_LIST": [
{
"ip_address": "FCBB:BBBB:20::",
"locator": "MAIN",
"action": "uA"
},
{
"ip_address": "FCBB:BBBB:20:F1::",
"locator": "MAIN",
"action": "uDT46"
}
]
}
}
},
"SRV6_MY_SID_DSCP_MODE_WITH_UN": {
"sonic-srv6:sonic-srv6": {
"sonic-srv6:SRV6_MY_LOCATORS": {
"SRV6_MY_LOCATORS_LIST": [
{
"locator_name": "MAIN",
"prefix": "FCBB:BBBB:20::"
}
]
},
"sonic-srv6:SRV6_MY_SIDS": {
"SRV6_MY_SIDS_LIST": [
{
"ip_address": "FCBB:BBBB:20::",
"locator": "MAIN",
"action": "uN",
"dscp_mode": "uniform"
},
{
"ip_address": "FCBB:BBBB:20:F1::",
"locator": "MAIN",
"action": "uDT46"
}
]
}
}
}
}
Loading
Loading