Table Of Contents
Table Of Contents

Priority Classifier

The PriorityClassifier module pushes packets to the first non-full connected queue.

In this step, packets are produced periodically by an active packet source (ActivePacketSource). The packet source is connected to a priority classifier (PriorityClassifier), which connects to two queues (PacketQueue). The queues are configured to have capacity for storing one packet. The queues are connected to two active packet sinks (ActivePacketSink). The classifier sends packets to the queues, favoring queue1. It will only consider queue2 when queue1 is full. The packets are popped from the queues by two active packet sinks (ActivePacketSink).

network PriorityClassifierTutorialStep
{
    @display("bgb=850,300");
    submodules:
        producer: ActivePacketSource {
            @display("p=100,100");
        }
        classifier: PriorityClassifier {
            @display("p=300,100");
        }
        queue1: PacketQueue {
            @display("p=525,100");
        }
        queue2: PacketQueue {
            @display("p=525,225");
        }
        collector1: ActivePacketSink {
            @display("p=750,100");
        }
        collector2: ActivePacketSink {
            @display("p=750,225");
        }
    connections allowunconnected:
        producer.out --> classifier.in;
        classifier.out++ --> queue1.in;
        classifier.out++ --> queue2.in;
        queue1.out --> collector1.in;
        queue2.out --> collector2.in;
}
[Config PriorityClassifier]
network = PriorityClassifierTutorialStep
sim-time-limit = 10s

*.queue*.packetCapacity = 1
*.producer.packetLength = 1B
*.producer.productionInterval = uniform(0s, 1s)
*.collector*.collectionInterval = uniform(0s, 2s)