Skip to content

Commit

Permalink
[YangModel][asic_sensors] Add ASIC_SENSORS yang models (#21218)
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mlok-nokia authored Dec 19, 2024
1 parent 7bfba32 commit cb2286e
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/sonic-yang-models/doc/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
* [SYSTEM_DEFAULTS table](#systemdefaults-table)
* [RADIUS](#radius)
* [Static DNS](#static-dns)
* [ASIC_SENSORS](#asic_sensors)
* [For Developers](#for-developers)
* [Generating Application Config by Jinja2 Template](#generating-application-config-by-jinja2-template)
* [Incremental Configuration by Subscribing to ConfigDB](#incremental-configuration-by-subscribing-to-configdb)
Expand Down Expand Up @@ -2914,6 +2915,23 @@ The DPUS table introduces the information on the DPUs (Data Processing Unit) ava
}
```

### ASIC_SENSORS

The ASIC_SENSORS table introduces the asic sensors polling configuration when they are available on the platform.

```json
{
"ASIC_SENSORS": {
"ASIC_SENSORS_POLLER_INTERVAL": {
"interval": "10"
},
"ASIC_SENSORS_POLLER_STATUS": {
"admin_status": "enable"
}
}
}
```


# For Developers

Expand Down
1 change: 1 addition & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ def run(self):
'./yang-models/sonic-system-port.yang',
'./yang-models/sonic-macsec.yang',
'./yang-models/sonic-bgp-sentinel.yang',
'./yang-models/sonic-asic-sensors.yang',
'./yang-models/sonic-bmp.yang',
'./yang-models/sonic-xcvrd-log.yang',
'./yang-models/sonic-grpcclient.yang',
Expand Down
8 changes: 8 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 @@ -2792,6 +2792,14 @@
"sampling_interval": "5",
"retention_period": "15"
}
},
"ASIC_SENSORS": {
"ASIC_SENSORS_POLLER_INTERVAL": {
"interval": "10"
},
"ASIC_SENSORS_POLLER_STATUS": {
"admin_status": "enable"
}
}
},
"SAMPLE_CONFIG_DB_UNKNOWN": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"ASIC_SENSORS_TABLE": {
"desc": "Config DB interval parameters for ASIC Sensors polling"
},
"ASIC_SENSORS_INVALID_POLLER_INTERVAL": {
"desc": "Configure an invalid ASIC Sensors polling interval",
"eStrKey" : "Pattern"
},
"ASIC_SENSORS_INVALID_POLLER_ADMIN_STATUS": {
"desc": "Configure an invalid ASIC Sensors polling admin status",
"eStrKey" : "InvalidValue"
},
"ASIC_SENSORS_POLLER_INTERVAL_BAD_LEN_MAX": {
"desc": "Configure an invalid ASIC Sensors polling interval: out of range value",
"eStrKey" : "InvalidValue"
},
"ASIC_SENSORS_POLLER_INTERVAL_EMPTY_VALUE": {
"desc": "Configure an empty ASIC Sensors polling interval",
"eStrKey" : "InvalidValue"
},
"ASIC_SENSORS_POLLER_ADMIN_STATUS_EMPTY_VALUE": {
"desc": "Configure an empty ASIC Sensors polling admin status",
"eStrKey" : "InvalidValue"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
{
"ASIC_SENSORS_TABLE": {
"sonic-asic-sensors:sonic-asic-sensors": {
"sonic-asic-sensors:ASIC_SENSORS": {
"ASIC_SENSORS_POLLER_INTERVAL": {
"interval": "10"
},
"ASIC_SENSORS_POLLER_STATUS": {
"admin_status": "enable"
}
}
}
},
"ASIC_SENSORS_INVALID_POLLER_INTERVAL": {
"sonic-asic-sensors:sonic-asic-sensors": {
"sonic-asic-sensors:ASIC_SENSORS": {
"ASIC_SENSORS_POLLER_INTERVAL": {
"interval": "0"
},
"ASIC_SENSORS_POLLER_STATUS": {
"admin_status": "enable"
}
}
}
},
"ASIC_SENSORS_INVALID_POLLER_ADMIN_STATUS": {
"sonic-asic-sensors:sonic-asic-sensors": {
"sonic-asic-sensors:ASIC_SENSORS": {
"ASIC_SENSORS_POLLER_INTERVAL": {
"interval": "10"
},
"ASIC_SENSORS_POLLER_STATUS": {
"admin_status": "testing"
}
}
}
},
"ASIC_SENSORS_POLLER_INTERVAL_BAD_LEN_MAX": {
"sonic-asic-sensors:sonic-asic-sensors": {
"sonic-asic-sensors:ASIC_SENSORS": {
"ASIC_SENSORS_POLLER_INTERVAL": {
"interval": "1010101010101010101010"
},
"ASIC_SENSORS_POLLER_STATUS": {
"admin_status": "enable"
}
}
}
},
"ASIC_SENSORS_POLLER_INTERVAL_EMPTY_VALUE": {
"sonic-asic-sensors:sonic-asic-sensors": {
"sonic-asic-sensors:ASIC_SENSORS": {
"ASIC_SENSORS_POLLER_INTERVAL": {
"interval": ""
},
"ASIC_SENSORS_POLLER_STATUS": {
"admin_status": "enable"
}
}
}
},
"ASIC_SENSORS_POLLER_ADMIN_STATUS_EMPTY_VALUE": {
"sonic-asic-sensors:sonic-asic-sensors": {
"sonic-asic-sensors:ASIC_SENSORS": {
"ASIC_SENSORS_POLLER_INTERVAL": {
"interval": "10"
},
"ASIC_SENSORS_POLLER_STATUS": {
"admin_status": ""
}
}
}
}
}
41 changes: 41 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-asic-sensors.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
module sonic-asic-sensors {
yang-version 1.1;
namespace "http://github.com/sonic-net/sonic-asic-sensors";
prefix asic-sensors;

import sonic-types {
prefix stypes;
}

description "ASIC SENSORs config yang Module for SONiC OS";

revision 2024-11-19 {
description "First Revision";
}

container sonic-asic-sensors {
container ASIC_SENSORS {
description "ASIC_SENSORS part of config_db.json";

container ASIC_SENSORS_POLLER_INTERVAL {
leaf interval {
description "ASIC SENSORS polling interval";
type uint32 {
range "1..999";
}
units seconds;
default "10 ";
}
} /* ASIC_SENSORS_POLLER_INTERVAL */

container ASIC_SENSORS_POLLER_STATUS {
leaf admin_status {
description "ASIC SENSORS polling administrative status";
type stypes:mode-status;
default "enable";
} /* admin_status */
} /* ASIC_SENSORS_POLLER_STATUS */

} /* end of ASIC_SENSORS */
} /* end of container sonic-asic-sensors */
} /* end of module sonic-asic-sensors */

0 comments on commit cb2286e

Please sign in to comment.