Direct Routing

Direct Routing#

This example demonstrates a direct per-hop routing implementation in a time-sliced optical network. The per-hop routing approach configures each switch node to make independent forwarding decisions based on the destination address, enabling packets to traverse the network hop-by-hop until they reach their final destination. This method provides a straightforward routing mechanism where each intermediate node determines the next hop based on local routing information.

examples/mininet_routing_direct_perhop.py#
 1from openoptics import Toolbox, OpticalTopo, OpticalRouting
 2
 3if __name__ == "__main__":
 4    nb_node = 4
 5    net = Toolbox.BaseNetwork(
 6        name="mininet_routing_direct_perhop",
 7        backend="Mininet",
 8        nb_node=nb_node,
 9        time_slice_duration_ms=1024,  # in ms
10        use_webserver=True,
11    )
12    circuits = OpticalTopo.round_robin(nb_node=nb_node)
13    # print(circuits)
14    assert net.deploy_topo(circuits)
15    paths = OpticalRouting.routing_direct(net.get_topo())
16    net.deploy_routing(paths, routing_mode="Per-hop")
17    net.start()