本文整理汇总了Python中mininet.net.Mininet.iperf方法的典型用法代码示例。如果您正苦于以下问题:Python Mininet.iperf方法的具体用法?Python Mininet.iperf怎么用?Python Mininet.iperf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mininet.net.Mininet
的用法示例。
在下文中一共展示了Mininet.iperf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testIt
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import iperf [as 别名]
def testIt():
topo = Topology(int(sys.argv[1]))
net = Mininet(topo, link=TCLink)
net.start()
h1, h2 = net.get('h1', 'h2')
net.iperf((h1,h2))
net.stop()
示例2: perfTest
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import iperf [as 别名]
def perfTest():
"Create network and run perf test"
linkopts1 = dict(bw=50, delay='5ms') #, loss=1, max_queue_size=1000, use_htb=True)
linkopts2 = dict(bw=30, delay='10ms') #, loss=3, max_queue_size=2000, use_htb=True)
linkopts3 = dict(bw=10, delay='15ms') #, loss=5, max_queue_size=3000, use_htb=True)
topo = CustomTopo(linkopts1, linkopts2, linkopts3, fanout=3)
net = Mininet(topo=topo, link=TCLink)
net.start()
"""
print "Dump host connections"
dumpNodeConnections(net.hosts)
print "Testing network connectivity"
net.pingAll()
"""
print "Testing bandwidth between h1 and h27"
h1 = net.get('h1')
h27 = net.get('h27')
net.iperf((h1, h27))
outputString = h1.cmd('ping', '-c6', h27.IP())
print "output: " + outputString.strip()
net.stop()
示例3: perfTest
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import iperf [as 别名]
def perfTest():
"Create network and run simple performance test"
prm = myParam(n=200, data_size=200)
print prm.n, prm.m, prm.data_size, prm.pipes
topo = myTopo(prm.n, prm.m)
net = Mininet(topo=topo, link=TCLink)
net.start()
print "Dumping host connections"
dumpNodeConnections( net.hosts )
print "Dumping switch connections"
dumpNodeConnections( net.switches )
#print "Testing network connectivity"
#net.pingAll()
print "Testing bandwidth under s1"
h1, h2 = net.get('h1', 'h2')
net.iperf((h1, h2))
print "Testing bandwidth across tree"
h1, h2 = net.get('h1', 'h%d'%(prm.n+1))
net.iperf((h1, h2))
for p in (1, 2, 5, 10, 20):
prm.pipes = p
simTrans(net.hosts, prm)
#CLI( net )
net.stop()
示例4: required
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import iperf [as 别名]
def required(x,y):
topo = MyTopo(x, y)
net = Mininet(topo,host=CPULimitedHost, link=TCLink)
net.start()
for i in xrange(y):
for j in xrange(y):
if (i+1)%2==0 and (j+1)%2==1:
net.nameToNode["h"+str(i+1)].cmd("iptables -A OUTPUT -o h"+str(i+1)+"-eth0 -d 10.0.0."+ str(j+1)+" -j DROP")
net.nameToNode["h"+str(j+1)].cmd("iptables -A OUTPUT -o h"+str(j+1)+"-eth0 -d 10.0.0."+ str(i+1)+" -j DROP")
elif (i+1)%2==1 and (j+1)%2==0:
net.nameToNode["h"+str(i+1)].cmd("iptables -A OUTPUT -o h"+str(i+1)+"-eth0 -d 10.0.0."+ str(j+1)+" -j DROP")
net.nameToNode["h"+str(j+1)].cmd("iptables -A OUTPUT -o h"+str(j+1)+"-eth0 -d 10.0.0."+ str(i+1)+" -j DROP")
net.pingAll()
try:
print "Testing bandwidth between h1 and h3"
h1, h3 = net.get('h1', 'h3')
net.iperf((h1, h3))
except:
c=1
try:
print "Testing bandwidth between h1 and h3"
h4, h2 = net.get('h2', 'h4')
net.iperf((h2, h4))
except:
c=1
dumpNodeConnections(net.switches)
CLI(net)
net.stop()
示例5: intfOptions
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import iperf [as 别名]
def intfOptions():
"run various traffic control commands on a single interface"
net = Mininet( autoStaticArp=True )
net.addController( 'c0' )
h1 = net.addHost( 'h1' )
h2 = net.addHost( 'h2' )
s1 = net.addSwitch( 's1' )
link1 = net.addLink( h1, s1, cls=TCLink )
net.addLink( h2, s1 )
net.start()
# flush out latency from reactive forwarding delay
net.pingAll()
info( '\n*** Configuring one intf with bandwidth of 5 Mb\n' )
link1.intf1.config( bw=5 )
info( '\n*** Running iperf to test\n' )
net.iperf()
info( '\n*** Configuring one intf with loss of 50%\n' )
link1.intf1.config( loss=50 )
info( '\n' )
net.iperf( ( h1, h2 ), l4Type='UDP' )
info( '\n*** Configuring one intf with delay of 15ms\n' )
link1.intf1.config( delay='15ms' )
info( '\n*** Run a ping to confirm delay\n' )
net.pingPairFull()
info( '\n*** Done testing\n' )
net.stop()
示例6: perf
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import iperf [as 别名]
def perf(Link):
net = Mininet( host=RemoteHost, link=Link )
h1 = net.addHost( 'h1')
h2 = net.addHost( 'h2', server='mn1.local' )
net.addLink( h1, h2 )
net.start()
net.pingAll()
net.iperf()
net.stop()
示例7: perf
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import iperf [as 别名]
def perf(Link):
"Test connectivity nand performance over Link"
net = Mininet( host=RemoteHost, link=Link )
h1 = net.addHost( 'h1')
h2 = net.addHost( 'h2', server='ubuntu2' )
net.addLink( h1, h2 )
net.start()
net.pingAll()
net.iperf()
net.stop()
示例8: perfTest
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import iperf [as 别名]
def perfTest():
topo = LinearTopo(k=4)
net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink)
net.start()
print "Dumping host connections"
dumpNodeConnections(net.hosts)
print "Testing network connectivity"
net.pingAll()
print "Testing bandwidth between h1 and h4"
h1, h4 = net.get('h1', 'h4')
net.iperf((h1, h4))
net.stop()
示例9: simpleTest
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import iperf [as 别名]
def simpleTest():
topo = SingleSwitchTopo(n = 4)
net = Mininet(topo = topo, host = CPULimitedHost, link = TCLink)
net.start()
print 'Dumping host connections'
dumpNodeConnections(net.hosts)
print "Testing network connectivity"
net.pingAll()
print "testing bandwidth between h1 and h4"
h1,h4 = net.get('h1', 'h4')
net.iperf((h1, h4))
net.stop()
示例10: perfTest
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import iperf [as 别名]
def perfTest():
"Create and test a simple performance test"
topo = LinearTopo(k=4)
net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink)
net.start()
print "Dmping host connections"
dumpNodeConnections(net.hosts)
print "Testing network connectivitiy"
net.pingAll()
print "Testing bandwidht between h1 and h4"
h1, h4 = net.get('h1', 'h4')
net.iperf((h1,h4))
net.stop()
示例11: perfTest
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import iperf [as 别名]
def perfTest( lossy=True ):
"Create network and run simple performance test"
topo = SingleSwitchTopo( n=4, lossy=lossy )
net = Mininet( topo=topo,
host=CPULimitedHost, link=TCLink,
autoStaticArp=True )
net.start()
print "Dumping host connections"
dumpNodeConnections(net.hosts)
print "Testing bandwidth between h1 and h4"
h1, h4 = net.getNodeByName('h1', 'h4')
net.iperf( ( h1, h4 ), l4Type='UDP' )
net.stop()
示例12: BasicOpenflowTest
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import iperf [as 别名]
class BasicOpenflowTest(unittest.TestCase):
def addHost(self, N):
logging.debug("Creating host h%s and add to net.", N)
name = 'h%d' % N
ip = '10.0.0.%d' % N
return self.net.addHost(name, ip=ip)
def setUp(self):
self.net = Mininet(controller=Controller, switch=Switch)
logging.info("Creating controllers")
self.net.addController('c1', command='ovs-testcontroller')
logging.info("Creating switches")
s1 = self.net.addSwitch('s1', protocols="OpenFlow10")
s2 = self.net.addSwitch('s2', protocols="OpenFlow10")
logging.info("Creating hosts (7 on each switch)")
hosts1 = [self.addHost(n) for n in (1, 2, 3, 4, 5, 6, 7)]
hosts2 = [self.addHost(n) for n in (8, 9, 10, 11, 12, 13, 14)]
logging.info("Creating links")
for h in hosts1:
self.net.addLink(s1, h)
for h in hosts2:
self.net.addLink(s2, h)
self.net.addLink(s1, s2)
logging.info("Starting network")
self.net.start()
def testPingAll(self):
logging.info("Testing network")
packetLoss = self.net.pingAll()
self.assertTrue(
packetLoss == 0,
"Packet loss during ping test %s" %
packetLoss)
def testIPerfTCP(self):
logging.info("Running TCP performance test")
self.net.iperf()
def testIPerfUDP(self):
logging.info("Running UDP performance test")
self.net.iperf(l4Type='UDP')
def tearDown(self):
logging.info("Stopping network")
self.net.stop()
示例13: perfTest
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import iperf [as 别名]
def perfTest():
"Create network and run simple performance test"
topo = CustomTopo(linkopts1=1, linkopts2=2, linkopts3=2, fanout=2)
net = Mininet(topo=topo,
host=CPULimitedHost, link=TCLink)
net.start()
print "Dumping host connections"
dumpNodeConnections(net.hosts)
print "Testing network connectivity"
net.pingAll()
print "Testing bandwidth between h1 and h4"
h1, h8 = net.get('h1', 'h8')
net.iperf((h1, h8))
net.stop()
示例14: perTest
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import iperf [as 别名]
def perTest():
"Specify performance parameters for the links"
# Between core and aggregation switches
linkopts1 = dict(bw=10, delay='5ms', loss=1, max_queue_size=1000, use_htb=True)
# Between aggregation and edge switches
linkopts2 = dict(bw=10, delay='5ms', loss=1, max_queue_size=1000, use_htb=True)
# Between edge switches and hosts
linkopts3 = dict(bw=10, delay='5ms', loss=1, max_queue_size=1000, use_htb=True)
"Create and test a simple network"
topo = CustomTopo(linkopts1=linkopts1, linkopts2=linkopts2, linkopts3=linkopts3, fanout=2)
net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink)
net.start()
print "Dumping host connections"
dumpNodeConnections(net.hosts)
print "Testing network connectivity"
net.pingAll()
print "Testing bandwidth between h1 with h2, h3 and h5"
h1, h2 = net.get('h1', 'h2')
net.iperf( ( h1, h2 ) )
h1, h3 = net.get('h1', 'h3')
net.iperf( ( h1, h3 ) )
h1, h5 = net.get('h1', 'h5')
net.iperf( ( h1, h5 ) )
h1, h7 = net.get('h1', 'h7')
net.iperf( ( h1, h7 ) )
net.stop()
示例15: verySimpleLimit
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import iperf [as 别名]
def verySimpleLimit( bw=150 ):
"Absurdly simple limiting test"
intf = custom( TCIntf, bw=bw )
net = Mininet( intf=intf )
h1, h2 = net.addHost( 'h1' ), net.addHost( 'h2' )
net.addLink( h1, h2 )
net.start()
net.pingAll()
net.iperf()
h1.cmdPrint( 'tc -s qdisc ls dev', h1.defaultIntf() )
h2.cmdPrint( 'tc -d class show dev', h2.defaultIntf() )
h1.cmdPrint( 'tc -s qdisc ls dev', h1.defaultIntf() )
h2.cmdPrint( 'tc -d class show dev', h2.defaultIntf() )
net.stop()