Search code examples
unetstack

How to delete route to a particular node in the agent?


I want to delete routing entries from routing table to a node 1 from the agent but i am not able to figure out how to write code for deleting routing entries to a particular node through my own agent.


Solution

  • What you're looking for is the EditRouteReq in the ROUTING service of UnetStack. The EditRoutReq has constructors that allow deletion of route that match specific criteria (e.g. EditRouteReq.deleteRoute() or EditRouteReq.deleteRoute(String uuid)). Sending this request to the router (agent offering the ROUTING service should do what you want.

    Example code snippet to delete route with UUID id:

    r = EditRouteReq.deleteRoute(id)
    r.recipient = agentForService(Services.ROUTING)
    request(r, 1000)
    

    or to delete all routes to destination address addr:

    r = EditRouteReq.deleteRoute()
    r.to = addr
    r.recipient = agentForService(Services.ROUTING)
    request(r, 1000)