schemas: refactor topology definitions into separate json schema
This is the initial refactor for topology related schema definitions.
Since we plan on updating some of those, we refactor all of it into
its own schema.
Tested: Schema Validator Pass
Change-Id: Ib199ca010e83618da59b2c3ba4200d782ebbdbca
Signed-off-by: Oliver Brewka <oliver.brewka@9elements.com>
diff --git a/schemas/exposes_record.json b/schemas/exposes_record.json
index b818ce9..a194618 100644
--- a/schemas/exposes_record.json
+++ b/schemas/exposes_record.json
@@ -82,10 +82,10 @@
"$ref": "legacy.json#/$defs/ExternalSensor"
},
{
- "$ref": "legacy.json#/$defs/Port"
+ "$ref": "topology.json#/$defs/Port"
},
{
- "$ref": "legacy.json#/$defs/DownstreamPort"
+ "$ref": "topology.json#/$defs/DownstreamPort"
},
{
"$ref": "legacy.json#/$defs/PSUPresence"
diff --git a/schemas/legacy.json b/schemas/legacy.json
index 75a2500..df5f0a1 100644
--- a/schemas/legacy.json
+++ b/schemas/legacy.json
@@ -477,44 +477,6 @@
"required": ["Name", "Type", "Units", "EntityId", "EntityInstance"],
"type": "object"
},
- "Port": {
- "description": "https://github.com/openbmc/docs/blob/master/designs/physical-topology.md",
- "additionalProperties": false,
- "properties": {
- "Name": {
- "$ref": "#/$defs/Types/Name"
- },
- "Type": {
- "description": "This enum may be extended as described in the design",
- "type": "string",
- "enum": ["MB Upstream Port"]
- }
- },
- "required": ["Name", "Type"],
- "type": "object"
- },
- "DownstreamPort": {
- "description": "https://github.com/openbmc/docs/blob/master/designs/physical-topology.md",
- "additionalProperties": false,
- "properties": {
- "Name": {
- "$ref": "#/$defs/Types/Name"
- },
- "ConnectsToType": {
- "description": "Should be equal to the 'Type' property on the upstream port",
- "$ref": "#/$defs/Types/ConnectsToType"
- },
- "PowerPort": {
- "$ref": "#/$defs/Types/PowerPort"
- },
- "Type": {
- "type": "string",
- "const": "DownstreamPort"
- }
- },
- "required": ["Name", "Type", "ConnectsToType"],
- "type": "object"
- },
"PSUPresence": {
"additionalProperties": false,
"properties": {
@@ -1167,10 +1129,6 @@
"required": ["Name", "Pwm", "Tachs"],
"type": "object"
},
- "ConnectsToType": {
- "type": "string",
- "const": "MB Upstream Port"
- },
"CpuID": {
"type": "number",
"minimum": 0,
@@ -1278,9 +1236,6 @@
"PowerFactorMin": {
"type": "number"
},
- "PowerPort": {
- "type": "boolean"
- },
"PowerScaleFactor": {
"type": "number"
},
diff --git a/schemas/meson.build b/schemas/meson.build
index 647024f..12a4c07 100644
--- a/schemas/meson.build
+++ b/schemas/meson.build
@@ -17,5 +17,6 @@
'pid_zone.json',
'satellite_controller.json',
'stepwise.json',
+ 'topology.json',
'virtual_sensor.json',
]
diff --git a/schemas/topology.json b/schemas/topology.json
new file mode 100644
index 0000000..c076bb7
--- /dev/null
+++ b/schemas/topology.json
@@ -0,0 +1,55 @@
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "$defs": {
+ "Port": {
+ "description": "https://github.com/openbmc/docs/blob/master/designs/physical-topology.md",
+ "additionalProperties": false,
+ "properties": {
+ "Name": {
+ "$ref": "#/$defs/Types/Name"
+ },
+ "Type": {
+ "description": "This enum may be extended as described in the design",
+ "type": "string",
+ "enum": ["MB Upstream Port"]
+ }
+ },
+ "required": ["Name", "Type"],
+ "type": "object"
+ },
+ "DownstreamPort": {
+ "description": "https://github.com/openbmc/docs/blob/master/designs/physical-topology.md",
+ "additionalProperties": false,
+ "properties": {
+ "Name": {
+ "$ref": "#/$defs/Types/Name"
+ },
+ "ConnectsToType": {
+ "description": "Should be equal to the 'Type' property on the upstream port",
+ "$ref": "#/$defs/Types/ConnectsToType"
+ },
+ "PowerPort": {
+ "$ref": "#/$defs/Types/PowerPort"
+ },
+ "Type": {
+ "type": "string",
+ "const": "DownstreamPort"
+ }
+ },
+ "required": ["Name", "Type", "ConnectsToType"],
+ "type": "object"
+ },
+ "Types": {
+ "ConnectsToType": {
+ "type": "string",
+ "const": "MB Upstream Port"
+ },
+ "Name": {
+ "type": "string"
+ },
+ "PowerPort": {
+ "type": "boolean"
+ }
+ }
+ }
+}