Start a Lab From a GitHub netlab Topology File

Someone approached me after my NOG.HR netlab presentation and said: “wouldn’t it be great if we could just start the lab from an example topology published on GitHub?

It took me almost a year to get it done, but the functionality finally made it into the 25.09 release:

  • You can use a URL instead of a topology file name with netlab up and netlab create commands.
  • netlab recognizes GitHub URLs and appends ?raw=true to them to get the YAML file contents instead of the HTML page1.
  • netlab prefers to download the topology file into an empty directory. It will complain otherwise and ask for a confirmation, but will keep quiet if you use the --quiet flag.
  • The topology file is downloaded, parsed (to verify it’s valid YAML), and saved into downloaded.yml. The filename is fixed, and there’s no way to change it at the moment.
  • After the downloaded topology has been saved, netlab up or netlab create commands continue like you’d specify downloaded.yml as the topology file.

You can use this functionality to quickly check the graph examples I wrote about a few days ago:

  • Copy the link to a lab topology file (for example, https://github.com/ipspace/netlab-examples/blob/master/graphs/colors-lines/spine-color.yml)
  • Execute netlab create URL to download the topology file and transform it.
  • Use netlab graph command to create graph description files and dot or d2 commands to generate the graphs.
  • If you want to experiment, modify the downloaded topology file (downloaded.yml), execute netlab create downloaded.yml to transform it, and generate modified graphs.

  1. If you want to have a similar support for other public Git repositories, open an issue or (even better) modify the code and submit a pull request↩︎

Add comment
Sidebar