Mininet自定义topo使用floodlight做控制器

在服务器上自定义一个数据中心的topo结构。

image?w=610&h=271&rev=1&ac=1


自定义拓扑代码如下:


'''
Coursera:
- Software Defined Networking (SDN) course
-- Module 3 Programming Assignment
Professor: Nick Feamster
Teaching Assistant: Muhammad Shahbaz
'''
from mininet.topo import Topo
from mininet.util import *
from mininet.log import setLogLevel
from mininet.net import Mininet
from mininet.node import CPULimitedHost
from mininet.link import TCLink
from mininet.node import *
#from mininet.examples import
class CustomTopo(Topo):
    "Simple Data Center Topology"
    "linkopts - (1:core, 2:aggregation, 3: edge) parameters"
    "fanout - number of child switch per parent switch"
                                                         
    def __init__(self, linkopts1, linkopts2, linkopts3, fanout=2, **opts):
        # Initialize topology and default options
        Topo.__init__(self, **opts)
                                                             
        # Add your logic here ...
        "Layer1"
        hostnum =1
        agrsnum =1
        edgesum =1
        coreswitch=self.addSwitch('c1')
        for i in irange(1,fanout):
            edgeswitch = self.addSwitch('e%s' %edgesum)
            edgesum = edgesum+1
            lay1link = self.addLink(coreswitch, edgeswitch,bw=10, delay='5ms', loss=1, max_queue_size=1000, use_htb=True)
            print 'This is i %s' %i
            print 'ADD EDGESWITCHE e%s' %i
            for j in irange(1,fanout):
                agrswitch = self.addSwitch('a%s' %agrsnum)
                agrsnum = agrsnum+1
                lay2link = self.addLink(edgeswitch, agrswitch,bw=10, delay='5ms', loss=1, max_queue_size=1000, use_htb=True)
                print 'This is j %s' %j
                print 'ADD AGRESWITCHE a%s' %(i*j)
                for k in irange(1,fanout):
                    host = self.addHost('h%s' %hostnum,cpu=.5/k)
                    hostnum= hostnum+1
                    lay3link = self.addLink(agrswitch, host,bw=10, delay='5ms', loss=1, max_queue_size=1000, use_htb=True)
                    print 'This is k %s' %k
                    print 'ADD Host h%s' %(i*j*k)

但使用floodlight作为控制器时一直报线程错误:

ERROR [n.f.l.i.LinkDiscoveryManager:Scheduled-1] Error in quarantine worker threadjava.lang.NullPointerException: nullat net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager.generateSwitchPortStatusUpdate(LinkDiscoveryManager.java:1000) ~[bin/:na]at net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager.processBDDPLists(LinkDiscoveryManager.java:990) ~[bin/:na]at net.floodlightcontroller.linkdiscovery.internal.LinkDiscoveryManager$QuarantineWorker.run(LinkDiscoveryManager.java:907) ~[bin/:na]at net.floodlightcontroller.core.util.SingletonTask$SingletonTaskWorker.run(SingletonTask.java:73) [bin/:na]at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [na:1.7.0_40]at java.util.concurrent.FutureTask.run(FutureTask.java:262) [na:1.7.0_40]at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178) [na:1.7.0_40]at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292) [na:1.7.0_40]at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [na:1.7.0_40]at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [na:1.7.0_40]at java.lang.Thread.run(Thread.java:724) [na:1.7.0_40]

这个错误。苦思不得解。

之后在虚拟机上测试,运行良好。发现是mininet版本的问题。服务器上用的是mininent的master版本。虚拟机是2.1.0。以后做实验需要用软件稳定版本。

你可能感兴趣的:(服务器,software,控制器,数据中心,Course)