Skip to content

Commit

Permalink
mobility: add sensors
Browse files Browse the repository at this point in the history
  • Loading branch information
ramonfontes committed Jun 26, 2020
1 parent 8084cba commit d209d80
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 25 deletions.
2 changes: 1 addition & 1 deletion mn_wifi/net.py
Expand Up @@ -1017,7 +1017,7 @@ def mobility(self, *args, **kwargs):
def get_mob_stat_nodes(self):
mob_nodes = []
stat_nodes = []
nodes = self.stations + self.aps + self.cars
nodes = self.stations + self.aps + self.cars + self.sensors + self.apsensors
for node in nodes:
if hasattr(node, 'position') and 'initPos' not in node.params:
stat_nodes.append(node)
Expand Down
40 changes: 40 additions & 0 deletions position.py
@@ -0,0 +1,40 @@
#!/usr/bin/python

from mininet.log import setLogLevel, info
from mn_wifi.cli import CLI
from mn_wifi.net import Mininet_wifi


def topology():
"Create a network."
net = Mininet_wifi(iot_module='mac802154_hwsim')
# iot_module: fakelb or mac802154_hwsim
# mac802154_hwsim is only supported from kernel 4.18

info("*** Creating nodes\n")
sensor1 = net.addSensor('sensor1', ip6='2001::1/64', panid='0xbeef')
sensor2 = net.addSensor('sensor2', ip6='2001::2/64', panid='0xbeef')
sensor3 = net.addSensor('sensor3', ip6='2001::3/64', panid='0xbeef', position='10,150,0')



info("*** Configuring 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()

info("*** Running CLI\n")
CLI(net)

info("*** Stopping network\n")
net.stop()


if __name__ == '__main__':
setLogLevel('info')
topology()
8 changes: 0 additions & 8 deletions rssi-sta1-mn-telemetry.txt

This file was deleted.

8 changes: 0 additions & 8 deletions rssi-sta2-mn-telemetry.txt

This file was deleted.

8 changes: 0 additions & 8 deletions rssi-sta3-mn-telemetry.txt

This file was deleted.

0 comments on commit d209d80

Please sign in to comment.