| 111 | | === Usage Example === |
| | 118 | |
| | 119 | ==== attribute_add - Add an attribute ==== |
| | 120 | |
| | 121 | {{{ |
| | 122 | <service name="attribute_add"> |
| | 123 | <info>Add attribute to resource</info> |
| | 124 | <args> |
| | 125 | <arg name="name" value="name" isRequired="true"> |
| | 126 | <info>Resource name</info> |
| | 127 | </arg> |
| | 128 | <arg name="attribute" value="attribute" isRequired="true"> |
| | 129 | <info>Name of attribute</info> |
| | 130 | </arg> |
| | 131 | <arg name="value" value="value" isRequired="true"> |
| | 132 | <info>Value of attribute </info> |
| | 133 | </arg> |
| | 134 | </args> |
| | 135 | </service> |
| | 136 | }}} |
| | 137 | |
| | 138 | ==== attribute_delete - Delete an attribute ==== |
| | 139 | |
| | 140 | {{{ |
| | 141 | <service name="attribute_delete"> |
| | 142 | <info>Delete all attributes matching attribute pattern for all nodes matching node name pattern (rn)</info> |
| | 143 | <args> |
| | 144 | <arg name="name" value="[name]" isRequired="false"> |
| | 145 | <info>Resource name or resource name pattern</info> |
| | 146 | </arg> |
| | 147 | <arg name="attribute" value="attribute" isRequired="true"> |
| | 148 | <info>Attribute pattern</info> |
| | 149 | </arg> |
| | 150 | </args> |
| | 151 | </service> |
| | 152 | }}} |
| | 153 | |
| | 154 | ==== attribute_modify - Modify an attribute value ==== |
| | 155 | |
| | 156 | {{{ |
| | 157 | <service name="attribute_modify"> |
| | 158 | <info>Modify attribute's value</info> |
| | 159 | <args> |
| | 160 | <arg name="name" value="name" isRequired="true"> |
| | 161 | <info>Resource name</info> |
| | 162 | </arg> |
| | 163 | <arg name="attribute" value="attribute" isRequired="true"> |
| | 164 | <info>Attribute name</info> |
| | 165 | </arg> |
| | 166 | <arg name="value" value="value" isRequired="true"> |
| | 167 | <info>New value of attribute </info> |
| | 168 | </arg> |
| | 169 | </args> |
| | 170 | </service> |
| | 171 | }}} |
| | 172 | |
| | 173 | ==== attribute_list - List attributes ==== |
| | 174 | |
| | 175 | {{{ |
| | 176 | <service name="attribute_list"> |
| | 177 | <info>Get node with names matching name pattern with attributes matching attribute name pattern and value matching attribute value pattern</info> |
| | 178 | <args> |
| | 179 | <arg name="set" value="[set]" isRequired="false"> |
| | 180 | <info>Set of resource names or resource name pattern</info> |
| | 181 | </arg> |
| | 182 | <arg name="attribute" value="[attribute]" isRequired="false"> |
| | 183 | <info>Attribute name pattern</info> |
| | 184 | </arg> |
| | 185 | <arg name="value" value="[value]" isRequired="false"> |
| | 186 | <info>Attribute value pattern</info> |
| | 187 | </arg> |
| | 188 | </args> |
| | 189 | </service> |
| | 190 | }}} |
| | 191 | |
| | 192 | ==== attribute_listChildren - List attributes of children ==== |
| | 193 | |
| | 194 | {{{ |
| | 195 | <service name="attribute_listChildren"> |
| | 196 | <info>Get node with names matching name pattern with child (device) attributes matching attribute name pattern and value matching attribute value pattern</info> |
| | 197 | <args> |
| | 198 | <arg name="set" value="[set]" isRequired="false"> |
| | 199 | <info>Set of resource names or resource name pattern</info> |
| | 200 | </arg> |
| | 201 | <arg name="attribute" value="[attribute]" isRequired="false"> |
| | 202 | <info>Child attribute name pattern</info> |
| | 203 | </arg> |
| | 204 | <arg name="value" value="[value]" isRequired="false"> |
| | 205 | <info>Child attribute value pattern</info> |
| | 206 | </arg> |
| | 207 | </args> |
| | 208 | </service> |
| | 209 | }}} |
| | 210 | |
| | 211 | === Usage Examples === |
| 116 | | |
| | 216 | # Define the testbed |
| | 217 | wget -qO- 'http://new.orbit-lab.org:5054/inventory/resource_add?name=sb10.orbit-lab.org&type=testbed' |
| | 218 | # Add a node |
| | 219 | wget -qO- 'http://new.orbit-lab.org:5054/inventory/resource_add?name=node1-1.sb10.orbit-lab.org&type=node' |
| | 220 | # Create the parent/child relationship between the testbed and the node |
| | 221 | wget -qO- 'http://new.orbit-lab.org:5054/inventory/relation_add?parent=sb10.orbit-lab.org&child=node1-1.sb10.orbit-lab.org' |
| | 222 | # Add basic attributes |
| | 223 | # CM is CM3 (mandatory) |
| | 224 | wget -qO- 'http://new.orbit-lab.org:5054/inventory/attribute_add?name=node1-1.sb10.orbit-lab.org&attribute=CM_type&value=3' |
| | 225 | # IP Address for this CM (mandatory) |
| | 226 | wget -qO- 'http://new.orbit-lab.org:5054/inventory/attribute_add?name=node1-1.sb10.orbit-lab.org&attribute=CM_ip&value=10.22.1.1' |
| | 227 | # IP Port for this CM (mandatory) |
| | 228 | wget -qO- 'http://new.orbit-lab.org:5054/inventory/attribute_add?name=node1-1.sb10.orbit-lab.org&attribute=CM_port&value=1' |
| | 229 | # Disk from the node boots (for imaging) |
| | 230 | wget -qO- 'http://new.orbit-lab.org:5054/inventory/attribute_add?name=node1-1.sb10.orbit-lab.org&attribute=INF_default_disk&value=/dev/sda' |
| | 231 | ... |
| | 232 | }}} |
| | 233 | |
| | 234 | |
| | 235 | Replace inventory information |
| | 236 | |
| | 237 | {{{ |
| | 238 | # Delete all attributes colected by the inventory process running on the node |
| | 239 | wget -qO- 'http://new.orbit-lab.org:5054/inventory/attribute_delete?name=node1-1.sb10.orbit-lab.org&attribute=INV_*' |
| | 240 | XXXXX Delete all devices for the node??? XXXXX |
| | 241 | # Add first device (and add it to the node) |
| | 242 | wget -qO- 'http://new.orbit-lab.org:5054/inventory/resource_add?name=ethernet0&type=device' |
| | 243 | wget -qO- 'http://new.orbit-lab.org:5054/inventory/relation_add?parent=node1-1.sb10.orbit-lab.org&child=ethernet0' |
| | 244 | # Add attributes for the new device |
| | 245 | wget -qO- 'http://new.orbit-lab.org:5054/inventory/attribute_add?name=ethernet0&attribute=INV_MAC_0&value=00:01:02:03:04:05' |