我想计算使用 pox 和 openflow 实现切换的 UDP 数据包的数量。
这是我使用的拓扑:
#!/usr/bin/python
"""
Script created by VND - Visual Network Description (SDN version)
"""
from mininet.net import Mininet
from mininet.node import Controller, RemoteController, OVSKernelSwitch, IVSSwitch, UserSwitch
from mininet.link import Link, TCLink
from mininet.cli import CLI
from mininet.log import setLogLevel
def topology():
"Create a network."
net = Mininet( controller=Controller, link=TCLink, switch=OVSKernelSwitch )
print "*** Creating nodes"
c1 = net.addController( 'c1' )
s2 = net.addSwitch( 's2', protocols='OpenFlow13', listenPort=6673, mac='00:00:00:00:00:02' )
h4 = net.addHost( 'h4', mac='00:00:00:00:00:04', ip='10.0.0.4/8' )
h5 = net.addHost( 'h5', mac='00:00:00:00:00:05', ip='10.0.0.5/8' )
h6 = net.addHost( 'server', mac='00:00:00:00:00:06', ip='10.0.0.6/8' )
print "*** Creating links"
net.addLink(s2, h6)
net.addLink(s2, h4)
net.addLink(s2, h5)
print "*** Starting network"
net.build()
c1.start()
s2.start( [c1] )
print "*** Running CLI"
CLI( net )
print "*** Stopping network"
net.stop()
if __name__ == '__main__':
setLogLevel( 'info' )
topology()
我想计算“h4”通过交换机发送到服务器的 udp 数据包的数量,以及“h5”通过交换机发送到服务器的 udp 数据包的数量。