Error in Mininet for SDN-VANET

77 views
Skip to first unread message

manish kumar

unread,
Jul 26, 2023, 6:39:28 AM7/26/23
to mininet-wifi-discuss
Dear Researchers,

can any one point out the error in the following code
#!/usr/bin/python

from mininet.node import Controller, OVSKernelSwitch
from mininet.link import TCLink
from mn_wifi.cli import CLI
from mn_wifi.net import Mininet_wifi

def topology():
    net = Mininet_wifi(controller=Controller, accessPoint=OVSKernelSwitch, link=TCLink, ssid='vanet_ssid', mode='g', channel='1')

    print("*** Creating nodes ***")
    vehicles = []
    for i in range(10):
        vehicles.append(net.addCar('car{}'.format(i+1), wlans=1, ip='10.0.0.{}'.format(i+1)))

    c0 = net.addController('c0', controller=Controller)

    print("*** Creating links ***")
    net.plotGraph(max_x=200, max_y=200)

    print("*** Starting network ***")
    net.build()
    c0.start()
    print("*** Starting network ***")
    for vehicle in vehicles:
        vehicle.setIP('192.168.0.%s'.format(vehicle.index+1), intf='%s-wlan0' % vehicle)

    print("*** Applying mobility model to cars ***")
    net.mobility(
        model='RandomWayPoint',
        max_x=200,
        max_y=200,
        min_v=5,
        max_v=10,
        seed=1,
        time=10
    )

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

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

if __name__ == '__main__':
    topology()


Error:
*** Creating nodes ***
*** Creating links ***
*** Starting network ***
Traceback (most recent call last):
  File "10node.py", line 46, in <module>
    topology()
  File "10node.py", line 22, in topology
    net.build()
  File "/usr/local/lib/python2.7/dist-packages/mininet_wifi-2.6-py2.7.egg/mn_wifi/net.py", line 787, in build
    self.auto_association()
  File "/usr/local/lib/python2.7/dist-packages/mininet_wifi-2.6-py2.7.egg/mn_wifi/net.py", line 1458, in auto_association
    node.intfs[wlan].ip = node.wintfs[wlan].ip
KeyError: 0

Thanks

Ramon Fontes

unread,
Jul 26, 2023, 8:25:25 AM7/26/23
to manish kumar, mininet-wifi-discuss
It is missing "net.configureWifiNodes()"
Reply all
Reply to author
Forward
0 new messages