def add_switch(name, dpid, proto_version): if type(dpid) is unicode: dpid = dpid.encode('ascii','ignore') switch = OVSKernelSwitch(name, protocols=proto_version, inNamespace=False, dpid=dpid) switch.start(controllers) switches[name] = switch logger.debug("==> added switch name={}; dpid={}".format(name,dpid))
def add_switch_worker(): while True: name = names.get() switch = OVSKernelSwitch(name, protocols='OpenFlow13', inNamespace=False) switches[name] = switch switch.start(controllers) # time to here, 5 switches : 0.88s, 50sw : 2.8 (15), 200 : 22s (33) logger.debug("==> added switch name={}".format(name)) names.task_done()
for srcIntf, dstIntf in connections: print srcIntf, dstIntf result = srcIntf.ifconfig(status) if result: error('link src status change failed: %s\n' % result) result = dstIntf.ifconfig(status) if result: error('link dst status change failed: %s\n' % result) h0 = Host('h0') h1 = Host('h1') h2 = Host('h2') h3 = Host('h3') s0 = OVSKernelSwitch('s0', inNamespace=False) s1 = OVSKernelSwitch('s1', inNamespace=False) s2 = OVSKernelSwitch('s2', inNamespace=False) s3 = OVSKernelSwitch('s3', inNamespace=False) c0 = RemoteController('c0', ip='10.108.100.195') c1 = RemoteController('c1', ip='10.108.100.248') c2 = RemoteController('c2', ip='10.108.102.176') c3 = RemoteController('c3', ip='10.108.101.48') l1 = Link(h0, s1) Link(h1, s1) Link(h2, s2) Link(h3, s3) Link(s0, s1) Link(s0, s2)