Skip to content

Commit cb2286e

Browse files
authored
[YangModel][asic_sensors] Add ASIC_SENSORS yang models (#21218)
Why I did it Add Yang Models support for ASIC_SENSORS configuration. Work item tracking Microsoft ADO (number only): How I did it Add Yang Models support for the following ASIC_SENSORs configuration { "ASIC_SENSORS": { "ASIC_SENSORS_POLLER_INTERVAL": { "interval": "10" }, "ASIC_SENSORS_POLLER_STATUS": { "admin_status": "enable" } } } How to verify it Image Build should be passed. Signed-off-by: mlok <marty.lok@nokia.com>
1 parent 7bfba32 commit cb2286e

6 files changed

Lines changed: 167 additions & 0 deletions

File tree

src/sonic-yang-models/doc/Configuration.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@
9090
* [SYSTEM_DEFAULTS table](#systemdefaults-table)
9191
* [RADIUS](#radius)
9292
* [Static DNS](#static-dns)
93+
* [ASIC_SENSORS](#asic_sensors)
9394
* [For Developers](#for-developers)
9495
* [Generating Application Config by Jinja2 Template](#generating-application-config-by-jinja2-template)
9596
* [Incremental Configuration by Subscribing to ConfigDB](#incremental-configuration-by-subscribing-to-configdb)
@@ -2914,6 +2915,23 @@ The DPUS table introduces the information on the DPUs (Data Processing Unit) ava
29142915
}
29152916
```
29162917

2918+
### ASIC_SENSORS
2919+
2920+
The ASIC_SENSORS table introduces the asic sensors polling configuration when they are available on the platform.
2921+
2922+
```json
2923+
{
2924+
"ASIC_SENSORS": {
2925+
"ASIC_SENSORS_POLLER_INTERVAL": {
2926+
"interval": "10"
2927+
},
2928+
"ASIC_SENSORS_POLLER_STATUS": {
2929+
"admin_status": "enable"
2930+
}
2931+
}
2932+
}
2933+
```
2934+
29172935

29182936
# For Developers
29192937

src/sonic-yang-models/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ def run(self):
203203
'./yang-models/sonic-system-port.yang',
204204
'./yang-models/sonic-macsec.yang',
205205
'./yang-models/sonic-bgp-sentinel.yang',
206+
'./yang-models/sonic-asic-sensors.yang',
206207
'./yang-models/sonic-bmp.yang',
207208
'./yang-models/sonic-xcvrd-log.yang',
208209
'./yang-models/sonic-grpcclient.yang',

src/sonic-yang-models/tests/files/sample_config_db.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2792,6 +2792,14 @@
27922792
"sampling_interval": "5",
27932793
"retention_period": "15"
27942794
}
2795+
},
2796+
"ASIC_SENSORS": {
2797+
"ASIC_SENSORS_POLLER_INTERVAL": {
2798+
"interval": "10"
2799+
},
2800+
"ASIC_SENSORS_POLLER_STATUS": {
2801+
"admin_status": "enable"
2802+
}
27952803
}
27962804
},
27972805
"SAMPLE_CONFIG_DB_UNKNOWN": {
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"ASIC_SENSORS_TABLE": {
3+
"desc": "Config DB interval parameters for ASIC Sensors polling"
4+
},
5+
"ASIC_SENSORS_INVALID_POLLER_INTERVAL": {
6+
"desc": "Configure an invalid ASIC Sensors polling interval",
7+
"eStrKey" : "Pattern"
8+
},
9+
"ASIC_SENSORS_INVALID_POLLER_ADMIN_STATUS": {
10+
"desc": "Configure an invalid ASIC Sensors polling admin status",
11+
"eStrKey" : "InvalidValue"
12+
},
13+
"ASIC_SENSORS_POLLER_INTERVAL_BAD_LEN_MAX": {
14+
"desc": "Configure an invalid ASIC Sensors polling interval: out of range value",
15+
"eStrKey" : "InvalidValue"
16+
},
17+
"ASIC_SENSORS_POLLER_INTERVAL_EMPTY_VALUE": {
18+
"desc": "Configure an empty ASIC Sensors polling interval",
19+
"eStrKey" : "InvalidValue"
20+
},
21+
"ASIC_SENSORS_POLLER_ADMIN_STATUS_EMPTY_VALUE": {
22+
"desc": "Configure an empty ASIC Sensors polling admin status",
23+
"eStrKey" : "InvalidValue"
24+
}
25+
}
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"ASIC_SENSORS_TABLE": {
3+
"sonic-asic-sensors:sonic-asic-sensors": {
4+
"sonic-asic-sensors:ASIC_SENSORS": {
5+
"ASIC_SENSORS_POLLER_INTERVAL": {
6+
"interval": "10"
7+
},
8+
"ASIC_SENSORS_POLLER_STATUS": {
9+
"admin_status": "enable"
10+
}
11+
}
12+
}
13+
},
14+
"ASIC_SENSORS_INVALID_POLLER_INTERVAL": {
15+
"sonic-asic-sensors:sonic-asic-sensors": {
16+
"sonic-asic-sensors:ASIC_SENSORS": {
17+
"ASIC_SENSORS_POLLER_INTERVAL": {
18+
"interval": "0"
19+
},
20+
"ASIC_SENSORS_POLLER_STATUS": {
21+
"admin_status": "enable"
22+
}
23+
}
24+
}
25+
},
26+
"ASIC_SENSORS_INVALID_POLLER_ADMIN_STATUS": {
27+
"sonic-asic-sensors:sonic-asic-sensors": {
28+
"sonic-asic-sensors:ASIC_SENSORS": {
29+
"ASIC_SENSORS_POLLER_INTERVAL": {
30+
"interval": "10"
31+
},
32+
"ASIC_SENSORS_POLLER_STATUS": {
33+
"admin_status": "testing"
34+
}
35+
}
36+
}
37+
},
38+
"ASIC_SENSORS_POLLER_INTERVAL_BAD_LEN_MAX": {
39+
"sonic-asic-sensors:sonic-asic-sensors": {
40+
"sonic-asic-sensors:ASIC_SENSORS": {
41+
"ASIC_SENSORS_POLLER_INTERVAL": {
42+
"interval": "1010101010101010101010"
43+
},
44+
"ASIC_SENSORS_POLLER_STATUS": {
45+
"admin_status": "enable"
46+
}
47+
}
48+
}
49+
},
50+
"ASIC_SENSORS_POLLER_INTERVAL_EMPTY_VALUE": {
51+
"sonic-asic-sensors:sonic-asic-sensors": {
52+
"sonic-asic-sensors:ASIC_SENSORS": {
53+
"ASIC_SENSORS_POLLER_INTERVAL": {
54+
"interval": ""
55+
},
56+
"ASIC_SENSORS_POLLER_STATUS": {
57+
"admin_status": "enable"
58+
}
59+
}
60+
}
61+
},
62+
"ASIC_SENSORS_POLLER_ADMIN_STATUS_EMPTY_VALUE": {
63+
"sonic-asic-sensors:sonic-asic-sensors": {
64+
"sonic-asic-sensors:ASIC_SENSORS": {
65+
"ASIC_SENSORS_POLLER_INTERVAL": {
66+
"interval": "10"
67+
},
68+
"ASIC_SENSORS_POLLER_STATUS": {
69+
"admin_status": ""
70+
}
71+
}
72+
}
73+
}
74+
}
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
module sonic-asic-sensors {
2+
yang-version 1.1;
3+
namespace "http://github.com/sonic-net/sonic-asic-sensors";
4+
prefix asic-sensors;
5+
6+
import sonic-types {
7+
prefix stypes;
8+
}
9+
10+
description "ASIC SENSORs config yang Module for SONiC OS";
11+
12+
revision 2024-11-19 {
13+
description "First Revision";
14+
}
15+
16+
container sonic-asic-sensors {
17+
container ASIC_SENSORS {
18+
description "ASIC_SENSORS part of config_db.json";
19+
20+
container ASIC_SENSORS_POLLER_INTERVAL {
21+
leaf interval {
22+
description "ASIC SENSORS polling interval";
23+
type uint32 {
24+
range "1..999";
25+
}
26+
units seconds;
27+
default "10 ";
28+
}
29+
} /* ASIC_SENSORS_POLLER_INTERVAL */
30+
31+
container ASIC_SENSORS_POLLER_STATUS {
32+
leaf admin_status {
33+
description "ASIC SENSORS polling administrative status";
34+
type stypes:mode-status;
35+
default "enable";
36+
} /* admin_status */
37+
} /* ASIC_SENSORS_POLLER_STATUS */
38+
39+
} /* end of ASIC_SENSORS */
40+
} /* end of container sonic-asic-sensors */
41+
} /* end of module sonic-asic-sensors */

0 commit comments

Comments
 (0)