Skip to content

Commit 7ace2d0

Browse files
authored
[YangModel][asic_sensors] Add ASIC_SENSORS yang models (sonic-net#21218) (sonic-net#21579)
[YangModel][asic_sensors] Add ASIC_SENSORS yang models
1 parent b8ce5a4 commit 7ace2d0

6 files changed

Lines changed: 167 additions & 1 deletion

File tree

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

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ Table of Contents
9494
* [SYSTEM_DEFAULTS table](#systemdefaults-table)
9595
* [RADIUS](#radius)
9696
* [Static DNS](#static-dns)
97+
* [ASIC_SENSORS](#asic_sensors)
9798
* [For Developers](#for-developers)
9899
* [Generating Application Config by Jinja2 Template](#generating-application-config-by-jinja2-template)
99100
* [Incremental Configuration by Subscribing to ConfigDB](#incremental-configuration-by-subscribing-to-configdb)
@@ -2919,7 +2920,23 @@ The DPUS table introduces the information on the DPUs (Data Processing Unit) ava
29192920
}
29202921
```
29212922

2922-
#### 5.2.3 Update value directly in db memory
2923+
### ASIC_SENSORS
2924+
2925+
The ASIC_SENSORS table introduces the asic sensors polling configuration when they are available on the platform.
2926+
2927+
```json
2928+
{
2929+
"ASIC_SENSORS": {
2930+
"ASIC_SENSORS_POLLER_INTERVAL": {
2931+
"interval": "10"
2932+
},
2933+
"ASIC_SENSORS_POLLER_STATUS": {
2934+
"admin_status": "enable"
2935+
}
2936+
}
2937+
}
2938+
```
2939+
29232940

29242941
For Developers
29252942
==============

src/sonic-yang-models/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ def run(self):
204204
'./yang-models/sonic-system-port.yang',
205205
'./yang-models/sonic-macsec.yang',
206206
'./yang-models/sonic-bgp-sentinel.yang',
207+
'./yang-models/sonic-asic-sensors.yang',
207208
'./yang-models/sonic-bmp.yang',
208209
'./yang-models/sonic-xcvrd-log.yang',
209210
'./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
@@ -2802,6 +2802,14 @@
28022802
"sampling_interval": "5",
28032803
"retention_period": "15"
28042804
}
2805+
},
2806+
"ASIC_SENSORS": {
2807+
"ASIC_SENSORS_POLLER_INTERVAL": {
2808+
"interval": "10"
2809+
},
2810+
"ASIC_SENSORS_POLLER_STATUS": {
2811+
"admin_status": "enable"
2812+
}
28052813
}
28062814
},
28072815
"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)