Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

The inventory

Purpose

The r2lab-inventory repo describes all the devices in the testbed, and propagates changes. It covers the testbed deployed on faraday.inria.fr and its sibling, the preplab: where each physical node sits (a slot in prod, the preplab, or defunct), and the other devices that have an IP address.

From that description it generates the configuration of:

Use it for instance when a node is broken, and you want to replace it with a spare one. On prod, most of the time there is no discrepancy, i.e. node X sits on slot X in the chamber; but when a spare node needs to be deployed instead, the testbed needs to be reconfigured.

See also Sources of truth for the big picture.

The data files

filedescribeshow to change it
boxes.yamlthe hardware boxes (nodes), and where they sitwith the inventory command
positions.yamlwhat is at each slot of the testbedby hand
devices.yamlthe devices that are not nodesby hand
inventory-phones.yamlthe phonesby hand
inventory-pdus.yamlthe PDUsby hand
inventory-relays.yamlthe temperature relaysby hand

boxes.yaml

This is the source of truth for how the boxes are labelled; it contains one entry per physical node (the number on the label glued to the node) like this:

42:
  mac: "00:03:1d:0e:03:5b"
  wlan: ["7c:c3:a1:a8:26:9e", "7c:c3:a1:a8:1c:2a"]
  where: {prod: 27}      # or: prep | defunct
  note: "replaced fit27 2025-10"

The location of a node, where, is one of

positions.yaml

boxes.yaml is about the hardware boxes, that can be moved around. What belongs to a position in the chamber, whatever box sits there (SDR, duplexer, antennas, photos, ...), goes here. This file is edited by hand; it maps a slot (1..37) to a free-form mapping:

12:
  usrp: {type: b205, duplexer: 2-5G, logo: antenna}
  data_interface: true
  images: [2017-12/fit12.jpg]

The tool makes no assumption on what is in there: each mapping is copied as-is, under the key static, in the entry of that slot in the generated *-inventory-nodes.yaml; monitornodes then exposes it as-is to the sidecar and the web UI. Only the slot numbers are checked. The file is optional, and it does not apply to the preplab, where nodes are exposed by physical number.

devices.yaml

The extra devices, that have an IP address on the testbed networks but are not nodes, i.e. that have no entry in boxes.yaml: gateway interfaces, switches, PDUs, relays, phone hosts, SDRs, etc. This file is edited by hand; it is a list with one entry per device:

- {name: switch-data, ip: 192.168.4.102, mac: "f8:b1:56:33:50:ad", static: true,
   comment: "CONFIRMED to be the main data switch"}
keymeaning
namemandatorythe main hostname
ipmandatoryits IP address
macoptionalwithout it there is nothing in dnsmasq
staticdefault falsethe device is configured statically, so it is not handed out by DHCP
aliasesoptionalother names in the hosts file
commentoptionalshown above the generated lines
labdefault prodprod, prep or both: in the files for faraday and/or the preplab

Each device produces a line in the hosts file, and a dhcp-host line in dnsmasq if it has a mac (commented out if static is true).

The other inventories

inventory-phones.yaml, inventory-pdus.yaml and inventory-relays.yaml are the sources of the other prod inventory files; they are installed as-is (with a warning header) in /etc/rhubarbe, on faraday only.

The inventory command

Everything should be doable through a single command, inventory. Its source code is in r2lab_inventory.py, and inventory is the script that uv sync installs from pyproject.toml; run it as uv run inventory, or activate .venv.

Installation

# install (needs uv)
uv sync

# see overview
uv run inventory help

A typical session

As an example to illustrate a typical workflow, let’s assume that

cd r2lab-inventory

# always a good idea
git pull

# activate the venv - this can be done automatically for you with direnv
source .venv/bin/activate

# you can't move a node to a non-empty slot
# so first free the slot, then fill it
inventory move 27 preplab
inventory move 42 prod:27

# optionally, maintain the note field
inventory set-note 27 "broken CMC"

# check what's expected to be in prod
inventory list --prod

# check what will be generated
inventory generate

# then commit and push the changes into the repo, e.g.
git add boxes.yaml
git commit -m "replaced node 27 in slot 27 with node 42"
git push
# nothing else to do: run-updates on faraday and on the preplab
# catches the push within 5 minutes, and calls deploy/update.sh,
# that installs the files and restarts the services

The list command

inventory list [--prod|--prep|--defunct] [-v]

shows where the nodes are. By default it draws the room as in the livemap; each cell is the ceiling slot, then the physical number of the node deployed there, or -- for an empty slot. On a terminal, the cells where the node differs from the slot number (like 11:06) are shown in light red, and the empty slots in light blue. This is followed by the nodes in the preplab and the defunct ones (colored in a terminal):

output of inventory list

With -v you get one line per node instead, with its note field.

The move command

inventory move PHY DESTINATION

where the destination is prod:N, preplab or defunct. The free-form note of a node is set with inventory set-note PHY NOTE (an empty note removes it).

It fails if the destination slot is busy; so to replace the node in slot 27, first move it out of the way (to preplab or defunct), and then move the new one in. It also fails on a duplicate slot or MAC, and list / generate warn about empty prod slots.

The generate command

inventory generate [--prod|--prep]

only computes the files locally, in the current directory; it is not mandatory to run it on your dev box, but can help if you need to inspect the outcome and make sure everything is fine

$ inventory generate --prod
WARNING: empty prod slots: 04 06 13 15 17
(Over)wrote prod-inventory-nodes.yaml from boxes.yaml
(Over)wrote prod-dnsmasq              from boxes.yaml
(Over)wrote prod-hosts                from boxes.yaml

The warning lists the prod slots that no node is deployed in.

The install command

should only be used on the production box - that’s what is triggered by a git push

inventory install --prod|--prep [--root DIR]

does a generate, then installs the files on the box where it runs: /etc/rhubarbe/inventory-*.yaml (the phones, pdus and relays ones only for prod, these being copies of inventory-{phones,pdus,relays}.yaml with a warning header), the dnsmasq configuration and /etc/hosts. It also updates all_scope in /etc/rhubarbe/rhubarbe.conf.local, to reflect the nodes that are actually there: for faraday that is all_scope=1-37,~4,~6 where the ~ ones are the empty slots, and for the preplab the list of nodes that sit there.

It restarts nothing, and it is not meant to be run by hand: it is called by deploy/update.sh, that run-updates runs after each push. That script figures out whether it is on prod or on the preplab (prod is where monitorphones and monitorpdus are enabled), runs inventory install, and then restarts NetworkManager (which is what runs dnsmasq) and the rhubarbe services that are enabled. Everything is recomputed and restarted every time, on purpose, to keep things simple.

--root installs under another directory instead of /, for testing.

More subcommands

see full list with

inventory help