Directory Structure - pjw7904/closnet GitHub Wiki
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.
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. |
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 |
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
Protocol-agnostic Mako templates (e.g., a base FRR skeleton) shared across implementations.
Protocol-specific templates live alongside their respective protocol.
-
docs/
β Build withmake html
for browsable API docs and diagrams. -
test/
β Fast CI tests that spin up tiny two-tier fabrics.
-
Configuration
CLI flags and/or JSON βConfigParser
β argparse namespace. -
Topology build
A<Protocol>ClosConfig
subclass (BGPClosConfig
,MTPClosConfig
, β¦) callsClosGenerator
to lay out the folded-Clos graph and populate node metadata. -
Config rendering
NodeConfigGenerator
walks the graph and expands per-node templates into/tmp/*.conf
. -
Mininet boot
Switch subclasses (BGPSwitch
,MTPSwitch
, β¦) start the appropriate daemons (FRRouting, native MTP binary) inside their namespaces and load those configs. -
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. -
Results
Logs and metrics land inlogs/<protocol>_<topology>_<timestamp>/
βready for plotting or inclusion in papers.