Create top categories dynamically based on inventory object.

Presently, the settingsd code will statically create objects 'host0',
'bmc0' and 'bmc0/clock' from top-level categories Host and Bmc
in the YAML file. This code provides a 1-to-1 mapping between
YAML categories and inventory objects and changes filename format
to correspond to an inventory object.

Resolves openbmc/openbmc#638

Change-Id: I462cf4c7b7cf042b37e1006a73b36bf11fa52b43
Signed-off-by: Sergey Solomin <sergey.solomin@us.ibm.com>
diff --git a/settings.yaml b/settings.yaml
index ca26840..7e88be0 100644
--- a/settings.yaml
+++ b/settings.yaml
@@ -1,68 +1,74 @@
 ---
 # Settings Config File
 org.openbmc.settings.Host:
-    powercap:
-        name: power_cap
-        type: i
-        default: 0
-        min: 0
-        max: 1000
-        unit: watts
-        validation: range
-    bootflags:
-        name: boot_flags
-        type: s
-        default: "default"
-        validation: list
-        allowed: ["Network", "Disk", "Safe", "CDROM", "Setup", "default"]
-    sysstate:
-        name: system_state
-        type: s
-        default: ""
-        validation: None
-    powerpolicy:
-        name: power_policy
-        type: s
-        default: "RESTORE_LAST_STATE"
-        validation: list
-        allowed: ["ALWAYS_POWER_ON", "RESTORE_LAST_STATE", "LEAVE_OFF"]
-    restrictedmode:
-        name: restricted_mode
-        type: b
-        default: false
-        min: 0
-        max: 1
-        validation: range
-    bootpolicy:
-        name: boot_policy
-        type: s
-        default: "ONETIME"
-        validation: list
-        allowed: ["ONETIME", "PERMANENT"]
-    networkconfig:
-        name: network_config
-        type: s
-        default: "ipaddress=,prefix=,gateway=,mac=,addr_type="
-        validation: custom
-        method: validate_net_config
-    TimeMode:
-        name: time_mode
-        type: s
-        default: "NTP"
-        validation: list
-        allowed: ["NTP", "MANUAL"]
-    TimeOwner:
-        name: time_owner
-        type: s
-        default: "BMC"
-        validation: list
-        allowed: ["BMC", "HOST", "SPLIT", "BOTH"]
-    UseDhcpNtp:
-        name: use_dhcp_ntp
-        type: s
-        default: "yes"
-        validation: list
-        allowed: ["yes", "no"]
+    settings:
+        powercap:
+            name: power_cap
+            type: i
+            default: 0
+            min: 0
+            max: 1000
+            unit: watts
+            validation: range
+        bootflags:
+            name: boot_flags
+            type: s
+            default: "default"
+            validation: list
+            allowed: ["Network", "Disk", "Safe", "CDROM", "Setup", "default"]
+        sysstate:
+            name: system_state
+            type: s
+            default: ""
+            validation: None
+        powerpolicy:
+            name: power_policy
+            type: s
+            default: "RESTORE_LAST_STATE"
+            validation: list
+            allowed: ["ALWAYS_POWER_ON", "RESTORE_LAST_STATE", "LEAVE_OFF"]
+        restrictedmode:
+            name: restricted_mode
+            type: b
+            default: false
+            min: 0
+            max: 1
+            validation: range
+        bootpolicy:
+            name: boot_policy
+            type: s
+            default: "ONETIME"
+            validation: list
+            allowed: ["ONETIME", "PERMANENT"]
+        networkconfig:
+            name: network_config
+            type: s
+            default: "ipaddress=,prefix=,gateway=,mac=,addr_type="
+            validation: custom
+            method: validate_net_config
+        TimeMode:
+            name: time_mode
+            type: s
+            default: "NTP"
+            validation: list
+            allowed: ["NTP", "MANUAL"]
+        TimeOwner:
+            name: time_owner
+            type: s
+            default: "BMC"
+            validation: list
+            allowed: ["BMC", "HOST", "SPLIT", "BOTH"]
+        UseDhcpNtp:
+            name: use_dhcp_ntp
+            type: s
+            default: "yes"
+            validation: list
+            allowed: ["yes", "no"]
+    query:
+        type: instance_query
+        keyregex: "host"
+        subtree: "/org/openbmc/control"
+        matchregex: "control/(host\d*)$"
 
 # Example of using regex
 #    macaddress: