Reputation: 21
I am trying to get the information for link's bandwidth from mininet
by using Opendaylight
Controller, but the problem is that even though there are different links with different bandwidth in the mininet
topology, the information that I get from opendaylight
controller (using Postman) is showing the same result for every link.
The python code used to create the topology is:
from mininet.net import Mininet
from mininet.node import CPULimitedHost
from mininet.link import TCLink
from mininet.util import dumpNodeConnections
from mininet.log import setLogLevel
from mininet.topo import Topo
class MyTopo( Topo ):
"Simple topology example."
def __init__( self ):
"Create custom topo."
# Initialize topology
Topo.__init__( self )
# Add hosts and switches
H1 = self.addHost( 'h1' )
H2 = self.addHost( 'h2' )
H3 = self.addHost( 'h3' )
H4 = self.addHost( 'h4' )
S1 = self.addSwitch( 's1')
S2 = self.addSwitch( 's2')
S3 = self.addSwitch( 's3')
S4 = self.addSwitch( 's4')
# Add links
self.addLink( H1, S1,cls = TCLink, bw = 5)
self.addLink( H2, S2,cls = TCLink, bw = 1)
self.addLink( H3, S3,cls = TCLink, bw = 1)
self.addLink( H4, S4,cls = TCLink, bw = 1)
self.addLink( S1, S2,cls = TCLink, bw = 1)
self.addLink( S2, S3,cls = TCLink, bw = 1)
self.addLink( S3, S4,cls = TCLink, bw = 1)
self.addLink( S4, S1,cls = TCLink, bw = 1)
topos = { 'mytopo': ( lambda: MyTopo() ) }
The result from opendaylight controller is:
The result for "sh ovs-ofctl -O OpenFlow13 dump-ports-desc s1", where s1-eth1 is the port that connects H1 with S1:
I would really appreciate if someone could help me find a way to get the real information for link capacities from mininet.
Upvotes: 2
Views: 1631
Reputation: 26
Here is mine demo conf. for mininet router.py
class LinuxRouter(Node):
def config(self, **params):
super(LinuxRouter, self).config(**params)
self.cmd('sysctl net.ipv4.ip_forward=1')
def terminate(self):
self.cmd('sysctl net.ipv4.ip_forward=0')
super(LinuxRouter, self).terminate()
class NetworkTopo(Topo):
def build(self, **_opts):
router = self.addNode('r0', cls=LinuxRouter, ip='192.168.1.1/24')
h1_01 = self.addHost('h1_01', ip='192.168.1.100/24', defaultRoute='via 192.168.1.1')
h1_02 = self.addHost('h1_02', ip='192.168.1.150/24', defaultRoute='via 192.168.1.1')
h2_01 = self.addHost('h2_01', ip='172.16.0.100/12', defaultRoute='via 172.16.0.1')
h2_02 = self.addHost('h2_02', ip='172.16.0.150/12', defaultRoute='via 172.16.0.1')
h3_01 = self.addHost('h3_01', ip='10.0.0.100/8', defaultRoute='via 10.0.0.1')
h3_02 = self.addHost('h3_02', ip='10.0.0.150/8', defaultRoute='via 10.0.0.1')
h3_03 = self.addHost('h3_03', ip='10.0.0.200/8', defaultRoute='via 10.0.0.1')
s1 = self.addSwitch('s1')
s2 = self.addSwitch('s2')
s3 = self.addSwitch('s3')
self.addLink(h1_01, s1)
self.addLink(h1_02, s1)
self.addLink(h2_01, s2)
self.addLink(h2_02, s2)
self.addLink(h3_01, s3)
self.addLink(h3_02, s3)
self.addLink(h3_03, s3)
self.addLink(s1, router, intfName2='r0-eth1', params2={'ip': '192.168.1.1/24'})
self.addLink(s2, router, intfName2='r0-eth2', params2={'ip': '172.16.0.1/12'})
self.addLink(s3, router, intfName2='r0-eth3', params2={'ip': '10.0.0.1/8'})
def run():
topo = NetworkTopo()
net = Mininet(topo=topo)
net.start() (
print net['r0'].cmd('route')
CLI(net)
net.stop()
if __name__ == '__main__':
setLogLevel('info')
run()
Upvotes: 0
Reputation: 11
you can try the following command from within mininet CLI: sh ovs-ofctl -O openflow13 dump-ports-desc s1
Upvotes: 1