diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/srv6.json b/src/sonic-yang-models/tests/yang_model_tests/tests/srv6.json index d65d1c1cb7f..41d4921a04f 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/srv6.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/srv6.json @@ -15,11 +15,11 @@ "desc": "A SID configured with invalid locator identifier", "eStrKey" : "LeafRef" }, - "SRV6_MY_SID_INVALID_IP_ADDR": { + "SRV6_MY_SID_INVALID_IP_PREFIX": { "desc": "A SID configured with invalid IPv6 address", "eStrKey" : "Pattern" }, - "SRV6_MY_SID_UNMATCHED_IP_ADDR": { + "SRV6_MY_SID_UNMATCHED_IP_PREFIX": { "desc": "A SID configured with an IPv6 Address that does not match with the prefix of the locator", "eStrKey" : "Must" }, @@ -27,10 +27,5 @@ "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"] } } \ No newline at end of file diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/srv6.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/srv6.json index 5185d41007c..2b92720aa31 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/srv6.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/srv6.json @@ -12,12 +12,12 @@ "sonic-srv6:SRV6_MY_SIDS": { "SRV6_MY_SIDS_LIST": [ { - "ip_address": "FCBB:BBBB:20::", + "ip_prefix": "FCBB:BBBB:20::/48", "locator": "MAIN", "action": "uN" }, { - "ip_address": "FCBB:BBBB:20:F1::", + "ip_prefix": "FCBB:BBBB:20:F1::/64", "locator": "MAIN", "action": "uDT46" } @@ -39,12 +39,12 @@ "sonic-srv6:SRV6_MY_SIDS": { "SRV6_MY_SIDS_LIST": [ { - "ip_address": "FCBB:BBBB:20::", + "ip_prefix": "FCBB:BBBB:20::/48", "locator": "MAIN", "action": "uN" }, { - "ip_address": "FCBB:BBBB:20:F1::", + "ip_prefix": "FCBB:BBBB:20:F1::/64", "locator": "MAIN", "action": "uDT46" } @@ -66,12 +66,12 @@ "sonic-srv6:SRV6_MY_SIDS": { "SRV6_MY_SIDS_LIST": [ { - "ip_address": "FCBB:BBBB:20::", + "ip_prefix": "FCBB:BBBB:20::/48", "locator": "MAIN", "action": "uN" }, { - "ip_address": "FCBB:BBBB:20:F1::", + "ip_prefix": "FCBB:BBBB:20:F1::/64", "locator": "MAIN", "action": "uDT46" } @@ -92,12 +92,12 @@ "sonic-srv6:SRV6_MY_SIDS": { "SRV6_MY_SIDS_LIST": [ { - "ip_address": "FCBB:BBBB:20::", + "ip_prefix": "FCBB:BBBB:20::/48", "locator": "None", "action": "uN" }, { - "ip_address": "FCBB:BBBB:20:F1::", + "ip_prefix": "FCBB:BBBB:20:F1::/64", "locator": "MAIN", "action": "uDT46" } @@ -105,7 +105,7 @@ } } }, - "SRV6_MY_SID_INVALID_IP_ADDR": { + "SRV6_MY_SID_INVALID_IP_PREFIX": { "sonic-srv6:sonic-srv6": { "sonic-srv6:SRV6_MY_LOCATORS": { "SRV6_MY_LOCATORS_LIST": [ @@ -118,12 +118,12 @@ "sonic-srv6:SRV6_MY_SIDS": { "SRV6_MY_SIDS_LIST": [ { - "ip_address": "FCBB:BBBB:200001::", + "ip_prefix": "FCBB:BBBB:21::", "locator": "MAIN", "action": "uN" }, { - "ip_address": "FCBB:BBBB:20:F1::", + "ip_prefix": "FCBB:BBBB:20:F1::/64", "locator": "MAIN", "action": "uDT46" } @@ -131,7 +131,7 @@ } } }, - "SRV6_MY_SID_UNMATCHED_IP_ADDR": { + "SRV6_MY_SID_UNMATCHED_IP_PREFIX": { "sonic-srv6:sonic-srv6": { "sonic-srv6:SRV6_MY_LOCATORS": { "SRV6_MY_LOCATORS_LIST": [ @@ -144,12 +144,12 @@ "sonic-srv6:SRV6_MY_SIDS": { "SRV6_MY_SIDS_LIST": [ { - "ip_address": "FCBB:BBBB:21::", + "ip_prefix": "FCBB:BBBB:21::/48", "locator": "MAIN", "action": "uN" }, { - "ip_address": "FCBB:BBBB:20:F1::", + "ip_prefix": "FCBB:BBBB:20:F1::/64", "locator": "MAIN", "action": "uDT46" } @@ -170,39 +170,12 @@ "sonic-srv6:SRV6_MY_SIDS": { "SRV6_MY_SIDS_LIST": [ { - "ip_address": "FCBB:BBBB:20::", + "ip_prefix": "FCBB:BBBB:20::/48", "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::", + "ip_prefix": "FCBB:BBBB:20:F1::/64", "locator": "MAIN", "action": "uDT46" } diff --git a/src/sonic-yang-models/yang-models/sonic-srv6.yang b/src/sonic-yang-models/yang-models/sonic-srv6.yang index 2ef9c3ac6df..9f7c9405c48 100644 --- a/src/sonic-yang-models/yang-models/sonic-srv6.yang +++ b/src/sonic-yang-models/yang-models/sonic-srv6.yang @@ -3,10 +3,6 @@ module sonic-srv6 { prefix srv6; yang-version 1.1; - import ietf-yang-types { - prefix yang; - } - import ietf-inet-types { prefix inet; } @@ -87,10 +83,10 @@ module sonic-srv6 { container SRV6_MY_SIDS { list SRV6_MY_SIDS_LIST { - key "locator ip_address"; + key "locator ip_prefix"; - leaf ip_address { - type inet:ipv6-address; + leaf ip_prefix { + type inet:ipv6-prefix; } leaf locator { @@ -125,12 +121,9 @@ module sonic-srv6 { enum uniform; enum pipe; } - when "../action = 'uDT46'"; - - default "uniform"; } - must 'starts-with(./ip_address, + must 'starts-with(substring-before(./ip_prefix, "::"), substring-before(/srv6:sonic-srv6/SRV6_MY_LOCATORS/SRV6_MY_LOCATORS_LIST[current()/locator]/prefix, "::"))'; } }