本文整理汇总了Python中fnss.topologies.topology.Topology.adj[u][v]['capacity']方法的典型用法代码示例。如果您正苦于以下问题:Python Topology.adj[u][v]['capacity']方法的具体用法?Python Topology.adj[u][v]['capacity']怎么用?Python Topology.adj[u][v]['capacity']使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类fnss.topologies.topology.Topology
的用法示例。
在下文中一共展示了Topology.adj[u][v]['capacity']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: from_mininet
# 需要导入模块: from fnss.topologies.topology import Topology [as 别名]
# 或者: from fnss.topologies.topology.Topology import adj[u][v]['capacity'] [as 别名]
def from_mininet(topology):
"""Convert a Mininet topology to an FNSS one.
Parameters
----------
topology : Mininet Topo
A Mininet topology object
Returns
-------
topology : Topology
An FNSS Topology object
"""
fnss_topo = Topology(capacity_unit='Mbps')
for v in topology.switches():
fnss_topo.add_node(v, type='switch')
for v in topology.hosts():
fnss_topo.add_node(v, type='host')
for u, v in topology.links():
fnss_topo.add_edge(u, v)
opts = topology.linkInfo(u, v)
if 'bw' in opts:
fnss_topo.adj[u][v]['capacity'] = opts['bw']
if 'delay' in opts:
delay = opts['delay']
val = re.findall("\d+\.?\d*", delay)[0]
unit = delay.strip(val).strip(' ')
set_delays_constant(fnss_topo, val, unit, [(u, v)])
return fnss_topo