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 resource

  • slices bi --site-id be-gent1-bi-vm1 create-from-file <RESOURCE SPEC FILE> will request a VM resource

  • slices 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.

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"
          ]
        }
      ]
    }
  ]
}