BaseNetwork#

class openoptics.Toolbox.BaseNetwork(name, nb_node, nb_link=1, nb_host_per_tor=1, backend='Mininet', time_slice_duration_us=None, time_slice_duration_ms=None, guardband_us=None, guardband_ms=None, arch_mode='TO', use_webserver=True, ocs_tor_link_bw_gbps: float = 1.0, tor_host_link_bw_gbps: float = 1.0, **backend_kwargs)[source]#

Bases: object

The base class of optical networks.

This class provides the foundation for creating and managing optical networks in OpenOptics. It includes topology and routing configurations, network monitoring, and interaction with the underlying backend.

The class handles both Traffic-Oblivious (TO) and Traffic-Aware (TA) architectures, allowing for pre-defined topology or runtime reconfiguration.

BaseNetwork.__init__(name, nb_node, nb_link=1, nb_host_per_tor=1, backend='Mininet', time_slice_duration_us=None, time_slice_duration_ms=None, guardband_us=None, guardband_ms=None, arch_mode='TO', use_webserver=True, ocs_tor_link_bw_gbps: float = 1.0, tor_host_link_bw_gbps: float = 1.0, **backend_kwargs)[source]#

Initialize the BaseNetwork.

Parameters:
  • name (str) – Name of the network

  • backend (str) – Backend of OpenOptics. “Mininet”, “Testbed”, or “ns3”

  • nb_node (int) – Number of nodes in the network

  • nb_link (int, optional) – Number of links per node (defaults to 1)

  • nb_host_per_tor (int, optional) – Number of hosts per ToR (defaults to 1)

  • time_slice_duration_us (int, optional) – Duration of each time slice in microseconds

  • time_slice_duration_ms (int, optional) – Duration of each time slice in milliseconds Specify at most one of time_slice_duration_us or time_slice_duration_ms (default 128 ms).

  • guardband_us (int, optional) – Guard band in microseconds

  • guardband_ms (int, optional) – Guard band in milliseconds Specify at most one of guardband_us or guardband_ms (default 25 ms).

  • arch_mode (str, optional) – architecture mode: “TO” or “TA” (defaults to “TO”)

  • use_webserver (bool, optional) – Whether to use web server for dashboard (defaults to True)

  • ocs_tor_link_bw_gbps (float, optional) – Bandwidth in Gbps for OCS↔ToR links (defaults to 1.0)

  • tor_host_link_bw_gbps (float, optional) – Bandwidth in Gbps for ToR↔host links (defaults to 1.0)

  • **backend_kwargs – Backend-specific parameters (e.g. link_delay_ms for Mininet/ns-3). Validated immediately against the selected backend’s accepted_kwargs(); unknown names raise ValueError.

User APIs#

BaseNetwork.connect(time_slice, node1, node2)

Connect two node ports at the given time slice by configuring OCS, if no optical connections haven't been built for both ports.

BaseNetwork.disconnect(time_slice, node1, node2)

Disconnect two node ports at the given time slice.

BaseNetwork.add_time_flow_entry(node_id, entries)

Add the time flow entry(s) to the node.

BaseNetwork.deploy_topo([circuits, start_fresh])

Create ocs schedules based on given circuits or existing slice_to_topo variable (updated by connect() before), and load them to OCS.

BaseNetwork.deploy_routing(paths[, ...])

Deploy routing to nodes.

BaseNetwork.start()

Start OpenOptics user interface (CLI, dashboard, ...).

BaseNetwork.start_traffic_aware([topo_func, ...])

Deploy traffic aware architecture.

BaseNetwork.activate_calendar_queue()

Update active calendar queues based on the current topology, for traffic-aware.

BaseNetwork.pause_calendar_queue()

Pause traffic before reconfigure topology.

BaseNetwork.get_topo([time_slice])

Get the topology (nx.Graph) at the given time slice.