[DPB][YANG] Fix cases when boolean is used in different literal cases (#9418)
Fixes #9326 #### Why I did it When we try execute DPB from CLI we have error: `libyang[0]: Invalid value "False" in "has_global_scope" element. (path: /sonic-feature:sonic-feature/FEATURE/FEATURE_LIST[name='bgp']/has_global_scope)` The reason for this issue is that has_global_scope and other have been stored in redis database with value False or True form capital letter: ``` "FEATURE":{ "bgp":{ "auto_restart":"enabled", "has_global_scope":"False", "has_per_asic_scope":"True", "has_timer":"False", "high_mem_alert":"disabled", "state":"enabled" } ``` But yang model support boolean just in lowercase letters (https://datatracker.ietf.org/doc/html/rfc6020#section-9.5.1). #### How I did it Added boolean to sonic-types as typedef with different literal cases. #### How to verify it Run the command config interface breakout <breakout_mode> **NOTE:** To verify this fix, the following PRs that fix other problems in SONiC must be merged into master: 1) Azure/sonic-buildimage/pull/9075 2) Azure/sonic-buildimage/pull/9276
This commit is contained in:
parent
5384b30d3c
commit
afd40984fc
@ -1220,9 +1220,9 @@
|
|||||||
"FEATURE": {
|
"FEATURE": {
|
||||||
"bgp": {
|
"bgp": {
|
||||||
"auto_restart": "enabled",
|
"auto_restart": "enabled",
|
||||||
"has_global_scope": "false",
|
"has_global_scope": "False",
|
||||||
"has_per_asic_scope": "true",
|
"has_per_asic_scope": "True",
|
||||||
"has_timer": "false",
|
"has_timer": "False",
|
||||||
"high_mem_alert": "disabled",
|
"high_mem_alert": "disabled",
|
||||||
"state": "enabled",
|
"state": "enabled",
|
||||||
"set_owner": "local"
|
"set_owner": "local"
|
||||||
|
@ -7,6 +7,11 @@
|
|||||||
"eStrKey": "Pattern",
|
"eStrKey": "Pattern",
|
||||||
"eStr": ["enabled|disabled|always_enabled|always_disabled"]
|
"eStr": ["enabled|disabled|always_enabled|always_disabled"]
|
||||||
},
|
},
|
||||||
|
"FEATURE_WITH_INVALID_BOOLEAN_TYPE" : {
|
||||||
|
"desc": "Referring invalid feature boolean types.",
|
||||||
|
"eStrKey": "Pattern",
|
||||||
|
"eStr": ["false|true|False|True"]
|
||||||
|
},
|
||||||
"FEATURE_WITH_INVALID_OWNER" : {
|
"FEATURE_WITH_INVALID_OWNER" : {
|
||||||
"desc": "Referring invalid feature set_owner field.",
|
"desc": "Referring invalid feature set_owner field.",
|
||||||
"eStrKey": "Pattern",
|
"eStrKey": "Pattern",
|
||||||
|
@ -7,9 +7,9 @@
|
|||||||
"name": "database",
|
"name": "database",
|
||||||
"state": "always_enabled",
|
"state": "always_enabled",
|
||||||
"auto_restart": "always_enabled",
|
"auto_restart": "always_enabled",
|
||||||
"has_timer": "false",
|
"has_timer": "False",
|
||||||
"has_global_scope": "true",
|
"has_global_scope": "True",
|
||||||
"has_per_asic_scope": "true",
|
"has_per_asic_scope": "True",
|
||||||
"set_owner": "local"
|
"set_owner": "local"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -101,5 +101,21 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"FEATURE_WITH_INVALID_BOOLEAN_TYPE": {
|
||||||
|
"sonic-feature:sonic-feature": {
|
||||||
|
"sonic-feature:FEATURE": {
|
||||||
|
"FEATURE_LIST": [
|
||||||
|
{
|
||||||
|
"name": "database",
|
||||||
|
"state": "always_enabled",
|
||||||
|
"auto_restart": "always_enabled",
|
||||||
|
"has_timer": "FALSE",
|
||||||
|
"has_global_scope": "TRUE",
|
||||||
|
"has_per_asic_scope": "TRUE"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,6 +5,10 @@ module sonic-feature{
|
|||||||
namespace "http://github.com/Azure/sonic-feature";
|
namespace "http://github.com/Azure/sonic-feature";
|
||||||
prefix feature;
|
prefix feature;
|
||||||
|
|
||||||
|
import sonic-types {
|
||||||
|
prefix stypes;
|
||||||
|
}
|
||||||
|
|
||||||
description "Feature Table yang Module for SONiC";
|
description "Feature Table yang Module for SONiC";
|
||||||
|
|
||||||
typedef feature-state {
|
typedef feature-state {
|
||||||
@ -53,22 +57,22 @@ module sonic-feature{
|
|||||||
leaf has_timer {
|
leaf has_timer {
|
||||||
description "This configuration identicates if there is
|
description "This configuration identicates if there is
|
||||||
timer associated to this feature";
|
timer associated to this feature";
|
||||||
type boolean;
|
type stypes:boolean_type;
|
||||||
default false;
|
default "false";
|
||||||
}
|
}
|
||||||
|
|
||||||
leaf has_global_scope {
|
leaf has_global_scope {
|
||||||
description "This configuration identicates there will only one service
|
description "This configuration identicates there will only one service
|
||||||
spawned for the device";
|
spawned for the device";
|
||||||
type boolean;
|
type stypes:boolean_type;
|
||||||
default false;
|
default "false";
|
||||||
}
|
}
|
||||||
|
|
||||||
leaf has_per_asic_scope {
|
leaf has_per_asic_scope {
|
||||||
description "This configuration identicates there will only one service
|
description "This configuration identicates there will only one service
|
||||||
spawned per asic";
|
spawned per asic";
|
||||||
type boolean;
|
type stypes:boolean_type;
|
||||||
default false;
|
default "false";
|
||||||
}
|
}
|
||||||
|
|
||||||
leaf high_mem_alert {
|
leaf high_mem_alert {
|
||||||
|
@ -5,6 +5,10 @@ module sonic-flex_counter {
|
|||||||
namespace "http://github.com/Azure/sonic-flex_counter";
|
namespace "http://github.com/Azure/sonic-flex_counter";
|
||||||
prefix flex_counter;
|
prefix flex_counter;
|
||||||
|
|
||||||
|
import sonic-types {
|
||||||
|
prefix stypes;
|
||||||
|
}
|
||||||
|
|
||||||
description "FLEX COUNTER YANG Module for SONiC OS";
|
description "FLEX COUNTER YANG Module for SONiC OS";
|
||||||
|
|
||||||
revision 2020-04-10 {
|
revision 2020-04-10 {
|
||||||
@ -24,7 +28,7 @@ module sonic-flex_counter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
typedef flex_delay_status {
|
typedef flex_delay_status {
|
||||||
type boolean;
|
type stypes:boolean_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef poll_interval {
|
typedef poll_interval {
|
||||||
|
@ -217,6 +217,12 @@ module sonic-types {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
typedef boolean_type {
|
||||||
|
type string {
|
||||||
|
pattern "false|true|False|True";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
typedef mac-addr-and-mask {
|
typedef mac-addr-and-mask {
|
||||||
type string {
|
type string {
|
||||||
pattern "[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}|[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}/[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}";
|
pattern "[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}|[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}/[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}";
|
||||||
|
Reference in New Issue
Block a user