Skip to content

Commit

Permalink
Adds YANG models for configurable intervals in CONFIG_DB for stormond (
Browse files Browse the repository at this point in the history
…sonic-net#18657)

#### Why I did it
This is part of a larger feature: [SONiC Storage Monitoring Daemon](sonic-net/SONiC#1481) -- this commit adds the option to configure the daemon's polling interval and fsstats file sync interval (in seconds) of the daemon via config_db by introducing YANG models.

#### How I did it
Gives userside the option to dynamically a new table 'STORMOND' with key INTERVALS and fields 'daemon_polling_interval' with default value of '3600' seconds and 'fsstats_sync_interval' with default value of '86400' seconds as defined in the YANG model.

#### How to verify it
Flash image onto a DUT and add the aforementioned table to the CONFIG_DB. Verify that `stormond` has picked up your config intervals.
  • Loading branch information
assrinivasan authored May 22, 2024
1 parent 7d7332a commit 8db0a1f
Show file tree
Hide file tree
Showing 5 changed files with 175 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -2072,6 +2072,27 @@ key - name
| collector_port | Destination L4 port of the Sflow collector | | 6343 | |
| collector_vrf | Specify the Collector VRF. In this revision, it is either default VRF or Management VRF.| | | |

### Storage Monitoring Daemon Interval Configuration

These options are used to configure the daemon polling and sync-to-disk interval
of the Storage Monitoring Daemon (stormond)

**Config Sample**
```
{
"STORMOND_CONFIG": {
"INTERVALS": {
"daemon_polling_interval" : "60",
"fsstats_sync_interval" : "360"
}
}
}
```

* `daemon_polling_interval` - Determines how often stormond queries the disk for relevant information and posts to STATE_DB
* `fsstats_sync_interval` - Determines how often key information from the STATE_DB is synced to a file on disk


### Syslog Global Configuration

These configuration options are used to configure rsyslog utility and the way
Expand Down
6 changes: 6 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -2683,5 +2683,11 @@
"global": {
}
}
},
"STORMOND_CONFIG": {
"INTERVALS": {
"daemon_polling_interval" : "3600",
"fsstats_sync_interval" : "86400"
}
}
}
29 changes: 29 additions & 0 deletions src/sonic-yang-models/tests/yang_model_tests/tests/stormond.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"STORMOND_CONFIG_TABLE": {
"desc": "Config DB interval parameters for Storage Monitoring Daemon"
},
"STORMOND_INVALID_POLLING_INTERVAL": {
"desc": "Configure an invalid daemon polling interval",
"eStrKey" : "InvalidValue"
},
"STORMOND_INVALID_SYNC_INTERVAL": {
"desc": "Configure an invalid fsstats file sync interval",
"eStrKey" : "InvalidValue"
},
"STORMOND_POLLING_INTVL_BAD_LEN_MAX": {
"desc": "Configure an invalid daemon polling interval: out of range value",
"eStrKey" : "InvalidValue"
},
"STORMOND_SYNC_INTVL_BAD_LEN_MAX": {
"desc": "Configure an invalid fsstats file sync interval: out of range value",
"eStrKey" : "InvalidValue"
},
"STORMOND_SYNC_INTVL_EMPTY_VALUE": {
"desc": "Configure an empty file sync interval",
"eStrKey" : "InvalidValue"
},
"STORMOND_POLLING_INTVL_EMPTY_VALUE": {
"desc": "Configure an empty file sync interval",
"eStrKey" : "InvalidValue"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"STORMOND_CONFIG_TABLE": {
"sonic-stormond-config:sonic-stormond-config": {
"sonic-stormond-config:STORMOND_CONFIG": {
"INTERVALS":{
"daemon_polling_interval" : "3600",
"fsstats_sync_interval" : "86400"

}
}
}
},
"STORMOND_INVALID_POLLING_INTERVAL": {
"sonic-stormond-config:sonic-stormond-config": {
"sonic-stormond-config:STORMOND_CONFIG": {
"INTERVALS":{
"daemon_polling_interval" : "-1",
"fsstats_sync_interval" : "86400"

}
}
}
},
"STORMOND_INVALID_SYNC_INTERVAL": {
"sonic-stormond-config:sonic-stormond-config": {
"sonic-stormond-config:STORMOND_CONFIG": {
"INTERVALS":{
"daemon_polling_interval" : "3600",
"fsstats_sync_interval" : "five_thousand_two_hundred_seconds"

}
}
}
},
"STORMOND_POLLING_INTVL_BAD_LEN_MAX": {
"sonic-stormond-config:sonic-stormond-config": {
"sonic-stormond-config:STORMOND_CONFIG": {
"INTERVALS":{
"daemon_polling_interval" : "360036003600360036003600360036003",
"fsstats_sync_interval" : "86400"

}
}
}
},
"STORMOND_SYNC_INTVL_BAD_LEN_MAX": {
"sonic-stormond-config:sonic-stormond-config": {
"sonic-stormond-config:STORMOND_CONFIG": {
"INTERVALS":{
"daemon_polling_interval" : "3600",
"fsstats_sync_interval" : "864008640086400864008640086400864"

}
}
}
},
"STORMOND_SYNC_INTVL_EMPTY_VALUE": {
"sonic-stormond-config:sonic-stormond-config": {
"sonic-stormond-config:STORMOND_CONFIG": {
"INTERVALS":{
"daemon_polling_interval" : "3600",
"fsstats_sync_interval" : ""

}
}
}
},
"STORMOND_POLLING_INTVL_EMPTY_VALUE": {
"sonic-stormond-config:sonic-stormond-config": {
"sonic-stormond-config:STORMOND_CONFIG": {
"INTERVALS":{
"daemon_polling_interval" : "",
"fsstats_sync_interval" : "86400"

}
}
}
}
}
40 changes: 40 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-stormond-config.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
module sonic-stormond-config{

yang-version 1.1;

namespace "http://github.com/sonic-net/sonic-stormond-config";
prefix stormond-config;

import sonic-types {
prefix stypes;
}

description "STORMOND_CONFIG Table yang Module for SONiC";

container sonic-stormond-config {

container STORMOND_CONFIG {

description "stormond_config table in config_db.json";

container INTERVALS {

leaf daemon_polling_interval {
description "Polling inerval for Storage Monitoring Daemon in STORMOND_CONFIG table";
type uint32 {
range "1..4294967295";
}
default "3600";
}

leaf fsstats_sync_interval {
description "FSSTATS JSON file syncing interval for the Storage Monitoring Daemon in STORMOND_CONFIG table";
type uint32 {
range "1..4294967295";
}
default "86400";
}
}
}
}
}

0 comments on commit 8db0a1f

Please sign in to comment.