def emptyNet(): net = Mininet(topo=None, build=False) c0 = Controller('c0', inNamespace=False) h1 = Host('h1') h2 = Host('h2') #intf1 = Intf("h1-eth1") #intf2 = Intf("h2-eth1") s1 = OVSSwitch('br0', inNamespace=False) Link(h1, s1) Link(h2, s1) c0.start() s1.start([c0]) net.start() #s1.cmd('ovs-vsctl set bridge br0 protocols=OpenFlow13') CLI(net) net.stop() h1.stop() h2.stop() s1.stop() c0.stop()
def stop(self): "Terminate P4 switch." OVSSwitch.stop(self) self.output.flush() self.cmd('kill %' + self.sw_path) self.cmd('wait') self.deleteIntfs()
from mininet.link import Link h1 = Host('h1') h2 = Host('h2') h3 = Host('h3') h4 = Host('h4') s1 = OVSSwitch('s1', inNamespace=False) s2 = OVSSwitch('s2', inNamespace=False) c0 = Controller('c0', inNamespace=False) Link(h1, s1) Link(h2, s1) Link(h3, s2) Link(h4, s2) Link(s1, s2) h1.setIP('10.0.0.1/24') h2.setIP('10.0.0.2/24') h3.setIP('10.0.0.3/24') h4.setIP('10.0.0.4/24') c0.start() s1.start([c0]) s2.start([c0]) print h1.IP print h2.IP print h3.IP print h4.IP print 'Pinging ...' print h1.cmd('ping -c3 ', h2.IP()) print h1.cmd('ping -c3 ', h3.IP()) s1.stop() s2.stop() c0.stop()
def stop( self ): for intf in self.intfList(): if type( intf ) is TCIntf: self.dropOVSqos( intf ) OVSSwitch.stop( self )
#!/usr/bin/python from mininet.topo import Topo from mininet.node import Host, OVSSwitch, Controller from mininet.link import Link h1 = Host('h1') h2 = Host('h2') s1 = OVSSwitch('s1', inNamespace=False) c0 = Controller('c0', inNamespace=False) Link(h1, s1) Link(h2, s1) h1.setIP('10.1/8') h2.setIP('10.2/8') c0.start() s1.start([c0]) print h1.cmd('ping -c1', h2.IP()) s1.stop() c0.stop()
#!/usr/bin/python from mininet.topo import Topo from mininet.node import Host, OVSSwitch, Controller from mininet.link import Link h1 = Host('h1') h2 = Host('h2') s1 = OVSSwitch('s1', inNamespace=False) c0 = Controller('c0', inNamespace=False) Link(h1,s1) Link(h2,s1) h1.setIP('10.1/8') h2.setIP('10.2/8') c0.start() s1.start([c0]) print h1.cmd('ping -c1', h2.IP()) s1.stop() c0.stop()
while( i <= n ** 2): e1 = OVSSwitch( 'e%d', inNamespace=False ) % (i) Link( acount, ei ) if i == n: count = count + 1 i = i + 1 i = 1 count = 1 while( i <= n ** 3) : h1 = Host( 'h%d' ) % (i) Link( ecount, hi ) hi.setIP( '10.0.0.1/24' ) if i == n: count = count + 1 i = i + 1 c0.start() a1.start( [ c0 ] ) a2.start( [ c0 ] ) print h1.IP print h2.IP print h3.IP print h4.IP print 'Pinging ...' print h1.cmd( 'ping -c3 ', h2.IP() ) print h1.cmd( 'ping -c3 ', h3.IP() ) a1.stop() a2.stop() c0.stop()
Link(h4, e2) Link(h5, e3) Link(h6, e3) Link(h7, e4) Link(h8, e4) h1.setIP('10.0.0.1/24') h2.setIP('10.0.0.2/24') h3.setIP('10.0.0.3/24') h4.setIP('10.0.0.4/24') h5.setIP('10.0.0.5/24') h6.setIP('10.0.0.6/24') h7.setIP('10.0.0.7/24') h8.setIP('10.0.0.8/24') c1.start() a1.start([c1]) a2.start([c1]) print h1.IP print h2.IP print h3.IP print h4.IP print h5.IP print h6.IP print h7.IP print h8.IP print 'Pinging ...' print h1.cmd('ping -c3 ', h2.IP()) print h1.cmd('ping -c3 ', h3.IP()) a1.stop() a2.stop() c1.stop()