/iotlab-contiki-ng-helper

A helper script when using Contiki-NG with the FIT IoT-LAB

Primary LanguagePython

What is this

A simple python script that takes information about your FIT IoT-LAB experiment setup and generates

  1. The struct to use with the Contiki-NGs deployment module. The deployment module and its struct maps node MACs (that are long, hard to remember, change between experiment setups, etc.) to node IDs (that are short, easier to work with in logs, may be mapped to new MACs as needed, etc.).
  2. The -l argument (list of nodes) for the iot-lab-experiment submit CLI.

The script uses a JSON-file with properties of all nodes in FIT IoT-LAB to fetch e.g. MAC address. A JSON-file from 15th of May 2023 is included - to fetch a new file, see the testbed-status site.

Disclaimer

  • I used this script to play and get familiar with Python, especially classes, and it shows.
  • Tested only to the extent of my usage: m3-nodes and grenoble/strasbourg

How to use

Edit the inputs at the bottom of the script and run it. No CLI or reading of a input-file.

Example

For input:

node_ids = [1,  4,  5,  8,   9, 11, 39, 64, 61, 60,
            57, 56, 53, 48, 29, 20, 22, 34, 32, 36,
            37, 24, 52, 50, 10, 62]
site = "strasbourg"
archi = "m3:at86rf231"

It outputs:

Operating on 26 nodes

Contiki-ng deployment struct:
const struct id_mac deployment_fit[] = {
  { 0x01, {{0x02,0x00,0x00,0x00,0x00,0x00,0xa4,0x84}}}, // 1
  { 0x02, {{0x02,0x00,0x00,0x00,0x00,0x00,0x93,0x88}}}, // 4
  { 0x03, {{0x02,0x00,0x00,0x00,0x00,0x00,0x98,0x89}}}, // 5
  { 0x04, {{0x02,0x00,0x00,0x00,0x00,0x00,0xa8,0x87}}}, // 8
  { 0x05, {{0x02,0x00,0x00,0x00,0x00,0x00,0xb8,0x85}}}, // 9
  { 0x06, {{0x02,0x00,0x00,0x00,0x00,0x00,0x89,0x84}}}, // 11
  { 0x07, {{0x02,0x00,0x00,0x00,0x00,0x00,0xa1,0x84}}}, // 39
  { 0x08, {{0x02,0x00,0x00,0x00,0x00,0x00,0x96,0x87}}}, // 64
  { 0x09, {{0x02,0x00,0x00,0x00,0x00,0x00,0xa9,0x88}}}, // 61
  { 0x0a, {{0x02,0x00,0x00,0x00,0x00,0x00,0xa6,0x86}}}, // 60
  { 0x0b, {{0x02,0x00,0x00,0x00,0x00,0x00,0x99,0x86}}}, // 57
  { 0x0c, {{0x02,0x00,0x00,0x00,0x00,0x00,0xa2,0x88}}}, // 56
  { 0x0d, {{0x02,0x00,0x00,0x00,0x00,0x00,0x98,0x90}}}, // 53
  { 0x0e, {{0x02,0x00,0x00,0x00,0x00,0x00,0x97,0x89}}}, // 48
  { 0x0f, {{0x02,0x00,0x00,0x00,0x00,0x00,0xa2,0x84}}}, // 29
  { 0x10, {{0x02,0x00,0x00,0x00,0x00,0x00,0xb7,0x86}}}, // 20
  { 0x11, {{0x02,0x00,0x00,0x00,0x00,0x00,0xa4,0x88}}}, // 22
  { 0x12, {{0x02,0x00,0x00,0x00,0x00,0x00,0xa7,0x86}}}, // 34
  { 0x13, {{0x02,0x00,0x00,0x00,0x00,0x00,0xb2,0x87}}}, // 32
  { 0x14, {{0x02,0x00,0x00,0x00,0x00,0x00,0x91,0x84}}}, // 36
  { 0x15, {{0x02,0x00,0x00,0x00,0x00,0x00,0xa3,0x86}}}, // 37
  { 0x16, {{0x02,0x00,0x00,0x00,0x00,0x00,0x90,0x84}}}, // 24
  { 0x17, {{0x02,0x00,0x00,0x00,0x00,0x00,0x96,0x89}}}, // 52
  { 0x18, {{0x02,0x00,0x00,0x00,0x00,0x00,0xb5,0x86}}}, // 50
  { 0x19, {{0x02,0x00,0x00,0x00,0x00,0x00,0x93,0x87}}}, // 10
  { 0x1a, {{0x02,0x00,0x00,0x00,0x00,0x00,0xb3,0x86}}}, // 62
  { 0,    {{0}}}
};

IoT-LAB CLI nodes argument:
1+4+5+8+9+11+39+64+61+60+57+56+53+48+29+20+22+34+32+36+37+24+52+50+10+62