forked from intrig-unicamp/mininet-wifi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mobilityModel.py
executable file
·43 lines (30 loc) · 1.19 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
#!/usr/bin/python
'Setting the position of Nodes and providing mobility using mobility models'
from mininet.log import setLogLevel, info
from mn_wifi.cli import CLI_wifi
from mn_wifi.net import Mininet_wifi
def topology():
"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)
ap1 = net.addAccessPoint('ap1', ssid='new-ssid', mode='g', channel='1',
failMode="standalone", position='50,50,0')
info("*** Configuring wifi nodes\n")
net.configureWifiNodes()
net.plotGraph(max_x=300, max_y=300)
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_wifi(net)
info("*** Stopping network\n")
net.stop()
if __name__ == '__main__':
setLogLevel('info')
topology()