fnss.netconfig.buffers.set_buffer_sizes_link_bandwidth¶
-
set_buffer_sizes_link_bandwidth
(topology, k=1.0, default_size=None, buffer_unit='bytes', packet_size=1500)[source]¶ Assign a buffer sizes proportionally to the bandwidth of the interface on which the flush. In particularly, the buffer size will be equal to , where is the capacity of the link in bps.
This assignment is equal to the bandwidth-delay product if is the average RTT in seconds.
To use this function, all links of the topology must have a capacity attribute. If the length of a link cannot be determined, it is applied the delay equal default_delay if specified, otherwise an error is returned.
Parameters: - topology : Topology or DirectedTopology
The topology on which delays are applied.
- k : float, optional
The multiplicative constant applied to capacity to derive buffer size
- default_size : float, optional
The buffer size to be applied to interfaces whose speed is unknown. If it is None and at least one link does not have a capacity attribute, return an error
- buffer_unit : string, unit
The unit of buffer sizes. Supported units are: bytes and packets
- packet_size : int, optional
The average packet size (in bytes). It used only if packets is selected as buffer size to properly calculate buffer sizes given bandwidth and delay values.
Examples
>>> import fnss >>> topology = fnss.erdos_renyi_topology(50, 0.1) >>> fnss.set_capacities_constant(topology, 10, 'Mbps') >>> fnss.set_delays_constant(topology, 2, 'ms') >>> fnss.set_buffer_sizes_link_bandwidth(topology, k=1.0)