2017-03-28 13 views
0

처음에는 복잡한 토폴로지 (서로 연결된 많은 스위치)를 만들고 싶었지만이 단순한 토폴로지조차도 작동하지 않습니다. 예를 들어 작업 연결을 얻을 수 없습니다. topologyMininet-wifi 커스텀 토폴로지

그는 해당 토폴로지를 작성해야 스크립트는 다음과 같습니다 : 'H1 핑 H2'여기

토폴로지입니다

!/usr/bin/python 

""" 
Setting the position of Nodes (only for Stations and Access Points) and providing mobility. 

""" 

from mininet.net import Mininet 
from mininet.node import Controller, RemoteController, OVSKernelAP 
from mininet.link import TCLink 
from mininet.cli import CLI 
from mininet.log import setLogLevel 

def topology(): 

    "Create a network." 
    net = Mininet(controller=Controller, link=TCLink, accessPoint=OVSKernelAP) 

    print "*** Creating nodes" 
    h1 = net.addHost('h1', mac='00:00:00:00:00:01', ip='10.0.0.1/8') 
    h2 = net.addHost('h2', mac='00:00:00:00:00:11', ip='10.0.1.1/8') 

    sta1 = net.addStation('sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8', position='50,50,0') 
    sta2 = net.addStation('sta2', mac='00:00:00:00:00:03', ip='10.0.0.3/8', position='40,50,0') 
    sta3 = net.addStation('sta3', mac='00:00:00:00:00:04', ip='10.0.0.4/8', position='20,50,0') 

    ap1 = net.addAccessPoint('ap1', ssid= 'new-ssid', mode= 'g', channel= '5', position='25,50,0', range='35') 
    ap2 = net.addAccessPoint('ap2', ssid= 'new-ssid', mode= 'g', channel= '5', position='75,50,0', range='35') 

    c1 = net.addController('c1') 

    s1 = net.addSwitch('s1') 

    #net.runAlternativeModule('../module/mac80211_hwsim.ko') 

    print "*** Configuring wifi nodes" 
    net.configureWifiNodes() 

    print "*** Associating and Creating links" 

    net.addLink(ap1, s1) 
    net.addLink(ap2, s1) 
    net.addLink(s1, c1) 
    #net.addLink(ap1, ap2) 

    net.addLink(s1, h1) 
    net.addLink(s1, h2) 

    net.addLink(ap1, sta1) 
    net.addLink(ap1, sta2) 
    net.addLink(ap1, sta3) 

    print "*** Starting network" 
    net.build() 
    c1.start() 
    ap1.start([c1]) 
    ap2.start([c1]) 

    """uncomment to plot graph""" 
    net.plotGraph(max_x=100, max_y=100) 

    net.startMobility(startTime=0) 
    net.mobility(sta1, 'start', time=1, position='0.0,50.0,0.0') 
    net.mobility(sta1, 'stop', time=30, position='100.0,50.0,0.0') 
    net.stopMobility(stopTime=31) 

    print "*** Running CLI" 
    CLI(net) 

    print "*** Stopping network" 
    net.stop() 

if __name__ == '__main__': 
    setLogLevel('info') 
    topology() 

으로 이미 말했다 난 핑 H1 수 없습니다입니다 그리고 h2 :( 심지어 RemoteController를 사용하려고 시도했지만 동일한 결과가 나타납니다.

답변

2

ch 아래 ANGES :

from mininet.node import Controller, RemoteController, OVSKernelAP, OVSSwitch 
net = Mininet(controller=Controller, link=TCLink, accessPoint=OVSKernelAP, switch=OVSSwitch) 
c1 = net.addController('c1', controller=Controller) 
s3 = net.addSwitch('s3') 

제거 :
net.addLink(s1, c1)

추가 :
s3.start([c1])

은 모두 AP를 설정 한 경우 동일한 ID로 전환하는 것이 있습니다 (예를 들어, s1, ap1), 기본적으로 동일한 DPID를 갖습니다. 그래서 s1을 s3으로 바꿔야했습니다. 반면에 노드를 추가 할 때 DPID를 매개 변수로 정의 할 수 있습니다.