Duplicating Packets from One Input to One Output¶
The PacketDuplicator module creates a configured number of duplicates of incoming packets.
In this example network, packets are produced periodically by an active packet source (ActivePacketSource). The packets are pushed into a (PacketDuplicator), which creates 0 or 1 copy of them randomly. Finally, the packets are all sent into a passive packet sink (PassivePacketSink).

network DuplicatorTutorialStep
{
@display("bgb=600,200");
submodules:
producer: ActivePacketSource {
@display("p=100,100");
}
duplicator: PacketDuplicator {
@display("p=300,100");
}
consumer: PassivePacketSink {
@display("p=500,100");
}
connections allowunconnected:
producer.out --> duplicator.in;
duplicator.out --> consumer.in;
}
[Config Duplicator]
network = DuplicatorTutorialStep
sim-time-limit = 10s
*.producer.packetLength = 1B
*.producer.productionInterval = 1s
*.duplicator.numDuplicates = intuniform(0, 1)