本文整理汇总了Python中mininet.util.dumpNodeConnections函数的典型用法代码示例。如果您正苦于以下问题:Python dumpNodeConnections函数的具体用法?Python dumpNodeConnections怎么用?Python dumpNodeConnections使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dumpNodeConnections函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setupITG
def setupITG( network ):
for host in network.hosts:
host.cmd( '/usr/sbin/sshd -D &')
host.cmd( 'ITGRecv < /dev/null &' )
# DEBUGGING INFO
print
print "Dumping host connections"
dumpNodeConnections(network.hosts)
print
print "*** Hosts addresses:"
print
for host in network.hosts:
print host.name, host.IP()
print
print "*** Type 'exit' or control-D to shut down network"
print
print "*** For testing network connectivity among the hosts, wait a bit for the controller to create all the routes, then do 'pingall' on the mininet console."
print
CLI( network )
print "Killing ITGRecv(s)..."
for host in network.hosts:
host.cmd('kill %' + '/usr/sbin/sshd')
host.cmd( 'pkill -15 ITGRecv')
print "Stopping the network..."
network.stop()
示例2: multiSwitchTest
def multiSwitchTest():
topo = MultiSwitchTopo(depth=2, fanout=4)
#net = Mininet(topo, controller=OVSController)
net = Mininet(topo, controller=lambda name: RemoteController(name, ip='192.168.56.1'))
net.start()
print "Dumping host connections"
dumpNodeConnections(net.hosts)
print "Testing network connectivity"
net.pingAll()
receivers = ["00:11:22:33:44:00",
"00:11:22:33:44:04",
"00:11:22:33:44:08",
"00:11:22:33:44:0c"]
for host in net.hosts:
if host.defaultIntf().MAC() in receivers:
startLogReceiver(host)
else:
startLogSender(host)
for host in net.hosts:
if not (host.defaultIntf().MAC() in receivers):
runGenerator(host)
for host in net.hosts:
if host.defaultIntf().MAC() in receivers:
stopLogReceiver(host)
else:
stopLogSender(host)
net.stop()
示例3: main
def main():
start = time()
try:
topo = NetworkTopo(switch_bw=args.bw_net, host_bw=args.bw_host, switch_delay='%sms' %(args.delay, ), queue_size=23593)
net = Mininet(topo=topo, host=CPULimitedHost, link=TCLink)
net.start()
dumpNodeConnections(net.hosts)
net.pingAll()
if args.http:
test_http(net)
else:
run_tcp_first(net, args.tcp_n)
except:
print "-"*80
print "Caught exception. Cleaning up..."
print "-"*80
import traceback
traceback.print_exc()
raise
finally:
stop_all_iperf()
net.stop()
Popen("killall -9 top bwm-ng tcpdump cat mnexec; mn -c", shell=True, stderr=PIPE)
Popen("pgrep -f webserver.py | xargs kill -9", shell=True).wait()
stop_tcpprobe()
end = time()
cprint("Experiment took %s seconds\n" % (end - start), "yellow")
示例4: myTopo
def myTopo():
net = Mininet(switch=OVSKernelSwitch)
net.addController('controller01',controller=RemoteController,ip=ofc_ip, port=ofc_port)
spine1 = net.addSwitch(spine1_name, dpid=spine1_dpid)
leaf1 = net.addSwitch(leaf1_name, dpid=leaf1_dpid)
leaf2 = net.addSwitch(leaf2_name, dpid=leaf2_dpid)
host1 = net.addHost(host1_name, ip=host1_ip)
host2 = net.addHost(host2_name, ip=host2_ip)
host3 = net.addHost(host3_name, ip=host3_ip)
host4 = net.addHost(host4_name, ip=host4_ip)
net.addLink(spine1, leaf1)
net.addLink(spine1, leaf2)
net.addLink(leaf1, host1)
net.addLink(leaf1, host2)
net.addLink(leaf2, host3)
net.addLink(leaf2, host4)
net.start()
print "Dumping node connections"
dumpNodeConnections(net.switches)
dumpNodeConnections(net.hosts)
ofp_version(spine1, ['OpenFlow13'])
ofp_version(leaf1, ['OpenFlow13'])
ofp_version(leaf2, ['OpenFlow13'])
CLI(net)
net.stop()
示例5: perfTest
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()
示例6: perfTest
def perfTest():
"Create network and run simple performance test"
topo =LinearTopo(k=Y)
net =Mininet(topo=topo, host=CPULimitedHost, link=TCLink,controller=OVSController)
count=1
for i in range(1,X+1,2):
stri="h"
stri2="127.0.0."
stri2=stri2+str(count)
count=count+1
stri=stri+str(i)
hi=net.get(stri)
hi.setIP(stri2,24)
count=1
for i in range(2,X+1,2):
stri="h"
stri2="192.168.0."
stri=stri+str(i)
stri2=stri2+str(count)
count=count+1
hi=net.get(stri)
hi.setIP(stri2,29)
net.start()
print "Dumping host connections"
dumpNodeConnections(net.hosts)
print "Testing network connectivity"
net.pingAll()
net.stop()
示例7: run_quic_topology
def run_quic_topology():
# remove old files
os.system( "rm /tmp/client-*")
os.system( "rm /tmp/server-*")
# kill old processes
os.system( "killall -q controller" )
os.system( "killall -q quic_client" )
os.system( "killall -q quic_server" )
topo = QuicTester()
net = Mininet(topo=topo, host=Host, link=Link)
net.start()
client = net.getNodeByName('client')
server = net.getNodeByName('server')
set_all_IP(net, client, server)
#Dump connections
dumpNodeConnections(net.hosts)
display_routes(net, client, server)
run_quic(client, server)
CLI(net)
net.stop()
示例8: create_mininet
def create_mininet(self, topo=None, tunnels=[], switch=UserSwitch, controller=None):
"Create a Mininet and test it with pingall"
self.setLogLevel('debug')
self.logger.info("Creating mininet instance")
if not topo:
topo=SingleSwitchTopo(k=2)
if controller:
self.net = Mininet(topo=topo, intf=TCIntf, link=TCLink, switch=switch, controller=controller)
else:
self.net = Mininet(topo=topo, intf=TCIntf, link=TCLink, switch=switch)
self.logger.info("Adding tunnels to mininet instance")
for tunnel in tunnels:
port=None
cls=None
if "port" in tunnel[2].keys():
port = tunnel[2]["port"]
del tunnel[2]["port"]
if "cls" in tunnel[2].keys():
cls = tunnel[2]["cls"]
del tunnel[2]["cls"]
self.addTunnel(tunnel[0], tunnel[1], port, cls, **tunnel[2])
self.logger.info("Starting Mininet...")
self.net.start()
#print "Dumping host connections"
dumpNodeConnections(self.net.hosts)
self.logger.info("Startup complete.")
示例9: do_net
def do_net( self, _line ):
"List network connections."
nl=self.nodelist
simhost=self.mn.nameToNode['simhost']
x=nl.index(simhost)
nl.remove(nl[x])
dumpNodeConnections( nl )
示例10: __init__
def __init__( self, loss):
"Create custom topo."
# Initialize topology
Topo.__init__( self )
self.loss = loss
# Add hosts and switches
leftHost = self.addHost( 'h1' )
leftHost2 = self.addHost( 'h2' )
rightHost = self.addHost( 'h3' )
leftSwitch = self.addSwitch( 's4' )
leftSwitch2 = self.addSwitch( 's5' )
middleSwitch = self.addSwitch( 's6' )
rightSwitch = self.addSwitch( 's7' )
# Add links
self.addLink( leftHost, leftSwitch , loss=self.loss ) #(h1,s4)
self.addLink( leftHost2, leftSwitch2 , loss=self.loss ) #(h2,s5)
self.addLink( leftSwitch, middleSwitch , loss=self.loss ) #(s4,s6)
self.addLink( leftSwitch2, middleSwitch , loss=self.loss ) #(s5,s6)
self.addLink( middleSwitch, rightSwitch , loss=self.loss ) #(s6,s7)
self.addLink( rightSwitch, rightHost , loss=self.loss ) #(s7,h3)
# preconfigure the ARP table
arpNodes = [rightHost,rightSwitch]
net = Mininet(self)
print "\n dumping node connection info"
dumpNodeConnections(net.hosts)
print "\n"
示例11: rosTest
def rosTest():
"Create network and run simple performance test"
topo = SingleSwitchTopo(n=3)
net = Mininet(topo=topo,
link=TCLink)
net.start()
print "Dumping host connections"
dumpNodeConnections(net.hosts)
print "Testing network connectivity"
net.pingAll()
h1, h2, h3 = net.get('h1', 'h2', 'h3')
print "Starting roscore"
output = h3.cmd('source /opt/ros/indigo/setup.bash && '
'export ROS_IP='+h3.IP()+
' && export ROS_MASTER_URI=http://'+h3.IP()+
':11311 && roscore &')
print output
print "Starting receiver"
output = h2.cmd('export LD_LIBRARY_PATH=/home/jeb/:$LD_LIBRARY_PATH && export ROS_IP='+h2.IP()+
' && export ROS_MASTER_URI=http://'+h3.IP()+
':11311 && /home/jeb/node_main -config /home/jeb/receiver.xml --tg_time 50 &')
print output
print "Starting sender"
output = h1.cmd('export LD_LIBRARY_PATH=/home/jeb/:$LD_LIBRARY_PATH && export ROS_IP='+h1.IP()+
' && export ROS_MASTER_URI=http://'+h3.IP()+
':11311 && /home/jeb/node_main -config /home/jeb/sender.xml --tg_time 50 --max_data_length_bits 6000 &')
print output
sleep(70)
net.stop()
示例12: startNetwork
def startNetwork():
"instantiates a topo, then starts the network and prints debug information"
info('** Creating Quagga network topology\n')
topo = QuaggaTopo()
info('** Starting the network\n')
global net
net = MiniNExT(topo, controller=OVSController)
net.start()
info('** Dumping host connections\n')
dumpNodeConnections(net.hosts)
info('** Dumping host processes\n')
# for host in net.hosts:
# host.cmdPrint("ps aux")
# for host in net.hosts:
# host.cmdPrint('ifconfig')
# Enabling IP forwarding
net.get("R1").cmd("sysctl -w net.ipv4.ip_forward=1")
net.get("R2").cmd("sysctl -w net.ipv4.ip_forward=1")
net.get("R3").cmd("sysctl -w net.ipv4.ip_forward=1")
net.get("R4").cmd("sysctl -w net.ipv4.ip_forward=1")
# Setting Interface IPs
net.get("R1").cmd("ifconfig R1-eth1 172.0.2.1/24")
net.get("R1").cmd("ifconfig R1-eth2 172.0.6.2/24")
net.get("R2").cmd("ifconfig R2-eth1 172.0.3.1/24")
net.get("R4").cmd("ifconfig R4-eth1 172.0.3.2/24")
net.get("R4").cmd("ifconfig R4-eth2 172.0.5.1/24")
net.get("R3").cmd("ifconfig R3-eth1 172.0.5.2/24")
# Static Routes from R1 to R2
net.get("H1").cmd("route add default gw 172.0.1.2")
net.get("R1").cmd("ip route add 172.0.3.0/24 via 172.0.2.2 dev R1-eth1")
net.get("R1").cmd("ip route add 172.0.4.0/24 via 172.0.2.2 dev R1-eth1")
net.get("R2").cmd("ip route add 172.0.4.0/24 via 172.0.3.2 dev R2-eth1")
# Allowing Nating ar each router in the path from H1 to H2
net.get("R1").cmd("iptables -t nat -A POSTROUTING -o R1-eth1 -j MASQUERADE")
net.get("R1").cmd("iptables -A FORWARD -i R1-eth1 -o R1-eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT")
net.get("R1").cmd("iptables -A FORWARD -i R1-eth0 -o R1-eth1 -j ACCEPT")
net.get("R2").cmd("iptables -t nat -A POSTROUTING -o R2-eth1 -j MASQUERADE")
net.get("R2").cmd("iptables -A FORWARD -i R2-eth1 -o R2-eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT")
net.get("R2").cmd("iptables -A FORWARD -i R2-eth0 -o R2-eth1 -j ACCEPT")
net.get("R4").cmd("iptables -t nat -A POSTROUTING -o R4-eth0 -j MASQUERADE")
net.get("R4").cmd("iptables -A FORWARD -i R4-eth0 -o R4-eth1 -m state --state RELATED,ESTABLISHED -j ACCEPT")
net.get("R4").cmd("iptables -A FORWARD -i R4-eth1 -o R4-eth0 -j ACCEPT")
info('** Testing network connectivity\n')
net.ping(net.hosts)
info('** Running CLI\n')
CLI(net)
示例13: testIt
def testIt():
topo = SingleSwitch()
net = Mininet(topo)
net.start()
dumpNodeConnections(net.hosts)
net.pingAll()
net.stop()
示例14: createTopo
def createTopo():
logging.debug("Create FatTopo")
global topo
topo = FatTopo()
topo.createTopo()
topo.createLink()
logging.debug("Start Mininet")
CONTROLLER_IP = "127.0.0.1"
CONTROLLER_PORT = 6633
global net
net = Mininet(topo=topo, link=TCLink, controller=None)
net.addController('controller', controller=RemoteController, ip=CONTROLLER_IP, port=CONTROLLER_PORT)
net.start()
logger.debug("dumpNode")
# enableSTP()
dumpNodeConnections(net.hosts)
# pingTest(net)
# iperfTest(net, topo)
root = net.get(topo.HostList[0])
makeTerm(root)
# root.cmd('java -jar ../ncintents-bridge.jar 9000 &')
run(host='172.20.4.112', port=8090)
CLI(net)
net.stop()
示例15: startup
def startup():
topo=Network1()
net=Mininet(topo,link=TCLink)
net.start()
dumpNodeConnections(net.hosts)
CLI(net)
net.stop()