[Help] Update station positions from SUMO into Mininet-WiFi

13 views
Skip to first unread message

ELENA VENTURA

unread,
Sep 28, 2025, 8:02:36 PMSep 28
to mininet-wifi-discuss

Hi everyone,

I am working with Mininet-WiFi integrated with SUMO, and I would like to clarify how to correctly update the positions of stations.

What I need is quite simple: if my stations (e.g., sta1, sta2) move in SUMO according to the mobility defined in the .rou.xml and .net.xml files, I want their positions to be automatically updated in Mininet-WiFi  

Here is what I did:

  • I configured a SUMO GUI simulation with 4 stations moving along a straight road (defined in road.sumocfg). 

  • I launched Mininet-WiFi with the following script (simplified example below).

  •  The SUMO GUI works fine and I can clearly see the stations moving but then I tried to check the stations’ positions from the Mininet CLI using sta1 position, but the position did not seem to update at all. In fact, the CLI sometimes tells me the position is not even defined.

 This is the script I used:  

#!/usr/bin/env python3

from mn_wifi.sumo.runner import sumo
from mn_wifi.net import Mininet_wifi
from mn_wifi.node import OVSKernelAP
from mn_wifi.cli import CLI
from mininet.node import RemoteController

def topology():
    net = Mininet_wifi(controller=RemoteController, accessPoint=OVSKernelAP)

    print("*** Adding Ryu controller")
    c0 = net.addController('c0', controller=RemoteController,
                           ip='127.0.0.1', port=6633)

    print("*** Adding nodes")
    ap1 = net.addAccessPoint('ap1', ssid='new-ssid', mode='ac', channel='36',
                             position='50,0,0', range=40)

    sta1 = net.addStation('sta1', ip='10.0.0.1/8')
    sta2 = net.addStation('sta2', ip='10.0.0.2/8')
    sta3 = net.addStation('sta3', ip='10.0.0.3/8')
    sta4 = net.addStation('sta4', ip='10.0.0.4/8')

    h1 = net.addHost('h1', ip='10.0.0.100/8')

    net.setPropagationModel(model="logDistance", exp=4.5)
    net.configureWifiNodes()
    net.addLink(ap1, h1)

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

    # Start SUMO (moves the stations according to road.sumocfg)
    print("*** Starting SUMO simulation")
    net.useExternalProgram(sumo, config_file='examples/CR_GRSIM/road.sumocfg')

    # CLI interactive
    print("*** Starting CLI (type exit to quit)")
    CLI(net)

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

if __name__ == '__main__':
    topology()

My question is:
Am I missing some step to correctly synchronize SUMO mobility with the Mininet-WiFi stations’ positions?
Do I need to explicitly match the station IDs in Mininet with the vehicle IDs in SUMO, or use clients=2 when launching SUMO?

Any minimal working example (e.g., 2 stations moving along a road and their positions updating in Mininet CLI) would be very helpful.

Thank you very much for your support!
Elena


Ramon Fontes

unread,
Sep 28, 2025, 8:05:29 PMSep 28
to ELENA VENTURA, mininet-wifi-discuss

--
You received this message because you are subscribed to the Google Groups "mininet-wifi-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mininet-wifi-dis...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/mininet-wifi-discuss/6feeadb1-e015-4f9c-97d6-4e4ffaa6aaabn%40googlegroups.com.

ELENA VENTURA

unread,
Oct 1, 2025, 8:11:05 AMOct 1
to mininet-wifi-discuss

Good morning,

I tried running the example you suggested, and it helped me a lot to develop my solution! 

My goal was to implement a specific topology with moving stations that automatically associate and disassociate from the AP depending on whether they are inside or outside the AP’s coverage range.

I replaced the default map.sumocfg file in runner.py, so that the positions of my stations (cars) are tracked based on a simpler road network (a straight 100m line) crossing the AP’s coverage area.

I ran some experiments with ping to check how the stations would associate and disassociate depending on their position. However, I found that only entering the AP’s range worked correctly (the station associates). When the station leaves the coverage area, I get an error, and the AP still allows communication even though the station has already left its range.


