settings objects: support multiple interfaces
A settings object had the limitation that it could implement a single,
corresponding settings interface. This was found to be too restrictive
because there are use-cases (such as in the boot settings area) that
would simplify describing settings with objects that can implement more
than one interface.
This commit adds the ability for settings objects to implement multiple
interfaces. The settings config yaml now should contain a list of
interface(s) under each settings object.
Change-Id: I90dec9e766e1afd1b0c8616e491832714bbd069d
Signed-off-by: Deepak Kodihalli <dkodihal@in.ibm.com>
diff --git a/settings_example.yaml b/settings_example.yaml
index 82b63be..e285953 100644
--- a/settings_example.yaml
+++ b/settings_example.yaml
@@ -1,31 +1,43 @@
-/xyz/openbmc_project/control/host0/boot_mode:
- Interface: xyz.openbmc_project.Control.Boot.Mode
- Properties:
- BootMode:
- Default: Mode::Modes::Safe
+# This settings object implements multiple interfaces
+/xyz/openbmc_project/control/host0/boot:
+ - Interface: xyz.openbmc_project.Control.Boot.Mode
+ Properties:
+ BootMode:
+ Default: Mode::Modes::Safe
+ - Interface: xyz.openbmc_project.Control.Boot.Source
+ Properties:
+ BootSource:
+ Default: Source::Sources::Default
-/xyz/openbmc_project/control/host1/boot_mode:
- Interface: xyz.openbmc_project.Control.Boot.Mode
- Properties:
- BootMode:
- Default: Mode::Modes::Regular
+# Same as the previous settings object, but for a different host
+/xyz/openbmc_project/control/host1/boot:
+ - Interface: xyz.openbmc_project.Control.Boot.Mode
+ Properties:
+ BootMode:
+ Default: Mode::Modes::Safe
+ - Interface: xyz.openbmc_project.Control.Boot.Source
+ Properties:
+ BootSource:
+ Default: Source::Sources::Default
+# This settings object has a property that needs to be validated, when changed.
/xyz/openbmc_project/network/host0/intf:
- Interface: xyz.openbmc_project.Network.MACAddress
- Properties:
- MACAddress:
- Default: '"00:00:00:00:00:00"'
- Validation:
- Type: "regex"
- Validator: '^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$'
+ - Interface: xyz.openbmc_project.Network.MACAddress
+ Properties:
+ MACAddress:
+ Default: '"00:00:00:00:00:00"'
+ Validation:
+ Type: "regex"
+ Validator: '^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$'
+
/xyz/openbmc_project/control/host0/power_cap:
- Interface: xyz.openbmc_project.Control.Power.Cap
- Properties:
- PowerCap:
- Default: 0
- Validation:
- Type: "range"
- Validator: "0..1000"
- Unit: "Watts"
- PowerCapEnable:
- Default: 'false'
+ - Interface: xyz.openbmc_project.Control.Power.Cap
+ Properties:
+ PowerCap:
+ Default: 0
+ Validation:
+ Type: "range"
+ Validator: "0..1000"
+ Unit: "Watts"
+ PowerCapEnable:
+ Default: 'false'