summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Qos/Priority.pm
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2009-04-14 14:42:55 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2009-04-14 14:42:55 -0700
commitbd8069c891026a121ce4916b7522c7c314e58d2a (patch)
tree5ce0c2dd06c0d59ceceb0b5b0d73012f251de568 /lib/Vyatta/Qos/Priority.pm
parentc8d46a00631df87002cb671a40b063990467d31f (diff)
downloadvyatta-cfg-qos-bd8069c891026a121ce4916b7522c7c314e58d2a.tar.gz
vyatta-cfg-qos-bd8069c891026a121ce4916b7522c7c314e58d2a.zip
Remove priority queue implementation
It needs more work (not ready for prime time).
Diffstat (limited to 'lib/Vyatta/Qos/Priority.pm')
-rw-r--r--lib/Vyatta/Qos/Priority.pm131
1 files changed, 0 insertions, 131 deletions
diff --git a/lib/Vyatta/Qos/Priority.pm b/lib/Vyatta/Qos/Priority.pm
deleted file mode 100644
index f4f01da..0000000
--- a/lib/Vyatta/Qos/Priority.pm
+++ /dev/null
@@ -1,131 +0,0 @@
-# Strict Priority
-# This is a deficit round robin scheduler
-#
-# **** License ****
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# This code was originally developed by Vyatta, Inc.
-# Portions created by Vyatta are Copyright (C) 2008 Vyatta, Inc.
-# All Rights Reserved.
-# **** End License ****
-
-package Vyatta::Qos::Priority;
-use strict;
-use warnings;
-
-require Vyatta::Config;
-require Vyatta::Qos::ShaperClass;
-
-# Create a new instance based on config information
-sub new {
- my ( $that, $config, $name ) = @_;
-
- my @classes = _getClasses( $config->setLevel() );
- my $self = {};
- my $class = ref($that) || $that;
- bless $self, $class;
- $self->{_classes} = \@classes;
-
- return $self;
-}
-
-sub _getClasses {
- my $level = shift;
- my @classes;
- my $config = new Vyatta::Config;
-
- $config->setLevel($level);
- my $default;
- if ( $config->exists("default") ) {
- $config->setLevel("$level default");
- $default = new Vyatta::Qos::ShaperClass($config);
- $config->setLevel($level);
- }
- else {
- $default = new Vyatta::Qos::ShaperClass;
- }
- push @classes, $default;
- $default->{id} = 1;
-
- foreach my $id ( $config->listNodes("class") ) {
- $config->setLevel("$level class $id");
- push @classes, new Vyatta::Qos::ShaperClass( $config, $id );
- }
-
- return @classes;
-}
-
-sub commands {
- my ( $self, $dev ) = @_;
- my $classes = $self->{_classes};
- my $parent = 1;
-
- printf "qdisc add dev %s s handle %x: prio limit %d\n",
- $dev, 'root', $parent, $self->{_limit};
-
- foreach my $class (@$classes) {
- $class->gen_leaf( $dev, $parent );
- foreach my $match ( $class->matchRules() ) {
- $match->filter( $dev, $parent, 1 );
- printf " parent %x:%x\n", $parent, $class->{id};
- }
- }
-}
-
-# Walk configuration tree and look for changed nodes
-# The configuration system should do this but doesn't do it right
-sub isChanged {
- my ( $self, $name ) = @_;
- my $config = new Vyatta::Config;
-
- $config->setLevel("qos-policy priority-queue $name");
-
- foreach my $attr (qw(queue-limit queue-type)) {
- return "default $attr" if ( $config->isChanged("default $attr") );
- }
-
- my %classNodes = $config->listNodeStatus('class');
- while ( my ( $class, $status ) = each %classNodes ) {
- return "class $class" if ( $status ne 'static' );
-
- foreach my $attr (qw(queue-limit queue-type)) {
- return "class $class $attr"
- if ( $config->isChanged("class $class $attr") );
- }
-
- my %matchNodes = $config->listNodeStatus("class $class match");
- while ( my ( $match, $status ) = each %matchNodes ) {
- my $level = "class $class match $match";
- if ( $status ne 'static' ) {
- return $level;
- }
-
- foreach my $parm (
- (
- 'vif',
- 'interface',
- 'ip protocol',
- 'ip source address',
- 'ip destination address',
- 'ip source port',
- 'ip destination port'
- )
- )
- {
- return "$level $parm"
- if ( $config->isChanged("$level $parm") );
- }
- }
- }
-
- return; # false
-}
-
-1;