本文整理汇总了Python中mininet.net.Mininet.interact方法的典型用法代码示例。如果您正苦于以下问题:Python Mininet.interact方法的具体用法?Python Mininet.interact怎么用?Python Mininet.interact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mininet.net.Mininet
的用法示例。
在下文中一共展示了Mininet.interact方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: runAndInteractTopology
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import interact [as 别名]
def runAndInteractTopology():
"Create network and run simple performance test"
topo = SpecialTopo(100, 10)
net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink, controller=RemoteController)
net.start()
net.interact()
net.stop()
示例2: topoTest
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import interact [as 别名]
def topoTest():
"Create network and run simple performance test"
topo = ITATopo()
# topo = ITATopo(12, 10)
net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink)
net.interact()
示例3: main
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import interact [as 别名]
def main():
topo = PyRouterTopo(args)
net = Mininet(topo=topo, link=TCLink, autoSetMacs=True, cleanup=True, listenPort=10001, controller=RemoteController)
mb = net.get('mb')
mb.setIP('0.0.0.0') # don't set an IP address on middlebox
net.staticArp()
start_webservers(net)
net.interact()
示例4: StartScripts
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import interact [as 别名]
def StartScripts():
topo = RoundRobinTopo()
net = Mininet(topo, controller=lambda name:RemoteController(name, deafultIP='127.0.0.1'), listenPort=6633)
net.start()
h1, h2, h3 = net.get('h1', 'h2', 'h3')
#h1.cmd('./wget.sh')
h1.cmd('python -m SimpleHTTPServer 80 &')
h2.cmd('python -m SimpleHTTPServer 80 &')
h3.cmd('python -m SimpleHTTPServer 80 &')
sleep(5)
h4, h5, h6 = net.get('h4', 'h5', 'h6')
h4.cmd('wget -O - 10.0.0.1')
h4.cmd('wget -O - 10.0.0.2')
h4.cmd('wget -O - 10.0.0.3')
h4.cmd('./randomConnect.sh &')
h5.cmd('./randomConnect.sh &')
h6.cmd('./randomConnect.sh &')
net.interact()
net.stop()
示例5: main
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import interact [as 别名]
def main():
topo = PyRouterTopo(args)
net = Mininet(topo=topo, link=TCLink, cleanup=True)
setup_addressing(net)
net.interact()
示例6: __init__
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import interact [as 别名]
def __init__( self ):
# Initialize topology
Topo.__init__( self )
# Add hosts
h1 = self.addHost( 'h1' ) # Valid user
h2 = self.addHost( 'h2' ) # Invalid malicious user
h3 = self.addHost( 'h3' ) # Invalid DDoS user
s1 = self.addSwitch( 's1', protocols='OpenFlow13')
# Add links between switches and hosts
self.addLink( h1, s1 )
self.addLink( h2, s1 )
self.addLink( h3, s1 )
if __name__ == '__main__':
testTopo = TestTopo()
remoteCtrl = RemoteController( 'ctrl', ip='127.0.0.1', port=6653 )
net = Mininet( topo=testTopo, controller=remoteCtrl, switch=OVSKernelSwitch, autoSetMacs=True )
# Connect real interfaces to switch
Intf( 'brApache', node=net.switches[0] ) # Apache server
# Intf( 'enp0s3 ', node=net.switches[0] ) # Internet
net.start()
net.interact()
示例7: build_prox
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import interact [as 别名]
build_prox(args.prox)
wait_on_controller()
mn = Mininet(
topo=MyTopo(),
autoSetMacs=True,
autoStaticArp=True,
controller=RemoteController,
switch=OVSKernelSwitch
)
mn.start()
sleep(2) # yuk
for src in mn.hosts:
for dst in mn.hosts:
if src != dst:
# This is to work around a bug in the version of mininet on the VM
src.setARP(ip=dst.IP(), mac=dst.intf(None).MAC())
# Magic for floodlight to map MAC addresses to switch ports
src.setARP(ip=MAGIC_IP, mac=MAGIC_MAC)
src.cmd("ping", "-c1", "-W1", MAGIC_IP)
px = Prox(mn.getNodeByName("prox"), args.plog)
px.start()
mn.interact()
# TODO cleanup threads
# vim: set noet ts=4 sw=4 :
示例8: main
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import interact [as 别名]
def main():
topo = PyRouterTopo(args)
net = Mininet(topo=topo, link=TCLink, cleanup=True, autoSetMacs=True)
setup_addressing(net)
net.staticArp()
net.interact()
示例9: main
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import interact [as 别名]
def main():
topo = PySwitchTopo(args)
net = Mininet(controller=None, topo=topo, link=TCLink, cleanup=True)
setup_addressing(net)
net.interact()
示例10: main
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import interact [as 别名]
def main():
topo = MyTopo(args)
net = Mininet(topo=topo, link=TCLink, cleanup=True)
net.interact()
示例11: StartScripts
# 需要导入模块: from mininet.net import Mininet [as 别名]
# 或者: from mininet.net.Mininet import interact [as 别名]
def StartScripts():
topo = SimpleTopo()
net = Mininet(topo)
net.start()
net.interact()
net.stop()