NED File src/inet/networklayer/diffserv/DiffservQueue.ned

Name Type Description
DiffservQueue compound module

This is an example queue, that can be used in interfaces of DS core and edge nodes to support the AFxy (RFC 2597) and EF (RFC 3246) PHBs.

Source code

// Copyright (C) 2012 Opensim Ltd.
// Author: Tamas Borbely
// 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 2
// 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
// 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 inet.networklayer.diffserv;

import inet.common.queue.DropTailQueue;
import inet.common.queue.IOutputQueue;
import inet.common.queue.PriorityScheduler;
import inet.common.queue.Sink;
import inet.common.queue.WrrScheduler;

// This is an example queue, that can be used in
// interfaces of DS core and edge nodes to support
// the AFxy (RFC 2597) and EF (RFC 3246) PHBs.
// The incoming packets are first classified according to
// their DSCP field. DSCPs other than AFxy and EF are handled
// as BE (best effort).
// EF packets are stored in a dedicated queue, and served first
// when a packet is requested. Because they can preempt the other
// queues, the rate of the EF packets should be limited to a fraction
// of the bandwith of the link. This is achieved by metering the EF
// traffic with a token bucket meter and dropping packets that
// does not conform to the traffic profile.
// There are other queues for AFx classes and BE. The AFx queues
// use RED to implement 3 different drop priorities within the class.
// BE packets are stored in a drop tail queue.
// Packets from AFxy and BE queues are sheduled by a WRR scheduler,
// which ensures that the remaining bandwith is allocated among the classes
// according to the specified weights.
// @see ~AFxyQueue
module DiffservQueue like IOutputQueue
        string interfaceTableModule;
        *.interfaceTableModule = default(absPath(interfaceTableModule));
        input in;
        output out;
        classifier: BehaviorAggregateClassifier {
            dscps = "EF AF11 AF12 AF13 AF21 AF22 AF23 AF31 AF32 AF33 AF41 AF42 AF43";
        efMeter: TokenBucketMeter {
            cir = default("10%"); // reserved EF bandwith as percentage of datarate of the interface
            cbs = default(5000B); // 5 1000B packets
        sink: Sink {
        efQueue: DropTailQueue {
            frameCapacity = default(5); // keep low, for low delay and jitter
        af1xQueue: AFxyQueue {
        af2xQueue: AFxyQueue {
        af3xQueue: AFxyQueue {
        af4xQueue: AFxyQueue {
        beQueue: DropTailQueue {
        wrr: WrrScheduler {
            weights = default("1 1 1 1 1");
        priority: PriorityScheduler {

        in --> classifier.in;
        classifier.outs++ --> efMeter.in++;
        classifier.outs++ --> af1xQueue.afx1In;
        classifier.outs++ --> af1xQueue.afx2In;
        classifier.outs++ --> af1xQueue.afx3In;
        classifier.outs++ --> af2xQueue.afx1In;
        classifier.outs++ --> af2xQueue.afx2In;
        classifier.outs++ --> af2xQueue.afx3In;
        classifier.outs++ --> af3xQueue.afx1In;
        classifier.outs++ --> af3xQueue.afx2In;
        classifier.outs++ --> af3xQueue.afx3In;
        classifier.outs++ --> af4xQueue.afx1In;
        classifier.outs++ --> af4xQueue.afx2In;
        classifier.outs++ --> af4xQueue.afx3In;
        classifier.defaultOut --> beQueue.in;

        efMeter.greenOut --> { @display("ls=green"); } --> efQueue.in;
        efMeter.redOut --> { @display("ls=red"); } --> sink.in++;

        af1xQueue.out --> wrr.in++;
        af2xQueue.out --> wrr.in++;
        af3xQueue.out --> wrr.in++;
        af4xQueue.out --> wrr.in++;
        beQueue.out --> wrr.in++;
        efQueue.out --> priority.in++;
        wrr.out --> priority.in++;
        priority.out --> out;