The scenario of a minus task is a file named scenario.yaml, located at the toplevel of the task directory.

Syntax

The syntax of the file is YAML, a popular file format. The full YAML specification is quite large but only a small subset of YAML is needed for scenario files, and this subset is very intuitive, and easily understandable just by looking at a scenario.yaml example. See for example the GNURadio benchmark example scenario. Otherwise, you can read the Grammar section below to get a more formal description of the scenario grammar.

Please bear in mind that YAML is indentation sensitive, just like python. YAML will follow whatever indentation system the scenario file uses, provided that it is consistent within the file. Note that in particular you should not mix spaces and tabs (beware, some text editors do that silently and need to be properly configured to avoid that). The suggested best practice is to use two spaces for indentation.

Comments in YAML start with a #

The syntax of a yaml file may be checked with http://www.yamllint.com/

Grammar

We're progressively adding new capabilities to the CorteXlab platform. There is now two different syntaxes for the scenario file, the legacy syntax, where commands are run on the nodes, and the new syntax, where docker containers are run on the nodes. Both syntaxes are allowed, even in the same scenario, but only one syntax is allowed per-node.

The scenario.yaml file is structured as follows:

An example scenario (new syntax):

description: Example of new syntax with docker containers
duration: 120
nodes:
  node3:
    container:
    - image: m1mbert/cxlb-gnuradio-3.8:1.0
    - image: m1mbert/cxlb-gnuradio-3.8:1.0
      command: /usr/sbin/sshd -p 2223 -D
  node4:
    container:
      image: m1mbert/openbts-xenial:1.1
    passive: true

Note that in this example, on node3, two containers are instanciated, based on the same image. The first container does not specify a command, so the default command of the image is used, which is an ssh daemon listening on port 2222. The second container overrides the default command with an ssh daemon listening on port 2223 (if we try to instanciate two identical containers from this image, both ssh daemons will try to bind to port 2222 and the second one will fail)

An example scenario (old syntax):

description: Dummy scenario example
duration: 60
nodes:
  node1:
    command: sleep 1000
    # a bash command
    passive: true
  node2:
    command: ./myscript
    # relative path to a script embedded in the task
  node3:
    command: gnuradio-config-info -v
    # calling a gnuradio executable which is in the $PATH
  node4:
    command: /cortexlab/toolchains/current/share/gnuradio/examples/uhd/usrp_wfm_rcv.py
    # absolute path to a script or binary