When I run the since file on the sumo gui it works perfectly but when I try to run it with my py code the sumo gui freezes at 2 seconds which is when the dirt vehicle spawns. So I’m wondering if anyone can give me guidance to what is wrong with my code. I’m trying to make 2 codes one with and without a controller but for my first I’m trying it without a controller. Here is my code:#!/usr/bin/env python3
from mininet.log import setLogLevel, info
from mn_wifi.cli import CLI
from mn_wifi.net import Mininet_wifi
from mn_wifi.sumo.runner import sumo
from mn_wifi.link import wmediumd
from mn_wifi.wmediumdConnector import interference
from mn_wifi.telemetry import telemetry
from mininet.node import Controller
import os
os.environ['SUMO_HOME'] = '/home/vboxuser/.local/share/eclipse-sumo-1.25.0'
os.environ['PATH'] += os.pathsep + os.path.join(os.environ['SUMO_HOME'], 'bin')
def topology():
# NO ITSLink - this causes the freeze
net = Mininet_wifi(link=wmediumd, wmediumd_mode=interference)
print("*** Adding nodes...")
# EXACTLY 14 vehicles matching routes.rou.xml
for x in range(0,12):
net.addCar('car%s' % (x+1), wlans=2, encrypt=['wpa2', ''])
police = net.addCar('police', wlans=2, encrypt=['wpa2', ''])
ambulance = net.addCar('ambulance', wlans=2, encrypt=['wpa2', ''])
# APs
kwargs = {'ssid': 'roadside-ssid', 'mode': 'g', 'encrypt': 'wpa2',
'failMode': 'standalone', 'datapath': 'user'}
ap1 = net.addAccessPoint('ap1', channel='1', position='900,830,0', **kwargs)
ap2 = net.addAccessPoint('ap2', channel='6', position='2000,100,0', **kwargs)
ap3 = net.addAccessPoint('ap3', channel='11', position='750,1400,0', **kwargs)
ap4 = net.addAccessPoint('ap4', channel='1', position='705,265,0', **kwargs)
ap5 = net.addAccessPoint('ap5', channel='6', position='1635,1265,0', **kwargs)
server = net.addHost('server', ip='10.0.0.100/24')
c0 = net.addController('c0', controller=Controller)
net.setPropagationModel(model="logDistance", exp=2.8)
net.configureWifiNodes()
# Backbone
net.addLink(ap1, c0); net.addLink(ap1, ap2); net.addLink(ap1, ap3)
net.addLink(ap1, ap4); net.addLink(ap1, ap5); net.addLink(ap1, server)
# CRITICAL: Build FIRST
print("*** Building network")
net.build()
# Start APs
for ap in net.aps:
ap.start([])
# Start SUMO with MINIMAL params
print("*** Starting SUMO...")
net.useExternalProgram(
program=sumo,
port=8813,
config_file='ksuroadtest.sumocfg',
extra_params=["--start", "--no-step-log", "--no-warnings"],
clients=1
)
# IPs - NO ITSLink
print("*** Configuring IPs...")
for i, car in enumerate(net.cars):
car.setIP(f'10.0.0.{i+1}/24', intf=car.wintfs[0].name)
car.setIP(f'10.0.1.{i+1}/24', intf=car.wintfs[1].name)
print(f" {car.name}: wlan0=10.0.0.{i+1}")
# Telemetry
nodes = net.cars + net.aps
telemetry(nodes=nodes, data_type='position', min_x=-1200, min_y=-1000, max_x=3000, max_y=2500)
print("*** CLI ready")
CLI(net)
net.stop()
if __name__ == '__main__':
setLogLevel('info')
topology()--
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/d213d4fc-f338-4241-b644-59190cf011c6n%40googlegroups.com.