run_mininet: Adopt utility methods of Mininet class

Currently, run_mininet uses low level APIs of mininet.
This patch fixes to use utility methods of Mininet class.

Signed-off-by: IWASE Yusuke <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
IWASE Yusuke 2016-02-22 13:29:50 +09:00 committed by FUJITA Tomonori
parent 6b10a3b45a
commit f2bb13dbb5

View File

@ -4,11 +4,9 @@ import sys
from mininet.cli import CLI from mininet.cli import CLI
from mininet.net import Mininet from mininet.net import Mininet
from mininet.link import Link
from mininet.node import RemoteController from mininet.node import RemoteController
from mininet.node import OVSSwitch from mininet.node import OVSSwitch
from mininet.node import UserSwitch from mininet.node import UserSwitch
from mininet.term import makeTerm
from oslo_config import cfg from oslo_config import cfg
from ryu import version from ryu import version
@ -37,14 +35,11 @@ if '__main__' == __name__:
s1 = net.addSwitch('s1') s1 = net.addSwitch('s1')
s2 = net.addSwitch('s2') s2 = net.addSwitch('s2')
Link(s1, s2) net.addLink(s1, s2)
Link(s1, s2) net.addLink(s1, s2)
Link(s1, s2) net.addLink(s1, s2)
net.build() net.start()
c0.start()
s1.start([c0])
s2.start([c0])
if conf.switch == 'ovs': if conf.switch == 'ovs':
s1.cmd('ovs-vsctl set Bridge s1 protocols=%s' % conf.protocols) s1.cmd('ovs-vsctl set Bridge s1 protocols=%s' % conf.protocols)