summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSaurabh Mohan <saurabh.mohan@vyatta.com>2012-08-09 13:24:40 -0700
committerSaurabh Mohan <saurabh.mohan@vyatta.com>2012-08-09 13:24:40 -0700
commitcfc534db10d57d7b733bedee63188abf1b214adb (patch)
tree9fd5af96d042ec5530a66abcacb95a71988504c4
parent4aa2f5175cd9c8763978daef3a9e95162e3a4c8d (diff)
downloadvyatta-cfg-qos-cfc534db10d57d7b733bedee63188abf1b214adb.tar.gz
vyatta-cfg-qos-cfc534db10d57d7b733bedee63188abf1b214adb.zip
Bugfix 8217: VTI: add traffic-policy cfg commands
Add support for interface vti for cfg commands for QOS.
-rw-r--r--debian/vyatta-cfg-qos.install1
-rwxr-xr-xgen-interface-templates.pl27
2 files changed, 24 insertions, 4 deletions
diff --git a/debian/vyatta-cfg-qos.install b/debian/vyatta-cfg-qos.install
index 0a79f6e..4efaa4c 100644
--- a/debian/vyatta-cfg-qos.install
+++ b/debian/vyatta-cfg-qos.install
@@ -11,5 +11,6 @@ opt/vyatta/share/vyatta-cfg/templates/interfaces/loopback
opt/vyatta/share/vyatta-cfg/templates/interfaces/openvpn
opt/vyatta/share/vyatta-cfg/templates/interfaces/pseudo-ethernet
opt/vyatta/share/vyatta-cfg/templates/interfaces/tunnel
+opt/vyatta/share/vyatta-cfg/templates/interfaces/vti
opt/vyatta/share/vyatta-cfg/templates/interfaces/wireless
opt/vyatta/share/vyatta-cfg/templates/interfaces/wirelessmodem
diff --git a/gen-interface-templates.pl b/gen-interface-templates.pl
index 06fe254..32e35b2 100755
--- a/gen-interface-templates.pl
+++ b/gen-interface-templates.pl
@@ -40,6 +40,7 @@ my %interface_hash = (
# 'pseudo-ethernet/node.tag/vif/node.tag' => '$VAR(../@).$VAR(@)',
'tunnel/node.tag' => '$VAR(@)',
+ 'vti/node.tag' => '$VAR(@)',
'bridge/node.tag' => '$VAR(@)',
'openvpn/node.tag' => '$VAR(@)',
'input/node.tag' => '$VAR(@)',
@@ -59,8 +60,14 @@ my %interface_hash = (
'serial/node.tag/ppp/vif/node.tag' => '$VAR(../../@).$VAR(@)',
);
+# Hash table to check if the priority needs to set @ root
+# of the node.def which is generated.
+my %interface_prio = (
+ 'vti/node.tag' => '901',
+);
+
sub gen_template {
- my ( $inpath, $outpath, $ifname, $iftree ) = @_;
+ my ( $inpath, $outpath, $ifname, $iftree, $gen_prio, $prio, $depth ) = @_;
print $outpath, "\n" if ($debug);
opendir my $d, $inpath
@@ -80,14 +87,18 @@ sub gen_template {
or mkdir($out)
or die "Can't create $out: $!";
- gen_template( $in, $out, $subif, $iftree);
+ gen_template( $in, $out, $subif, $iftree, $gen_prio, $prio, $depth+1);
next;
}
print "in: $in out: $out\n" if ($debug);
open my $inf, '<', $in or die "Can't open $in: $!";
open my $outf, '>', $out or die "Can't open $out: $!";
-
+
+ # For the top node.tag create the priority tag.
+ if ($name eq 'node.def' && $gen_prio == 1 && $depth <= 1) {
+ print $outf "priority: $prio\n";
+ }
while ( my $line = <$inf> ) {
$line =~ s#\$IFNAME#$ifname#;
next if (($line =~ /^update:/ || $line =~ /^delete:/) && $iftree =~ /openvpn/);
@@ -121,5 +132,13 @@ foreach my $if_tree ( keys %interface_hash ) {
or mkdir_p($outpath)
or die "Can't create $outpath:$!";
- gen_template( $inpath, $outpath, $interface_hash{$if_tree}, $if_tree );
+ my $gen_prio = 0;
+ my $prio = 0;
+ $gen_prio = 1 if (exists $interface_prio{ $if_tree });
+ if ($gen_prio == 1) {
+ $prio = $interface_prio{ $if_tree };
+ }
+
+ gen_template( $inpath, $outpath, $interface_hash{$if_tree}, $if_tree,
+ $gen_prio, $prio, 0 );
}