fnss.netconfig.delays.set_delays_geo_distance

set_delays_geo_distance(topology, specific_delay, default_delay=None, delay_unit='ms', links=None)[source]

Assign a delay to all selected links equal to the product of link length and specific delay. To use this function, all nodes must have a ‘latitude’ and a ‘longitude’ attribute. Alternatively, all links of the topology must have a ‘length’ 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

The topology on which delays are applied.

specific_delay : float

The specific delay (in ms/Km) to be applied to all links

default_delay : float, optional

The delay to be applied to links whose length is not known. If None, if the length of a link cannot be determined, an error is returned

delay_unit : string, optional

The unit of delays. Supported units are: “us” (microseconds), “ms” (milliseconds) and “s” (seconds)

links : list, optional

List of selected links on which weights are applied. If it is None, all links are selected

Examples

>>> import fnss
>>> topology = fnss.parse_abilene('abilene_topo.txt')
>>> fnss.set_delays_geo_distance(topology, specific_delay=fnss.PROPAGATION_DELAY_FIBER)