intrig-unicamp / mininet-wifi

Emulator for Software-Defined Wireless Networks
https://mn-wifi.readthedocs.io/
Other
431 stars 239 forks source link

AttributeError: 'managed' object has no attribute 'wmIface' #538

Closed 14vv1A0516 closed 1 month ago

14vv1A0516 commented 1 month ago
from mininet.log import setLogLevel, info
from mn_wifi.link import wmediumd, adhoc
from mn_wifi.cli import CLI
from mn_wifi.net import Mininet_wifi
from mn_wifi.wmediumdConnector import interference
from mininet.term import makeTerm

def topology():
    "Create a network."
    net = Mininet_wifi(link=wmediumd, wmediumd_mode=interference)

    info("*** Creating nodes\n")
    sta1 = net.addStation('sta1', wlans=1, mac='00:00:00:00:00:11', ip='192.168.10.1/24', min_v=5.0, max_v=10.0, range=3, color="red")
    sta2 = net.addStation('sta2', wlans=1, mac='00:00:00:00:00:12', ip='192.168.10.2/24', min_v=5.0, max_v=10.0, range=3, color="red")

    sta3 = net.addStation('sta3', wlans=1, mac='00:00:00:00:00:03', ip='192.168.10.3/24', min_v=5.0, max_v=10.0, range=5, color="red")
    sta4 = net.addStation('sta4', wlans=1, mac='00:00:00:00:00:04', ip='192.168.10.4/24', min_v=5.0, max_v=10.0, range=5, color="red")
    sta5 = net.addStation('sta5', wlans=1, mac='00:00:00:00:00:05', ip='192.168.10.5/24', min_v=5.0, max_v=10.0, range=5, color="red")

    sta6 = net.addStation('sta6', wlans=1, mac='00:00:00:00:00:06', ip='192.168.10.6/24', min_v=5.0, max_v=10.0, range=5, color="red")
    sta7 = net.addStation('sta7', wlans=1, mac='00:00:00:00:00:07', ip='192.168.10.7/24', min_v=5.0, max_v=10.0, range=5, color="red")
    sta8 = net.addStation('sta8', wlans=1, mac='00:00:00:00:00:08', ip='192.168.10.8/24', min_v=5.0, max_v=10.0, range=5, color="red")
    sta9 = net.addStation('sta9', wlans=1, mac='00:00:00:00:00:09', ip='192.168.10.9/24', min_v=5.0, max_v=10.0, range=5, color="red")
    sta10 = net.addStation('sta10', wlans=1, mac='00:00:00:00:00:10', ip='192.168.10.10/24', min_v=5.0, max_v=10.0, range=5, color="red")

    sta11 = net.addStation('sta11', wlans=1, mac='00:00:00:00:00:11', ip='192.168.10.11/24', min_v=5.0, max_v=10.0, range=5, color="red")

    info("*** Configuring wifi nodes\n")
    net.configureWifiNodes()

    info("*** Setting links\n")

    info("*** Plotting Graph\n")
    net.plotGraph(max_x=230, max_y=135)

    print ("Starting Mobility")
    net.startMobility (time=0, seed=1, model='RandomDirection') #, AC='ssf')

    net.mobility(sta1, 'start', time=10, position='1,70,0')
    net.mobility(sta1, 'stop', time=40, position='210,70,0')

    net.mobility(sta2, 'start', time=15, position='1,70,0')
    net.mobility(sta2, 'stop', time=45, position='210,70,0')

    net.mobility(sta3, 'start', time=20, position='1,70,0')
    net.mobility(sta3, 'stop', time=50, position='210,70,0')

    net.mobility(sta4, 'start', time=25, position='1,70,0')
    net.mobility(sta4, 'stop', time=55, position='210,70,0')

    net.mobility(sta5, 'start', time=30, position='1,70,0')
    net.mobility(sta5, 'stop', time=60, position='210,70,0')

    net.mobility(sta6, 'start', time=35, position='1,70,0')
    net.mobility(sta6, 'stop', time=65, position='210,35,0')

    net.mobility(sta7, 'start', time=40, position='1,70,0')
    net.mobility(sta7, 'stop', time=70, position='210,35,0')

    net.mobility(sta8, 'start', time=45, position='1,70,0')
    net.mobility(sta8, 'stop', time=75, position='210,70,0')

    net.mobility(sta9, 'start', time=50, position='1,70,0')
    net.mobility(sta9, 'stop', time=80, position='210,70,0')

    net.mobility(sta10, 'start', time=55, position='1,70,0')
    net.mobility(sta10, 'stop', time=85, position='210,70,0')

    net.mobility(sta11, 'start', time=60, position='1,70,0')
    net.mobility(sta11, 'stop', time=90, position='210,70,0')

    net.stopMobility (time=400)
    info("*** Starting network\n")
    net.build()

    info("*** Running CLI\n")
    CLI(net)

    info("*** Stopping network\n")
    net.stop()

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

