forked from intrig-unicamp/mininet-wifi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mobilityModel.py
executable file
·50 lines (37 loc) · 1.44 KB
/
mobilityModel.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/usr/bin/env python
'Setting the position of Nodes and providing mobility using mobility models'
import sys
from mininet.log import setLogLevel, info
from mn_wifi.cli import CLI
from mn_wifi.net import Mininet_wifi
def topology(args):
"Create a network."
net = Mininet_wifi()
info("*** Creating nodes\n")
net.addStation('sta1', mac='00:00:00:00:00:02', ip='10.0.0.2/8',
min_x=10, max_x=30, min_y=50, max_y=70, min_v=5, max_v=10)
net.addStation('sta2', mac='00:00:00:00:00:03', ip='10.0.0.3/8',
min_x=60, max_x=70, min_y=10, max_y=20, min_v=1, max_v=5)
if '-m' in args:
ap1 = net.addAccessPoint('ap1', wlans=2, ssid='ssid1,ssid2', mode='g',
channel='1', failMode="standalone",
position='50,50,0')
else:
ap1 = net.addAccessPoint('ap1', ssid='new-ssid', mode='g', channel='1',
failMode="standalone", position='50,50,0')
info("*** Configuring nodes\n")
net.configureNodes()
if '-p' not in args:
net.plotGraph()
net.setMobilityModel(time=0, model='RandomDirection',
max_x=100, max_y=100, seed=20)
info("*** Starting network\n")
net.build()
ap1.start([])
info("*** Running CLI\n")
CLI(net)
info("*** Stopping network\n")
net.stop()
if __name__ == '__main__':
setLogLevel('info')
topology(sys.argv)