Resource specifications¶
Introduction¶
To start, please read first the basics of the Slices basic infrastructure service.
Resource specifications¶
In Starting your first Virtual or Baremetal Machine, you learned how to create your first basic infrastructure resource, a virtual or baremetal machine, on the Slices research infrastructure.
If you need larger or more complex experiments, it is also possible to use a JSON Resource Specification
. This is a JSON file describing
the resources you want to provision.
You can use these files with the slices bi create-from-file
command
Usage: slices bi create-from-file [OPTIONS] FILE
Request basic infrastructure (BI) resources, described in a file.
The file can override the site-id (argument or env var) per resource.
╭─ Arguments ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ * file FILENAME File with resource definitions. [required] │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ * --experiment TEXT Experiment name or ID. [env var: SLICES_EXPERIMENT] [required] │
│ --duration -d DURATION_OR_DATETIME Lifetime of the resource. Can be extended later on. [default: 3h] │
│ --wait Wait till resources are ready after creation. │
│ --ssh-key SSH-KEY (Extra) SSH public key to register for login. [env var: SLICES_SSH_KEY] │
│ --ssh-key-file FILENAME (Extra) SSH public key file to use for login. [env var: SLICES_SSH_KEY_FILE] │
│ --help Show this message and exit. │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Basic example¶
A basic example of such a resource specification file:
{
"resources": [
{
"friendly_name": "generic-node1",
"disk_image_id": "Ubuntu 24.04.1",
"userdata_file": "ci-BI-03.txt"
}
]
}
More advanced example¶
{
"resources": [{
"site_id": "be-gent1-bi-baremetal1",
"friendly_name": "node4",
"disk_image_id": "Ubuntu 24.04.1",
"flavor_id": "pc",
"network_interfaces": [{
"port_id": "if0",
"network_id": "tst_link",
"addresses": ["192.168.1.10/24"]
}]
}, {
"site_id": "be-gent1-bi-baremetal1",
"friendly_name": "node5",
"disk_image_id": "Ubuntu 24.04.1",
"flavor_id": "pc",
"network_interfaces": [{
"port_id": "if0",
"network_id": "tst_link",
"addresses": ["192.168.1.11/24"]
}]
}],
"links": [{
"friendly_name": "testlink",
"network_id": "tst_link",
"type": "lan",
"impairment": [{
"source":"node4:if0",
"destination": "node5:if0",
"latency_ms": 20
},{
"source":"node5:if0",
"destination": "node4:if0",
"latency_ms": 20
}
]
}]
}