BEFORE CROSSING THE RANGE

64 bytes from 10.0.0.10: icmp_seq=66 ttl=64 time=0.717 ms

64 bytes from 10.0.0.10: icmp_seq=67 ttl=64 time=0.841 ms

...

64 bytes from 10.0.0.10: icmp_seq=70 ttl=64 time=0.757 ms


WHILE CROSSING THE RANGE: Here is the error I get when the station goes out of range:

Exception in thread wifiParameters:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/local/lib/python3.8/dist-packages/mn_wifi/mobility.py", line 175, in parameters
    self.config_links(mob_nodes)
  File "/usr/local/lib/python3.8/dist-packages/mn_wifi/mobility.py", line 197, in config_links
    ack = self.associate_interference_mode(intf, ap_intf)
  File "/usr/local/lib/python3.8/dist-packages/mn_wifi/mobility.py", line 184, in associate_interference_mode
    return self.check_in_range(intf, ap_intf)
  File "/usr/local/lib/python3.8/dist-packages/mn_wifi/mobility.py", line 143, in check_in_range
    self.ap_out_of_range(intf, ap_intf)
  File "/usr/local/lib/python3.8/dist-packages/mn_wifi/mobility.py", line 109, in ap_out_of_range
    intf.disconnect(ap_intf)
  File "/usr/local/lib/python3.8/dist-packages/mn_wifi/link.py", line 522, in disconnect
    self.iwdev_cmd('{} disconnect'.format(self.name))
  File "/usr/local/lib/python3.8/dist-packages/mn_wifi/link.py", line 117, in iwdev_cmd
    return self.cmd('iw dev', *args)
  File "/usr/local/lib/python3.8/dist-packages/mininet/node.py", line 386, in cmd
    self.sendCmd( *args, **kwargs )
  File "/usr/local/lib/python3.8/dist-packages/mininet/node.py", line 303, in sendCmd
    assert self.shell and not self.waiting
AssertionError

AFTER CROSSING THE RANGE:

64 bytes from 10.0.0.10: icmp_seq=71 ttl=64 time=0.773 ms

64 bytes from 10.0.0.10: icmp_seq=72 ttl=64 time=0.759 ms


So in short:

  • Association works fine when the station enters the AP range.

  • Disassociation when leaving the range fails with the above AssertionError.

  • After that, the AP still lets the station communicate, even though it should no longer be in range.

My question is: has anyone faced this issue before, and how can I properly fix it? Should I modify the ap_out_of_range function in mobility.py to handle the disconnection differently?

If so, what would be the correct approach?

Thank you for helping me, 

Elena 

Ramon Fontes

unread,
Oct 1, 2025, 9:01:19 AMOct 1
to ELENA VENTURA, mininet-wifi-discuss
Hi Elena,

I wasn’t able to reproduce this behavior. Are you running it in a VM?
If so, could you try increasing the number of allocated cores?

Em qua., 1 de out. de 2025 às 09:11, ELENA VENTURA
<eleve...@gmail.com> escreveu:
> To view this discussion visit https://groups.google.com/d/msgid/mininet-wifi-discuss/a563d9f4-37be-4f6b-aaf6-a1e707030176n%40googlegroups.com.

ELENA VENTURA

unread,
Oct 1, 2025, 10:23:29 AMOct 1
to mininet-wifi-discuss
No I’m not running it on a VM.
Maybe I didn’t explain myself clearly the first time, so I’ll try to show you step by step what I did.  

I created a very simple topology where cars move along a 100m straight road in SUMO and associate/disassociate with one AP depending on coverage.

Here is the code I’m using:

#!/usr/bin/env python3

import sys
sys.path.insert(0, "/home/<my-username>/Progetti/mininet-wifi/mininet-wifi/mn_wifi/sumo")

from mininet.log import setLogLevel, info


from mn_wifi.cli import CLI
from mn_wifi.net import Mininet_wifi
from mn_wifi.node import OVSKernelAP

from mininet.node import RemoteController

