I would like to integrate two sample codes (TAS and gPTP) into the One Master Clock network environment.
The following are the .ini and .ned codes.
simpleGptp.ini
[General]
network = OneMasterClockGptpShowcase
**.displayGateSchedules = true
**.gateFilter = "**.eth[1].**"
**.gateScheduleVisualizer.height = 16
**.gateScheduleVisualizer.placementHint = "top"
# client applications
*.tsnDevice1.numApps = 2
*.tsnDevice1.app[*].typename = "UdpSourceApp"
*.tsnDevice1.app[0].display-name = "best effort"
*.tsnDevice1.app[1].display-name = "video"
*.tsnDevice1.app[*].io.destAddress = "tsnDevice2"
*.tsnDevice1.app[0].io.destPort = 1000
*.tsnDevice1.app[1].io.destPort = 1001
*.tsnDevice1.app[*].source.packetLength = 1000B - 54B # 42B = 8B (UDP) + 20B (IP) + 14B (ETH MAC) + 4B (ETH FCS) + 8B (ETH PHY)
*.tsnDevice1.app[0].source.productionInterval = exponential(200us) # ~40Mbps
*.tsnDevice1.app[1].source.productionInterval = exponential(400us) # ~20Mbps
# server applications
*.tsnDevice2.numApps = 2
*.tsnDevice2.app[*].typename = "UdpSinkApp"
*.tsnDevice2.app[0].io.localPort = 1000
*.tsnDevice2.app[1].io.localPort = 1001
# enable outgoing streams
*.tsnDevice1.hasOutgoingStreams = true
# client stream identification
*.tsnDevice1.bridging.streamIdentifier.identifier.mapping = [{stream: "best effort", packetFilter: expr(udp.destPort == 1000)},
{stream: "video", packetFilter: expr(udp.destPort == 1001)}]
# client stream encoding
*.tsnDevice1.bridging.streamCoder.encoder.mapping = [{stream: "best effort", pcp: 0},
{stream: "video", pcp: 4}]
# enable egress traffic shaping
*.tsnSwitch.hasEgressTrafficShaping = true
# time-aware traffic shaping
*.tsnSwitch.eth[*].macLayer.queue.numTrafficClasses = 2
*.tsnSwitch.eth[*].macLayer.queue.*[0].display-name = "best effort"
*.tsnSwitch.eth[*].macLayer.queue.*[1].display-name = "video"
*.tsnSwitch.eth[*].macLayer.queue.transmissionGate[0].offset = 0ms
*.tsnSwitch.eth[*].macLayer.queue.transmissionGate[0].durations = [4ms, 6ms] # period is 10 # length of periods
*.tsnSwitch.eth[*].macLayer.queue.transmissionGate[1].offset = 6ms
*.tsnSwitch.eth[*].macLayer.queue.transmissionGate[1].durations = [2ms, 8ms]
# enable time synchronization in all network nodes
*.*.hasTimeSynchronization = true
# all oscillators have a random constant drift
**.oscillator.typename = "ConstantDriftOscillator"
**.oscillator.driftRate = uniform(-100ppm, 100ppm)
# all Ethernet interfaces have 100 Mbps speed
*.*.eth[*].bitrate = 100Mbps
*.visualizer.typename = "IntegratedMultiCanvasVisualizer"
*.visualizer.infoVisualizer.displayInfos = true
# TSN clock gPTP master ports
*.tsnClock.gptp.masterPorts = ["eth0"]
# TSN switch gPTP bridge master ports
*.tsnSwitch.gptp.masterPorts = ["eth1", "eth2"]
# Set all reference clocks to master clock so the time difference can be visualized
**.referenceClock = "tsnClock.clock"
# data link visualizer displays gPTP time synchronization packets
*.visualizer.dataLinkVisualizer[0].displayLinks = true
*.visualizer.dataLinkVisualizer[0].activityLevel = "protocol"
*.visualizer.dataLinkVisualizer[0].packetFilter = "GptpSync"
*.visualizer.dataLinkVisualizer[0].lineColor = "blue2"
*.visualizer.numInfoVisualizers = 3
*.visualizer.infoVisualizer[0].modules = "*.tsnClock.clock"
*.tsnClock.clock.displayStringTextFormat = "time: %T"
*.visualizer.infoVisualizer[1].modules = "*.tsnSwitch.clock"
*.visualizer.infoVisualizer[1].placementHint = "topLeft"
*.visualizer.infoVisualizer[2].modules = "*.tsnDevice*.clock"
*.visualizer.infoVisualizer[2].placementHint = "bottom"
*.tsnDevice*.clock.displayStringTextFormat = "diff: %d"
*.tsnSwitch.clock.displayStringTextFormat = "diff: %d"
simpleGptp.ned
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with this program. If not, see http://www.gnu.org/licenses/.
//
package tsn_scalability.simulations;
import inet.common.scenario.ScenarioManager;
import inet.networks.base.TsnNetworkBase;
import inet.node.ethernet.EthernetLink;
import inet.node.tsn.TsnClock;
import inet.node.tsn.TsnDevice;
import inet.node.tsn.TsnSwitch;
network OneMasterClockGptpShowcase extends TsnNetworkBase
{
submodules:
tsnClock: TsnClock {
#display("p=500,150");
}
tsnSwitch: TsnSwitch {
#display("p=500,300");
}
tsnDevice1: TsnDevice {
#display("p=400,450");
}
tsnDevice2: TsnDevice {
#display("p=600,450");
}
connections:
tsnClock.ethg++ <--> EthernetLink <--> tsnSwitch.ethg++;
tsnSwitch.ethg++ <--> EthernetLink <--> tsnDevice1.ethg++;
tsnSwitch.ethg++ <--> EthernetLink <--> tsnDevice2.ethg++;
}
Error message
omnetpp::common::expression::ExprNode::eval_error: Object nullptr has no member named 'destPort' -- in module (inet::queueing::PacketMultiplexer) OneMasterClockGptpShowcase.tsnDevice1.bridging.directionReverser.join (id=337), at t=0s, event #13
The problem happened when the tsnDevice1 sent the GptpPdelayReq packet passing through the bridging module.
If you have any ideas, please let me know. Thank you.
The gPTP packet doesn't contain a UDP header, so you should avoid dereferencing the UDP header if there's none.
For example:
expr(has(udp) && udp.destPort == 1000)
Ideally the gPTP packet is neither part of the video nor the best effort streams.
the example is for Store&Forward forwarding, if I try to switch to Cutthrough by adding *.*.hasCutthroughSwitching = true , the simulation ends with the errormessage Another packet streaming operation is already in progress -- in module (inet::physicallayer::EthernetPhyHeaderInserter) TsnMultiClient.switch.eth[5].phyLayer.phyHeaderInserter (id=705), at t=0.000000962s, event #87
Could this problem also solved with such a small tweak?
Thank you very much :)
Related
So i'm creating an adhoc network of vehicles. The wireless nodes are configured with UdpBasicApp. I want to calculate Goodputs and end to end delay. Unfortunately i'm getting zeros in end to end delay and can't figure out the way for goodput (not throughput). Since it is written that "The received packets are discarded" on the omnet website on UdpBasicApp. Therefore on application layer, only sent packets are there.. not the received . For example
node[0].app[0].packetSent..... = 345
But
node[0].app[0].packetreceived..... = 0
However
node[0].udp do receive something...
The ini file is as follows:
[General]
network = RoutingScenario
sim-time-limit = 10s
debug-on-errors = true
cmdenv-express-mode = true
image-path = ../../../../images
## UDPBasicApp
*.node[*].numApps = 1
*.node[*].app[0].typename = "UdpBasicBurst"
*.node[*].app[0].destAddresses = "10.0.0.72"
*.node[*].app[0].destPort = 5000
*.node[*].app[0].messageLength = 256B
*.node[*].app[0].sendInterval = 0.25s
*.node[*].app[0].packetName = "UDPData"
*.node[*].app[0].startTime = uniform(1s, 2s)
# Ieee80211Interface
*.node[*].wlan[0].opMode = "p"
*.node[*].wlan[0].radio.bandName = "5.9 GHz"
*.node[*].wlan[0].radio.channelNumber = 3
*.node[*].wlan[0].radio.transmitter.power = 100mW
*.node[*].wlan[0].radio.bandwidth = 10 MHz
# HostAutoConfigurator
*.node[*].ipv4.configurator.typename = "HostAutoConfigurator"
*.node[*].ipv4.configurator.interfaces = "wlan0"
*.node[*].ipv4.configurator.mcastGroups = "224.0.0.1"
# VeinsInetMobility
*.node[*].mobility.typename = "VeinsInetMobility"
*.node[*].mobility.speed = normal(8mps, 0.01mps)
# VeinsInetManager
*.manager.updateInterval = 0.1s
*.manager.host = "localhost"
*.manager.port = 9999
*.manager.autoShutdown = true
*.manager.launchConfig = xmldoc("osm.launchd.xml")
*.manager.moduleType = "vanettutorials.veins_inet.VeinsInetRoutingCar"
**.vector-recording = true
**.scalar-recording = true
**.statistic-recording = true
# Routing
**.router = "Aodv"
With UdpBasicApp, the received packets are discarded, but the statistics are recorded (throughput, endtoenddelay, number of received/sent packets, etc).
The throughput recorded by UdpBasicApp is goodput (as in application-level throughput).
I am facing a problem with the simulation time limit.When It is reached, a new udp packet is created and the routing protocol is about to send a control packet then the end simulation event appears .so, how to prevent creating this udp packet at the end of simulation.
I am using INET veins-5.1-i2
omnetpp.ini file
network = Scenario
sim-time-limit = 24s
debug-on-errors = true
cmdenv-express-mode = true
image-path = ../../../../images
#UDPBasicApp
*.node[*].numApps = 1
*.node[*].app[0].typename = "UdpBasicApp"
*.node[1].app[0].destAddresses = "node[4]"
*.node[*].app[0].multicastInterface = "wlan0"
*.node[*].app[0].joinLocalMulticastGroups = true
*.node[*].app[0].destPort = 9001
*.node[*].app[0].localPort = 9001
*.node[*].app[0].messageLength = 100B
*.node[1].app[0].startTime = 21s
*.node[*].app[0].sendInterval = 1s
# Ieee80211Interface
*.node[*].wlan[0].opMode = "p"
*.node[*].wlan[0].radio.typename = "Ieee80211DimensionalRadio"
*.node[*].wlan[0].radio.bandName = "5.9 GHz"
*.node[*].wlan[0].radio.channelNumber = 3
*.node[*].wlan[0].radio.transmitter.power = 20mW
*.node[*].wlan[0].radio.bandwidth = 10 MHz
*.node[*].wlan[*].radio.antenna.mobility.typename = "AttachedMobility"
*.node[*].wlan[*].radio.antenna.mobility.mobilityModule = "^.^.^.^.mobility"
*.node[*].wlan[*].radio.antenna.mobility.offsetX = -2.5m
*.node[*].wlan[*].radio.antenna.mobility.offsetZ = 1.5m
*.node[*].wlan[*].radio.antenna.mobility.constraintAreaMinX = 0m
*.node[*].wlan[*].radio.antenna.mobility.constraintAreaMaxX = 0m
*.node[*].wlan[*].radio.antenna.mobility.constraintAreaMinY = 0m
*.node[*].wlan[*].radio.antenna.mobility.constraintAreaMaxY = 0m
*.node[*].wlan[*].radio.antenna.mobility.constraintAreaMinZ = 0m
*.node[*].wlan[*].radio.antenna.mobility.constraintAreaMaxZ = 0m
# HostAutoConfigurator
*.node[*].ipv4.configurator.typename = "HostAutoConfigurator"
*.node[*].ipv4.configurator.interfaces = "wlan0"
*.node[*].ipv4.configurator.mcastGroups = "224.0.0.1"
# VeinsInetMobility
*.node[*].mobility.typename = "VeinsInetMobility"
# VeinsInetManager
*.manager.updateInterval = 0.1s
*.manager.host = "localhost"
*.manager.port = 9999
*.manager.autoShutdown = true
*.manager.launchConfig = xmldoc("square.launchd.xml")
*.manager.moduleType = "org.car2x.veins.subprojects.veins_inet.VeinsInetCar"
# PhysicalEnvironment
*.physicalEnvironment.config = xmldoc("obstacles.xml")
*.radioMedium.obstacleLoss.typename = "IdealObstacleLoss"
# Misc
**.vector-recording = true
If the simulation time limit is low and you are afraid that a single extra packet can affect and throw off your results then:
a) You are doing it wrong because you have so few events and messages in your simulation that the result you receive has no statistical significance. (like: my packet delivery ratio is 81% (+- 60%) ???). This is useless. So, you should either run the simulation for a much longer time (if it converges to a steady state) or run a lot of simulations with different random generator seeds. In either case the effect of a single packet will disappear.
b) If you insist on counting all packets accurately and you don't want to loose even a single packet, then do what you would do in real life: stop sending packets from the data sources well before the simulation stops so all packets will have a chance (and time) to arrive at destination. You should configure your applications to stop sending at least a few seconds before the simulation time limit. There are parameters to do that in almost all application models.
I have been working on adding more than one host to the INET throughput example.
inet/showcases/wireless/throughput
However, when I run the code after adding more hosts, the graph generated looks pretty similar to the original and I expected some sort of obvious difference - which leaves me to believe that there is something wrong with the code.
Original example code:
throughput.ini
[General]
[Config Throughput]
network = Throughput
sim-time-limit = 1s
*.*Host.ipv4.arp.typename = "GlobalArp"
*.*Host.wlan[*].mgmt.typename = "Ieee80211MgmtAdhoc"
*.*Host.wlan[*].agent.typename = ""
*.*Host.wlan[*].opMode = "g(erp)"
*.*Host.wlan[*].bitrate = ${bitrate = 6,9,12,18,24,36,48,54}Mbps
*.*Host.wlan[*].mac.dcf.originatorMacDataService.fragmentationPolicy.fragmentationThreshold = 2304B + 28B
*.*Host.wlan[*].radio.separateReceptionParts = true
*.*Host.wlan[*].radio.separateTransmissionParts = true
*.sourceHost.numApps = 1
*.sourceHost.app[0].typename = "UdpBasicApp"
*.sourceHost.app[*].destAddresses = "destinationHost"
*.sourceHost.app[*].destPort = 5000
*.sourceHost.app[*].packetName = "UDPData-"
*.sourceHost.app[*].startTime = 0s
*.sourceHost.app[*].messageLength = ${packetLength = 100, 1000, 2268}byte
*.sourceHost.app[*].sendInterval = ${packetLength} * 8 / ${bitrate} * 1us
*.destinationHost.numApps = 1
*.destinationHost.app[0].typename = "UdpSink"
*.destinationHost.app[*].localPort = 5000
throughput.ned
package inet.showcases.wireless.throughput;
import inet.networklayer.configurator.ipv4.Ipv4NetworkConfigurator;
import inet.node.inet.WirelessHost;
import inet.physicallayer.ieee80211.packetlevel.Ieee80211ScalarRadioMedium;
network Throughput
{
#display("bgb=6,4");
#statistic[throughput](source=liveThroughput(destinationHost.app[0].packetReceived)/1000000; record=figure; targetFigure=panel.throughput; checkSignals=false);
#statistic[numRcvdPk](source=count(destinationHost.app[0].packetReceived); record=figure; targetFigure=panel.numRcvdPkCounter; checkSignals=false);
#figure[panel](type=panel; pos=1.5,0.1);
// #figure[panel.throughput](type=gauge; pos=0,0; size=100,100; minValue=0; maxValue=40; tickSize=5; label="App level throughput [Mbps]");
#figure[panel.throughput](type=linearGauge; pos=250,50; size=250,30; minValue=0; maxValue=54; tickSize=6; label="Application level throughput [Mbps]");
#figure[panel.numRcvdPkCounter](type=counter; pos=50,50; label="Packets received"; decimalPlaces=6);
submodules:
sourceHost: WirelessHost {
#display("p=3.019269,2.746169");
}
destinationHost: WirelessHost {
#display("p=4.369595,1.8054924");
}
configurator: Ipv4NetworkConfigurator {
#display("p=1.0772266,0.6220604");
}
radioMedium: Ieee80211ScalarRadioMedium {
#display("p=1.03171,1.9723867");
}
}
The way I did it was copying the source host submodule in throughput.ned and giving it a name like sourceHost2. Then, I modified the ini file to accommodate for the changes for example, changing
*.*Host.ipv4.arp.typename = "GlobalArp"
to
*.*Host*.ipv4.arp.typename = "GlobalArp"
This runs fine but does not really change the throughput at all - one or two slightly harsher peaks/troughs in the graphs but nothing noticeable - any ideas?
I am new to veins and I would like to make DoS attack using flooding technique. I have tried sending a message, that used in case of an accident, say, a million times by a specific car. Is this enough to make a DoS attack? Can I make this code more sophisticated?
void TraCIDemo11p::handlePositionUpdate(cObject* obj) {
BaseWaveApplLayer::handlePositionUpdate(obj);
if (externalID == "2"){ //2 is the attacker
for (int i = 0; i<1000000; i++)
sendMessage(mobility->getRoadId());
}
Note: I am using omnet 5.0, sumo-0.25.0 and veins-4.4, TraCIDemo11p.cc
For the NED File
import inet.applications.dhcp.DhcpServer;
import inet.node.dsdv.DsdvRouter;
import inet.node.inet.AdhocHost;
import inet.node.inet.MulticastRouter;
import inet.node.inet.WirelessHost;
import inet.networklayer.configurator.ipv4.Ipv4NetworkConfigurator;
import inet.node.aodv.AodvRouter;
import inet.node.wireless.AccessPoint;
import inet.physicallayer.ieee80211.packetlevel.Ieee80211ScalarRadioMedium;
import inet.visualizer.integrated.IntegratedVisualizer;
import inet.visualizer.networklayer.NetworkRouteVisualizer;
import inet.visualizer.integrated.IntegratedMultiVisualizer;
import ned.DelayChannel;
network pingattack
{
parameters:
int numhost;
int numattacker;
submodules:
visualizer: IntegratedMultiVisualizer {
#display("p=14,295");
}
configurator: Ipv4NetworkConfigurator {
//config = default(xml("<config><interface WirelessHost='**' address='10.0.0.x' netmask='255.255.255.0'/></config>"));
#display("p=42,430");
}
radioMedium: Ieee80211ScalarRadioMedium {
#display("p=14,339");
}
Attacker[numattacker]: WirelessHost {
#display("p=180,331");
}
Master: WirelessHost {
#display("p=274,316");
}
Slaves[numhost]: WirelessHost {
#display("p=313,247");
}
ap: AccessPoint {
#display("p=244,246");
}
}
For the Ini File,
[General]
description = Displaying Ping Attack
network = pingattack
# Setting up the max area which the modules are able to travel to
# "Z" limits the height. It can only be observed in 3D
**.constraintAreaMinX = 0m
**.constraintAreaMinY = 0m
**.constraintAreaMinZ = 0m
**.updateInterval = 0.1s # test with 0s too, and let getCurrentPosition update the display string from a test module
# Does not specify the intial positions. Random initial position will be chosen within the contraint area,
# unless it is specified in the display string in NED file or initialX,Y,Z
**.mobility.initFromDisplayString = false
# Setting all the default application type to "GlobalArp"
**.arp.typename = "GlobalArp"
# Attacker parameters
*.Attacker[*].numApps = 1 # Number of application layers on attackers
*.Attacker[*].app[0].typename = "PingApp" # Application type for attackers
*.Attacker[*].app[0].destAddr = "Master" # Set ping destination
*.Attacker[*].app[0].startTime = 10s # Initialize start time of ping
# Master Communication
*.Master.numApps = 1 # Number of application layers on master
*.Master.app[0].typename = "PingApp" # Application type for master
# MasterDrone Mobility
*.Master.mobility.typename = "LinearMobility" # Master move at constant speed
*.Master.mobility.speed = 20mps # of 20mps
# Slave Communication
*.Slaves[*].numApps = 1 # Number of application layers on slaves
*.Slaves[*].app[0].typename = "PingApp" # Application type for slaves
*.Slaves[*].app[0].destAddr = "Master" # Set ping destination, to ensure connection with master
*.Slaves[*].app[0].startTime = replaceUnit (0.1*(parentIndex()), "s") # to avoid synchronization
#*.Slaves[*].app[0].sendInterval= 1s # Slaves send ping every 1 second
# Slave mobility
*.Slaves[*].mobility.typename = "MassMobility" # Slaves move randomly
*.Slaves[*].mobility.changeInterval = truncnormal(2s, 0.5s)
*.Slaves[*].mobility.angleDelta = normal(0deg, 30deg)
#*.Slaves[*].mobility.speed = 15mps
# Wlan Config
*.Master.wlan[*].radio.transmitter.power = 10mW # Setting up Master, slaves, attacker wlan transmit power
*.ap.wlan[*].radio.transmitter.power = 100mW
# Pcap recording
**.crcMode = "computed" # To include CRC values in capture files
**.fcsMode = "computed" # To include FCS values in capture files
**.numPcapRecorders = 1 # To include PcapRecordere module
**.pcapRecorder[*].pcapNetwork = 105 # Set PCAP files link-layer header type to 802.11
**.pcapRecorder[*].pcapFile = "results/all.pcap" # Specifying file to write traces in & enable packet capture
**.pcapRecorder[*].verbose = true # To print tcpdump-like textual information to the log (EV)
**.pcapRecorder[*].alwaysFlush = true # Record the packets even if simulation crashes
**.pcapRecorder[*].packetFilter = "ping*"
#Analysis
*.*.wlan[*].**.vector-recording = false
# Visualizer parameters
# Displaying network path activity
*.visualizer.*.numDataLinkVisualizers = 2
*.visualizer.*.numInterfaceTableVisualizers = 2
*.visualizer.*.dataLinkVisualizer[0].displayLinks = true
*.visualizer.*.dataLinkVisualizer[0].packetFilter = "*ping*"
#*.visualizer.*.physicalLinkVisualizer[*].displayLinks = true
#*.visualizer.*.interfaceTableVisualizer[*].displayInterfaceTables = true
#*.visualizer.*.interfaceTableVisualizer[0].format = "%4"
*.visualizer.*.infoVisualizer[0].modules = "*.*.app[0]"
*.visualizer.*.infoVisualizer[1].modules = "*.*.app[1]"
#*.visualizer.*.infoVisualizer[*].format = "%t"
#*.visualizer.*.statisticVisualizer[0].sourceFilter = "**.app[*]"
#*.visualizer.*.statisticVisualizer[0].signalName = "rtt"
#*.visualizer.*.statisticVisualizer[0].unit = "ms"
#*.visualizer.*.infoVisualizer[*].placementHint = "topCenter"
#*.visualizer.*.packetDropVisualizer[*].displayPacketDrops = true
#*.visualizer.*.packetDropVisualizer[*].packetFilter = "ping*"
#*.visualizer.*.packetDropVisualizer[*].labelFormat = "%n/reason: %r"
#*.visualizer.*.packetDropVisualizer[*].fadeOutTime = 3s
#edit
# Set number of Attacker
# Set number of Host
# Set Attacker Ping interval
# Set Transmittion Power of Master Slave Attacker and AP
# Set Max constrain area XYZ
sim-time-limit = 20s
pingattack.numhost = 5
pingattack.numattacker = 1
*.Attacker[*].app[0].sendInterval = 0.0001s
**.constraintAreaMaxX = 2000m
**.constraintAreaMaxY = 2000m
**.constraintAreaMaxZ = 2000m
*.Slaves[*].wlan[*].radio.transmitter.power = 100mW
*.Attacker[*].wlan[*].radio.transmitter.power = 200mW
*.Attacker[*].**.vector-recording = false
*.Slaves[*].mobility.speed = 16mps
Hi I did a DOS Attack using PingApp. I think you can refer to the source code of PingApp. The important part is to have the sendInterval be 0.0001s. Hope this helps!
I have 1000 hosts. I need to simulate the situation when host[0] connects with other 999 hosts by PingApp in accordance with a timetable.
For example
**.host[0]*.numPingApps = 999 #number of hosts
**.host[0]*.pingApp[*].typename = "PingApp"
**.host[0]*.pingApp[*].packetSize = 42 B
**.host[0]*.pingApp[*].sendInterval = 1 s
**.host[0]*.pingApp[*].srcAddr = "host[0]"
**.host[0]*.pingApp[0].destAddr = "host[1]"
**.host[0]*.pingApp[0].startTime = 0 s
**.host[0]*.pingApp[0].stopTime = 5s
**.host[0]*.pingApp[1].destAddr = "host[2]"
**.host[0]*.pingApp[1].startTime = 0.1 s
**.host[0]*.pingApp[1].stopTime = 5.1 s
**.host[0]*.pingApp[2].destAddr = "host[3]"
**.host[0]*.pingApp[2].startTime = 0.2 s
**.host[0]*.pingApp[2].stopTime = 5.2 s
**.host[0]*.pingApp[3].destAddr = "host[4]"
**.host[0]*.pingApp[3].startTime = 0.3 s
**.host[0]*.pingApp[3].stopTime = 5.3 s
and so on...
How can I create the loop for automatic changes of parameters: startTime, stopTime, destAddr, number of pingApp?
I need to increase startTime and stopTime by 0.1s at every step of one point increase of pingApp number and destAddr.
Help me please!
Thank you!
Actually, every host should have only one Ping Application. To achieve your goal you can use the following settings:
**.host[*].numApps = 1
**.host[*].app[0].typename = "PingApp"
**.host[999].app[0].destAddr = "host[0]"
**.host[*].app[0].destAddr = "host[" + string(parentIndex()+1) + "]"
**.host[*].app[0].startTime = replaceUnit (0.1*(parentIndex()), "s")
**.host[*].app[0].stopTime = replaceUnit (5 + 0.1*(parentIndex()), "s")
The paretnIndex() returns the index of the host in vector of hosts, reference OMNeT++ Manual. For the last node (i.e. host[999]) destAddr is set by hand because parentIndex()+1 will return 1000, and there is no host[1000].
The second NED function - replaceUnit() - is used to add the unit to the result of calculation.
Here is an other quasi solution:
From the PingApp's documentation:
string destAddr = default(""); // destination address(es), separated by spaces, "*" means all IPv4/IPv6 interfaces in entire simulation
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).
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'.
So if you have only these hosts in the network and you don't mind that in the beginning the host pings itself too, destAddr="*" and count=1
I combined answers of #Rudi and #JerzyD. and got the workable solution:
**.host[0]*.numPingApps = 999
**.host[0]*.pingApp[*].typename = "PingApp"
**.host[0]*.pingApp[*].sendInterval = 1 s
**.host[0]*.pingApp[*].packetSize = 42 B
**.host[0]*.pingApp[0..998].destAddr = "host[" + string(index()+1) + "]"
**.host[0]*.pingApp[0..998].startTime = replaceUnit (0.1 * (index()), "s")
**.host[0]*.pingApp[0..998].stopTime = replaceUnit (5 + 0.1 * (index()), "s")