繁体   English   中英

在 Python 中使用 Mininet() class 创建拓扑时如何提及“--switch=ovsk,protocols=OpenFlow13”?

[英]How to mention “--switch=ovsk,protocols=OpenFlow13” while making a topology using Mininet() class in Python?

看下面的命令——

$ sudo mn --controller=remote,ip=127.0.0.1,port=6653 --switch=ovsk,protocols=OpenFlow13 --topo=tree,depth=2,fanout=4

我想使用 Python 代码来实现这种拓扑。

到目前为止,我在 python 中得到了以下几行,它们部分实现了上述命令的结果 -

from mininet.net import Mininet
from mininet.node import RemoteController
from mininet.topolib import TreeTopo

controller = RemoteController('c0', ip='127.0.0.1', port=6653)
topo = TreeTopo(2,4)
net = Mininet(topo=topo, controller=controller)
net.start()

如何在此 python 代码中包含开关协议部分?

请参考 mininet文档

在你的情况下:

from mininet.net import Mininet
from mininet.node import RemoteController, OVSSwitch
from mininet.topolib import TreeTopo
from mininet.cli import CLI

controller = RemoteController('c0', ip='127.0.0.1', port=6653, protocols="OpenFlow13")
topo = TreeTopo(2,4)
net = Mininet(topo=topo, controller=controller, switch=OVSSwitch)
net.start()

#IF you want to start the CLI
CLI(net)
#If you want to clean the environment
net.stop()

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM