Mininet - UofG-netlab/BPFabric GitHub Wiki
You can run BPFabric in Mininet if you want to create a virtual network to test or evaluate your functions and the operation of your controller.
The only different from an out-of-the-box Mininet topology is that you must use the classes eBPFHost and eBPFSwitch as the implementation of the hosts and switches.
Once your Mininet topology is running you can start your controller as you would normally. The switches created by Mininet will establish a connection to the controller.
The 1 switch topology is provided as 1sw_topo.py
. This topology provide a very simple network with one switch and 2 nodes as describe in the Running BPFabric page.
The switch s1
is created with two links to nodes h1
and h2
. h1
IP is 10.0.0.1
and h2
IP is 10.0.0.2
Running Mininet
sudo python3 1sw_topo.py
Starting eBPF switch s1
Setting up 2 interfaces
mininet> Interface s1-eth1, index 0, fd 3
Interface s1-eth2, index 1, fd 4
mininet>
Running the controller CLI and installing the learning switch function
python3 cli.py
--------------------------------------------------------------------------------
eBPF Switch Controller Command Line Interface - Netlab 2024
Simon Jouet <[email protected]> - University of Glasgow
--------------------------------------------------------------------------------
Documented commands (type help <topic>):
========================================
help
Undocumented commands:
======================
connections
(Cmd) Connection from switch 00000001, version 1
(Cmd) 1 add 0 learningswitch ../examples/learningswitch.o
(Cmd) Function has been installed
Checking the node to node communication in Mininet
mininet> h1 ping h2
PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=0.410 ms
64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=0.284 ms
Checking the inports table of the learning switch function
(Cmd) 1 table 0 inports list
(Cmd)
Key Value
============== ==========
4a4a76877e71 00000000
5a781525c98c 01000000
f64d0ec89904 01000000
7a2c79e08d0c 00000000
============== ==========
A sample topology with 3 switches and 4 hosts. A "core" switch is connected to the other 2 "aggregation" switches. Each aggregation switch is connected to 2 nodes.
Running the topology in mininet creates the 3 switches:
sudo python3 3sw_topo.py
Starting eBPF switch s1
Starting eBPF switch s2
Setting up 2 interfaces
Starting eBPF switch s3
Setting up 3 interfaces
Setting up 3 interfaces
Interface s1-eth1, index 0, fd 3
Interface s2-eth2, index 0, fd 3
Interface s3-eth2, index 0, fd 3
Interface s1-eth2, index 1, fd 4
Interface s3-eth3, index 1, fd 4
Interface s2-eth3, index 1, fd 4
Interface s3-eth1, index 2, fd 5
Interface s2-eth1, index 2, fd 5
mininet>
Running the controller and installing the learningswitch on all 3 switches
sudo python3 3sw_topo.py
[...]
Connection from switch 00000001, version 1
Connection from switch 00000003, version 1
Connection from switch 00000002, version 1
(Cmd) 1 add 0 learningswitch ../examples/learningswitch.o
(Cmd) Function has been installed
(Cmd) 2 add 0 learningswitch ../examples/learningswitch.o
(Cmd) Function has been installed
(Cmd) 3 add 0 learningswitch ../examples/learningswitch.o
(Cmd) Function has been installed
Testing the connectivity in Mininet
mininet> pingall
*** Ping: testing ping reachability
h_0_1 -> h_0_2 h_1_1 h_1_2
h_0_2 -> h_0_1 h_1_1 h_1_2
h_1_1 -> h_0_1 h_0_2 h_1_2
h_1_2 -> h_0_1 h_0_2 h_1_1
*** Results: 0% dropped (12/12 received)
You can create any custom topology allowed by Mininet using the eBPFHost
and eBPFSwitch
classes. You can use those classes by default when you create the Mininet instance.
def main():
topo = YourToplogy()
net = Mininet(topo = topo, host = eBPFHost, switch = eBPFSwitch, controller = None)
net.start()
CLI(net)
net.stop()