from runner import sumo
from mn_wifi.link import wmediumd, ITSLink
from mn_wifi.wmediumdConnector import interference
from mn_wifi.wmediumdConnector import error_prob

def topology():
    "Create a network with Ryu + SUMO cars"
    net = Mininet_wifi(controller=RemoteController,
                       accessPoint=OVSKernelAP,link=wmediumd, wmediumd_mode=interference)

    info("*** Adding Ryu controller\n")


    c0 = net.addController('c0', controller=RemoteController,
                           ip='127.0.0.1', port=6633)

    info("*** Creating nodes\n")
    # Access Point connesso al controller


    ap1 = net.addAccessPoint('ap1', ssid='new-ssid', mode='ac', channel='36',

                             position='50,20,0', range=40)

    # Host 
    h1 = net.addHost('h1', ip='10.0.0.10/8')

    # 4 cars controlled by sumo
    for id in range(0, 4):
        net.addCar('car%s' % (id+1), wlans=1, mode='ac')  # wlans=1 basta

    info("*** Configuring Propagation Model\n")
    net.setPropagationModel(model="logDistance", exp=2.8)
    net.configureNodes()

    info("*** Creating links\n")
    net.addLink(ap1, h1)
    """
    for car in net.cars:
        net.addLink(car, intf=car.wintfs[0].name,
                    cls=ITSLink, band=20, channel=181)

    """

    info("*** Starting SUMO\n")
    net.useExternalProgram(program=sumo, port=8813,
                           extra_params=["--start --delay 1000"],
                           clients=1, exec_order=0)

    info("*** Starting network\n")


    net.build()
    c0.start()
    ap1.start([c0])

    # dinamic IP for cars
    for id, car in enumerate(net.cars):
        car.setIP('10.0.0.{}/8'.format(id+1),
                  intf=car.wintfs[0].name)

    
    net.telemetry(nodes=net.cars + [ap1], data_type='position',
                  min_x=0, min_y=0, max_x=100, max_y=40)

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


    net.stop()


if __name__ == '__main__':

    setLogLevel('info')
    topology()


then i create a simple sumo map with a 100m street. I have attached some pictures that describe exactly how my test network works: one AP with a certain coverage range, and cars (stations) moving across it.

I ran two experiments:

Test 1 – Entering the AP range

  • I checked that a station which is still outside the AP range cannot communicate through it.

  • As soon as the station moves inside the AP coverage, it successfully associates and can reach the host via the AP.
    This works correctly ( in the second image you can see that from "Destination Host Unreachable" it start sending package as the station enters in the range ) 

Test 2 – Leaving the AP range

  • I checked that a station which leaves the AP range should automatically disconnect and lose connectivity to the host.

  • However, this does not happen: instead, I get the previous error with that strange behaviour

I think my implementation may have a problem with the ap_out_of_range function in mobility.py.
I was wondering if maybe I could modify it or adapt it in some way to properly handle the disconnection when a station leaves the AP range  

Thank you, 
Elena 
how_my_topology_withsumoworks.png
test1_car_connection_after_entering_in_ap_range.png

Ramon Fontes

unread,
Oct 1, 2025, 10:26:46 AMOct 1
to ELENA VENTURA, mininet-wifi-discuss
Does the error still occur if you open a terminal for the node using
xterm and run a ping from there?

ELENA VENTURA

unread,
Oct 1, 2025, 10:37:21 AMOct 1
to mininet-wifi-discuss
  I’ll try, thank you for the advice! I’ll let you know how it goes  

ELENA VENTURA

unread,
Oct 1, 2025, 11:26:24 AMOct 1
to mininet-wifi-discuss

Hi,
I tried your suggestion with xterm and it worked! 

So the issue was exactly what you suspected: when I was running the ping directly from the Mininet CLI, the node’s shell was already busy. Since the disconnect function is not asynchronous, Mininet couldn’t send the command and raised the AssertionError.

Running the ping inside an xterm kept the Mininet shell free, and now the disconnect works correctly when the station leaves the AP range.

Thanks a lot for the advice, it really clarified what was going on! 

Reply all
Reply to author
Forward
0 new messages