PingApp

Package: inet.applications.pingapp

PingApp

simple module

Generates ping requests to several hosts (or rather, network interfaces), and calculates the packet loss and round trip times of the replies. It works exactly like 'ping' except that it is possible to specify several destination addresses as a space separated list of IP addresses or module names. (The L3AddressResolver class is used to resolve the address.) Specifying '*' allows pinging ALL configured network interfaces in the whole simulation. This is useful to check if a host can reach ALL other hosts in the network (i.e. routing tables were set up properly).

Start/stop time, sendInterval etc. can be specified via parameters. An address may be given in the dotted decimal notation (or, for IPv6, in the usual notation with colons), or with the module name. (The L3AddressResolver class is used to resolve the address.)

To specify the number of ping requests sent to a single destination address, use the 'count' parameter. After the specified number of ping requests was sent to a destination address, the application goes to sleep for 'sleepDuration'. Once the sleep timer has expired, the application switches to the next destination and starts pinging again. The application stops pinging once all destination addresses were tested or the simulation time reaches 'stopTime'.

To disable send, specify empty destAddr.

Every ping request is sent out with a sequence number, and replies are expected to arrive in the same order. Whenever there's a jump in the in the received ping responses' sequence number (e.g. 1, 2, 3, 5), then the missing pings (number 4 in this example) is counted as lost. Then if it still arrives later (that is, a reply with a sequence number smaller than the largest one received so far) it will be counted as out-of-sequence arrival. So the number of really lost pings will be "lost" minus "out-of-order" (assuming there's no duplicate or bogus reply).

See also: Icmp, Icmpv6

Inheritance diagram

The following diagram shows inheritance relationships for this type. Unresolved types are missing from the diagram.

Parameters

Name Type Default value Description
destAddr string ""

destination address(es), separated by spaces, "*" means all IPv4/IPv6 interfaces in entire simulation

srcAddr string ""

source address (useful with multi-homing)

packetSize int 56B

of ping payload, in bytes

sendInterval double 1s

time to wait between pings (can be random)

hopLimit int -1

TTL or hopLimit for IP packets

count int -1

number of pings requests sent to a single destination address, -1 means continuously (only first address will be used from destAddr)

startTime double uniform(0s, this.sleepDuration + this.sendInterval)

send first ping at startTime

stopTime double -1s

time to finish sending, negative values mean forever

sleepDuration double 0s

time spent in sleep between switching destinations

continuous bool false

whether to continuously ping the destinations in a round-robin fashion

printPing bool false

log to stdout

crcMode string "declared"
networkProtocol string ""

uses specified network protocol for communication; uses the address-specified default network protocol when the parameter is empty

stopOperationExtraTime double -1s

extra time after lifecycle stop operation finished

stopOperationTimeout double 2s

timeout value for lifecycle stop operation

Properties

Name Value Description
display i=block/app
lifecycleSupport
selfMessageKinds inet::PingSelfKinds

kind used in self messages

Gates

Name Direction Size Description
socketIn input
socketOut output

Signals

Name Type Unit
pingRxSeq long
numLost long
rtt simtime_t
numOutOfOrderArrivals long
pingTxSeq long

Statistics

Name Title Source Record Unit Interpolation Mode
pingRxSeq ping rx seq count, vector none
numLost pings lost last, vector none
rtt ping round-trip time histogram, vector s none
numOutOfOrderArrivals ping out-of-order arrivals last, vector none
pingTxSeq ping tx seq count, vector none

Scheduled messages (observed)

msgkindctrltagsmsgnamecontext
omnetpp::cMessage1001 (PingSelfKinds::PING_FIRST_ADDR)sendPing
omnetpp::cMessage1002 (PingSelfKinds::PING_CHANGE_ADDR)sendPing
omnetpp::cMessage1003 (PingSelfKinds::PING_SEND)sendPing

Direct method calls (observed)

call tofunctioninfo
MessageDispatcherinet::MessageDispatcher::arrivedarrived
ScenarioManagerinet::ScenarioManager::moduleOperationStageCompletedmoduleOperationStageCompleted
InterfaceTableinet::InterfaceTable::findInterfaceByNamefindInterfaceByName
SimpleEpEnergyManagementinet::power::SimpleEpEnergyManagement::moduleOperationStageCompletedmoduleOperationStageCompleted

Called methods (observed)

functioninfocall from
inet::PingApp::handleOperationStagehandleOperationStageScenarioManager, SimpleEpEnergyManagement, SimpleEpEnergyStorage

Incoming messages (observed)

gatemsgkindctrlsrcModuletags
socketInIndication1Ipv4SocketClosedIndicationIpv4SocketInd
socketInPacket0FloodingDispatchProtocolReq, HopLimitInd, InterfaceInd, L3AddressInd, MacAddressInd, NetworkProtocolInd, PacketProtocolTag, SocketInd
socketInPacket0Ipv4DispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, NetworkProtocolInd, PacketProtocolTag, SocketInd, TosInd, DispatchProtocolInd?, ErrorRateInd?, Ieee802SapInd?, InterfaceReq?, MacAddressInd?, MacAddressReq?, SignalPowerInd?, SignalTimeInd?, SnirInd?, UserPriorityInd?, LlcProtocolTag?, Ieee80211ChannelInd?, Ieee80211ModeInd?, Ieee80211ModeReq?
socketInPacket0Ipv6DispatchProtocolInd, DispatchProtocolReq, DscpInd, EcnInd, HopLimitInd, InterfaceInd, L3AddressInd, MacAddressInd, NetworkProtocolInd, PacketProtocolTag, SocketInd, TosInd, ErrorRateInd?, Ieee802SapInd?, SignalPowerInd?, SignalTimeInd?, SnirInd?, Ieee80211ChannelInd?, Ieee80211ModeInd?
socketInPacket0NextHopForwardingDispatchProtocolReq, HopLimitInd, InterfaceInd, L3AddressInd, MacAddressInd, NetworkProtocolInd, PacketProtocolTag, SocketInd, ErrorRateInd?, Ieee802SapInd?, SignalPowerInd?, SignalTimeInd?, SnirInd?, Ieee80211ChannelInd?, Ieee80211ModeInd?
socketInPacket0AdaptiveProbabilisticBroadcastDispatchProtocolInd, DispatchProtocolReq, InterfaceInd, L3AddressInd, MacAddressInd, MacAddressReq, NetworkProtocolInd, PacketProtocolTag, SocketInd
socketInPacket0ProbabilisticBroadcastDispatchProtocolInd, DispatchProtocolReq, InterfaceInd, L3AddressInd, MacAddressInd, MacAddressReq, NetworkProtocolInd, PacketProtocolTag, SocketInd
socketInPacket0WiseRouteDispatchProtocolReq, InterfaceInd, L3AddressInd, MacAddressInd, NetworkProtocolInd, PacketProtocolTag, SocketInd

Outgoing messages (observed)

gatemsgkindctrldestModuletags
socketOutPacket0FloodingDispatchProtocolReq, L3AddressReq, PacketProtocolTag, SocketReq
socketOutPacket0Ipv4DispatchProtocolReq, L3AddressReq, PacketProtocolTag, SocketReq
socketOutPacket0Ipv6DispatchProtocolReq, L3AddressReq, PacketProtocolTag, SocketReq
socketOutPacket0NextHopForwardingDispatchProtocolReq, L3AddressReq, PacketProtocolTag, SocketReq
socketOutPacket0AdaptiveProbabilisticBroadcastDispatchProtocolReq, L3AddressReq, PacketProtocolTag, SocketReq
socketOutPacket0ProbabilisticBroadcastDispatchProtocolReq, L3AddressReq, PacketProtocolTag, SocketReq
socketOutPacket0WiseRouteDispatchProtocolReq, L3AddressReq, PacketProtocolTag, SocketReq
socketOutRequest1Ipv4SocketBindCommandIpv4DispatchProtocolReq, SocketReq
socketOutRequest1Ipv6SocketBindCommandIpv6DispatchProtocolReq, SocketReq
socketOutRequest1L3SocketBindCommandFloodingDispatchProtocolReq, SocketReq
socketOutRequest1L3SocketBindCommandNextHopForwardingDispatchProtocolReq, SocketReq
socketOutRequest1L3SocketBindCommandAdaptiveProbabilisticBroadcastDispatchProtocolReq, SocketReq
socketOutRequest1L3SocketBindCommandProbabilisticBroadcastDispatchProtocolReq, SocketReq
socketOutRequest1L3SocketBindCommandWiseRouteDispatchProtocolReq, SocketReq
socketOutRequest3Ipv4SocketCloseCommandIpv4DispatchProtocolReq, SocketReq

Packet operations (observed)

chunkTypepacketAction
peekDataAsBytes, peekDataAt
ByteCountChunkinsertAtBack
EchoPacketinsertAtFront, popAtFront
IcmpEchoRequestinsertAtFront
IcmpHeaderpopAtFront
Icmpv6EchoRequestMsginsertAtFront
Icmpv6HeaderpopAtFront

Shared Tagging operations (observed)

tagTypetagAction
DispatchProtocolReqaddTagIfAbsent
HopLimitIndfindTag
L3AddressIndgetTag
L3AddressReqaddTag
PacketProtocolTagaddTag, getTag
SocketIndfindTag, getTag
SocketReqaddTagIfAbsent

Tagging operations (observed)

tagTypetagAction
inet::Ipv4InterfaceDatafindTag
inet::Ipv6InterfaceDatafindTag
inet::NextHopInterfaceDatafindTag

Source code

//
// Generates ping requests to several hosts (or rather, network interfaces),
// and calculates the packet loss and round trip times of the replies.
// It works exactly like 'ping' except that it is possible to specify
// several destination addresses as a space separated list of IP addresses
// or module names. (The L3AddressResolver class is used to resolve the address.)
// Specifying '*' allows pinging ALL configured network interfaces in the
// whole simulation. This is useful to check if a host can reach ALL other
// hosts in the network (i.e. routing tables were set up properly).
//
// Start/stop time, sendInterval etc. can be specified via parameters. An address
// may be given in the dotted decimal notation (or, for IPv6, in the usual
// notation with colons), or with the module name.
// (The L3AddressResolver class is used to resolve the address.)
//
// To specify the number of ping requests sent to a single destination address,
// use the 'count' parameter. After the specified number of ping requests was
// sent to a destination address, the application goes to sleep for 'sleepDuration'.
// Once the sleep timer has expired, the application switches to the next destination
// and starts pinging again. The application stops pinging once all destination
// addresses were tested or the simulation time reaches 'stopTime'.
//
// To disable send, specify empty destAddr.
//
// Every ping request is sent out with a sequence number, and replies are
// expected to arrive in the same order. Whenever there's a jump in the
// in the received ping responses' sequence number (e.g. 1, 2, 3, 5), then
// the missing pings (number 4 in this example) is counted as lost.
// Then if it still arrives later (that is, a reply with a sequence number
// smaller than the largest one received so far) it will be counted as
// out-of-sequence arrival. So the number of really lost pings will be
// "lost" minus "out-of-order" (assuming there's no duplicate or bogus reply).
//
// @see ~Icmp, ~Icmpv6
//
simple PingApp like IApp
{
    parameters:
        string destAddr = default(""); // destination address(es), separated by spaces, "*" means all IPv4/IPv6 interfaces in entire simulation
        string srcAddr = default(""); // source address (useful with multi-homing)
        int packetSize @unit(B) = default(56B); // of ping payload, in bytes
        volatile double sendInterval @unit(s) = default(1s); // time to wait between pings (can be random)
        int hopLimit = default(-1); // TTL or hopLimit for IP packets
        int count = default(-1); // number of pings requests sent to a single destination address, -1 means continuously (only first address will be used from destAddr)
        double startTime @unit(s) = default(uniform(0s, this.sleepDuration + this.sendInterval)); // send first ping at startTime
        double stopTime @unit(s) = default(-1s); // time to finish sending, negative values mean forever
        volatile double sleepDuration @unit(s) = default(0s); // time spent in sleep between switching destinations
        bool continuous = default(false);  // whether to continuously ping the destinations in a round-robin fashion
        bool printPing = default(false); // log to stdout
        string crcMode @enum("declared","computed") = default("declared");
        string networkProtocol = default(""); // uses specified network protocol for communication; uses the address-specified default network protocol when the parameter is empty
        @display("i=block/app");
        @lifecycleSupport;
        double stopOperationExtraTime @unit(s) = default(-1s);    // extra time after lifecycle stop operation finished
        double stopOperationTimeout @unit(s) = default(2s);    // timeout value for lifecycle stop operation
        @signal[rtt](type=simtime_t);
        @signal[numLost](type=long);
        @signal[numOutOfOrderArrivals](type=long);
        @signal[pingTxSeq](type=long);
        @signal[pingRxSeq](type=long);
        @statistic[rtt](title="ping round-trip time"; unit=s; record=histogram,vector; interpolationmode=none);
        @statistic[numLost](title="pings lost"; record=last,vector; interpolationmode=none);
        @statistic[numOutOfOrderArrivals](title="ping out-of-order arrivals"; record=last,vector; interpolationmode=none);
        @statistic[pingTxSeq](title="ping tx seq"; record=count,vector; interpolationmode=none);
        @statistic[pingRxSeq](title="ping rx seq"; record=count,vector; interpolationmode=none);
        @selfMessageKinds(inet::PingSelfKinds);    // kind used in self messages
    gates:
        input socketIn @labels(ITransportPacket/up);
        output socketOut @labels(ITransportPacket/down);
}

File: src/inet/applications/pingapp/PingApp.ned