[DPB][YANG] Fix cases when boolean is used in different literal cases (#9654)

* Add boolean as typedef to sonic-types
* Fix boolean in sonic-feature yang model
* Fix boolean in sonic-flex_counter yang model

#### Why I did it
It was request to cherry-pick fix from master (#9418) to 202111 branch to fix issue when boolean is used in different literal cases.

#### 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 <interface_name> <breakout_mode>
This commit is contained in:
Mykola Gerasymenko 2022-01-11 00:46:04 +02:00 committed by GitHub
parent 3c8d0a6e51
commit 3d82e6cf67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 50 additions and 15 deletions

View File

@ -1214,9 +1214,9 @@
"FEATURE": {
"bgp": {
"auto_restart": "enabled",
"has_global_scope": "false",
"has_per_asic_scope": "true",
"has_timer": "false",
"has_global_scope": "False",
"has_per_asic_scope": "True",
"has_timer": "False",
"high_mem_alert": "disabled",
"state": "enabled",
"set_owner": "local"
@ -1329,7 +1329,7 @@
"scheduler": "TEST@1",
"wred_profile": "Wred1"
}
},
},
"DSCP_TO_TC_MAP": {
"Dscp_to_tc_map1": {

View File

@ -7,6 +7,11 @@
"eStrKey": "Pattern",
"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" : {
"desc": "Referring invalid feature set_owner field.",
"eStrKey": "Pattern",

View File

@ -7,9 +7,9 @@
"name": "database",
"state": "always_enabled",
"auto_restart": "always_enabled",
"has_timer": "false",
"has_global_scope": "true",
"has_per_asic_scope": "true",
"has_timer": "False",
"has_global_scope": "True",
"has_per_asic_scope": "True",
"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"
}
]
}
}
}
}

View File

@ -5,8 +5,12 @@ module sonic-feature{
namespace "http://github.com/Azure/sonic-feature";
prefix feature;
import sonic-types {
prefix stypes;
}
description "Feature Table yang Module for SONiC";
typedef feature-state {
description "configuration to set the feature running state";
type string {
@ -53,22 +57,22 @@ module sonic-feature{
leaf has_timer {
description "This configuration identicates if there is
timer associated to this feature";
type boolean;
default false;
type stypes:boolean_type;
default "false";
}
leaf has_global_scope {
description "This configuration identicates there will only one service
spawned for the device";
type boolean;
default false;
type stypes:boolean_type;
default "false";
}
leaf has_per_asic_scope {
description "This configuration identicates there will only one service
spawned per asic";
type boolean;
default false;
type stypes:boolean_type;
default "false";
}
leaf high_mem_alert {

View File

@ -5,6 +5,10 @@ module sonic-flex_counter {
namespace "http://github.com/Azure/sonic-flex_counter";
prefix flex_counter;
import sonic-types {
prefix stypes;
}
description "FLEX COUNTER YANG Module for SONiC OS";
revision 2020-04-10 {
@ -24,7 +28,7 @@ module sonic-flex_counter {
}
typedef flex_delay_status {
type boolean;
type stypes:boolean_type;
}
typedef poll_interval {

View File

@ -217,6 +217,12 @@ module sonic-types {
}
}
typedef boolean_type {
type string {
pattern "false|true|False|True";
}
}
typedef mac-addr-and-mask {
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}";