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.
Unless only resources on a single site are requested,
╭─ 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. │
╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
Note that a site_id
is not required in the resource specification file.
If you specify a site_id with slices bi --site-id <SITE> create-from-file ...
, that site will be used.
If you don’t specify a site ID anywhere, in a lot of cases, the orchestrator will figure out which site is compatible.
The orchestrator will be used for resource specifications which span multiple sites. If only resources from a single site are requested, that site will be contacted and not the orchestrator.
Examples¶
Basic example¶
A basic example of such a resource specification file:
{
"resources": [
{
"friendly_name": "generic-node1",
"disk_image": "Ubuntu 24.04.1",
"userdata_file": "ci-BI-03.txt"
}
]
}
No flavor is specified, so the testbed will choose one.
The specified disk image “Ubuntu 24.04.1” is available for both VMs and bare metal machines.
Which resource you get depends on how you request it:
slices bi --site-id be-gent1-bi-baremetal1 create-from-file <RESOURCE SPEC FILE>
will request a bare metal resourceslices bi --site-id be-gent1-bi-vm1 create-from-file <RESOURCE SPEC FILE>
will request a VM resourceslices bi create-from-file <RESOURCE SPEC FILE>
will leave the choice up to the orchestrator. At the moment, the orchestrator will fail instead of choose. This behaviour might change in the future.
You can off course specify a site in the resource specification file:
{
"resources": [
{
"friendly_name": "generic-node1",
"site_id": "be-gent1-bi-baremetal11",
"disk_image": "Ubuntu 22.04.1",
"userdata_file": "ci-BI-03.txt"
}
]
}
You can also request a specific flavor:
{
"resources": [
{
"friendly_name": "generic-node1",
"site_id": "be-gent1-bi-vm1",
"disk_image": "Ubuntu 22.04.1",
"flavor": "m1.small"
}
]
}
You can request multiple resources in the same file, and if they have links, configure these links.
Bare metal with link¶
You don’t need to specify a lot of details to get a link between 2 bare metal nodes.
Just specifying the same network_id
for each resource connected to the link is enough.
Defaults link settings will be used.
{
"resources": [
{
"site_id": "be-gent1-bi-baremetal1",
"friendly_name": "bm1",
"disk_image": "Ubuntu 24.04.1",
"flavor": "pcgen07",
"network_interfaces": [ { "network_id": "tst_link" } ]
},
{
"site_id": "be-gent1-bi-baremetal1",
"friendly_name": "bm2",
"disk_image": "Ubuntu 24.04.1",
"flavor": "pcgen07",
"network_interfaces": [ { "network_id": "tst_link" } ]
}
]
}
Bare metal with impaired link¶
This example has 2 bare metal nodes, with a link between them. There’s a lot more configuration specified, like IP address and link impairment (delay in this case).
{
"resources": [
{
"site_id": "be-gent1-bi-baremetal1",
"friendly_name": "node4",
"disk_image": "Ubuntu 24.04.1",
"flavor": "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": "Ubuntu 24.04.1",
"flavor": "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
}
]
}
]
}
Advanced bare metal link features¶
Some sites may have specific more advanced features. These features can be used through the resource specification file.
Below is an example of more advanced link features for be-gent1-bi-baremetal1
.
{
"resources": [
{
"friendly_name": "node1",
"disk_mage": "Ubuntu 24.04.1",
"flavor": "pc",
"network_interfaces": [
{
"port_id": "if0",
"network_id": "tst_link",
"addresses": [
"192.168.1.10/24"
]
},
{
"port_id": "if1",
"network_id": "tst_link2",
"addresses": [
"192.168.2.1/24"
]
}
]
},
{
"friendly_name": "node2",
"disk_mage": "Ubuntu 24.04.1"
"flavor": "pc",
"network_interfaces": [
{
"port_id": "if0",
"network_id": "tst_link",
"addresses": [
"192.168.1.11/24"
]
},
{
"port_id": "if1",
"network_id": "tst_link2",
"addresses": [
"192.168.2.2/24"
]
}
]
}
],
"links": [
{
"friendly_name": "test_link1",
"network_id": "tst_link",
"type": "lan",
"share_lan_name": null,
"impairment": [
{
"source": "node0:if0",
"destination": "node1:if0",
"capacity_kbit_per_s": 10000,
"packet_loss": 0.20,
"latency_ms": 5
},
{
"source": "node1:if0",
"destination": "node0:if0",
"capacity_kbit_per_s": 20000,
"packet_loss": 0.10,
"latency_ms": 10
}
]
},
{
"friendly_name": "test_link2",
"network_id": "tst_link",
"type": "gre",
"share_lan_name": "vlanname",
"impairment": [
{
"source": "node0:if1",
"destination": "node1:if1",
"packet_loss": 0.20
},
{
"source": "node1:if1",
"destination": "node0:if1",
"latency_ms": 10
}
]
}
]
}
Combining multiple sites in a singe resource specification¶
This example combines 2 bare metal nodes and 2 VMs in 1 request.
The 2 bare metal nodes have a link between them with fixed IPs.
{
"resources": [
{
"site_id": "be-gent1-bi-vm1",
"friendly_name": "node7",
"disk_image": "Ubuntu 22.04.1",
"flavor": "m1.small"
},
{
"site_id": "be-gent1-bi-vm1",
"friendly_name": "node8",
"disk_image": "Debian 12.7",
"flavor": "m1.tiny"
},
{
"site_id": "be-gent1-bi-baremetal1",
"friendly_name": "node3",
"disk_mage": "Ubuntu 22.04.1",
"flavor": "pc",
"network_interfaces": [
{
"port_id": "if0",
"network_id": "tst_link",
"addresses": [
"192.168.1.10/24"
]
}
]
},
{
"site_id": "be-gent1-bi-baremetal1",
"friendly_name": "node4",
"disk_mage": "Ubuntu 22.04.5",
"flavor": "pcgen07",
"network_interfaces": [
{
"port_id": "if0",
"network_id": "tst_link",
"addresses": [
"192.168.1.11/24"
]
}
]
}
]
}
Links between sites (not yet available in production)¶
You can request layer 2 links between 2 different sites.
Behind the scenes, the orchestrator will reserve VLANs and configure everything as needed.
{
"resources": [
{
"site_id": "be-gent1-bi-vm1",
"friendly_name": "vm",
"disk_image": "debian 12.7",
"flavor": "m1.tiny",
"network_interfaces": [
{
"port_id": "if0",
"network_id": "tst_link",
"addresses": [
"192.168.1.11/24"
]
}
]
},
{
"site_id": "be-gent1-bi-baremetal1",
"friendly_name": "bm",
"disk_image": "Ubuntu 24.04.1",
"flavor": "pcgen07",
"network_interfaces": [
{
"port_id": "if0",
"network_id": "tst_link",
"addresses": [
"192.168.1.10/24"
]
}
]
}
],
"links": [
{
"friendly_name": "cross site link",
"network_id": "tst_link"
}
]
}