Skip to content

Commit c16a335

Browse files
[DPB][YANG] Fix cases when boolean is used in different literal cases
* Add boolean as typedef to sonic-types * Fix boolean in sonic-feature yang model * Fix boolean in sonic-flex_counter yang model Signed-off-by: Mykola Gerasymenko <[email protected]>
1 parent 69ac3e7 commit c16a335

File tree

3 files changed

+16
-7
lines changed

3 files changed

+16
-7
lines changed

src/sonic-yang-models/yang-models/sonic-feature.yang

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,22 @@ module sonic-feature{
4242
leaf has_timer {
4343
description "This configuration identicates if there is
4444
timer associated to this feature";
45-
type boolean;
46-
default false;
45+
type stypes:boolean_type;
46+
default "false";
4747
}
4848

4949
leaf has_global_scope {
5050
description "This configuration identicates there will only one service
5151
spawned for the device";
52-
type boolean;
53-
default false;
52+
type stypes:boolean_type;
53+
default "false";
5454
}
5555

5656
leaf has_per_asic_scope {
5757
description "This configuration identicates there will only one service
5858
spawned per asic";
59-
type boolean;
60-
default false;
59+
type stypes:boolean_type;
60+
default "false";
6161
}
6262

6363
leaf high_mem_alert {

src/sonic-yang-models/yang-models/sonic-flex_counter.yang

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ module sonic-flex_counter {
55
namespace "http://github.com/Azure/sonic-flex_counter";
66
prefix flex_counter;
77

8+
import sonic-types {
9+
prefix stypes;
10+
}
11+
812
description "FLEX COUNTER YANG Module for SONiC OS";
913

1014
revision 2020-04-10 {
@@ -24,7 +28,7 @@ module sonic-flex_counter {
2428
}
2529

2630
typedef flex_delay_status {
27-
type boolean;
31+
type stypes:boolean_type;
2832
}
2933

3034
description "FLEX_COUNTER_TABLE part of config_db.json";

src/sonic-yang-models/yang-templates/sonic-types.yang.j2

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,11 @@ module sonic-types {
222222
}
223223
}
224224

225+
typedef boolean_type {
226+
type string {
227+
pattern "false|true|False|True";
228+
}
229+
}
225230

226231

227232
/* Required for CVL */

0 commit comments

Comments
 (0)