I'm using node.startup ={} in the simulation script to generate static routes by sending routeDiscoveryNtf at each node. I've included all headers but still, ROUTING service isn't recognized.
Simulation script is as follows, startup functionality is same for all nodes
//! Simulation: 5-node network
import org.arl.fjage.*
import org.arl.fjage.Agent.*
import org.arl.fjage.RealTimePlatform
import org.arl.unet.sim.*
import org.arl.unet.sim.channels.*
import org.arl.unet.phy.*
import org.arl.unet.phy.Physical.*
import org.arl.unet.net.*
import org.arl.unet.*
import org.arl.unet.DatagramReq
import org.arl.unet.net.Router
import org.arl.unet.Services
platform = RealTimePlatform
channel.model = ProtocolChannelModel
channel.soundSpeed = 1500.mps // c
channel.communicationRange = 100.m // Rc
channel.detectionRange = 100.m // Rd
channel.interferenceRange = 100.m // Ri
channel.pDetection = 1 // pd
channel.pDecoding = 1 // pc
simulate {
def n1 = node '1', address: 1, location: [0.m, 0.m, 0.m], shell: true, stack:"$home/etc/initrc-stack"
n1.startup = {
def router = agentForService ROUTING
router.send new RouteDiscoveryNtf(to:4,nextHop:1)
router.send new RouteDiscoveryNtf(to:2,nextHop:1)
router.send new RouteDiscoveryNtf(to:3,nextHop:1)
router.send new RouteDiscoveryNtf(to:5,nextHop:1)
}
def n2 =node '2', address: 2, location: [70.m, 0.m, 0.m], shell:5102, stack: "$home/etc/initrc-stack"
n2.startup = {
def router = agentForService ROUTING
router.send new RouteDiscoveryNtf(to:4,nextHop:2)
router.send new RouteDiscoveryNtf(to:1,nextHop:2)
router.send new RouteDiscoveryNtf(to:5,nextHop:2)
router.send new RouteDiscoveryNtf(to:3,nextHop:4)
router.send new RouteDiscoveryNtf(to:3,nextHop:1)
router.send new RouteDiscoveryNtf(to:1,nextHop:5)
}
def n3 = node '3', address: 3, location: [-70.m, 0.m, 0.m], shell: 5103, stack:"$home/etc/initrc-stack"
n3.startup = {
def router = agentForService ROUTING
router.send new RouteDiscoveryNtf(to:4,nextHop:3)
router.send new RouteDiscoveryNtf(to:1,nextHop:3)
router.send new RouteDiscoveryNtf(to:5,nextHop:3)
router.send new RouteDiscoveryNtf(to:2,nextHop:4)
router.send new RouteDiscoveryNtf(to:2,nextHop:1)
router.send new RouteDiscoveryNtf(to:2,nextHop:5)
}
def n4 = node '4', address: 4, location: [0.m, 70.m, 0.m], shell: 5104, stack:"$home/etc/initrc-stack"
n4.startup = {
def router = agentForService ROUTING
router.send new RouteDiscoveryNtf(to:1,nextHop:4)
router.send new RouteDiscoveryNtf(to:2,nextHop:4)
router.send new RouteDiscoveryNtf(to:3,nextHop:4)
router.send new RouteDiscoveryNtf(to:5,nextHop:1)
router.send new RouteDiscoveryNtf(to:5,nextHop:2)
router.send new RouteDiscoveryNtf(to:5,nextHop:3)
}
def n5 = node '5', address: 5, location: [0.m, -70.m, 0.m], shell: 5105, stack:"$home/etc/initrc-stack"
n5.startup = {
def router = agentForService ROUTING
router.send new RouteDiscoveryNtf(to: 1 , nextHop:5)
router.send new RouteDiscoveryNtf(to: 3 , nextHop:5)
router.send new RouteDiscoveryNtf(to: 2 , nextHop:5)
router.send new RouteDiscoveryNtf(to: 4 , nextHop:1)
router.send new RouteDiscoveryNtf(to: 4 , nextHop:2)
router.send new RouteDiscoveryNtf(to: 4 , nextHop:3)
}
}
Simulation Error is as follows:
SEVERE: <3> > Exception in agent: simulator
SEVERE: <4> > Exception in agent: simulator
SEVERE: <1> > Exception in agent: simulator
SEVERE: <5> > Exception in agent: simulator
SEVERE: <2> > Exception in agent: simulator
Though stack is being loaded on every node, Routes are not being created.
Log file stats are :
1562654374493|SEVERE|<1>@36:run|Exception in agent: simulator
groovy.lang.MissingPropertyException: No such property: ROUTING for class: org.arl.unet.sim.SimulationAgent
Stack trace: ...
org.arl.unet.sim.SimulationAgent.propertyMissing(initrc.groovy:216) ...
org.arl.unet.sim.SimulationAgent.getProperty(initrc.groovy) ...
ping-sim2$_run_closure1$_closure2.doCall(ping-sim2.groovy:37)
ping-sim2$_run_closure1$_closure2.doCall(ping-sim2.groovy) ...
org.arl.unet.sim.SimulationAgent.this$dist$invoke$2(initrc.groovy)
org.arl.unet.sim.SimulationAgent$1.methodMissing(initrc.groovy) ...
org.arl.unet.sim.SimulationAgent$1.action(initrc.groovy:172)
org.arl.fjage.Agent.run(Agent.java:777) ...
I believe ROUTING
service's canonical name is org.arl.unet.Services.ROUTING
. So you might have to use that string instead of just ROUTING
def router = agentForService org.arl.unet.Services.ROUTING