summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@vyatta.com>2012-07-13 13:53:51 -0700
committerStephen Hemminger <shemminger@vyatta.com>2012-07-13 16:06:31 -0700
commit3c68c870041d5e4e2be560db5ba9e5be08450df8 (patch)
treeb3d27b5a7372738caa02b655199a572b5ea434e1
parentdefc161a43dfa74b4de8d8289ca099a9d807d9b5 (diff)
downloadvyatta-cfg-qos-3c68c870041d5e4e2be560db5ba9e5be08450df8.tar.gz
vyatta-cfg-qos-3c68c870041d5e4e2be560db5ba9e5be08450df8.zip
Add support for priority-queue policy
Bug 3643 Enhancement to expose kernel priority queuing.
-rw-r--r--Makefile.am1
-rw-r--r--lib/Vyatta/Qos/Priority.pm118
-rw-r--r--lib/Vyatta/Qos/ShaperClass.pm5
-rw-r--r--lib/Vyatta/Qos/TrafficShaper.pm4
-rw-r--r--templates/traffic-policy/priority-queue/node.def8
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.def6
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/description/node.def2
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.def4
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/description/node.def2
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/destination/node.def2
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/node.def1
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/protocol/node.def15
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/source/node.def2
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/interface/node.def7
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/address/node.def2
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/node.def1
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/port/node.def5
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/dscp/node.def18
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/node.def2
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/protocol/node.def16
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/source/address/node.def2
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/source/node.def1
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/source/port/node.def6
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/destination/address/node.def2
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/destination/node.def1
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/destination/port/node.def5
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/dscp/node.def18
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/node.def1
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/protocol/node.def16
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/source/address/node.def2
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/source/node.def1
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/source/port/node.def6
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/mark/node.def2
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/vif/node.def5
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/priority/node.def5
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/queue-limit/node.def4
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/class/node.tag/queue-type/node.def11
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/default/node.def1
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/default/priority/node.def5
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/default/queue-limit/node.def4
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/default/queue-type/node.def8
-rw-r--r--templates/traffic-policy/priority-queue/node.tag/description/node.def2
42 files changed, 327 insertions, 2 deletions
diff --git a/Makefile.am b/Makefile.am
index fb904c6..0d15ff1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -18,6 +18,7 @@ share_perl5_DATA += lib/Vyatta/Qos/RoundRobin.pm
share_perl5_DATA += lib/Vyatta/Qos/NetworkEmulator.pm
share_perl5_DATA += lib/Vyatta/Qos/RandomDetect.pm
share_perl5_DATA += lib/Vyatta/Qos/TrafficLimiter.pm
+share_perl5_DATA += lib/Vyatta/Qos/Priority.pm
etcdir = /etc
etc_SCRIPTS =
diff --git a/lib/Vyatta/Qos/Priority.pm b/lib/Vyatta/Qos/Priority.pm
new file mode 100644
index 0000000..b148b1c
--- /dev/null
+++ b/lib/Vyatta/Qos/Priority.pm
@@ -0,0 +1,118 @@
+# Priority Queue
+#
+# **** 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;
+use POSIX;
+
+# Kernel limits on quantum (bytes)
+use constant {
+ MAXQUANTUM => 200000,
+ MINQUANTUM => 1000,
+};
+
+
+# Create a new instance based on config information
+sub new {
+ my ( $that, $config, $name ) = @_;
+ my $level = $config->setLevel();
+ my @classes = _getClasses($level);
+
+ my $self = {};
+ my $class = ref($that) || $that;
+ bless $self, $class;
+
+ $self->{_level} = $level;
+ $self->{_classes} = \@classes;
+ return $self;
+}
+
+sub _getClasses {
+ my $level = shift;
+ my @classes;
+ my $config = new Vyatta::Config;
+
+ $config->setLevel($level);
+ $config->exists("default")
+ or die "$level configuration not complete: missing default class\n";
+
+ $config->setLevel("$level default");
+ push @classes, new Vyatta::Qos::ShaperClass($config);
+ $config->setLevel($level);
+
+ foreach my $id ( $config->listNodes("class") ) {
+ $config->setLevel("$level class $id");
+ push @classes, new Vyatta::Qos::ShaperClass( $config, $id );
+ }
+
+ return @classes;
+}
+
+# Note: priority does not have internal classes, only sub-qdisc's
+#
+# Although Linux supports mapping TOS and priority to bands, this
+# is not used here. Instead we apply filters to traffic and statically
+# assign bands.
+sub commands {
+ my ( $self, $dev ) = @_;
+ my $classes = $self->{_classes};
+ my $default = shift @$classes;
+ my $maxid = 1;
+ my $bands = 2;
+
+ foreach my $class (@$classes) {
+ my $level = "$self->{_level} class $class->{id}";
+ $class->valid_leaf( $level );
+
+ # find largest class id
+ $maxid = $class->{id}
+ if ( defined $class->{id} && $class->{id} > $maxid );
+
+ # find largest priority
+ my $prio = $class->{_priority};
+
+ $bands = $prio + 1
+ if ( defined $prio && $prio >= $bands);
+ }
+
+ # fill in id of default
+ $default->{id} = ++$maxid;
+ unshift @$classes, $default;
+
+ my $parent = 1;
+ my $root = "root";
+
+ # Since we use filters to set priority
+ printf "qdisc add dev %s %s handle %x: prio bands %d\n",
+ $dev, $root, $parent, $bands;
+
+ # prio is not really classful!
+ foreach my $class (@$classes) {
+ $class->gen_leaf( $dev, $parent );
+
+ my $prio = 1;
+ foreach my $match ( $class->matchRules() ) {
+ $match->filter( $dev, $parent, $class->{id}, $prio++ );
+ }
+ }
+}
+
+1;
diff --git a/lib/Vyatta/Qos/ShaperClass.pm b/lib/Vyatta/Qos/ShaperClass.pm
index 4afd90c..1cb7fbe 100644
--- a/lib/Vyatta/Qos/ShaperClass.pm
+++ b/lib/Vyatta/Qos/ShaperClass.pm
@@ -234,6 +234,10 @@ sub rateCheck {
$rate / 1000;
exit 1;
}
+}
+
+sub valid_leaf {
+ my ($self, $level, $rate) = @_;
my $qtype = $self->{_qdisc};
my $q = $qdiscValidate{$qtype};
@@ -268,7 +272,6 @@ sub gen_class {
print " quantum $quantum" if ($quantum);
print " burst $self->{_burst}" if ( $self->{_burst} );
print " prio $self->{_priority}" if ( $self->{_priority} );
-
print "\n";
}
diff --git a/lib/Vyatta/Qos/TrafficShaper.pm b/lib/Vyatta/Qos/TrafficShaper.pm
index 3fd687a..5e365c5 100644
--- a/lib/Vyatta/Qos/TrafficShaper.pm
+++ b/lib/Vyatta/Qos/TrafficShaper.pm
@@ -144,7 +144,9 @@ sub commands {
$default->rateCheck( $rate, "$self->{_level} default" );
foreach my $class (@$classes) {
- $class->rateCheck( $rate, "$self->{_level} class $class->{id}" );
+ my $level = "$self->{_level} class $class->{id}";
+ $class->rateCheck( $rate, $level );
+ $class->valid_leaf( $level );
# find largest class id
if ( defined $class->{id} && $class->{id} > $maxid ) {
diff --git a/templates/traffic-policy/priority-queue/node.def b/templates/traffic-policy/priority-queue/node.def
new file mode 100644
index 0000000..b848108
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.def
@@ -0,0 +1,8 @@
+tag:
+type: txt
+help: Priority queuing based policy
+syntax:expression: pattern $VAR(@) "^[[:alnum:]][-_[:alnum:]]*$"
+ ; "only alpha-numeric policy name allowed"
+create: /opt/vyatta/sbin/vyatta-qos.pl --create-policy $VAR(.) $VAR(@)
+delete: /opt/vyatta/sbin/vyatta-qos.pl --delete-policy $VAR(@)
+end: /opt/vyatta/sbin/vyatta-qos.pl --apply-policy $VAR(@)
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.def
new file mode 100644
index 0000000..1e9ae0b
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.def
@@ -0,0 +1,6 @@
+tag:
+type: u32
+help: Class handle
+syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 4095; \
+ "Class identifier must be between 1 and 4095"
+val_help: u32:1-4095; Class identifier
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/description/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/description/node.def
new file mode 100644
index 0000000..9a24868
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/description/node.def
@@ -0,0 +1,2 @@
+type: txt
+help: Description for this traffic class
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.def
new file mode 100644
index 0000000..cde128f
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.def
@@ -0,0 +1,4 @@
+tag:
+type: txt
+syntax:expression: pattern $VAR(@) "^[^-]" ; "Match queue name cannot start with \"-\""
+help: Class matching rule name
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/description/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/description/node.def
new file mode 100644
index 0000000..903f260
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/description/node.def
@@ -0,0 +1,2 @@
+type: txt
+help: Description for this match
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/destination/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/destination/node.def
new file mode 100644
index 0000000..92fb9a9
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/destination/node.def
@@ -0,0 +1,2 @@
+type: macaddr
+help: Ethernet destination address for this match
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/node.def
new file mode 100644
index 0000000..454c1ed
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/node.def
@@ -0,0 +1 @@
+help: Ethernet header match
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/protocol/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/protocol/node.def
new file mode 100644
index 0000000..9da50a6
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/protocol/node.def
@@ -0,0 +1,15 @@
+type: txt
+help: Ethernet protocol for this match
+allowed: echo \
+ all 802.1Q 802_2 802_3 aarp aoe arp atalk \
+ dec ip ipv6 ipx lat localtalk rarp snap x25
+
+val_help: u32:0-65535; Ethernet protocol number
+val_help: txt; Ethernet protocol name
+val_help: all; Any protocol
+val_help: ip; Internet IP (IPv4)
+val_help: _ipv6; Internet IP (IPv6)
+val_help: arp; Address Resolution Protocol
+val_help: atalk; Appletalk
+val_help: ipx; Novell Internet Packet Exchange
+val_help: 802.1Q; 802.1Q VLAN tag
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/source/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/source/node.def
new file mode 100644
index 0000000..3094167
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ether/source/node.def
@@ -0,0 +1,2 @@
+type: macaddr
+help: Ethernet source address for this match
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/interface/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/interface/node.def
new file mode 100644
index 0000000..f12c59c
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/interface/node.def
@@ -0,0 +1,7 @@
+type: txt
+help: Interface name for this match
+syntax:expression: exec "[ -f /sys/class/net/$VAR(@)/ifindex ]" ; "Interface must already exist"
+allowed: local -a array
+ array=( /sys/class/net/* )
+ echo -n ${array[@]##*/}
+
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/address/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/address/node.def
new file mode 100644
index 0000000..8d02285
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/address/node.def
@@ -0,0 +1,2 @@
+type: ipv4net
+help: IP destination address for this match
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/node.def
new file mode 100644
index 0000000..54eef5b
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/node.def
@@ -0,0 +1 @@
+help: Match on destination port or address
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/port/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/port/node.def
new file mode 100644
index 0000000..fc85c5f
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/destination/port/node.def
@@ -0,0 +1,5 @@
+type: txt
+help: TCP (or UDP) destination port for this match
+
+val_help: u32:1-65535; Numeric IP port
+val_help: txt; Assigned TCP (or UDP) port name
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/dscp/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/dscp/node.def
new file mode 100644
index 0000000..224b002
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/dscp/node.def
@@ -0,0 +1,18 @@
+type: txt
+help: Match on Differentiated Services Codepoint (DSCP)
+syntax:expression: exec "/opt/vyatta/sbin/vyatta-qos-util.pl --dscp $VAR(@)"
+allowed: awk '
+ /^#/ { next }
+ { printf "%s ", $2 }' </etc/iproute2/rt_dsfield
+val_help: u32:0-63;Differentiated Services Codepoint (DSCP) value
+val_help: default; match DSCP (000000)
+val_help: reliability; match; DSCP (000001)
+val_help: throughput; match; DSCP (000010)
+val_help: lowdelay; match; DSCP (000100)
+val_help: priority; match; DSCP (001000)
+val_help: immediate; match; DSCP (010000)
+val_help: flash; match DSCP (011000)
+val_help: flash-override; match DSCP (100000)
+val_help: critical; match DSCP (101000)
+val_help: internet; match; DSCP (110000)
+val_help: network; match; DSCP (111000)
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/node.def
new file mode 100644
index 0000000..517dc71
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/node.def
@@ -0,0 +1,2 @@
+help: Match IP protocol header
+
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/protocol/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/protocol/node.def
new file mode 100644
index 0000000..b0ef59f
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/protocol/node.def
@@ -0,0 +1,16 @@
+type: txt
+help: Match IP protocol name or number
+syntax:expression: exec "/opt/vyatta/sbin/vyatta-qos-util.pl --protocol $VAR(@)"
+allowed: awk '
+ /^#/ { next }
+ { if($1 != "ip") printf "%s ", $1 }' </etc/protocols
+val_help: u32:0-255; IP protocol value
+val_help: icmp; Internet Control Message Protocol
+val_help: igmp; Internet Group Management Protocol
+val_help: ggp; Gateway-Gateway protocol
+val_help: tcp; Transmission Control Protocol
+val_help: egp; Exterior Gateway Protocol
+val_help: udp; User Datagram Protocol
+val_help: gre; General Routing Encapsulation
+val_help: ospf; Open Shortest Path First IGP
+val_help: sctp; Stream Control Transmission Protocol
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/source/address/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/source/address/node.def
new file mode 100644
index 0000000..6053344
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/source/address/node.def
@@ -0,0 +1,2 @@
+type: ipv4net
+help: IP source address for this match
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/source/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/source/node.def
new file mode 100644
index 0000000..4271b94
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/source/node.def
@@ -0,0 +1 @@
+help: Match on source port or address
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/source/port/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/source/port/node.def
new file mode 100644
index 0000000..6d211d1
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ip/source/port/node.def
@@ -0,0 +1,6 @@
+type: txt
+help: TCP (or UDP) source port for this match
+
+val_help: u32:1-65535; Numeric IP port
+val_help: txt; Assigned TCP (or UDP) port name
+
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/destination/address/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/destination/address/node.def
new file mode 100644
index 0000000..3fbbc31
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/destination/address/node.def
@@ -0,0 +1,2 @@
+type: ipv6net
+help: IP destination address for this match
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/destination/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/destination/node.def
new file mode 100644
index 0000000..54eef5b
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/destination/node.def
@@ -0,0 +1 @@
+help: Match on destination port or address
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/destination/port/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/destination/port/node.def
new file mode 100644
index 0000000..fc85c5f
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/destination/port/node.def
@@ -0,0 +1,5 @@
+type: txt
+help: TCP (or UDP) destination port for this match
+
+val_help: u32:1-65535; Numeric IP port
+val_help: txt; Assigned TCP (or UDP) port name
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/dscp/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/dscp/node.def
new file mode 100644
index 0000000..224b002
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/dscp/node.def
@@ -0,0 +1,18 @@
+type: txt
+help: Match on Differentiated Services Codepoint (DSCP)
+syntax:expression: exec "/opt/vyatta/sbin/vyatta-qos-util.pl --dscp $VAR(@)"
+allowed: awk '
+ /^#/ { next }
+ { printf "%s ", $2 }' </etc/iproute2/rt_dsfield
+val_help: u32:0-63;Differentiated Services Codepoint (DSCP) value
+val_help: default; match DSCP (000000)
+val_help: reliability; match; DSCP (000001)
+val_help: throughput; match; DSCP (000010)
+val_help: lowdelay; match; DSCP (000100)
+val_help: priority; match; DSCP (001000)
+val_help: immediate; match; DSCP (010000)
+val_help: flash; match DSCP (011000)
+val_help: flash-override; match DSCP (100000)
+val_help: critical; match DSCP (101000)
+val_help: internet; match; DSCP (110000)
+val_help: network; match; DSCP (111000)
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/node.def
new file mode 100644
index 0000000..8ff47bb
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/node.def
@@ -0,0 +1 @@
+help: Match IPV6 header
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/protocol/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/protocol/node.def
new file mode 100644
index 0000000..355c6a6
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/protocol/node.def
@@ -0,0 +1,16 @@
+type: txt
+help: Match IP protocol name or number
+syntax:expression: exec "/opt/vyatta/sbin/vyatta-qos-util.pl --protocol $VAR(@)"
+allowed: awk '
+ /^#/ { next }
+ { printf "%s ", $1 }' </etc/protocols
+val_help: u32:0-255; IP protocol value
+val_help: icmp; Internet Control Message Protocol
+val_help: igmp; Internet Group Management Protocol
+val_help: ggp; Gateway-Gateway protocol
+val_help: tcp; Transmission Control Protocol
+val_help: egp; Exterior Gateway Protocol
+val_help: udp; User Datagram Protocol
+val_help: gre; General Routing Encapsulation
+val_help: ospf; Open Shortest Path First IGP
+val_help: sctp; Stream Control Transmission Protocol
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/source/address/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/source/address/node.def
new file mode 100644
index 0000000..9071a74
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/source/address/node.def
@@ -0,0 +1,2 @@
+type: ipv6net
+help: IP source address for this match
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/source/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/source/node.def
new file mode 100644
index 0000000..4271b94
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/source/node.def
@@ -0,0 +1 @@
+help: Match on source port or address
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/source/port/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/source/port/node.def
new file mode 100644
index 0000000..6d211d1
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/ipv6/source/port/node.def
@@ -0,0 +1,6 @@
+type: txt
+help: TCP (or UDP) source port for this match
+
+val_help: u32:1-65535; Numeric IP port
+val_help: txt; Assigned TCP (or UDP) port name
+
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/mark/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/mark/node.def
new file mode 100644
index 0000000..a3a805e
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/mark/node.def
@@ -0,0 +1,2 @@
+type: u32
+help: Match on mark applied by firewall
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/vif/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/vif/node.def
new file mode 100644
index 0000000..d975074
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/match/node.tag/vif/node.def
@@ -0,0 +1,5 @@
+type: u32
+help: Virtual Local Area Network (VLAN) ID for this match
+syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 4095; \
+ "VLAN ID must be between 0 and 4095"
+val_help: u32:0-4095; Virtual Local Area Network (VLAN) tag
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/priority/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/priority/node.def
new file mode 100644
index 0000000..6cacb22
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/priority/node.def
@@ -0,0 +1,5 @@
+type: u32
+help: Priority for usage of excess bandwidth
+syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 7 ;\
+ "priority must be between 0 than 7"
+val_help: u32:0-7; Priority order for bandwidth pool
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/queue-limit/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/queue-limit/node.def
new file mode 100644
index 0000000..bf011c2
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/queue-limit/node.def
@@ -0,0 +1,4 @@
+type: u32
+help: Maximum queue size (packets)
+syntax:expression: $VAR(@) > 0 ; "queue limit must be greater than zero"
+val_help: u32:1-4294967295; Queue size in packets
diff --git a/templates/traffic-policy/priority-queue/node.tag/class/node.tag/queue-type/node.def b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/queue-type/node.def
new file mode 100644
index 0000000..6b44648
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/class/node.tag/queue-type/node.def
@@ -0,0 +1,11 @@
+type: txt
+default: "fair-queue"
+syntax:expression: $VAR(@) in "fair-queue", "priority", "drop-tail", "random-detect";\
+ "Unknown queue-type"
+help: Queue type for this class
+
+val_help: fair-queue; Stochastic Fair Queue (SFQ)
+val_help: drop-tail; First-In-First-Out (FIFO)
+val_help: priority; Priority queueing based on DSCP
+val_help: random-detect; Random Early Detection (RED)
+
diff --git a/templates/traffic-policy/priority-queue/node.tag/default/node.def b/templates/traffic-policy/priority-queue/node.tag/default/node.def
new file mode 100644
index 0000000..142cba3
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/default/node.def
@@ -0,0 +1 @@
+help: Default policy
diff --git a/templates/traffic-policy/priority-queue/node.tag/default/priority/node.def b/templates/traffic-policy/priority-queue/node.tag/default/priority/node.def
new file mode 100644
index 0000000..c46ee3e
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/default/priority/node.def
@@ -0,0 +1,5 @@
+type: u32
+help: Priority for this queue
+syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 7 ;\
+ "priority must be between 0 than 7"
+val_help: u32:0-7; Priority
diff --git a/templates/traffic-policy/priority-queue/node.tag/default/queue-limit/node.def b/templates/traffic-policy/priority-queue/node.tag/default/queue-limit/node.def
new file mode 100644
index 0000000..7b07913
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/default/queue-limit/node.def
@@ -0,0 +1,4 @@
+type: u32
+help: Maximum queue size (packets)
+syntax:expression: $VAR(@) > 0; "Queue limit must be greater than zero"
+val_help: u32:1-4294967295; Queue size in packets
diff --git a/templates/traffic-policy/priority-queue/node.tag/default/queue-type/node.def b/templates/traffic-policy/priority-queue/node.tag/default/queue-type/node.def
new file mode 100644
index 0000000..e4283ab
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/default/queue-type/node.def
@@ -0,0 +1,8 @@
+type: txt
+default: "fair-queue"
+syntax:expression: $VAR(@) in "fair-queue", "priority", "drop-tail", "random-detect";\
+ "Unknown queue-type"
+help: Queue type for default traffic
+val_help: fair-queue; Stochastic Fair Queue (SFQ)
+val_help: drop-tail; First-In-First-Out (FIFO)
+val_help: random-detect; Random Early Detection (RED)
diff --git a/templates/traffic-policy/priority-queue/node.tag/description/node.def b/templates/traffic-policy/priority-queue/node.tag/description/node.def
new file mode 100644
index 0000000..1da9e34
--- /dev/null
+++ b/templates/traffic-policy/priority-queue/node.tag/description/node.def
@@ -0,0 +1,2 @@
+type: txt
+help: Description for this queuing policy