Table Of Contents
Table Of Contents

Content-Based Scheduler

The ContentBasedScheduler pops packets from the connected passive packet sources based on the configured packet filter and packet data filter functions. There is one filter (of both kinds) per packet source. The scheduler iterates over the packet filter expressions and the packets offered by each connected packet source, and chooses the first matching packet to pop. It inherently prioritizes earlier expressions and earlier input gates.

In this example network, packets are generated by two passive packet sources (PassivePacketSource). An active packet sink (ActivePacketSink) pops packets from the scheduler, which pops packets from one of the packet sources.

The providers generate packets at random intervals between 0 and 2 seconds, randomly containing either 0 or 1 as data; the collector pops a packet from the scheduler every second. The scheduler’s packet data filter is configured to first match packets containing 1, then those containing 0.

../../../_images/ContentBasedScheduler.png
network ContentBasedSchedulerTutorialStep
{
    @display("bgb=600,300");
    submodules:
        provider1: PassivePacketSource {
            @display("p=100,100");
        }
        provider2: PassivePacketSource {
            @display("p=100,200");
        }
        scheduler: ContentBasedScheduler {
            @display("p=300,100");
        }
        collector: ActivePacketSink {
            @display("p=500,100");
        }
    connections allowunconnected:
        provider1.out --> scheduler.in++;
        provider2.out --> scheduler.in++;
        scheduler.out --> collector.in;
}
[Config ContentBasedScheduler]
network = ContentBasedSchedulerTutorialStep
sim-time-limit = 10s

*.provider*.providingInterval = uniform(0s, 2s)
*.provider*.packetLength = 1B
*.provider*.packetData = intuniform(0,1)
*.collector.collectionInterval = 1s
*.scheduler.packetFilters = [expr(ByteCountChunk.data == 1), expr(ByteCountChunk.data == 0)]