Connecting a Passive Source to Multiple Active Sinks¶
The PacketDemultiplexer module connects to a passive packet source
on its input and multiple active packet sinks on its outputs. When one of the collectors requests a packet
from the demultiplexer, it pops a packet from the provider and forwards it to the collector.
In this example network, packets are collected at random intervals by several active
packet sinks (ActivePacketSink). The packets are provided by a single passive
packet source (PassivePacketSource). The source is connected to
the sinks using a demultiplexer, which simply forwards packets.
network DemultiplexerTutorialStep
{
parameters:
int numCollectors;
submodules:
provider: PassivePacketSource {
@display("p=100,100");
}
demultiplexer: PacketDemultiplexer {
@display("p=300,100");
}
collector[numCollectors]: ActivePacketSink {
@display("p=500,100,c,100");
}
connections allowunconnected:
provider.out --> demultiplexer.in;
for i=0..numCollectors-1 {
demultiplexer.out++ --> collector[i].in;
}
}
[Config Demultiplexer]
network = DemultiplexerTutorialStep
sim-time-limit = 10s
*.provider.packetLength = 1B
*.numCollectors = 3
*.collector[*].collectionInterval = uniform(0s, 2s)