-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[YANG] Add srv6 yang model and unit tests (#21175)
Why I did it To support the addition of two new tables in CONFIG_DB, i.e. SRV6_MY_SIDS and SRV6_MY_LOCATORS, in order to allow configuration for SRv6 in SONiC. Work item tracking Microsoft ADO (number only): 30513277 How I did it I define the YANG model based on SRv6 HLD. How to verify it Run the unit tests and build image.
- Loading branch information
Showing
4 changed files
with
414 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
36 changes: 36 additions & 0 deletions
36
src/sonic-yang-models/tests/yang_model_tests/tests/srv6.json
This file contains 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
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
213
src/sonic-yang-models/tests/yang_model_tests/tests_config/srv6.json
This file contains 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
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" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.