intrig-unicamp / mininet-wifi

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

AttributeError: 'Host' object has no attribute 'lock' #324

Closed nomanmazhar closed 4 years ago

nomanmazhar commented 4 years ago

Hi All,

I am compiling simple topology and getting the same error again and again....

MN version is 2.5 Ubuntu 20.04

Please guide me.....

regards noman

star@star:~/mininet-wifi/examples$ sudo python Simple_N1.py Adding controller Add switches/APs Add hosts/stations Configuring Propagation Model Configuring wifi nodes Connecting to wmediumd server /var/run/wmediumd.sock Add links Starting network Starting controllers Starting switches/APs Post configure nodes Starting CLI: mininet-wifi> nodes available nodes are: ap1 c0 h1 h2 s1 sta1 sta2 mininet-wifi> h1 ping -c2 h2 PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data. 64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=19.1 ms 64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=13.7 ms

--- 10.0.0.2 ping statistics --- 2 packets transmitted, 2 received, 0% packet loss, time 1002ms rtt min/avg/max/mdev = 13.689/16.371/19.053/2.682 ms Traceback (most recent call last): File "Simple_N1.py", line 74, in myNetwork() File "Simple_N1.py", line 68, in myNetwork CLI(net) File "/usr/local/lib/python2.7/dist-packages/mininet_wifi-2.5-py2.7.egg/mn_wifi/cli.py", line 13, in init MN_CLI.init(self, mn_wifi, stdin=sys.stdin, script=None) File "build/bdist.linux-x86_64/egg/mininet/cli.py", line 70, in init File "build/bdist.linux-x86_64/egg/mininet/cli.py", line 105, in run File "/usr/lib/python2.7/cmd.py", line 142, in cmdloop stop = self.onecmd(line) File "/usr/lib/python2.7/cmd.py", line 220, in onecmd return self.default(line) File "build/bdist.linux-x86_64/egg/mininet/cli.py", line 425, in default File "/usr/local/lib/python2.7/dist-packages/mininet_wifi-2.5-py2.7.egg/mn_wifi/cli.py", line 48, in waitForNode node.lock.release() AttributeError: 'Host' object has no attribute 'lock'

ramonfontes commented 4 years ago

Can I see your code?

nomanmazhar commented 4 years ago

!/usr/bin/python

from mininet.node import RemoteController, OVSKernelSwitch, Host from mininet.log import setLogLevel, info from mn_wifi.net import Mininet_wifi from mn_wifi.node import Station, OVSKernelAP from mn_wifi.cli import CLI from mn_wifi.link import wmediumd from mn_wifi.wmediumdConnector import interference from subprocess import call

def myNetwork():

net = Mininet_wifi(topo=None,
                   build=False,
                   link=wmediumd,
                   wmediumd_mode=interference,
                   ipBase='10.0.0.0/8')

info( '*** Adding controller\n' )
c0 = net.addController(name='c0',
                       controller=RemoteController,
                       ip='127.0.0.1',
                       protocol='tcp',
                       port=6653)

info( '*** Add switches/APs\n')
s1 = net.addSwitch('s1', cls=OVSKernelSwitch, protocols=["OpenFlow14"])
ap1 = net.addAccessPoint('ap1', cls=OVSKernelAP, ssid='ap1-ssid',
                         channel='1', mode='g', position='259.0,182.0,0')

info( '*** Add hosts/stations\n')
h2 = net.addHost('h2', cls=Host, ip='10.0.0.2', defaultRoute=None)
h1 = net.addHost('h1', cls=Host, ip='10.0.0.1', defaultRoute=None)
sta1 = net.addStation('sta1', ip='10.0.0.3',
                       position='124.0,302.0,0')
sta2 = net.addStation('sta2', ip='10.0.0.4',
                       position='298.0,312.0,0')

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

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

info( '*** Add links\n')
net.addLink(sta1, ap1)
net.addLink(sta2, ap1)
net.addLink(s1, ap1)
net.addLink(h1, s1)
net.addLink(h2, s1)

net.plotGraph(max_x=1000, max_y=1000)

info( '*** Starting network\n')
net.build()
info( '*** Starting controllers\n')
for controller in net.controllers:
    controller.start()

info( '*** Starting switches/APs\n')
net.get('s1').start([c0])
net.get('ap1').start([])

info( '*** Post configure nodes\n')

CLI(net)
net.stop()

if name == 'main': setLogLevel( 'info' ) myNetwork()

ramonfontes commented 4 years ago

Fixed https://github.com/intrig-unicamp/mininet-wifi/commit/89e0cd376bdfecfdf0daf1f0821b678be995345b.

Please do a git pull and then recompile the code with sudo make install

nomanmazhar commented 4 years ago

Great

Thanks it worked