The code works perfectly fine for 10 stations. When I try to create more than 10 stations in the above code, I get the following error. It is very strange to see this error. I hope the error is related to positioning of vehicle or network interface. I checked in issues and mininet-wifi conversations as well but of no use. Can you please help me resolve this ?

Creating nodes Configuring wifi nodes sta1-wlan0: the signal range should be changed to (at least) 116m >>> See https://mininet-wifi.github.io/faq/#q7 for more information sta2-wlan0: the signal range should be changed to (at least) 116m >>> See https://mininet-wifi.github.io/faq/#q7 for more information sta3-wlan0: the signal range should be changed to (at least) 116m >>> See https://mininet-wifi.github.io/faq/#q7 for more information sta4-wlan0: the signal range should be changed to (at least) 116m >>> See https://mininet-wifi.github.io/faq/#q7 for more information sta5-wlan0: the signal range should be changed to (at least) 116m >>> See https://mininet-wifi.github.io/faq/#q7 for more information sta6-wlan0: the signal range should be changed to (at least) 116m >>> See https://mininet-wifi.github.io/faq/#q7 for more information sta7-wlan0: the signal range should be changed to (at least) 116m >>> See https://mininet-wifi.github.io/faq/#q7 for more information sta8-wlan0: the signal range should be changed to (at least) 116m >>> See https://mininet-wifi.github.io/faq/#q7 for more information sta9-wlan0: the signal range should be changed to (at least) 116m >>> See https://mininet-wifi.github.io/faq/#q7 for more information sta10-wlan0: the signal range should be changed to (at least) 116m >>> See https://mininet-wifi.github.io/faq/#q7 for more information sta11-wlan0: the signal range should be changed to (at least) 116m >>> See https://mininet-wifi.github.io/faq/#q7 for more information Traceback (most recent call last): File "/home/mani/Desktop/Comparison Papers_Final_May17/Comparison Papers/Provable/test_eror.py", line 86, in topology() File "/home/mani/Desktop/Comparison Papers_Final_May17/Comparison Papers/Provable/test_eror.py", line 30, in topology net.configureWifiNodes() File "/usr/local/lib/python3.10/dist-packages/mininet_wifi-2.6-py3.10.egg/mn_wifi/net.py", line 1380, in configureWifiNodes self.start_wmediumd() File "/usr/local/lib/python3.10/dist-packages/mininet_wifi-2.6-py3.10.egg/mn_wifi/net.py", line 1278, in start_wmediumd wmediumd(wlinks=self.wlinks, fading_cof=self.fading_cof, File "/usr/local/lib/python3.10/dist-packages/mininet_wifi-2.6-py3.10.egg/mn_wifi/link.py", line 1483, in init self.configWmediumd(kwargs) File "/usr/local/lib/python3.10/dist-packages/mininet_wifi-2.6-py3.10.egg/mn_wifi/link.py", line 1527, in configWmediumd self.interference(nodes) File "/usr/local/lib/python3.10/dist-packages/mininet_wifi-2.6-py3.10.egg/mn_wifi/link.py", line 1567, in interference self.positions.append(w_pos(intf.wmIface, [posX, posY, posZ])) AttributeError: 'managed' object has no attribute 'wmIface'**

ramonfontes commented 1 month ago

You have set a mobility model and static positioning in the same scenario. What do you actually want to do?

14vv1A0516 commented 1 month ago

Thank you for the reply. Sir, I want to move the vehicles from one point to another. That's it. What is the issue ? Can you please correct which line of code has the issue ? One more question is you mentioned that I set a mobility model and static positioning in the same scenario. In that case, the mobility or code works fine with 10 vehicles. Issue arises when I create 11th vehicle. May I know my mistake ?

14vv1A0516 commented 1 month ago

Sir, I corrected the issue. I actually gave same MAC address for both sta1 and sta11. So, the position is unclear in the code. I corrected the MAC addresses. It works fine now. Thank you so much Sir.