Directory Structure - pjw7904/closnet GitHub Wiki

Repository tour

What to Know Quickly (TL;DR)
python -m closnet β†’ parses CLI or JSON depending on the mode run β†’ builds a folded-Clos topology β†’ autogenerates per-node configs β†’ boots Mininet with protocol-specific switch β†’ (optional) runs an experiment harness β†’ produces logs & metrics.


1 Top level

Path Purpose
closnet/ Importable Python package – all runtime code lives here.
docs/ Currently architecture diagrams, any formal code documentation would also go here.
test/ Basic Mininet tests for custom switches, nothing protocol-related.
install.sh / prep.sh Convenience scripts: dependency install & cleanup.
compile_mtp.sh Another convenience script: builds the Meshed Tree Protocol (MTP) daemon and places it in the correct location.
experiment.json Example of an experiment file.
requirements.txt Python dependencies for Closnet installation.

2 closnet/ – core package

File Role
__main__.py Program entry point – runs in interactive or experiment mode and utilizes other Closnet code to build the network and the per-node configuration
ConfigParser.py Parses CLI flags for interactive mode & JSON for experiment mode, validates parameters
ClosGenerator.py Builds folded-Clos graphs using the NetworkX package and supplied user input
NodeConfigGenerator.py Renders Mako templates into per-node configuration files that are installed on the Mininet switches.
TrafficGenerator.py Wrapper around scapy + tshark for testing client traffic

3 closnet/protocols/ – Pluggable Control Planes

Control-plane protocols that are installed on the folded-Clos topology live in this directory. Each protocol contains subdirectories and files that tell Closnet how to properly install the protocol on the nodes and provide them with an initial configuration that will allow for convergence.

If you use to extend Closnet to include a new protocol, simply add in the content below and make the necessary changes to point to it in the main function.

directory Purpose
analysis Contains a file with a subclass of the ExperimentAnalysis class that describes how to parse the log file generated by the protocol.
config Contains a Mako file that is used to render per-node configuration files and a file that extends ClosGenerator that includes the protocol configuration information based on the folded-Clos topology built.
mininet_switch Contains a file with a subclass of the Mininet Node class to start up the switch and point it to the protocol software as well as configuration file.
src Optional directory of protocol source code. If it is installed elsewhere, simply point to that location in the Mininet Node subclass.

An example of the two existing protocols that come with Closnet are provided in the following tree:

protocols/
β”œβ”€β”€ bgp/
β”‚ β”œβ”€β”€ config/ BGPClosConfig.py + bgp_conf.mako
β”‚ β”œβ”€β”€ mininet_switch/ BGPSwitch.py
β”‚ └── analysis/ BGPAnalysis.py
└── mtp/
| β”œβ”€β”€ config/ MTPClosConfig.py + mtp_conf.mako
| β”œβ”€β”€ mininet_switch/ MTPSwitch.py
| β”œβ”€β”€ src/ *MTP source code*
| └──analysis/ MTPAnalysis.py

4 closnet/templates/

Protocol-agnostic Mako templates (e.g., a base FRR skeleton) shared across implementations.
Protocol-specific templates live alongside their respective protocol.


5 docs/ and test/

  • docs/ – Build with make html for browsable API docs and diagrams.
  • test/ – Fast CI tests that spin up tiny two-tier fabrics.

How it all fits together

  1. Configuration
    CLI flags and/or JSON β†’ ConfigParser β†’ argparse namespace.

  2. Topology build
    A <Protocol>ClosConfig subclass (BGPClosConfig, MTPClosConfig, …) calls ClosGenerator to lay out the folded-Clos graph and populate node metadata.

  3. Config rendering
    NodeConfigGenerator walks the graph and expands per-node templates into /tmp/*.conf.

  4. Mininet boot
    Switch subclasses (BGPSwitch, MTPSwitch, …) start the appropriate daemons (FRRouting, native MTP binary) inside their namespaces and load those configs.

  5. Experiment mode (optional)
    Experiment.py disables an interface, waits for reconvergence, gathers logs.
    Protocol-specific *Analysis.py modules compute convergence time, blast radius, and traffic loss.

  6. Results
    Logs and metrics land in logs/<protocol>_<topology>_<timestamp>/β€”ready for plotting or inclusion in papers.

⚠️ **GitHub.com Fallback** ⚠️