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

[DPB][YANG] Fix cases when boolean is used in different literal cases #9418

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -1201,9 +1201,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",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added these changes with "False" and "True" with a capital letter to make it clear that this option can also be used and it is valid.

"high_mem_alert": "disabled",
"state": "enabled"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,10 @@
"desc": "Referring invalid feature state.",
"eStrKey": "Pattern",
"eStr": ["enabled|disabled|always_enabled"]
},
"FEATURE_WITH_INVALID_BOOLEAN_TYPE" : {
"desc": "Referring invalid feature boolean types.",
"eStrKey": "Pattern",
"eStr": ["false|true|False|True"]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
{
"name": "swss",
Expand Down Expand Up @@ -62,5 +62,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"
}
]
}
}
}
}
12 changes: 6 additions & 6 deletions src/sonic-yang-models/yang-models/sonic-feature.yang
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,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;
mykolaxgerasymenko marked this conversation as resolved.
Show resolved Hide resolved
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 {
Expand Down
6 changes: 5 additions & 1 deletion src/sonic-yang-models/yang-models/sonic-flex_counter.yang
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -24,7 +28,7 @@ module sonic-flex_counter {
}

typedef flex_delay_status {
type boolean;
type stypes:boolean_type;
}

description "FLEX_COUNTER_TABLE part of config_db.json";
Expand Down
5 changes: 5 additions & 0 deletions src/sonic-yang-models/yang-templates/sonic-types.yang.j2
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,11 @@ module sonic-types {
}
}

typedef boolean_type {
type string {
pattern "false|true|False|True";
}
}


/* Required for CVL */
Expand Down