add configuration schema for ModbusRTUDetect
The ModbusRTUDetect is an interface which exposes EM configuration for
Modbus devices which needs to be probed and enumerated. A related modbus
daemon will consume this configuration and creates ModbusDevicDetected
interface which will be inventory source for Modbus devices.
ModbusDeviceDetected will expose inventory information such as
PartNumber, SerialNumber etc in generic form for probing by EM json
configurations.
Tested: Schema validation passed
Change-Id: I32154b55c53e4a71c5615bcd84fb301b6a7ca3a0
Signed-off-by: Jagpal Singh Gill <paligill@gmail.com>
diff --git a/schemas/exposes_record.json b/schemas/exposes_record.json
index 2c2f569..06531dd 100644
--- a/schemas/exposes_record.json
+++ b/schemas/exposes_record.json
@@ -161,6 +161,9 @@
},
{
"$ref": "usb_port.json#/$defs/USBPort"
+ },
+ {
+ "$ref": "modbus.json#/$defs/ModbusRTUDetect"
}
]
},
diff --git a/schemas/meson.build b/schemas/meson.build
index e68d526..fb8821b 100644
--- a/schemas/meson.build
+++ b/schemas/meson.build
@@ -11,6 +11,7 @@
'leak_detector.json',
'legacy.json',
'mctp.json',
+ 'modbus.json',
'nvidia.json',
'openbmc-dbus.json',
'pid.json',
diff --git a/schemas/modbus.json b/schemas/modbus.json
new file mode 100644
index 0000000..7c358ab
--- /dev/null
+++ b/schemas/modbus.json
@@ -0,0 +1,89 @@
+{
+ "$schema1": "http://json-schema.org/draft-07/schema#",
+ "$defs": {
+ "ModbusRTUDetect": {
+ "additionalProperties": false,
+ "description": "The definition for the modbus device.",
+ "type": "object",
+ "properties": {
+ "Type": {
+ "description": "The type of configuration object.",
+ "const": "ModbusRTUDetect"
+ },
+ "Name": {
+ "description": "The name of the modbus device.",
+ "type": "string"
+ },
+ "Address": {
+ "description": "The address ranges for the modbus device.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "RangeStart": {
+ "description": "The start address for the address range of the modbus device.",
+ "type": "number"
+ },
+ "RangeEnd": {
+ "description": "The end address for the address range of the modbus device.",
+ "type": "number"
+ },
+ "SerialPort": {
+ "description": "The name of the serial port from SerialPort definition.",
+ "type": "string"
+ }
+ },
+ "required": ["RangeStart", "RangeEnd", "SerialPort"]
+ }
+ },
+ "Registers": {
+ "description": "The Modbus register definition.",
+ "type": "array",
+ "items": {
+ "type": "object",
+ "additionalProperties": false,
+ "properties": {
+ "Name": {
+ "description": "The name of the register.",
+ "enum": [
+ "PartNumber",
+ "SparePartNumber",
+ "SerialNumber",
+ "BuildDate",
+ "Model",
+ "Manufacturer"
+ ]
+ },
+ "Address": {
+ "description": "The address of the register.",
+ "type": "number"
+ },
+ "Size": {
+ "description": "The size of the register in bytes.",
+ "type": "number"
+ }
+ },
+ "required": ["Name", "Address", "Size"]
+ }
+ },
+ "DataParity": {
+ "description": "The parity to use for data transmission.",
+ "enum": ["Odd", "Even", "None"]
+ },
+ "BaudRate": {
+ "description": "The baudrate of the communication channel.",
+ "enum": [9600, 19200, 57600, 115200]
+ }
+ },
+ "required": [
+ "Name",
+ "Type",
+ "Address",
+ "Registers",
+ "DataParity",
+ "BaudRate"
+ ]
+ }
+ }
+}