whitefield-framework / whitefield

Whitefield provides a simulation environment for wireless sensor networks by combining RF simulation provided by NS3 and network stack provided by popular IoT OSes such as Contiki/RIOT/OpenThread.
GNU General Public License v2.0
82 stars 23 forks source link

Multiple BR/udp-servers in parallel #95

Closed nyrahul closed 3 years ago

nyrahul commented 4 years ago

A deployment may have multiple BRs, thus the tooling needs to consider this. monitor.sh is already changed to handle an argument which takes as an input br-nodeid and shows connectivity in context to it.

nyrahul commented 4 years ago

@philok93 The problem with plot-network seems to be contiki-ng specific. Plot-network works by using cmd_def_route from contiki-ng.

Currently, the default route returned by contiki-ng seems to be incorrect. image

I use this API in contiki and contiki-ng to query the default route. For contiki-ng this doesn't seem to work! image

Do you know which is the right API for contiki-ng?

philok93 commented 4 years ago

I found that you can use uip_ds6_defrt_lookup(uip_ds6_defrt_choose()) to return the default route ip address. Check this shell commands: https://github.com/contiki-ng/contiki-ng/blob/develop/os/services/shell/shell-commands.c#L632

Here the change:

int cmd_def_route(uint16_t id, char *buf, int buflen)
{
    const uip_ds6_defrt_t *route = uip_ds6_defrt_lookup(uip_ds6_defrt_choose());
    return uiplib_ipaddr_snprint(buf, buflen, &route->ipaddr);
}

I tried it and I notice that at start when network is not formed, the routes all show to node 1:

wfsh# cmd_def_route
sl_cmd "0:cmd_def_route"
fd00::1

sl_cmd "1:cmd_def_route"
fd00::1

sl_cmd "2:cmd_def_route"
fd00::1

sl_cmd "3:cmd_def_route"
fd00::1

sl_cmd "4:cmd_def_route"
fd00::1

sl_cmd "5:cmd_def_route"
fd00::1

sl_cmd "6:cmd_def_route"
fd00::1

sl_cmd "7:cmd_def_route"
fd00::1

Then, it is correct:

wfsh# cmd_def_route
sl_cmd "0:cmd_def_route"
fd00::1

sl_cmd "1:cmd_def_route"
fd00::1

sl_cmd "2:cmd_def_route"
fe80::302:304:506:1

sl_cmd "3:cmd_def_route"
fe80::302:304:506:0

sl_cmd "4:cmd_def_route"
fe80::302:304:506:0

sl_cmd "5:cmd_def_route"
fe80::302:304:506:0

sl_cmd "6:cmd_def_route"
fe80::302:304:506:0

sl_cmd "7:cmd_def_route"
fe80::302:304:506:0

But plotting network still showing mess graph. It should recognise that a valid IPv6 starts with fe80 and not with fd00. So that's why servers have always fd00 default route.

nyrahul commented 4 years ago

It was never expected that a stackline will report a global IP prefix in default route. Contiki-ng should fix this.

Whitefield did not take into account network prefix while plotting graphs. Now it does. Also, nodes who are not connected will show up in the plots. @philok93, this should work for you.

philok93 commented 4 years ago

Yeah thanks a lot! Now works perfectly! :) If you can guide me how to make the graph (position based network graph ) a bit better tell me. I try to plot it but nodes overlap and need some space between them.

nyrahul commented 4 years ago

Added a way to scale the position based graph.

Usage: ./scripts/wfshell plot_network_graph tree.png pos.png scale=20 Note the scale=20 parameter scaling the pos.png by 20x. scale= parameter is applicable only for position based graph.

Appreciate your offer for help but it was a small change in external scripts and hence decided to do it myself. Looking forward to any contribs while you do your experiments.

Hope it helps and thanks for constant feedback.

philok93 commented 4 years ago

Thanks a lot for your improvement! I will try it and give you my feedback. It should work now. I needed plotting the topology it to check how far each node is deployed from server because in random topology sometimes nodes don't connect and I believe that are far away. I really appreciate your help and in my future works I will reference you.

philok93 commented 4 years ago

I tried and this is the output with 22 nodes and scale=500:

p11

Is the x,y location of the nodes the real one coming from NS3? After executing the whitefield with random topology and scale=200 I got: p11

So does this mean the position of nodes is fixed? I notice that if I deploy 20 nodes for example with 2 servers, the 1 server is not in RX range of the nodes and no network if formed. That's why in the above figures you see no arrows in some nodes.

nyrahul commented 4 years ago

This looks like grid topology, certainly does not look random. Can you share your config wf.cfg? x,y location is the real location coming from ns3.

philok93 commented 4 years ago

This looks like grid topology, certainly does not look random. Can you share your config wf.cfg? x,y location is the real location coming from ns3.

Yes you are right, sorry my mistake I didn't change to randrect. I think plotting now works fine!

nyrahul commented 3 years ago

Handled.