UnetStack - Routing Protocols - unetstack

How to deploy a testbed to experiment routing protocols for UnetStack acoustic modems communication in an underwater network?
Which modem (model) is more suitable for this experiment?

Answer to Q1
The default stack when you boot up a Unet simulator or a modem with UnetStack support has two agents that relate to routing protocols.
The router agent (org.arl.unet.net.Router) does packet routing based on its routing tables. The routes, addroute, delroute, delroutesto and delroutes closures allow you to manually modify the routing tables. Just type help router in the Unet shell to get more information:
> help router
router - access to routing agent
Examples:
routes // display routing table
routes 2 // display routes to node 2
addroute 27, 29 // add a route to node 27 via node 29
delroute 2 // delete route number 2
delroutesto 27 // delete all routes to node 27
delroutes // delete all routes
Parameters:
MTU - maximum data transfer size
auto1hop - automatically assume single hop routes
link - default link to use
routes - routing table (read-only)
The rdp agent (org.arl.unet.net.RouteDiscoveryProtocol) populates the routing table for the router agent. The rreq and trace closures allow you to interact with this agent. Type help rdp for more information:
> help rdp
rdp - access to route discovery protocol agent
Examples:
rreq 27 // start route discovery to node 27
rreq 27, 3, 2, 10 // find <3-hop route to node 27 with 2 RREQs 10s apart
trace 27 // trace current route to node 27
If you want to implement your own routing protocol, the easiest option is to create your own agent that populates the routing table for router. This is done by sending RouteDiscoveryNtf messages to the router agent. For many routing protocols, this is sufficient, and easy to do.
If your routing protocol is more complicated and cannot be implemented by changing routing tables dynamically, you can remove the default router agent (from etc/setup.groovy file) and add your own routing agent implementation instead. Your routing agent must support the Routing service: A routing agent essentially accepts datagrams for any destination and sends them on the next hop. The agent also listens to datagram notifications from the Link agent, and forwards them on the next hop, if they are meant to be packets to be routed. Typically, a routing agent will have to add its own headers to know which packets are to be routed and to where, based on the protocol being implemented.
Answer to Q2
Any modem that supports UnetStack should work. Here's a list of known modems that currently support UnetStack.

Related

Apache camel IMAP multiple consumers of same mail account

I have application which allows dynamic creation and starting of routes. For example user can create route from IMAP to file and start it.
Problem: Multiple routes reading from same mail account through IMAP.
Caused by: org.apache.camel.FailedToStartRouteException: Failed to start route c1152_route because of Multiple consumers for the same endpoint is not allowed: imap://localhost:3143?delay=1000&password=xxxxxx&searchTerm.fromSentDate=now-24h&searchTerm.unseen=false&username=user#user
I've tried two approaches:
1.Creating additional single route from IMAP to multiple recipient routes. This one works but I'm not sure about this solution. It requires additional checks on starting/stopping of route because few routes might be dependent on this one.
from(imap())
.recipientList(imapMsgToDirectChannelRouter())
2.Creating IMAP endpoints with unique uri. For example unique searchTerm.fromSentDate for each routes. This one also works.
Is there any better solution to this problem?
I would definitely go for option#1 (recipientList).
I do not understand why would have to stop & start the 'master' route (the "imap" one).
Depending on the recipients you add or remove, you would start and stop the corresponding child routes, but not touch the master one.
I'm thinking on something like this:
from("imap:...")
.id("master-route")
.recipientList( simple("bean:computeRecipients") )
.parallelProcessing();
Where the on-the-fly calculation of the exact list of recipients is delegated to some bean.
This way, you do not have to touch the "master-route", instead just make the bean aware of the recipients

Setting up zigbee network with X-CTU 6.3.2

I'm trying to create Zigbee P2P using XB24C27WIT-004 modules with Digi USB explorers(CP2102). I am using 2 laptops and connected the XBee modules to each of them. I have added the modules to X-CTUs and changed the DL of one module as MY of another module and vice versa. Both are on same channel and same PAN ID. But i couldn't see the serially transmitted data from one console to another. The console window is as shown in the image. The commands are being seen when i'm trying to discover other radio.The console window. The function is set to ZIGBEE TH Reg for both modules.
Have you configured one as a coordinator (ATCE=1) and the other as a router (ATCE=0) so they can join to each other? The Router can keep ATDH and ATDL as 0 to target the coordinator. I'm not familiar with using the 16-bit network address for the destination, so I'd recommend setting ATDH to the router's ATSH, and ATDL to ATSL.
To confirm that the devices are joined to each other, their operating PAN ID (ATOI and ATOP) must match. Once you see that, see if the router can send data to the coordinator, and then from the coordinator to the router. You can use ATNR on the router to perform a Network Reset so it will try to re-join your coordinator. You might need to set ATNJ to 0xFF on the coordinator to allow joining.

Monitoring if camel routes work as aspected

