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 #519

Merged
merged 1 commit into from
Jan 22, 2025
Merged
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
25 changes: 25 additions & 0 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ Table of Contents
* [SYSTEM_DEFAULTS table](#systemdefaults-table)
* [RADIUS](#radius)
* [Static DNS](#static-dns)
* [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 @@ -2873,6 +2874,30 @@ The DNS_NAMESERVER table introduces static DNS nameservers configuration.
}
```

### SRv6

The **SRV6_MY_SIDS** and **SRV6_MY_LOCATORS** tables introduce Segment Routing over IPv6 configuration.
An example is as follows:
```
{
"SRV6_MY_LOCATORS" : {
"loc1" : {
"prefix" : "FCBB:BBBB:20::"
}
}
"SRV6_MY_SIDS" : {
"loc1|FCBB:BBBB:20::" : {
"action": "uN"
},
"loc1|FCBB:BBBB:20:F1::" : {
"action": "uDT46",
"decap_vrf": "default",
"decap_dscp_mode": "pipe"
}
}
}
```

### 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",
"decap_dscp_mode": "uniform"
},
{
"ip_address": "FCBB:BBBB:20:F1::",
"locator": "MAIN",
"action": "uDT46"
}
]
}
}
}
}
Loading
Loading