Mininet on FreeBSD
Motivation
Mininet is a network emulation tool that has seen fairly wide usage in software defined networking (SDN). A good chunk of Mininet's appeal comes from how it bundles in tools, controllers, and software switches like Open vSwitch (OVS) that are useful for development and research related to, or for learning about, SDN.
Mininet relies on cgroups and network namespaces to emulate network nodes and links, and tools like tc to shape traffic, meaning that someone who currently wants to use it either must run Ubuntu(or another supported Linux distribution) or run it in a VM where Mininet can be installed and used.
Mininet also has a wish list, which includes support on other platforms.
Approach
Mininet mostly hides away platform-specific features into a few classes and methods that call the right shell commands to use them. The work here takes advantage of the fact that many of the commands and features that Mininet relies on has analogues in FreeBSD. To be specific:
Hosts (processes in network namespaces) are implemented with vnet jails
Links (vnet links) are implemented with epairs
Resource-limited hosts (via cgroups) done with rctl and cpuset
Traffic shaping links (tc) can be done with dummynet
As for bundled software, some, like OVS, is already available as a port (albeit as a userspace switch). Others, like the OpenFlow reference switch, aren't as readily available, and either need to be ported or replaced with suitable substitutes.
Status
What's there, and/or working:
Hosts and Links
Built-in topologies e.g. Tree, Linear, etc.
OpenFlow nodes: OVSSwitch
Non-OpenFlow nodes: OVSBridge, IfBridge, NAT
Controllers: Ryu ('built-in' controller), RemoteController, NullController (for 'classic' networks)
Per-host directories that can be specified with Hosts during their startup - tmpfs for temporary, unionfs + nullfs for persistent files
What's missing
Nodes and Links for emulating resource constraints and traffic patterns (CPULimitedHosts, TCLinks)
A dedicated OpenFlow 1.3 switch that covers what OVS doesn't in 1.3 mode (UserSwitch)
Default controller when none are specified (--controller=ryu|none needs to be explicit)
Truly private per-Host directories
Most of the example scripts. Currently nat.py, natnet.py, and bind.py have been tested.
What haven't been tested/tried
testing on releases other than 10.3 and 11.0:
xterm/wireshark (things that need x11, e.g. h1 xterm)
'cluster-edition' features
miniedit
Known bugs
OVS can cause panics on 11.0 (fixed as of 315625)
213015
The CLI will sometimes not flush its input and re-run a previous input.
The NAT node's (ipfw) rules are probably incorrect.
Ports are sometimes left undestroyed after cleanup.
Additional Parts
These are some things that might be interesting or nice to have.
“Specialty” nodes like the LINC-OE optical emulator, and BMV2 P4 behavior model
Something more scalable and performant than userspace OVS, for example some kind of 'Netmap/VALE/mSwitch' node (actually another
wishlist item)
Linux hosts using Linux jails
netgraph network elements