Skip to content

Commit

Permalink
Update usage leaf in sonic-events-host yang models (sonic-net#15805)
Browse files Browse the repository at this point in the history
#### Why I did it

event yang models for usage currently use int as type for usage leaf, needs to be of type decimal64

##### Work item tracking
- Microsoft ADO **(number only)**:17747466

#### How I did it

Update yang models and UT

#### How to verify it

UT
  • Loading branch information
zbud-msft authored and sonic-otn committed Sep 20, 2023
1 parent f5bf083 commit 6d9d293
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"sonic-events-host:sonic-events-host": {
"sonic-events-host:disk-usage": {
"fs": "FILESYSTEM",
"usage": -30,
"limit": 99,
"usage": "INCORRECT_USAGE",
"limit": "2.0",
"timestamp": "1985-04-12T23:20:50.52Z"
}
}
Expand All @@ -13,7 +13,7 @@
"sonic-events-host:sonic-events-host": {
"sonic-events-host:disk-usage": {
"fs": "FILESYSTEM",
"usage": 32,
"usage": "2.0",
"limit": "INCORRECT_LIMIT",
"timestamp": "1985-04-12T23:20:50.52Z"
}
Expand All @@ -23,8 +23,8 @@
"sonic-events-host:sonic-events-host": {
"sonic-events-host:disk-usage": {
"fs": "FILESYSTEM",
"usage": 32,
"limit": 99,
"usage": "2.0",
"limit": "2.0",
"timestamp": "INCORRECT_TIMESTAMP"
}
}
Expand All @@ -33,25 +33,25 @@
"sonic-events-host:sonic-events-host": {
"sonic-events-host:disk-usage": {
"fs": "FILESYSTEM",
"usage": 32,
"limit": 99,
"usage": "2.0",
"limit": "2.0",
"timestamp": "1985-04-12T23:20:50.52Z"
}
}
},
"SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_USAGE": {
"sonic-events-host:sonic-events-host": {
"sonic-events-host:memory-usage": {
"usage": -30,
"limit": 99,
"usage": "INCORRECT_USAGE",
"limit": "2.0",
"timestamp": "1985-04-12T23:20:50.52Z"
}
}
},
"SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_LIMIT": {
"sonic-events-host:sonic-events-host": {
"sonic-events-host:memory-usage": {
"usage": 32,
"usage": "2.0",
"limit": "INCORRECT_LIMIT",
"timestamp": "1985-04-12T23:20:50.52Z"
}
Expand All @@ -60,34 +60,34 @@
"SONIC_EVENTS_HOST_MEMORY_USAGE_INCORRECT_TIMESTAMP": {
"sonic-events-host:sonic-events-host": {
"sonic-events-host:memory-usage": {
"usage": 32,
"limit": 99,
"usage": "2.0",
"limit": "2.0",
"timestamp": "INCORRECT_TIMESTAMP"
}
}
},
"SONIC_EVENTS_HOST_MEMORY_USAGE_VALID": {
"sonic-events-host:sonic-events-host": {
"sonic-events-host:memory-usage": {
"usage": 32,
"limit": 99,
"usage": "2.0",
"limit": "2.0",
"timestamp": "1985-04-12T23:20:50.52Z"
}
}
},
"SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_USAGE": {
"sonic-events-host:sonic-events-host": {
"sonic-events-host:cpu-usage": {
"usage": -30,
"limit": 99,
"usage": "INCORRECT_USAGE",
"limit": "2.0",
"timestamp": "1985-04-12T23:20:50.52Z"
}
}
},
"SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_LIMIT": {
"sonic-events-host:sonic-events-host": {
"sonic-events-host:cpu-usage": {
"usage": 32,
"usage": "2.0",
"limit": "INCORRECT_LIMIT",
"timestamp": "1985-04-12T23:20:50.52Z"
}
Expand All @@ -96,17 +96,17 @@
"SONIC_EVENTS_HOST_CPU_USAGE_INCORRECT_TIMESTAMP": {
"sonic-events-host:sonic-events-host": {
"sonic-events-host:cpu-usage": {
"usage": 32,
"limit": 99,
"usage": "2.0",
"limit": "2.0",
"timestamp": "INCORRECT_TIMESTAMP"
}
}
},
"SONIC_EVENTS_HOST_CPU_USAGE_VALID": {
"sonic-events-host:sonic-events-host": {
"sonic-events-host:cpu-usage": {
"usage": 32,
"limit": 99,
"usage": "2.0",
"limit": "2.0",
"timestamp": "1985-04-12T23:20:50.52Z"
}
}
Expand Down
12 changes: 4 additions & 8 deletions src/sonic-yang-models/yang-models/sonic-events-common.yang
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,15 @@ module sonic-events-common {

grouping sonic-events-usage {
leaf usage {
type uint8 {
range "0..100" {
error-message "Incorrect val for %";
}
type decimal64 {
fraction-digits 1;
}
description "Percentage in use";
}

leaf limit {
type uint8 {
range "0..100" {
error-message "Incorrect val for %";
}
type decimal64 {
fraction-digits 1;
}
description "Percentage limit set";
}
Expand Down

0 comments on commit 6d9d293

Please sign in to comment.