summaryrefslogtreecommitdiff
path: root/gen-interface-templates.pl
diff options
context:
space:
mode:
authorRobert Bays <robert@vyatta.com>2012-09-02 17:45:41 -0700
committerRobert Bays <robert@vyatta.com>2012-09-02 17:45:41 -0700
commit9da0929d8fe619e7a50f6507b488600080ffe1b5 (patch)
treeb37897cf8c9af9ff800b5b816533af92afae55dc /gen-interface-templates.pl
parent71381582340b72ac57f18f55f1e7a3d68e04a480 (diff)
parent41563446646940ded446e480a26554f7b6b2d0b9 (diff)
downloadvyatta-cfg-quagga-9da0929d8fe619e7a50f6507b488600080ffe1b5.tar.gz
vyatta-cfg-quagga-9da0929d8fe619e7a50f6507b488600080ffe1b5.zip
Merge branch 'pacifica' of http://git.vyatta.com/vyatta-cfg-quagga into pbrpbr
Diffstat (limited to 'gen-interface-templates.pl')
-rwxr-xr-xgen-interface-templates.pl25
1 files changed, 22 insertions, 3 deletions
diff --git a/gen-interface-templates.pl b/gen-interface-templates.pl
index 8cd074ad..48220321 100755
--- a/gen-interface-templates.pl
+++ b/gen-interface-templates.pl
@@ -41,6 +41,7 @@ my %interface_hash = (
'bonding/node.tag' => '$VAR(@)',
'bonding/node.tag/vif/node.tag' => '$VAR(../@).$VAR(@)',
'tunnel/node.tag' => '$VAR(@)',
+ 'vti/node.tag' => '$VAR(@)',
'bridge/node.tag' => '$VAR(@)',
'openvpn/node.tag' => '$VAR(@)',
'wirelessmodem/node.tag' => '$VAR(@)',
@@ -59,8 +60,14 @@ my %interface_hash = (
'dataplane/node.tag/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 ) = @_;
+ my ( $inpath, $outpath, $ifname, $gen_prio, $prio, $depth ) = @_;
print $outpath, "\n" if ($debug);
opendir my $d, $inpath
@@ -80,7 +87,7 @@ sub gen_template {
or mkdir($out)
or die "Can't create $out: $!";
- gen_template( $in, $out, $subif );
+ gen_template( $in, $out, $subif, $gen_prio, $prio, $depth+1);
next;
}
@@ -88,6 +95,10 @@ sub gen_template {
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#;
print $outf $line;
@@ -120,5 +131,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} );
+ 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},
+ $gen_prio, $prio, 0 );
}