I'm looking for a best practise how to monitor the functionality of camel routes.
I know there are monitoring tools like hawtio and camelwatch, but that's not exactly what I'm looking for.
I want to know if a route is "working" as aspected, for example you have a route which listens on a queue(from("jms...")). Maybe there are messages in the queue, but the listener is not able to dequeue them because of some db issues or something else(depends on the jms provider). With the monitoring tools mentioned above you just see inflight/failed/completed messages but you don't see if the listener is able to get the messages -> so the route is not "working".
I know there is also apache BAM, maybe I have to do some more research, but somehow it looks like BAM creates new routes and you can't monitor existing routes. I also don't want to implement/define such business cases for each route, I look for a more generic way. It's also mentioned on the camel 3.0 idea board that BAM wasn't touched for 5 years, so I think people don't use it that often(which means for me it doesn't fit their needs exactly).
I had similar requirement some time ago and at the end I developed a small Camel application for monitoring.
It run on timer, query different Camel applications installed in remote servers through JMX/Jolokia and if LastExchangeCompletedTimestamp of the route I am interested in is older than some time interval, send a mail to administrators.
Maybe this approach is too simple for your scenario, but could be an option.
(Edit: more details added)
Principal points:
Main routes queries DB for entities to control and spawns controlling routes
Controlling routes fires on quartz and http post the following url
.to("http://server:port/app/jolokia/?"+
"maxDepth=7&maxCollectionSize=500&ignoreErrors=true&canonicalNaming=false")
sending the following jsonRequest body
LinkedHashMap<String,Object> request=new LinkedHashMap<String,Object>();
request.put("type","read");
request.put("mbean","org.apache.camel:"+entity.getRouteId());
jsonRequest=mapper.writeValueAsString(request);
As response you get another JSON, parse it and get LastExchangeCompletedTimestamp value

How to configure reverse proxy/loadbalancer for custom routing

Suppose I have 3 webservers behind a reverse proxy/loadbalancer. Currently I use Apache 2 but don't mind switching.
Those webservers are not equal. They have different sets of local data meaning that different kinds of requests will be handled more efficiently on specific webserver.
I want to plug some custom routing logic into my loadbalancer, that would on start of a new session select a webserver for it, then tie that session to that node until it breaks down (sticky session).
For example: a new user comes to the webapp, load balancer runs my custom code somehow, this code finds out information about that user and makes a conclusion that this user should be handled on node1. The balancer proxies that user to node1 and sticks it to it. When another user comes, custom routing logic suggests node3, to which loadbalancer then proxies this user.
Is it possible to do with Apache 2? If not, what proxy/loadbalancer would give me that ability?
Thank you.
Apache mode_proxy_balancer has stickyness if you want to stay on apache.
Otherwise, have a look at Haproxy. The first line of the abstract states: "route HTTP requests depending on statically assigned cookies ;"
You just have to set a cookie to know which backend you want the user to be stuck to.

Apache Sticky sessions

I have configured a sticky session set up with a load balancer (Apache) and three app nodes running Jboss 4.2.2 .
the load balancer uses mod_jk and settings as mentioned in the tutorial here.
http://community.jboss.org/wiki/UsingModjk12WithJBoss;jsessionid=1569CBFB7C3096C59C977CD3F7159A32
I have the jumRoute set as node1 ,node2 and node3 for the three nodes and my workerlist property for load balancer is set as
node1,node2,node3
The tutorial has been followed till the last point but I did not configure the useJK parameters under.the value is still set to false.
The sticky sessions are holding up but I seem to loose session and get this error in my mod_jk log file
[error] ajp_get_reply::jk_ajp_common.c (1926): (node1) Timeout with waiting reply from tomcat. Tomcat is down, stopped or network problems (errno=110)
I personally checked the user logged in on node1 and then moved to node2.
Does Apache redirect to another node when it fails to get reply from node1, How does useJk help in this situation.
---edit 01---
I changed the UseJK value to true but still few users still experience sudden log out which I know due to change in the server node catering the users request.
I also wanted to know whether traffic on the nodes has any affect on sticky session and how to counter it.( I am experiencing high load on all the servers for a few days)
----edit 02 ----
I would also like to know about controlling the number of connections per worker.
controlling the number of ajp connector/connections.
relation between the number of connections of apache load balancer and number of
ajp connections in JBoss worker nodes.
what would be the best configuration between Apache 2.2.3 and JBoss 4.2.2 worker nodes with Tomcat 5.5 connectors.
---- edit03-----
http://community.jboss.org/wiki/OptimalModjk12Configuration
using the above article i just wanted to know the best values for Apache
MaxClients
ThreadPerChild
I found the following note in this article interesting. I haven't tried this, but perhaps could be useful for someone experiencing the same problem.
If you are using mod_jk and have turned sticky sessions on, but your sessions are failing to stick, you have probably failed to set the domain, or you have failed to set the jvmRoute, or you are using a non-standard cookie name to implement the stickyness!
I think in your worker.properties file the workerlist should have loadBalancer worker not the node1,node2 & node3.It should be like this
worker.list=loadmanager
worker.loadmanager.balance_workers=node1,node2,node3
I hope u must have these correct.
Also you have to set UserJK arttribute to set as true for load balancing with sticky session combined with JvmRoute. If set to true, it will insert a JvmRouteFilter
to intercept every request and replace the JvmRoute if it detects a failover.
<attribute name="UseJK">true</attribute>
in deploy/jboss-web.deployer/META-INF/jboss-service.xml

Resources