Closed nomanmazhar closed 2 years ago
Did you compile the code with the same Python version (sudo make install
)?
Yes i have compiled using python3 Also i am using UBUNTU 20.04LTS the wifi container net successfully install but when i compile my topology it gave following error
INFO:main:Adding controller
INFO:main:Adding docker containers
INFO:main:Adding switches
INFO:main:Creating links
Traceback (most recent call last):
File "nomanTopo.py", line 278, in
example topology
""" This is the most simple example to showcase Containernet. """ from containernet.cli import CLI from containernet.link import TCLink from containernet.net import Containernet from mininet.node import Controller from mininet.log import info, setLogLevel
setLogLevel('info')
net = Containernet(controller=Controller)
info(' Adding controller\n') net.addController('c0') info(' Adding docker containers\n') d1 = net.addDocker('d1', ip='10.0.0.251', dimage="ubuntu:trusty") d2 = net.addDocker('d2', ip='10.0.0.252', dimage="ubuntu:trusty") info(' Adding switches\n') s1 = net.addSwitch('s1') s2 = net.addSwitch('s2') info(' Creating links\n') net.addLink(d1, s1) net.addLink(s1, s2, cls=TCLink, delay='100ms', bw=1) net.addLink(s2, d2) info(' Starting network\n') net.start() info(' Testing connectivity\n') net.ping([d1, d2]) info(' Running CLI\n') CLI(net) info(' Stopping network') net.stop()
this example topology produce same error
i have compile the containernet using "sudo make install"
please let me know how to compile the code .....
what command i need to use
Also the containernet-wifi is running perfectly fine
only getting erro in containernet_example.py
I didn't check the other sample files. I can only confirm the wifi example.
In Containernet_wifi if i try to add link it gave error
*** Adding docker containers
sta1: kwargs {'ip': '10.0.0.3', 'ip6': '2001:0:0:0:0:0:0:1/64', 'channel': 1, 'freq': 2.4, 'band': 20, 'mode': 'g', 'mac': '00:02:00:00:00:10', 'cpu_shares': 20}
sta1: update resources {'cpu_quota': -1, 'cpu_shares': 20}
sta2: kwargs {'ip': '10.0.0.4', 'ip6': '2001:0:0:0:0:0:0:2/64', 'channel': 1, 'freq': 2.4, 'band': 20, 'mode': 'g', 'mac': '00:02:00:00:00:11', 'cpu_shares': 20}
sta2: update resources {'cpu_quota': -1, 'cpu_shares': 20}
Traceback (most recent call last):
File "containernet_wifi.py", line 47, in
this is the topology i try to run
""" This is the most simple example to showcase Containernet. """ from containernet.net import Containernet from containernet.node import DockerSta from containernet.cli import CLI from containernet.term import makeTerm from mininet.log import info, setLogLevel
def topology(): net = Containernet()
info('*** Adding docker containers\n')
sta1 = net.addStation('sta1', ip='10.0.0.3', mac='00:02:00:00:00:10',
cls=DockerSta, dimage="ubuntu:trusty", cpu_shares=20)
sta2 = net.addStation('sta2', ip='10.0.0.4', mac='00:02:00:00:00:11',
cls=DockerSta, dimage="ubuntu:trusty", cpu_shares=20)
ap1 = net.addAccessPoint('ap1')
c0 = net.addController('c0')
net.addLink(sta1, ap1)
net.addLink(sta2, ap1)
info('*** Configuring WiFi nodes\n')
net.configureWifiNodes()
info('*** Starting network\n')
net.build()
ap1.start([c0])
makeTerm(sta1, cmd="bash -c 'apt-get update && apt-get install iw;'")
makeTerm(sta2, cmd="bash -c 'apt-get update && apt-get install iw;'")
#sta1.cmd('iw dev sta1-wlan0 connect new-ssid')
#sta2.cmd('iw dev sta2-wlan0 connect new-ssid')
info('*** Running CLI\n')
CLI(net)
info('*** Stopping network\n')
net.stop()
if name == 'main': setLogLevel('info') topology()
thanks a lot for your great support
Yes now every thing works perfect....
Best Regards Noman
Hi,
1:- I am using containernet from "https://github.com/containernet/containernet"
2:- But for wifi i install containernet from "https://github.com/ramonfontes/containernet.git"
the topology made in first containernet does not work in the second containernet.
Both uses different version of python.
please guide me how can i run topology made in python3 to run in wifi based container.
thanks
regards noman