Topology Primitive#
This example demonstrates how to construct a time-sliced topology using openoptics.Toolbox.BaseNetwork.connect().
We build a network consisting of 4 nodes, with each node connected to an optical switch via one upper link.
Across all time slices, each node establishes a connection with every other node exactly once.
examples/topo_connect.py#
1from openoptics import Toolbox
2
3if __name__ == "__main__":
4 root = ""
5 net = Toolbox.BaseNetwork(
6 name="my_network",
7 backend="Mininet",
8 nb_node=4,
9 time_slice_duration_ms=256, # in ms
10 use_webserver=True,
11 )
12 net.connect(node1=0, node2=1, time_slice=0)
13 net.connect(node1=2, node2=3, time_slice=0)
14 net.connect(node1=0, node2=2, time_slice=1)
15 net.connect(node1=1, node2=3, time_slice=1)
16 net.connect(node1=0, node2=3, time_slice=2)
17 net.connect(node1=1, node2=2, time_slice=2)
18 net.deploy_topo()
19 net.start()