OMNeT++ AODV Simulation

AODV referred as Ad Hoc On Demand Distance vector routing protocol which enables constructing routes for particular destination.Main advantage of OMNeT++ AODV is that it doesn’t require nodes to keep routes when there is no active communication.OMNeT++ AODV uses destination sequence number method to avoid “counting to infinity” problem which makes it free loop environment.

OMNeT++ AODV Simulation

Functionalities of message types in AODV:

  • RREQ is used to initiate the route finding process.
  • RERR messages are used to notify the network or a link breakage in an active route.
  • RREP message is used to finalize the routes.

Advantages of using OMNeT++ AODV Routing Protocol:

  • Adaptability to dynamic networks.
  • Higher bandwidth share.
  • Lower setup delay.
  • Reduced overhead.
Architecture-of-AODV

Architecture-of-AODV

Characteristics of AODV:

  • Link breakages in active routes efficiently repaired.
  • Use of sequence numbers to track accuracy of information.
  • Multicast trees connecting group members maintained for lifetime of multicast groups.
  • Use of periodic HELLO messages to track neighbors.
  • On-demand route establishment with small delay.
  • Only keeps track of the next hop for a route instead of the entire route.

Download Sample Source Code for OMNeT++ AODV Routing Protocol


void AODVRouting::delayDatagram(IPv4Datagram *datagram)
{
    EV_DETAIL << "Queuing datagram, source " << datagram->getSrcAddress() << ", destination " << datagram->getDestAddress() << endl; const IPv4Address& target = datagram->getDestAddress();
    targetAddressToDelayedPackets.insert(std::pair<IPv4Address, IPv4Datagram *>(target, datagram));
}
void AODVRouting::sendRREQ(AODVRREQ *rreq, const IPv4Address& destAddr, unsigned int timeToLive)
{    
    std::map<IPv4Address, WaitForRREP *>::iterator rrepTimer = waitForRREPTimers.find(rreq->getDestAddr());
    WaitForRREP *rrepTimerMsg = NULL;
    if (rrepTimer != waitForRREPTimers.end()) {
        rrepTimerMsg = rrepTimer->second;
        unsigned int lastTTL = rrepTimerMsg->getLastTTL();
        rrepTimerMsg->setDestAddr(rreq->getDestAddr());
        if (timeToLive != 0) {
            rrepTimerMsg->setLastTTL(timeToLive);
            rrepTimerMsg->setFromInvalidEntry(true);
            cancelEvent(rrepTimerMsg);
        }
        else if (lastTTL + ttlIncrement < ttlThreshold) { ASSERT(!rrepTimerMsg->isScheduled());
            timeToLive = lastTTL + ttlIncrement;
            rrepTimerMsg->setLastTTL(lastTTL + ttlIncrement);
        }
        else {
            ASSERT(!rrepTimerMsg->isScheduled());
            timeToLive = netDiameter;
            rrepTimerMsg->setLastTTL(netDiameter);
        }
    }
    else {
        rrepTimerMsg = new WaitForRREP();
        waitForRREPTimers[rreq->getDestAddr()] = rrepTimerMsg;
        ASSERT(hasOngoingRouteDiscovery(rreq->getDestAddr()));
        timeToLive = ttlStart;
        rrepTimerMsg->setLastTTL(ttlStart);
        rrepTimerMsg->setFromInvalidEntry(false);
        rrepTimerMsg->setDestAddr(rreq->getDestAddr());    }
    // Each time, the timeout for receiving a RREP is RING_TRAVERSAL_TIME.
    simtime_t ringTraversalTime = 2.0 * nodeTraversalTime * (timeToLive + timeoutBuffer);
    scheduleAt(simTime() + ringTraversalTime, rrepTimerMsg);
    EV_INFO << "Sending a Route Request with target " << rreq->getDestAddr() << " and TTL= " << timeToLive << endl; sendAODVPacket(rreq, destAddr, timeToLive, jitterPar->doubleValue());
    rreqCount++;
}