diff options
88 files changed, 739 insertions, 1528 deletions
diff --git a/Makefile.am b/Makefile.am index 50f47de0..836a94ac 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,3 +1,4 @@ +share_perl5dir = /opt/vyatta/share/perl5/Vyatta/Quagga cfgdir = $(datadir)/vyatta-cfg/templates curverdir = $(sysconfdir)/config-migrate/current gentmpdir = generated-templates @@ -14,6 +15,8 @@ sbin_SCRIPTS += scripts/vyatta-link-detect sbin_PROGRAMS = src/check_prefix_boundary +share_perl5_DATA = lib/Vyatta/Quagga/Config.pm + src_check_prefix_boundary = src/check_prefix_boundary.c curver_DATA = cfg-version/quagga@1 diff --git a/lib/Vyatta/Quagga/Config.pm b/lib/Vyatta/Quagga/Config.pm new file mode 100644 index 00000000..107731fe --- /dev/null +++ b/lib/Vyatta/Quagga/Config.pm @@ -0,0 +1,378 @@ +# Author: Robert Bays <robert@vyatta.com> +# Date: 2010 +# Description: interface between Vyatta templates and Quagga vtysh + +# **** 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) 2010 Vyatta, Inc. +# All Rights Reserved. +# **** End License **** + +package Vyatta::Quagga::Config; + +use strict; +use warnings; + +use lib "/opt/vyatta/share/perl5/"; +use Vyatta::Config; + +my $_DEBUG = 0; +my %_vtysh; +my %_vtyshdel; +my $_qcomref = ''; +my $_qcomdelref = ''; + +### Public methods - +# Create the class. +# input: $1 - level of the Vyatta config tree to start at +# $2 - hashref to Quagga add/change command templates +# $3 - hashref to Quagga delete command templates +sub new { + my $that = shift; + my $class = ref ($that) || $that; + my $self = { + _level => shift, + _qcref => shift, + _qcdref => shift, + }; + + $_qcomref = $self->{_qcref}; + $_qcomdelref = $self->{_qcdref}; + + if (! _qtree($self->{_level}, 'delete')) { return 0; } + if (! _qtree($self->{_level}, 'set')) { return 0; } + + bless $self, $class; + return $self; +} + +# Set/check debug level +# input: $1 - debug level +sub setDebugLevel { + my ($self, $level) = @_; + if ($level > 0) { + $_DEBUG = $level; + return $level; + } + return 0; +} + +# reinitialize the vtysh hashes for troublshooting tree +# walk post object creation +sub _reInitialize { + my ($self) = @_; + + %_vtysh = (); + %_vtyshdel = (); + _qtree($self->{_level}, 'delete'); + _qtree($self->{_level}, 'set'); +} + +# populate an array reference with Quagga commands +sub returnQuaggaCommands { + my ($self, $arrayref) = @_; + my $key; + my $string; + + foreach $key (sort { $b cmp $a } keys %_vtyshdel) { + foreach $string (@{$_vtyshdel{$key}}) { + push @{$arrayref}, "$string"; + } + } + + foreach $key (sort keys %_vtysh) { + foreach $string (@{$_vtysh{$key}}) { + push @{$arrayref}, "$string"; + } + } + + return 1; +} + +# methods to send the commands to Quagga +sub setConfigTree { + my ($self, $level) = @_; + if (_setConfigTree($level, 0, 0)) { return 1; } + return 0; +} + +sub setConfigTreeRecursive { + my ($self, $level) = @_; + if (_setConfigTree($level, 0, 1)) { return 1; } + return 0; +} + +sub deleteConfigTree { + my ($self, $level) = @_; + if (_setConfigTree($level, 1, 0)) { return 1; } + return 0; +} + +sub deleteConfigTreeRecursive { + my ($self, $level) = @_; + if (_setConfigTree($level, 1, 1)) { return 1; } + return 0; +} + +### End Public methods - +### Private methods +# traverse the set/delete trees and send commands to quagga +# set traverses from $level in tree top down. +# delete traverses from bottom up in tree to $level. +# execute commands in tree one at a time. If there is an error in vtysh, +# fail. otherwise, remove command from tree on success as we may traverse +# this portion of the tree again otherwise. +# input: $1 - level of the tree to start at +# $2 - delete bool +# $3 - recursive bool +# output: none, return failure if needed +sub _setConfigTree { + my ($level, $delete, $recurse) = @_; + + if ((! defined $level) || + (! defined $delete) || + (! defined $recurse)) { return 0; } + + # default tree is the set vtysh hash + my $vtyshref = \%_vtysh; + # default tree walk order is top down + my $sortfunc = \&cmpf; + + # if this is delete, use delete vtysh hash and walk the tree bottom up + if ($delete) { + $vtyshref = \%_vtyshdel; + $sortfunc = \&cmpb; + } + + if ($_DEBUG >= 3) { print "DEBUG: _setConfigTree - enter - level: $level\tdelete: $delete\trecurse: $recurse\n"; } + + my $key; + my @keys; + foreach $key (sort $sortfunc keys %$vtyshref) { + if ($_DEBUG >= 3) { print "DEBUG: _setConfigTree - key $key\n"; } + + if ((($recurse) && ($key =~ /^$level/)) || ((! $recurse) && ($key =~ /^$level$/))) { + my ($index, $cmd); + $index = 0; + foreach $cmd (@{$vtyshref->{$key}}) { + if ($_DEBUG >= 2) { print "DEBUG: _setConfigTree - key: $key \t cmd: $cmd\n"; } + + if (! _sendQuaggaCommand("$cmd")) { return 0; } + # remove this command so we don't hit it again in another Recurse call + delete ${$vtyshref->{$key}}[$index]; + $index++; + } + } + } + + return 1; +} + +# sort subs for _setConfigTree +sub cmpf { $a cmp $b } +sub cmpb { $b cmp $a } + +# properly format a Quagga command for vtysh and send to Quagga +# input: $1 - qVarReplaced Quagga Command string +# output: none, return failure if needed +sub _sendQuaggaCommand { + my ($command) = @_; + my $section; + my $args = "/usr/sbin/vtysh --noerr -c 'configure terminal' "; + + my @commands = split / ; /, $command; + foreach $section (@commands) { + $args .= "-c '$section' "; + } + + if ($_DEBUG >= 2) { print "DEBUG: _sendQuaggaCommand - args prior to system call - $args\n"; } + system("$args"); + if ($? != 0) { + # TODO: note that DEBUG will never happen here with --noerr as an argument. + # need to fix --noerr. Also probably need to code a way to conditionally use --noerr. + if ($_DEBUG) { + print "DEBUG: _sendQuaggaCommand - vtysh failure $? - $args\n"; + print "\n"; + } + return 0; + } + + return 1; +} + +# translate a Vyatta config tree into a Quagga command using %qcom as a template. +# input: $1 - Vyatta config tree string +# $2 - Quagga command template string +# output: Quagga command suitable for vtysh as defined by %qcom. +sub _qVarReplace { + my $node = shift; + my $qcommand = shift; + + if ($_DEBUG >= 2) { + print "DEBUG: _qVarReplace entry: node - $node\n"; + print "DEBUG: _qVarReplace entry: qcommand - $qcommand\n"; + } + my @nodes = split /\s/, $node; + my @qcommands = split /\s/, $qcommand; + + my $result = ''; + my $token; + # try to replace (#num, ?var) references foreach item in Quagga command template array + # with their corresponding value in Vyatta command array at (#num) index + foreach $token (@qcommands) { + # is this a #var reference? if so translate and append to result + if ($token =~ s/\#(\d+);*/$1/) { + $token--; + $result="$result $nodes[$token]"; + } + # is this a ?var reference? if so check for existance of the var in Vyatta Config + # tree and conditionally append. append token + value. These conditional vars + # will only work at EOL in template string. + elsif ($token =~ s/\?(\w+);*/$1/) { + # TODO: Vyatta::Config needs to be fixed to accept level in constructor + my $config = new Vyatta::Config; + $config->setLevel($node); + my $value = $config->returnValue($token); + if ($value) { $result = "$result $token $value"; } + elsif ($config->exists($token)) { $result = "$result $token"; } + } + # is this a @var reference? if so, append just the value instead of token + value + elsif ($token =~ s/\@(\w+);*/$1/) { + my $config = new Vyatta::Config; + $config->setLevel($node); + my $value = $config->returnValue($token); + if ($value) { $result = "$result $value"; } + } + # if not, just append string to result + else { + $result = "$result $token"; + } + } + + # remove leading space characters + $result =~ s/^\s(.+)/$1/; + if ($_DEBUG >= 2) { + print "DEBUG: _qVarReplace exit: result - $result\n"; + } + + return $result; +} + +# For given Vyatta config tree string, find a corresponding Quagga command template +# string as defined in correctly referenced %qcom. i.e. add or delete %qcom. +# input: $1 - Vyatta config tree string +# $2 - Quagga command template hash +# output: %qcom hash key to corresponding Quagga command template string +sub _qCommandFind { + my $vyattaconfig = shift; + my $qcom = shift; + my $token = ''; + my $command = ''; + + my @nodes = split /\s+/, $vyattaconfig; + + # append each token in the Vyatta config tree. sequentially + # check if there is a corresponding hash in %qcom. if not, + # do same check again replacing the end param with var to see + # if this is a var replacement + foreach $token (@nodes) { + if (exists $qcom->{$token}) { $command = $token; } + elsif (exists $qcom->{"$command $token"}) { $command = "$command $token"; } + elsif (exists $qcom->{"$command var"}) { $command = "$command var"; } + else { return undef; } + } + + # return hash key if Quagga command template string is found + if (defined $qcom->{$command}) { return $command; } + else { return undef; } +} + +# translate the adds/changes in a Vyatta config tree into Quagga vtysh commands. +# recursively walks the tree. +# input: $1 - the level of the Vyatta config tree to start at +# $2 - the action (set|delete) +# output: none - creates the %vtysh that contains the Quagga add commands +sub _qtree { + my ($level, $action) = @_; + my @nodes; + my ($qcom, $vtysh); + + + # It's ugly that I have to create a new Vyatta config object every time, + # but something gets messed up on the stack if I don't. not sure + # what yet. would love to reference a global config and just reset Level. + my $config = new Vyatta::Config; + $config->setLevel($level); + + # setup references for set or delete action + if ($action eq 'set') { + $qcom = $_qcomref; + $vtysh = \%_vtysh; + + @nodes = $config->listNodes(); + } + else { + $qcom = $_qcomdelref; + $vtysh = \%_vtyshdel; + + @nodes = $config->listDeleted(); + } + + if ($_DEBUG) { print "DEBUG: _qtree - action: $action\tlevel: $level\n"; } + + # traverse the Vyatta config tree and translate to Quagga commands where apropos + if (@nodes > 0) { + my $node; + foreach $node (@nodes) { + if ($_DEBUG >= 2) { print "DEBUG: _qtree - foreach node loop - node $node\n"; } + + # for set action, need to check that the node was actually changed. Otherwise + # we end up re-writing every node to Quagga every commit, which is bad. Mmm' ok? + if (($action eq 'delete') || ($config->isChanged("$node"))) { + # is there a Quagga command template? + # TODO: need to add function reference support to qcom hash for complicated nodes + my $qcommand = _qCommandFind("$level $node", $qcom); + + # if I found a Quagga command template, then replace any vars + if ($qcommand) { + # get the apropos config value so we can use it in the Quagga command template + my $val = undef; + if ($action eq 'set') { $val = $config->returnValue($node); } + else { $val = $config->returnOrigValue($node); } + + # is this a leaf node? + if ($val) { + my $var = _qVarReplace("$level $node $val", $qcom->{$qcommand}); + push @{$vtysh->{"$qcommand"}}, $var; + if ($_DEBUG) { + print "DEBUG: _qtree leaf node command: set $level $action $node $val \n\t\t\t\t\t$var\n"; + } + } + else { + my $var = _qVarReplace("$level $node", $qcom->{$qcommand}); + push @{$vtysh->{"$qcommand"}}, $var; + if ($_DEBUG) { + print "DEBUG: _qtree node command: set $level $action $node \n\t\t\t\t$var\n"; + } + } + } + } + # recurse to next level in tree + _qtree("$level $node", 'delete'); + _qtree("$level $node", 'set'); + } + } + + return 1; +} + +return 1; diff --git a/scripts/bgp/vyatta-bgp.pl b/scripts/bgp/vyatta-bgp.pl index 2f541407..69518b28 100755 --- a/scripts/bgp/vyatta-bgp.pl +++ b/scripts/bgp/vyatta-bgp.pl @@ -1,13 +1,308 @@ #!/usr/bin/perl +# **** 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. +# +# A copy of the GNU General Public License is available as +# `/usr/share/common-licenses/GPL' in the Debian GNU/Linux distribution +# or on the World Wide Web at `http://www.gnu.org/copyleft/gpl.html'. +# You can also obtain it by writing to the Free Software Foundation, +# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, +# MA 02110-1301, USA. +# +# This code was originally developed by Vyatta, Inc. +# Portions created by Vyatta are Copyright (C) 2009,2010 Vyatta, Inc. +# All Rights Reserved. +# +# Author: Various +# Date: 2009-2010 +# Description: Script to setup Quagga BGP configuration +# +# **** End License **** +# + use strict; +use warnings; + +use Getopt::Long; +use NetAddr::IP::Lite; + use lib "/opt/vyatta/share/perl5/"; use Vyatta::Config; +use Vyatta::Quagga::Config; use Vyatta::Misc; -use Getopt::Long; -use NetAddr::IP::Lite; + +my %qcom = ( + "protocols" => undef, + "protocols bgp" => undef, + "protocols bgp var" => "router bgp #3", + "protocols bgp var aggregate-address" => undef, + "protocols bgp var aggregate-address var" => "router bgp #3 ; no aggregate-address #5 ; aggregate-address #5 ?as-set ?summary-only", + "protocols bgp var ipv6" => undef, + "protocols bgp var ipv6 aggregate-address" => undef, + "protocols bgp var ipv6 aggregate-address var" => "router bgp #3 ; no ipv6 bgp aggregate-address #6 ; ipv6 bgp aggregate-address #6 ?summary-only", + "protocols bgp var ipv6 network" => "router bgp #3 ; no ipv6 bgp network #6 ; ipv6 bgp network #6", + "protocols bgp var ipv6 redistribute" => undef, + "protocols bgp var ipv6 redistribute connected" => "router bgp #3 ; address-family ipv6 ; redistribute connected", + "protocols bgp var ipv6 redistribute connected metric" => "router bgp #3 ; address-family ipv6 ; redistribute connected metric #8", + "protocols bgp var ipv6 redistribute connected route-map" => "router bgp #3 ; address-family ipv6 ; redistribute connected route-map #8", + "protocols bgp var ipv6 redistribute kernel" => "router bgp #3 ; address-family ipv6 ; redistribute kernel", + "protocols bgp var ipv6 redistribute kernel metric" => "router bgp #3 ; address-family ipv6 ; redistribute kernel metric #8", + "protocols bgp var ipv6 redistribute kernel route-map" => "router bgp #3 ; address-family ipv6 ; redistribute kernel route-map #8", + "protocols bgp var ipv6 redistribute ospfv3" => "router bgp #3 ; address-family ipv6 ; redistribute ospfv3", + "protocols bgp var ipv6 redistribute ospfv3 metric" => "router bgp #3 ; address-family ipv6 ; redistribute ospfv3 metric #8", + "protocols bgp var ipv6 redistribute ospfv3 route-map" => "router bgp #3 ; address-family ipv6 ; redistribute ospfv3 route-map #8", + "protocols bgp var ipv6 redistribute ripng" => "router bgp #3 ; address-family ipv6 ; redistribute ripng", + "protocols bgp var ipv6 redistribute ripng metric" => "router bgp #3 ; address-family ipv6 ; redistribute ripng metric #8", + "protocols bgp var ipv6 redistribute ripng route-map" => "router bgp #3 ; address-family ipv6 ; redistribute ripng route-map #8", + "protocols bgp var ipv6 redistribute static" => "router bgp #3 ; address-family ipv6 ; redistribute static", + "protocols bgp var ipv6 redistribute static metric" => "router bgp #3 ; address-family ipv6 ; redistribute static metric #8", + "protocols bgp var ipv6 redistribute static route-map" => "router bgp #3 ; address-family ipv6 ; redistribute static route-map #8", + "protocols bgp var neighbor" => undef, + "protocols bgp var neighbor var" => "router bgp #3 ; neighbor #5", + "protocols bgp var neighbor var advertisement-interval" => "router bgp #3 ; neighbor #5 advertisement-interval #7", + # allowas-in as a standalone means any number of times. append number and you will only accept local-as N number of times in as-path + "protocols bgp var neighbor var allowas-in" => "router bgp #3 ; neighbor #5 allowas-in", + # default is 3, default won't be shown in quagga + "protocols bgp var neighbor var allowas-in number" => "router bgp #3 ; neighbor #5 allowas-in #8", + # it looks like "attribute-unchanged" as a standalone is really "attribute-unchanged as-path med next-hop" + "protocols bgp var neighbor var attribute-unchanged" => "router bgp #3 ; no neighbor #5 attribute-unchanged ; neighbor #5 attribute-unchanged ?as-path ?med ?next-hop", + "protocols bgp var neighbor var capability" => undef, + "protocols bgp var neighbor var capability dynamic" => "router bgp #3 ; neighbor #5 capability dynamic", + "protocols bgp var neighbor var capability orf" => undef, + "protocols bgp var neighbor var capability orf prefix-list" => undef, + # if both send and receive are sent then this gets translated to both in Quagga config. Doesn't mess up the delete though. + "protocols bgp var neighbor var capability orf prefix-list receive" => "router bgp #3 ; neighbor #5 capability orf prefix-list receive", + "protocols bgp var neighbor var capability orf prefix-list send" => "router bgp #3 ; neighbor #5 capability orf prefix-list send", + "protocols bgp var neighbor var default-originate" => "router bgp #3 ; neighbor #5 default-originate", + "protocols bgp var neighbor var default-originate route-map" => "router bgp #3 ; neighbor #5 default-originate route-map #8", + "protocols bgp var neighbor var disable-capability-negotiation" => "router bgp #3 ; neighbor #5 dont-capability-negotiate", + "protocols bgp var neighbor var disable-connected-check" => "router bgp #3 ; neighbor #5 disable-connected-check", + "protocols bgp var neighbor var disable-send-community" => undef, + "protocols bgp var neighbor var disable-send-community extended" => "router bgp #3 ; no neighbor #5 send-community extended", + "protocols bgp var neighbor var disable-send-community standard" => "router bgp #3 ; no neighbor #5 send-community standard", + "protocols bgp var neighbor var distribute-list" => undef, + "protocols bgp var neighbor var distribute-list export" => "router bgp #3 ; neighbor #5 distribute-list #8 out", + "protocols bgp var neighbor var distribute-list import" => "router bgp #3 ; neighbor #5 distribute-list #8 in", + "protocols bgp var neighbor var ebgp-multihop" => "router bgp #3 ; neighbor #5 ebgp-multihop #7", + "protocols bgp var neighbor var filter-list" => undef, + "protocols bgp var neighbor var filter-list export" => "router bgp #3 ; neighbor #5 filter-list #8 out", + "protocols bgp var neighbor var filter-list import" => "router bgp #3 ; neighbor #5 filter-list #8 in", + "protocols bgp var neighbor var local-as" => undef, + "protocols bgp var neighbor var local-as var" => "router bgp #3 ; no neighbor #5 local-as #7 ; neighbor #5 local-as #7", + "protocols bgp var neighbor var local-as var no-prepend" => "router bgp #3 ; no neighbor #5 local-as #7 ; neighbor #5 local-as #7 no-prepend", + "protocols bgp var neighbor var maximum-prefix" => "router bgp #3 ; neighbor #5 maximum-prefix #7", + "protocols bgp var neighbor var nexthop-self" => "router bgp #3 ; neighbor #5 next-hop-self", + "protocols bgp var neighbor var override-capability" => "router bgp #3 ; neighbor #5 override-capability", + "protocols bgp var neighbor var passive" => "router bgp #3 ; neighbor #5 passive", + "protocols bgp var neighbor var password" => "router bgp #3 ; neighbor #5 password #7", + "protocols bgp var neighbor var port" => "router bgp #3 ; neighbor #5 port #7", + "protocols bgp var neighbor var prefix-list" => undef, + "protocols bgp var neighbor var prefix-list export" => "router bgp #3 ; neighbor #5 prefix-list #8 out", + "protocols bgp var neighbor var prefix-list import" => "router bgp #3 ; neighbor #5 prefix-list #8 in", + "protocols bgp var neighbor var remote-as" => "router bgp #3 ; neighbor #5 remote-as #7", + "protocols bgp var neighbor var remove-private-as" => "router bgp #3 ; neighbor #5 remove-private-AS", + "protocols bgp var neighbor var route-map" => undef, + "protocols bgp var neighbor var route-map export" => "router bgp #3 ; neighbor #5 route-map #8 out", + "protocols bgp var neighbor var route-map import" => "router bgp #3 ; neighbor #5 route-map #8 in", + "protocols bgp var neighbor var route-reflector-client" => "router bgp #3 ; neighbor #5 route-reflector-client", + "protocols bgp var neighbor var route-server-client" => "router bgp #3 ; neighbor #5 route-server-client", + "protocols bgp var neighbor var shutdown" => "router bgp #3 ; neighbor #5 shutdown", + "protocols bgp var neighbor var soft-reconfiguration" => undef, + "protocols bgp var neighbor var soft-reconfiguration inbound" => "router bgp #3 ; neighbor #5 soft-reconfiguration inbound", + "protocols bgp var neighbor var strict-capability-match" => "router bgp #3 ; neighbor #5 strict-capability-match", + "protocols bgp var neighbor var timers" => 'router bgp #3 ; neighbor #5 timers @keepalive @holdtime', + "protocols bgp var neighbor var timers connect" => "router bgp #3 ; neighbor #5 timers connect #8", + "protocols bgp var neighbor var unsuppress-map" => "router bgp #3 ; neighbor #5 unsuppress-map #7", + "protocols bgp var neighbor var update-source" => "router bgp #3 ; neighbor #5 update-source #7", + "protocols bgp var neighbor var weight" => "router bgp #3 ; neighbor #5 weight #7", + "protocols bgp var network" => undef, + "protocols bgp var network var" => "router bgp #3 ; network #5 ?backdoor", + "protocols bgp var network var route-map" => "router bgp #3 ; network #5 route-map #7", + "protocols bgp var parameters" => undef, + "protocols bgp var parameters always-compare-med" => "router bgp #3 ; bgp always-compare-med", + "protocols bgp var parameters bestpath" => undef, + "protocols bgp var parameters bestpath as-path" => undef, + "protocols bgp var parameters bestpath as-path confed" => "router bgp #3 ; bgp bestpath as-path confed", + "protocols bgp var parameters bestpath as-path ignore" => "router bgp #3 ; bgp bestpath as-path ignore", + "protocols bgp var parameters bestpath compare-routerid" => "router bgp #3 ; bgp bestpath compare-routerid", + "protocols bgp var parameters bestpath med" => undef, + "protocols bgp var parameters bestpath med confed" => "router bgp #3 ; bgp bestpath med confed", + "protocols bgp var parameters bestpath med missing-as-worst" => "router bgp #3 ; bgp bestpath med missing-as-worst", + "protocols bgp var parameters cluster-id" => "router bgp #3 ; bgp cluster-id #6", + "protocols bgp var parameters confederation" => undef, + "protocols bgp var parameters confederation identifier" => "router bgp #3 ; bgp confederation identifier #7", + "protocols bgp var parameters confederation peers" => "router bgp #3 ; bgp confederation peers #7", + "protocols bgp var parameters dampening" => 'router bgp #3 ; no bgp dampening ; bgp dampening @half-life @re-use @start-suppress-time @max-suppress-time', + "protocols bgp var parameters default" => undef, + "protocols bgp var parameters default local-pref" => "router bgp #3 ; bgp default local-preference #7", + "protocols bgp var parameters default no-ipv4-unicast" => "router bgp #3 ; no bgp default ipv4-unicast", + "protocols bgp var parameters deterministic-med" => "router bgp #3 ; bgp deterministic-med", + "protocols bgp var parameters disable-network-import-check" => "router bgp #3 ; no bgp network import-check", + "protocols bgp var parameters enforce-first-as" => "router bgp #3 ; bgp enforce-first-as", + "protocols bgp var parameters graceful-restart" => undef, + "protocols bgp var parameters graceful-restart stalepath-time" => "router bgp #3 ; bgp graceful-restart stalepath-time #7", + "protocols bgp var parameters log-neighbor-changes" => "router bgp #3 ; bgp log-neighbor-changes", + "protocols bgp var parameters no-client-to-client-reflection" => "router bgp #3 ; no bgp client-to-client reflection", + "protocols bgp var parameters no-fast-external-failover" => "router bgp #3 ; no bgp fast-external-failover", + "protocols bgp var parameters router-id" => "router bgp #3 ; bgp router-id #6", + "protocols bgp var parameters scan-time" => "router bgp #3 ; bgp scan-time #6", + "protocols bgp var redistribute" => undef, + "protocols bgp var redistribute connected" => "router bgp #3 ; redistribute connected", + "protocols bgp var redistribute connected metric" => "router bgp #3 ; redistribute connected metric #7", + "protocols bgp var redistribute connected route-map" => "router bgp #3 ; redistribute connected route-map #7", + "protocols bgp var redistribute kernel" => "router bgp #3 ; redistribute kernel", + "protocols bgp var redistribute kernel metric" => "router bgp #3 ; redistribute kernel metric #7", + "protocols bgp var redistribute kernel route-map" => "router bgp #3 ; redistribute kernel route-map #7", + "protocols bgp var redistribute ospf" => "router bgp #3 ; redistribute ospf", + "protocols bgp var redistribute ospf metric" => "router bgp #3 ; redistribute ospf metric #7", + "protocols bgp var redistribute ospf route-map" => "router bgp #3 ; redistribute ospf route-map #7", + "protocols bgp var redistribute rip" => "router bgp #3 ; redistribute rip", + "protocols bgp var redistribute rip metric" => "router bgp #3 ; redistribute rip metric #7", + "protocols bgp var redistribute rip route-map" => "router bgp #3 ; redistribute rip route-map #7", + "protocols bgp var redistribute static" => "router bgp #3 ; redistribute static", + "protocols bgp var redistribute static metric" => "router bgp #3 ; redistribute static metric #7", + "protocols bgp var redistribute static route-map" => "router bgp #3 ; redistribute static route-map #7", + "protocols bgp var timers" => 'router bgp #3 ; timers bgp @keepalive @holdtime', +); + +my %qcomdel = ( + "protocols" => undef, + "protocols bgp" => undef, + "protocols bgp var" => "no router bgp #3", + "protocols bgp var aggregate-address" => undef, + "protocols bgp var aggregate-address var" => "router bgp #3 ; no aggregate-address #5 ?as-set ?summary-only", + "protocols bgp var ipv6" => undef, + "protocols bgp var ipv6 aggregate-address" => undef, + "protocols bgp var ipv6 aggregate-address var" => "router bgp #3 ; no ipv6 bgp aggregate-address #6 ?summary-only", + "protocols bgp var ipv6 network" => "router bgp #3 ; no ipv6 bgp network #6", + "protocols bgp var ipv6 redistribute" => undef, + "protocols bgp var ipv6 redistribute connected" => "router bgp #3 ; address-family ipv6 ; no redistribute connected", + "protocols bgp var ipv6 redistribute connected metric" => "router bgp #3 ; address-family ipv6 ; no redistribute connected metric #8", + "protocols bgp var ipv6 redistribute connected route-map" => "router bgp #3 ; address-family ipv6 ; no redistribute connected route-map #8", + "protocols bgp var ipv6 redistribute kernel" => "router bgp #3 ; address-family ipv6 ; no redistribute kernel", + "protocols bgp var ipv6 redistribute kernel metric" => "router bgp #3 ; address-family ipv6 ; no redistribute kernel metric #8", + "protocols bgp var ipv6 redistribute kernel route-map" => "router bgp #3 ; address-family ipv6 ; no redistribute kernel route-map #8", + "protocols bgp var ipv6 redistribute ospfv3" => "router bgp #3 ; address-family ipv6 ; no redistribute ospfv3", + "protocols bgp var ipv6 redistribute ospfv3 metric" => "router bgp #3 ; address-family ipv6 ; no redistribute ospfv3 metric #8", + "protocols bgp var ipv6 redistribute ospfv3 route-map" => "router bgp #3 ; address-family ipv6 ; no redistribute ospfv3 route-map #8", + "protocols bgp var ipv6 redistribute ripng" => "router bgp #3 ; address-family ipv6 ; no redistribute ripng", + "protocols bgp var ipv6 redistribute ripng metric" => "router bgp #3 ; address-family ipv6 ; no redistribute ripng metric #8", + "protocols bgp var ipv6 redistribute ripng route-map" => "router bgp #3 ; address-family ipv6 ; no redistribute ripng route-map #8", + "protocols bgp var ipv6 redistribute static" => "router bgp #3 ; address-family ipv6 ; no redistribute static", + "protocols bgp var ipv6 redistribute static metric" => "router bgp #3 ; address-family ipv6 ; no redistribute static metric #8", + "protocols bgp var ipv6 redistribute static route-map" => "router bgp #3 ; address-family ipv6 ; no redistribute static route-map #8", + "protocols bgp var neighbor" => undef, + "protocols bgp var neighbor var" => "router bgp #3 ; no neighbor #5", + "protocols bgp var neighbor var advertisement-interval" => "router bgp #3 ; no neighbor #5 advertisement-interval", + "protocols bgp var neighbor var allowas-in" => "router bgp #3 ; no neighbor #5 allowas-in", + "protocols bgp var neighbor var allowas-in number" => "router bgp #3 ; no neighbor #5 allowas-in #8 ; neighbor #5 allowas-in", + "protocols bgp var neighbor var attribute-unchanged" => "router bgp #3 ; no neighbor #5 attribute-unchanged ?as-path ?med ?next-hop", + "protocols bgp var neighbor var capability" => undef, + "protocols bgp var neighbor var capability dynamic" => "router bgp #3 ; no neighbor #5 capability dynamic", + "protocols bgp var neighbor var capability orf" => undef, + "protocols bgp var neighbor var capability orf prefix-list" => undef, + "protocols bgp var neighbor var capability orf prefix-list receive" => "router bgp #3 ; no neighbor #5 capability orf prefix-list receive", + "protocols bgp var neighbor var capability orf prefix-list send" => "router bgp #3 ; no neighbor #5 capability orf prefix-list send", + "protocols bgp var neighbor var default-originate" => "router bgp #3 ; no neighbor #5 default-originate", + "protocols bgp var neighbor var default-originate route-map" => "router bgp #3 ; no neighbor #5 default-originate route-map #8", + "protocols bgp var neighbor var disable-capability-negotiation" => "router bgp #3 ; no neighbor #5 dont-capability-negotiate", + "protocols bgp var neighbor var disable-connected-check" => "router bgp #3 ; no neighbor #5 disable-connected-check", + "protocols bgp var neighbor var disable-send-community" => undef, + "protocols bgp var neighbor var disable-send-community extended" => "router bgp #3 ; neighbor #5 send-community extended", + "protocols bgp var neighbor var disable-send-community standard" => "router bgp #3 ; neighbor #5 send-community standard", + "protocols bgp var neighbor var distribute-list" => undef, + "protocols bgp var neighbor var distribute-list export" => "router bgp #3 ; no neighbor #5 distribute-list #8 out", + "protocols bgp var neighbor var distribute-list import" => "router bgp #3 ; no neighbor #5 distribute-list #8 in", + "protocols bgp var neighbor var ebgp-multihop" => "router bgp #3 ; no neighbor #5 ebgp-multihop", + "protocols bgp var neighbor var filter-list" => undef, + "protocols bgp var neighbor var filter-list export" => "router bgp #3 ; no neighbor #5 filter-list #8 out", + "protocols bgp var neighbor var filter-list import" => "router bgp #3 ; no neighbor #5 filter-list #8 in", + "protocols bgp var neighbor var local-as" => "router bgp #3 ; no neighbor #5 local-as", + "protocols bgp var neighbor var local-as no-prepend" => "router bgp #3 ; no neighbor #5 local-as #7 no-prepend ; neighbor #5 local-as #7", + "protocols bgp var neighbor var maximum-prefix" => "router bgp #3 ; no neighbor #5 maximum-prefix ", + "protocols bgp var neighbor var nexthop-self" => "router bgp #3 ; no neighbor #5 next-hop-self", + "protocols bgp var neighbor var override-capability" => "router bgp #3 ; no neighbor #5 override-capability", + "protocols bgp var neighbor var passive" => "router bgp #3 ; no neighbor #5 passive", + "protocols bgp var neighbor var password" => "router bgp #3 ; no neighbor #5 password", + "protocols bgp var neighbor var port" => "router bgp #3 ; no neighbor #5 port", + "protocols bgp var neighbor var prefix-list" => undef, + "protocols bgp var neighbor var prefix-list export" => "router bgp #3 ; no neighbor #5 prefix-list #8 out", + "protocols bgp var neighbor var prefix-list import" => "router bgp #3 ; no neighbor #5 prefix-list #8 in", + "protocols bgp var neighbor var remote-as" => "router bgp #3 ; no neighbor #5 remote-as #7", + "protocols bgp var neighbor var remove-private-as" => "router bgp #3 ; no neighbor #5 remove-private-AS", + "protocols bgp var neighbor var route-map" => undef, + "protocols bgp var neighbor var route-map export" => "router bgp #3 ; no neighbor #5 route-map #8 out", + "protocols bgp var neighbor var route-map import" => "router bgp #3 ; no neighbor #5 route-map #8 in", + "protocols bgp var neighbor var route-reflector-client" => "router bgp #3 ; no neighbor #5 route-reflector-client", + "protocols bgp var neighbor var route-server-client" => "router bgp #3 ; no neighbor #5 route-server-client", + "protocols bgp var neighbor var shutdown" => "router bgp #3 ; no neighbor #5 shutdown", + "protocols bgp var neighbor var soft-reconfiguration" => undef, + "protocols bgp var neighbor var soft-reconfiguration inbound" => "router bgp #3 ; no neighbor #5 soft-reconfiguration inbound", + "protocols bgp var neighbor var strict-capability-match" => "router bgp #3 ; no neighbor #5 strict-capability-match", + "protocols bgp var neighbor var timers" => 'router bgp #3 ; no neighbor #5 timers', + "protocols bgp var neighbor var timers connect" => "router bgp #3 ; no neighbor #5 timers connect", + "protocols bgp var neighbor var unsuppress-map" => "router bgp #3 ; no neighbor #5 unsuppress-map #7", + "protocols bgp var neighbor var update-source" => "router bgp #3 ; no neighbor #5 update-source", + "protocols bgp var neighbor var weight" => "router bgp #3 ; no neighbor #5 weight", + "protocols bgp var network" => undef, + "protocols bgp var network var" => "router bgp #3 ; no network #5", + "protocols bgp var network var route-map" => "router bgp #3 ; no network #5 route-map #7", + "protocols bgp var parameters" => undef, + "protocols bgp var parameters always-compare-med" => "router bgp #3 ; no bgp always-compare-med", + "protocols bgp var parameters bestpath" => undef, + "protocols bgp var parameters bestpath as-path" => undef, + "protocols bgp var parameters bestpath as-path confed" => "router bgp #3 ; no bgp bestpath as-path confed", + "protocols bgp var parameters bestpath as-path ignore" => "router bgp #3 ; no bgp bestpath as-path ignore", + "protocols bgp var parameters bestpath compare-routerid" => "router bgp #3 ; no bgp bestpath compare-routerid", + "protocols bgp var parameters bestpath med" => undef, + "protocols bgp var parameters bestpath med confed" => "router bgp #3 ; no bgp bestpath med confed", + "protocols bgp var parameters bestpath med missing-as-worst" => "router bgp #3 ; no bgp bestpath med missing-as-worst", + "protocols bgp var parameters cluster-id" => "router bgp #3 ; no bgp cluster-id #6", + "protocols bgp var parameters confederation" => undef, + "protocols bgp var parameters confederation identifier" => "router bgp #3 ; no bgp confederation identifier #7", + "protocols bgp var parameters confederation peers" => "router bgp #3 ; no bgp confederation peers #7", + "protocols bgp var parameters dampening" => "router bgp #3 ; no bgp dampening", + "protocols bgp var parameters default" => undef, + "protocols bgp var parameters default local-pref" => "router bgp #3 ; no bgp default local-preference #7", + "protocols bgp var parameters default no-ipv4-unicast" => "router bgp #3 ; bgp default ipv4-unicast", + "protocols bgp var parameters deterministic-med" => "router bgp #3 ; no bgp deterministic-med", + "protocols bgp var parameters disable-network-import-check" => "router bgp #3 ; bgp network import-check", + "protocols bgp var parameters enforce-first-as" => "router bgp #3 ; no bgp enforce-first-as", + "protocols bgp var parameters graceful-restart" => undef, + "protocols bgp var parameters graceful-restart stalepath-time" => "router bgp #3 ; no bgp graceful-restart stalepath-time #7", + "protocols bgp var parameters log-neighbor-changes" => "router bgp #3 ; no bgp log-neighbor-changes", + "protocols bgp var parameters no-client-to-client-reflection" => "router bgp #3 ; bgp client-to-client reflection", + "protocols bgp var parameters no-fast-external-failover" => "router bgp #3 ; bgp fast-external-failover", + "protocols bgp var parameters router-id" => "router bgp #3 ; no bgp router-id #6", + "protocols bgp var parameters scan-time" => "router bgp #3 ; no bgp scan-time #6", + "protocols bgp var redistribute" => undef, + "protocols bgp var redistribute connected" => "router bgp #3 ; no redistribute connected", + "protocols bgp var redistribute connected metric" => "router bgp #3 ; no redistribute connected metric #7", + "protocols bgp var redistribute connected route-map" => "router bgp #3 ; no redistribute connected route-map #7", + "protocols bgp var redistribute kernel" => "router bgp #3 ; no redistribute kernel", + "protocols bgp var redistribute kernel metric" => "router bgp #3 ; no redistribute kernel metric #7", + "protocols bgp var redistribute kernel route-map" => "router bgp #3 ; no redistribute kernel route-map #7", + "protocols bgp var redistribute ospf" => "router bgp #3 ; no redistribute ospf", + "protocols bgp var redistribute ospf metric" => "router bgp #3 ; no redistribute ospf metric #7", + "protocols bgp var redistribute ospf route-map" => "router bgp #3 ; no redistribute ospf route-map #7", + "protocols bgp var redistribute rip" => "router bgp #3 ; no redistribute rip", + "protocols bgp var redistribute rip metric" => "router bgp #3 ; no redistribute rip metric #7", + "protocols bgp var redistribute rip route-map" => "router bgp #3 ; no redistribute rip route-map #7", + "protocols bgp var redistribute static" => "router bgp #3 ; no redistribute static", + "protocols bgp var redistribute static metric" => "router bgp #3 ; no redistribute static metric #7", + "protocols bgp var redistribute static route-map" => "router bgp #3 ; no redistribute static route-map #7", + "protocols bgp var timers" => "router bgp #3 ; no timers bgp", +); my ( $pg, $as, $neighbor ); -my ( $checkas, $peername, $checkifpeergroup, $checkpeergroups, $checksource ); +my ( $main, $checkas, $peername, $checkifpeergroup, $checkpeergroups, $checksource ); GetOptions( "peergroup=s" => \$pg, @@ -18,8 +313,10 @@ GetOptions( "check-peer-groups" => \$checkpeergroups, "check-if-peer-group" => \$checkifpeergroup, "check-source=s" => \$checksource, + "main" => \$main, ); +main() if ($main); check_peer_name($peername) if ($peername); check_for_peer_groups( $pg, $as ) if ($checkpeergroups); check_as( $neighbor, $as, $pg ) if ($checkas); @@ -126,3 +423,45 @@ sub check_source { die "Interface $src does not exist on the system\n" if ($found == 0); } } + +sub printQuaggaCommands { + my $cref = shift; + my @cmds; + my $cmd; + + $cref->returnQuaggaCommands(\@cmds); + foreach $cmd (@cmds) { print "$cmd\n"; } +} + +sub main { + # initialize the Quagga Config object with data from Vyatta config tree + my $qconfig = new Vyatta::Quagga::Config('protocols', \%qcom, \%qcomdel); + + #$qconfig->setDebugLevel('3'); + #$qconfig->_reInitialize(); + + print "deleteConfigTreeRecursive(protocols bgp)\n"; + print "---\n"; printQuaggaCommands($qconfig); print "---\n"; + $qconfig->deleteConfigTreeRecursive('protocols bgp') || die "exiting $?\n"; + + print "setConfigTree(protocols bgp var neighbor var remote-as)\n"; + print "---\n"; printQuaggaCommands($qconfig); print "---\n"; + $qconfig->setConfigTreeRecursive('protocols bgp var neighbor var remote-as') || die "exiting $?\n"; + + print "setConfigTreeRecursive(protocols bgp)\n"; + print "---\n"; printQuaggaCommands($qconfig); print "---\n"; + $qconfig->setConfigTreeRecursive('protocols bgp') || die "exiting $?\n"; + + print "---\n"; printQuaggaCommands($qconfig); print "---\n"; + + #700 protocols bgp var parameters + #705 protocols bgp var neighbhor shutdown + #715 protocols bgp var neighbhor route-map + #716 protocols bgp var neighbhor filter-list + #717 protocols bgp var neighbhor prefix-list + #718 protocols bgp var neighbhor distribute-list + #719 protocols bgp var neighbhor unsuppress-map + #720 protocols bgp var neighbhor + #730 protocols bgp var +} + diff --git a/templates/protocols/bgp/node.def b/templates/protocols/bgp/node.def index 6ceb8c63..8184995e 100644 --- a/templates/protocols/bgp/node.def +++ b/templates/protocols/bgp/node.def @@ -5,7 +5,4 @@ help: Configure Border Gateway Protocol (BGP) parameters comp_help: \1 <1-4294967294>\tAS number syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 4294967294 ; \ "AS number must be between 1 and 4294967294" -create: vtysh -c "configure terminal" -c "router bgp $VAR(@)" -delete: vtysh -c "configure terminal" -c "no router bgp $VAR(@)" - - +end: /opt/vyatta/sbin/vyatta-bgp.pl --main diff --git a/templates/protocols/bgp/node.tag/aggregate-address/node.def b/templates/protocols/bgp/node.tag/aggregate-address/node.def index 1fa743c4..70a6c6b9 100644 --- a/templates/protocols/bgp/node.tag/aggregate-address/node.def +++ b/templates/protocols/bgp/node.tag/aggregate-address/node.def @@ -3,21 +3,3 @@ type: ipv4net help: Set a BGP aggregate network comp_help: \1 <x.x.x.x/x>\taggregate network syntax:expression: exec "${vyatta_sbindir}/check_prefix_boundary $VAR(@)" -delete: touch /tmp/`echo $VAR(@) | sed 's!/!!'`.$PPID -end: vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../@)" \ - -c "no aggregate-address $VAR(@)"; - if [ -f "/tmp/`echo $VAR(@) | sed 's!/!!'`.$PPID" ]; then - rm -rf /tmp/`echo $VAR(@) | sed 's!/!!'`.$PPID; - else - if ${vyatta_sbindir}/vyatta_quagga_utils.pl --exists 'protocols bgp $VAR(../@) aggregate-address $VAR(@) as-set' ; then - cond="as-set"; - fi; - if ${vyatta_sbindir}/vyatta_quagga_utils.pl --exists 'protocols bgp $VAR(../@) aggregate-address $VAR(@) summary-only' ; then - cond="$cond summary-only"; - fi; - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../@)" \ - -c "aggregate-address $VAR(@) $cond"; - fi; diff --git a/templates/protocols/bgp/node.tag/ipv6/aggregate-address/node.def b/templates/protocols/bgp/node.tag/ipv6/aggregate-address/node.def index 37b76fe8..594d8782 100644 --- a/templates/protocols/bgp/node.tag/ipv6/aggregate-address/node.def +++ b/templates/protocols/bgp/node.tag/ipv6/aggregate-address/node.def @@ -5,19 +5,3 @@ comp_help: <h:h:h:h:h:h:h:h/x> IPv6 aggregate network syntax:expression: exec "${vyatta_sbindir}/check_prefix_boundary $VAR(@)" - -delete: touch /tmp/`echo $VAR(@) | sed 's!/!!'`.$PPID - -end: vtysh -n -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "no ipv6 bgp aggregate-address $VAR(@)"; - if [ -f "/tmp/`echo $VAR(@) | sed 's!/!!'`.$PPID" ]; then - rm -rf /tmp/`echo $VAR(@) | sed 's!/!!'`.$PPID; - else - if [ -n "$VAR(./summary-only)" ]; then - cond="$cond summary-only"; - fi; - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "ipv6 bgp aggregate-address $VAR(@) $cond"; - fi; diff --git a/templates/protocols/bgp/node.tag/ipv6/network/node.def b/templates/protocols/bgp/node.tag/ipv6/network/node.def index 81052ea2..14034a79 100644 --- a/templates/protocols/bgp/node.tag/ipv6/network/node.def +++ b/templates/protocols/bgp/node.tag/ipv6/network/node.def @@ -5,11 +5,3 @@ comp_help: <h:h:h:h:h:h:h:h/x> IPv6 network syntax:expression: exec "${vyatta_sbindir}/check_prefix_boundary $VAR(@)" - -create: vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "ipv6 bgp network $VAR(@)"; - -delete: vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "no ipv6 bgp network $VAR(@)"; diff --git a/templates/protocols/bgp/node.tag/ipv6/redistribute/connected/node.def b/templates/protocols/bgp/node.tag/ipv6/redistribute/connected/node.def index 2af59605..acdef3a3 100644 --- a/templates/protocols/bgp/node.tag/ipv6/redistribute/connected/node.def +++ b/templates/protocols/bgp/node.tag/ipv6/redistribute/connected/node.def @@ -1,22 +1 @@ help: Set to redistribute connected routes into BGP - -delete: touch /tmp/bgp-redist-connected.$PPID - -end: vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "no redistribute connected"; - if [ -f "/tmp/bgp-redist-connected.$PPID" ]; then - rm -rf /tmp/bgp-redist-connected.$PPID; - else - if [ -n "$VAR(./metric/@)" ]; then - cond="metric $VAR(./metric/@)"; - fi; - if [ -n "$VAR(./route-map/@)" ]; then - cond="$cond route-map $VAR(./route-map/@)"; - fi; - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "redistribute connected $cond"; - fi; diff --git a/templates/protocols/bgp/node.tag/ipv6/redistribute/kernel/node.def b/templates/protocols/bgp/node.tag/ipv6/redistribute/kernel/node.def index 0b83aee9..5f0bfb51 100644 --- a/templates/protocols/bgp/node.tag/ipv6/redistribute/kernel/node.def +++ b/templates/protocols/bgp/node.tag/ipv6/redistribute/kernel/node.def @@ -1,22 +1,2 @@ help: Set to redistribute kernel routes into BGP -delete: touch /tmp/bgp-redist-kernel.$PPID - -end: vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "no redistribute kernel "; - if [ -f "/tmp/bgp-redist-kernel.$PPID" ]; then - rm -rf /tmp/bgp-redist-kernel.$PPID; - else - if [ -n "$VAR(./metric/@)" ]; then - cond="metric $VAR(./metric/@)"; - fi; - if [ -n "$VAR(./route-map/@)" ]; then - cond="$cond route-map $VAR(./route-map/@)"; - fi; - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "redistribute kernel $cond"; - fi; diff --git a/templates/protocols/bgp/node.tag/ipv6/redistribute/ospfv3/node.def b/templates/protocols/bgp/node.tag/ipv6/redistribute/ospfv3/node.def index d9a08db7..76cf1808 100644 --- a/templates/protocols/bgp/node.tag/ipv6/redistribute/ospfv3/node.def +++ b/templates/protocols/bgp/node.tag/ipv6/redistribute/ospfv3/node.def @@ -1,22 +1 @@ help: Set to redistribute OSPFv3 routes into BGP - -delete: touch /tmp/bgp-redist-ospf.$PPID - -end: vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "no redistribute ospf6"; - if [ -f "/tmp/bgp-redist-ospf.$PPID" ]; then - rm -rf /tmp/bgp-redist-ospf.$PPID; - else - if [ -n "$VAR(./metric/@)" ]; then - cond="metric $VAR(./metric/@)"; - fi; - if [ -n "$VAR(./route-map/@)" ]; then - cond="$cond route-map $VAR(./route-map/@)"; - fi; - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "redistribute ospf6 $cond"; - fi; diff --git a/templates/protocols/bgp/node.tag/ipv6/redistribute/ripng/node.def b/templates/protocols/bgp/node.tag/ipv6/redistribute/ripng/node.def index dd24ef27..55ac8b58 100644 --- a/templates/protocols/bgp/node.tag/ipv6/redistribute/ripng/node.def +++ b/templates/protocols/bgp/node.tag/ipv6/redistribute/ripng/node.def @@ -1,22 +1 @@ help: Set to redistribute RIPng routes into BGP - -delete: touch /tmp/bgp-redist-rip.$PPID - -end: vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "no redistribute ripng"; - if [ -f "/tmp/bgp-redist-rip.$PPID" ]; then - rm -rf /tmp/bgp-redist-rip.$PPID; - else - if [ -n "$VAR(./metric/@)" ]; then - cond="metric $VAR(./metric/@)"; - fi; - if [ -n "$VAR(./route-map/@)" ]; then - cond="$cond route-map $VAR(./route-map/@)"; - fi; - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "redistribute ripng $cond"; - fi; diff --git a/templates/protocols/bgp/node.tag/ipv6/redistribute/static/node.def b/templates/protocols/bgp/node.tag/ipv6/redistribute/static/node.def index b59edfc4..c196a54b 100644 --- a/templates/protocols/bgp/node.tag/ipv6/redistribute/static/node.def +++ b/templates/protocols/bgp/node.tag/ipv6/redistribute/static/node.def @@ -1,22 +1 @@ help: Set to redistribute static routes into BGP - -delete: touch /tmp/bgp-redist-static.$PPID - -end: vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "no redistribute static"; - if [ -f "/tmp/bgp-redist-static.$PPID" ]; then - rm -rf /tmp/bgp-redist-static.$PPID; - else - if [ -n "$VAR(./metric/@)" ]; then - cond="metric $VAR(./metric/@)"; - fi; - if [ -n "$VAR(./route-map/@)" ]; then - cond="$cond route-map $VAR(./route-map/@)"; - fi; - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "redistribute static $cond"; - fi; diff --git a/templates/protocols/bgp/node.tag/neighbor/node.def b/templates/protocols/bgp/node.tag/neighbor/node.def index 333ee1a0..af7f1b5c 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.def @@ -1,5 +1,4 @@ tag: -priority: 720 type: txt help: Set a BGP neighbor comp_help: @@ -8,17 +7,3 @@ comp_help: syntax:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl \ --check-peer-name $VAR(@)" - - -create: if /opt/vyatta/sbin/vyatta-bgp.pl --check-if-peer-group \ - --peergroup $VAR(@); then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../@)" \ - -c "neighbor $VAR(@) peer-group"; - fi; - -delete: /opt/vyatta/sbin/vyatta-bgp.pl --check-peer-groups \ - --peergroup $VAR(@) --as $VAR(../@) || exit 1 - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../@)" \ - -c "no neighbor $VAR(@)" diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/advertisement-interval/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/advertisement-interval/node.def index 90432838..0e1b633b 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/advertisement-interval/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/advertisement-interval/node.def @@ -1,25 +1,6 @@ type: u32 - help: Set the minimum interval for sending routing updates - comp_help: possible completions: <0-600> advertisement interval in seconds - syntax:expression: $VAR(@) >= 0 && $VAR(@) <= 600; "must be between 0 and 600" - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" - -update: if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) advertisement-interval $VAR(@)" - -delete: vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) advertisement-interval" diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/allowas-in/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/allowas-in/node.def index 70c98e74..67b47667 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/allowas-in/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/allowas-in/node.def @@ -1,34 +1,2 @@ help: Set to accept a route that contains the local-AS in the as-path - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" - -end: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); then - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../@) allowas-in "; - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) allowas-in "; - fi; - - if [ ${COMMIT_ACTION} = 'SET' -o ${COMMIT_ACTION} = 'ACTIVE' ]; then - if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); then - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../@) allowas-in $VAR(./number/@)"; - else - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) allowas-in $VAR(./number/@)"; - fi - fi; diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/node.def index e9f02cc6..a23f4502 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/node.def @@ -1,52 +1,3 @@ help: Set whether BGP attributes are sent unchanged - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" - commit:expression: $VAR(../peer-group/) == ""; "protocols bgp $VAR(../../@) neighbor $VAR(../@): you can't set attribute-unchanged for a neighbor in a peer-group" - -end: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); then - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../@) activate" \ - -c "no neighbor $VAR(../@) attribute-unchanged "; - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) attribute-unchanged "; - fi - - if [ ${COMMIT_ACTION} = 'SET' -o ${COMMIT_ACTION} = 'ACTIVE' ]; then - ${vyatta_sbindir}/vyatta-check-typeless-node.pl "protocols bgp $VAR(../../@) neighbor $VAR(../@) attribute-unchanged as-path" - if [ $? -eq 0 ]; then - cond="as-path "; - fi; - ${vyatta_sbindir}/vyatta-check-typeless-node.pl "protocols bgp $VAR(../../@) neighbor $VAR(../@) attribute-unchanged med" - if [ $? -eq 0 ]; then - cond="$cond med "; - fi; - ${vyatta_sbindir}/vyatta-check-typeless-node.pl "protocols bgp $VAR(../../@) neighbor $VAR(../@) attribute-unchanged next-hop" - if [ $? -eq 0 ]; then - cond="$cond next-hop "; - fi; - if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../@) attribute-unchanged $cond"; - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) attribute-unchanged $cond"; - fi - fi diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/dynamic/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/dynamic/node.def index 64848769..1ad03793 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/dynamic/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/dynamic/node.def @@ -1,39 +1,2 @@ help: Set to advertise dynamic capability to this neighbor - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../../@) --neighbor $VAR(../../@)" - -update: if [ -n "$VAR(../../remote-as/@)" ]; - then - peer="remote-as $VAR(../../remote-as/@)"; - else - peer="peer-group $VAR(../../peer-group/@)"; - fi; - - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@); - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../../@) capability dynamic" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "neighbor $VAR(../../@) capability dynamic" - fi - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@); - then - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../../@) capability dynamic" - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "no neighbor $VAR(../../@) capability dynamic" - fi - diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/receive/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/receive/node.def index 33067593..f228a5c3 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/receive/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/receive/node.def @@ -1,38 +1,3 @@ help: Set capability to receive the ORF - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../../../../@) --neighbor $VAR(../../../../@)" - commit:expression: $VAR(../../../../peer-group/) == ""; "You can't set orf capability receive for neighbor $VAR(../../../../@) in peer-group $VAR(../../../../peer-group/@)" - -update: if [ -n "$VAR(../../../../remote-as/@)" ]; then - peer="remote-as $VAR(../../../../remote-as/@)"; - else - peer="peer-group $VAR(../../../../peer-group/@)"; - fi; - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../../../@); - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../../../@)" \ - -c "neighbor $VAR(../../../../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../../../../@) capability orf prefix-list receive" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../../../@)" \ - -c "neighbor $VAR(../../../../@) $peer" \ - -c "neighbor $VAR(../../../../@) capability orf prefix-list receive" - fi - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../../../@); - then - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../../../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../../../../@) capability orf prefix-list receive" - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../../../../@)" \ - -c "no neighbor $VAR(../../../../@) capability orf prefix-list receive" - fi diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/send/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/send/node.def index a3334d78..aff136ca 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/send/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/send/node.def @@ -1,41 +1,3 @@ help: Set capability to send the ORF - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../../../../@) --neighbor $VAR(../../../../@)" - commit:expression: $VAR(../../../../peer-group/) == ""; "You can't set capability orf send for neighbor $VAR(../../../../@) in peer-group $VAR(../../../../peer-group/@)" - -update: if [ -n "$VAR(../../../../remote-as/@)" ] - then - peer="remote-as $VAR(../../../../remote-as/@)" - else - peer="peer-group $VAR(../../../../peer-group/@)" - fi - - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../../../@); - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../../../@)" \ - -c "neighbor $VAR(../../../../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../../../../@) capability orf prefix-list send" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../../../@)" \ - -c "neighbor $VAR(../../../../@) $peer" \ - -c "neighbor $VAR(../../../../@) capability orf prefix-list send" - fi - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../../../@); - then - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../../../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../../../../@) capability orf prefix-list send" - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../../../../@)" \ - -c "no neighbor $VAR(../../../../@) capability orf prefix-list send" - fi - diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/node.def index 26c28b52..675adffd 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/node.def @@ -1,42 +1,3 @@ help: Set to send default route to this neighbor - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" - commit:expression: $VAR(../peer-group/) == ""; "protocold bgp $VAR(../../@) neighbor $VAR(../@): you can't set default-originate for a neighbor in a peer-group" - -end: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); then - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../@) default-originate "; - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) default-originate "; - fi; - - if [ ${COMMIT_ACTION} = 'SET' -o ${COMMIT_ACTION} = 'ACTIVE' ]; then - if [ -n "$VAR(./route-map/@)" ]; then - cond="route-map $VAR(./route-map/@) " ; - fi ; - if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../@) default-originate $cond"; - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) default-originate $cond"; - fi; - fi; diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/route-map/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/route-map/node.def index 923364b6..f2209d3f 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/route-map/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/route-map/node.def @@ -1,10 +1,7 @@ type: txt help: Set the route-map to specify criteria of the default - allowed: local -a params params=( /opt/vyatta/config/active/policy/route-map/* ) echo -n ${params[@]##*/} - commit:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy route-map $VAR(@)\" " ; "protocols bgp $VAR(../../../@) neighbor $VAR(../../@) default-originate: route-map $VAR(@) doesn't exist" - commit:expression: $VAR(../../peer-group/) == ""; "protocols bgp $VAR(../../../@) neighbor $VAR(../../@): you can't set default-originate for a neighbor in a peer-group" diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-capability-negotiation/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-capability-negotiation/node.def index a15d36ea..f476e35e 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-capability-negotiation/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-capability-negotiation/node.def @@ -1,13 +1,2 @@ help: Set to not perform capability negotiation with this neighbor commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" -update: if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) dont-capability-negotiate " -delete: vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) dont-capability-negotiate" - diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-connected-check/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-connected-check/node.def index bf96e198..98e3fb46 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-connected-check/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-connected-check/node.def @@ -1,13 +1,2 @@ help: Disable check to see if EBGP peer's address is a connected route commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" -update: if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) disable-connected-check" -delete: vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) disable-connected-check" - diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-send-community/extended/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-send-community/extended/node.def index 71083ca8..452e2792 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-send-community/extended/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-send-community/extended/node.def @@ -1,41 +1,3 @@ help: Set to not send extended community attributes to this neighbor - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../../@) --neighbor $VAR(../../@)" - commit:expression: $VAR(../../peer-group/) == ""; "protocols bgp $VAR(../../../@) neighbor $VAR(../../@): you can't set disable-send-community for a neighbor in a peer-group" - -update: if [ -n "$VAR(../../remote-as/@)" ]; then - peer="remote-as $VAR(../../remote-as/@)"; - else - peer="peer-group $VAR(../../peer-group/@)"; - fi; - - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@); - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../../@) send-community extended" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "no neighbor $VAR(../../@) send-community extended" - fi - - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@); - then - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../../@) send-community extended" - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) send-community extended" - - fi diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-send-community/standard/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-send-community/standard/node.def index d6cc6e17..6591deac 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-send-community/standard/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-send-community/standard/node.def @@ -1,39 +1,3 @@ help: Set to not send standard community attributes to this neighbor - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../../@) --neighbor $VAR(../../@)" - commit:expression: $VAR(../../peer-group/) == ""; "protocols bgp $VAR(../../../@) neighbor $VAR(../../@): you can't set disable-send-community for a neighbor in a peer-group" - -update: if [ -n "$VAR(../../remote-as/@)" ]; then - peer="remote-as $VAR(../../remote-as/@)"; - else - peer="peer-group $VAR(../../peer-group/@)"; - fi; - - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@); - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../../@) send-community standard" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "no neighbor $VAR(../../@) send-community standard" - fi - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@); - then - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../../@) send-community standard" - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) send-community standard" - fi diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/export/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/export/node.def index af7f92c8..9d6f2f12 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/export/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/export/node.def @@ -1,57 +1,14 @@ type: txt help: Set an access-list to filter outgoing route updates to this neighbor - comp_help: possible completions: <1-65535> access-list number <txt> access-list6 name - allowed: local -a params params=( /opt/vyatta/config/active/policy/access-list/* /opt/vyatta/config/active/policy/access-list6/* ) echo -n ${params[@]##*/} - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../../@) --neighbor $VAR(../../@)" - commit:expression: $VAR(../../peer-group/) == ""; "protocols bgp $VAR(../../../@) neighbor $VAR(../../@): you can't set a distribute-list for a neighbor in a peer-group" - -commit:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy access-list $VAR(@)\" || /opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy access-list6 $VAR(@)\" "; \ +commit:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy access-list $VAR(@)\" "; \ "protocols bgp $VAR(../../../@) neighbor $VAR(../../@) export: access-list $VAR(@) doesn't exist" - commit:expression: $VAR(../../prefix-list/export/) == ""; "protocols bgp $VAR(../../../@) neighbor $VAR(../../@) distribute-list export: you can't set both a prefix-list and a distribute list" - -update: if [ -n "$VAR(../../remote-as/@)" ]; then - peer="remote-as $VAR(../../remote-as/@)"; - else - peer="peer-group $VAR(../../peer-group/@)"; - fi; - - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@); - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../../@) activate" \ - -c "neighbor $VAR(../../@) distribute-list $VAR(@) out" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "neighbor $VAR(../../@) distribute-list $VAR(@) out" - fi - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@); - then - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../../@) distribute-list $VAR(@) out" - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "no neighbor $VAR(../../@) distribute-list $VAR(@) out" - fi - - diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/import/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/import/node.def index 4db868fe..76d48c47 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/import/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/import/node.def @@ -1,50 +1,10 @@ type: txt help: Set an access-list to filter incoming route updates from this neighbor - comp_help: possible completions: <1-65535> access-list number <txt> access-list6 name - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../../@) --neighbor $VAR(../../@)" - commit:expression: $VAR(../../peer-group/) == ""; "protocols bgp $VAR(../../../@) neighbor $VAR(../../@): you can't set a distribute-list for a neighbor in a peer-group" - -commit:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy access-list $VAR(@)\" || /opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy access-list6 $VAR(@)\" ";\ +commit:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy access-list $VAR(@)\" ";\ "protocols bgp $VAR(../../../@) neighbor $VAR(../../@) import: access-list $VAR(@) doesn't exist" - commit:expression: $VAR(../../prefix-list/import/) == ""; "protocols bgp $VAR(../../../@) neighbor $VAR(../../@) distribute-list import: you can't set both a prefix-list and a distribute list" - -update: if [ -n "$VAR(../../remote-as/@)" ]; then - peer="remote-as $VAR(../../remote-as/@)"; - else - peer="peer-group $VAR(../../peer-group/@)"; - fi; - - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@); - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../../@) distribute-list $VAR(@) in" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "neighbor $VAR(../../@) distribute-list $VAR(@) in" - fi - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@); - then - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../../@) distribute-list $VAR(@) in" - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "no neighbor $VAR(../../@) distribute-list $VAR(@) in" - fi - diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/node.def index 30392e79..4013725c 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/node.def @@ -1,2 +1 @@ -priority: 718 help: Set an access-list to filter route updates to/from this neighbor diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/ebgp-multihop/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/ebgp-multihop/node.def index 4186dfbd..d35d050e 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/ebgp-multihop/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/ebgp-multihop/node.def @@ -1,26 +1,6 @@ type: u32 - help: Allow this EBGP neighbor to not be on a directly connected network - comp_help: possible completions: <1-255> number of hops - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" - syntax:expression: $VAR(@) >=1 && $VAR(@) <= 255; "ebgp-multihop must be between 1 and 255" - -update: if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) ebgp-multihop $VAR(@)" - -delete: vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) ebgp-multihop" - diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/export/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/export/node.def index d5567d22..f510d1b7 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/export/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/export/node.def @@ -1,49 +1,10 @@ type: txt help: Set an as-path-list to filter outgoing route updates to this neighbor - allowed: local -a params params=( /opt/vyatta/config/active/policy/as-path-list/* ) echo -n ${params[@]##*/} - comp_help: possible completions: <txt> as-path-list name - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../../@) --neighbor $VAR(../../@)" - commit:expression: $VAR(../../peer-group/) == ""; "protocols bgp $VAR(../../../@) neighbor $VAR(../../@): you can't set a filter-list for a neighbor in peer-group" - commit:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy as-path-list $VAR(@)\" ";"protocols bgp $VAR(../../../@) neighbor $VAR(../../@) filter-list export: as-path-list $VAR(@) doesn't exist" - -update: if [ -n "$VAR(../../remote-as/@)" ]; then - peer="remote-as $VAR(../../remote-as/@)"; - else - peer="peer-group $VAR(../../peer-group/@)"; - fi; - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@); then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../../@) filter-list $VAR(@) out" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "neighbor $VAR(../../@) filter-list $VAR(@) out" - fi; - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@); then - vtysh --noerror \ - -c "configure terminal" \ - -c "address-family ipv6" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../../@) filter-list $VAR(@) out" - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "no neighbor $VAR(../../@) filter-list $VAR(@) out" - fi - diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/import/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/import/node.def index daee397b..573ae57f 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/import/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/import/node.def @@ -1,49 +1,10 @@ type: txt help: Set an as-path-list to filter incoming route updates from this neighbor - allowed: local -a params params=( /opt/vyatta/config/active/policy/as-path-list/* ) echo -n ${params[@]##*/} - comp_help: possible completions: <txt> as-path-list name - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../../@) --neighbor $VAR(../../@)" - commit:expression: $VAR(../../peer-group/) == ""; "protocols bgp $VAR(../../../@) neighbor $VAR(../../@): you can't set a filter-list for a neighbor in peer-group" - commit:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy as-path-list $VAR(@)\" ";"protocols bgp $VAR(../../../@) neighbor $VAR(../../@) filter-list import: as-path-list $VAR(@) doesn't exist" - -update: if [ -n "$VAR(../../remote-as/@)" ]; then - peer="remote-as $VAR(../../remote-as/@)"; - else - peer="peer-group $VAR(../../peer-group/@)"; - fi; - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@); then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../../@) filter-list $VAR(@) in" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "neighbor $VAR(../../@) filter-list $VAR(@) in" - fi; - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@); then - vtysh --noerror \ - -c "configure terminal" \ - -c "address-family ipv6" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../../@) filter-list $VAR(@) in" - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "no neighbor $VAR(../../@) filter-list $VAR(@) in" - fi - diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/node.def index 3f86399e..191c561b 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/node.def @@ -1,2 +1 @@ -priority: 716 help: Set an as-path-list to filter route updates to/from this neighbor diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/local-as/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/local-as/node.def deleted file mode 100644 index 46bdc386..00000000 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/local-as/node.def +++ /dev/null @@ -1,14 +0,0 @@ -type: u32 - -help: Set the local AS number [REQUIRED] - -comp_help: possible completions: - <1-4294967294> local AS number - -syntax:expression: $VAR(@) >=1 && $VAR(@) <= 4294967294; "local-as must be between 1 and 4294967294" - -commit:expression: $VAR(@) != $VAR(../../../@); "protocols bgp $VAR(../../../@) neighbor $VAR(../../@): you can't set local-as the same as the router AS" - -commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../../@) --neighbor $VAR(../../@)" - -commit:expression: $VAR(../peer-group/) == ""; "protocols bgp $VAR(../../../@) neighbor $VAR(../../@): you can't set local-as for a neighbor in a peer-group" diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/node.def index 1334cd2c..a7de0ea8 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/node.def @@ -1,40 +1,8 @@ -help: Set a different AS number to use with this neighbor - -syntax:expression: $VAR(./local-as/@) >= 1 && $VAR(./local-as/@) <= 4294967294; "AS number must be between 1 and 4294967294" - +tag: +type: u32 +help: Set the local AS number [REQUIRED] +comp_help: possible completions: + <1-4294967294> local AS number +syntax:expression: $VAR(@) >=1 && $VAR(@) <= 4294967294; "local-as must be between 1 and 4294967294" +commit:expression: $VAR(@) != $VAR(../../@); "protocols bgp $VAR(../../@) neighbor $VAR(../@): you can't set local-as the same as the router AS" commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" - -commit:expression: $VAR(./local-as/@) != $VAR(../../@); "protocols bgp $VAR(../../@) neighbor $VAR(../@) local-as: you can't set a different local-as for iBGP neighbors" - -commit:expression: $VAR(../peer-group/) == ""; "protocols bgp $VAR(../../@) neighbor $VAR(../@) local-as: you can't set local-as for a neighbor in a peer-group" - -end: vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) local-as "; - - if [ ${COMMIT_ACTION} = 'SET' -o ${COMMIT_ACTION} = 'ACTIVE' ]; then - if [ -z "$VAR(./local-as/@)" ]; then - echo protocols bgp $VAR(../../@) neighbor $VAR(../@) local-as: you must specify local-as local-as ; - exit 1 ; - fi ; - ## uncomment when 2525 is fixed - #if [ -n "$VAR(./no-prepend/@)" ]; then - # cond="no-prepend " ; - #fi ; - ${vyatta_sbindir}/vyatta-check-typeless-node.pl "protocols bgp $VAR(../../@) neighbor $VAR(../@) local-as no-prepend"; - if [ $? -eq 0 ]; then - cond="no-prepend "; - fi; - - if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) local-as $VAR(./local-as/@) $cond "; - fi; diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/no-prepend/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/node.tag/no-prepend/node.def index 299e92e9..299e92e9 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/no-prepend/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/node.tag/no-prepend/node.def diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/maximum-prefix/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/maximum-prefix/node.def index 344504fb..98a1129f 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/maximum-prefix/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/maximum-prefix/node.def @@ -1,42 +1,5 @@ type: u32 - help: Set the maximum number of prefixes to accept from this neighbor - comp_help: possible completions: <1-4294967295> prefix limit - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" - -update: if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../@) maximum-prefix $VAR(@)" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) maximum-prefix $VAR(@)" - fi - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); - then - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../@) maximum-prefix" - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) maximum-prefix" - fi diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/nexthop-self/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/nexthop-self/node.def index f7ec8e1f..ccbc5471 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/nexthop-self/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/nexthop-self/node.def @@ -1,39 +1,3 @@ help: Set nexthop for routes sent to this neighbor to be the local router - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" - commit:expression: $VAR(../peer-group/) == ""; "protocols bgp $VAR(../../@) neighbor $VAR(../@) next-hop-self: you can't set next-hop-self for a neighbor in a peer-group" - -update: if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../@) next-hop-self" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) next-hop-self" - fi - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); - then - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../@) next-hop-self " - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) next-hop-self " - fi diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/override-capability/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/override-capability/node.def index b403b38b..5eec1b35 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/override-capability/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/override-capability/node.def @@ -1,14 +1,3 @@ help: Set to ignore capability negotiation with specified neighbor commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" commit:expression: $VAR(../strict-capability/) == ""; "protocols bgp $VAR(../../@) neighbor $VAR(../@) override-capability: you can't set both strict-capability and override-capability" -update: if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) override-capability" -delete: vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) override-capability" - diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/passive/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/passive/node.def index 812def6a..46e8fc40 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/passive/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/passive/node.def @@ -1,13 +1,2 @@ help: Set to not try initiating a session with this neighbor commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" -update: if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) passive" -delete: vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) passive" - diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/password/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/password/node.def index 04a34027..3a2f318d 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/password/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/password/node.def @@ -5,15 +5,3 @@ syntax:expression: exec " \ echo Password must be 80 characters or less;\ exit 1 ; \ fi ; " -update: if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c 'neighbor $VAR(../@) password $VAR(@)' -delete: vtysh \ - -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) password" diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/peer-group/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/peer-group/node.def deleted file mode 100644 index 66d80b69..00000000 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/peer-group/node.def +++ /dev/null @@ -1,12 +0,0 @@ -type: txt -help: Set to add this neighbor to a peer-group -comp_help: \1 <txt>\tpeer-group name -syntax:expression: exec "if [ -n \"`echo $VAR(../@) | sed 's/[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}//'`\" ]; then \ - exit 1; \ - fi; "; "peer-group token may not be specified for a peer-group" -commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --peergroup=$VAR(@) --as $VAR(../../@) --neighbor $VAR(../@)" -commit:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"protocols bgp $VAR(../../@) neighbor $VAR(@)\" "; "protocols bgp $VAR(../../@) neighbor $VAR(../@) peer-group: peer-group $VAR(@) doesn't exist" -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) peer-group $VAR(@)" -delete: vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) peer-group $VAR(@)" diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/port/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/port/node.def index edf597a0..0cb689b5 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/port/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/port/node.def @@ -4,15 +4,3 @@ comp_help: \1 <1-65535>\tport number syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 65535; \ "port must be between 1 and 65535" commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" -update: if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) port $VAR(@)" -delete: vtysh --noerror \ - -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) port" diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/export/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/export/node.def index fde7d4f9..6341cde4 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/export/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/export/node.def @@ -1,52 +1,13 @@ type: txt help: Set a prefix-list to filter outgoing route updates to this neighbor - allowed: local -a params params=( /opt/vyatta/config/active/policy/prefix-list/* /opt/vyatta/config/active/policy/prefix-list6/*) echo -n ${params[@]##*/} - comp_help: possible completions: <txt> prefix-list name - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../../@) --neighbor $VAR(../../@)" - commit:expression: $VAR(../../peer-group/) == ""; "protocols bgp $VAR(../../../@) neighbor $VAR(../../@): you can't set a prefix-list for a neighbor in a peer-group" - -commit:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy prefix-list $VAR(@)\" || /opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy prefix-list6 $VAR(@)\""; \ +commit:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy prefix-list $VAR(@)\" "; \ "protocols bgp $VAR(../../../@) neighbor $VAR(../../@) prefix-list import: prefix-list $VAR(@) doesn't exist" - commit:expression: $VAR(../../distribute-list/export/) == ""; "protocols bgp $VAR(../../../@) neighbor $VAR(../../@) prefix-list export: you can't set both a prefix-list and a distribute list" - -update: if [ -n "$VAR(../../remote-as/@)" ]; then - peer="remote-as $VAR(../../remote-as/@)"; - else - peer="peer-group $VAR(../../peer-group/@)"; - fi; - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@); then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../../@) prefix-list $VAR(@) out" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "neighbor $VAR(../../@) prefix-list $VAR(@) out" - fi; - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@); then - vtysh --noerror \ - -c "configure terminal" \ - -c "address-family ipv6" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../../@) prefix-list $VAR(@) out" - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "no neighbor $VAR(../../@) prefix-list $VAR(@) out" - fi diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/import/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/import/node.def index f27abd95..8c7e99a7 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/import/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/import/node.def @@ -1,52 +1,14 @@ type: txt help: Set a prefix-list to filter incoming route updates from this neighbor - allowed: local -a params params=( /opt/vyatta/config/active/policy/prefix-list/* /opt/vyatta/config/active/policy/prefix-list6/*) echo -n ${params[@]##*/} - comp_help: possible completions: <txt> prefix-list name - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../../@) --neighbor $VAR(../../@)" - commit:expression: $VAR(../../peer-group/) == ""; "protocols bgp $VAR(../../../@) neighbor $VAR(../../@): you can't set a prefix-list for a neighbor in a peer-group" - -commit:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy prefix-list $VAR(@)\" || /opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy prefix-list6 $VAR(@)\""; \ +commit:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy prefix-list $VAR(@)\" "; \ "protocols bgp $VAR(../../../@) neighbor $VAR(../../@) prefix-list import: prefix-list $VAR(@) doesn't exist" - commit:expression: $VAR(../../distribute-list/import/) == ""; "protocols bgp $VAR(../../../@) neighbor $VAR(../../@) prefix-list import: you can't set both a prefix-list and a distribute list" -update: if [ -n "$VAR(../../remote-as/@)" ]; then - peer="remote-as $VAR(../../remote-as/@)"; - else - peer="peer-group $VAR(../../peer-group/@)"; - fi; - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@); then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../../@) prefix-list $VAR(@) in" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "neighbor $VAR(../../@) prefix-list $VAR(@) in" - fi; - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@); then - vtysh --noerror \ - -c "configure terminal" \ - -c "address-family ipv6" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../../@) prefix-list $VAR(@) in" - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "no neighbor $VAR(../../@) prefix-list $VAR(@) in" - fi diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/node.def index 7472c88f..1a6187c9 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/node.def @@ -1,2 +1 @@ -priority: 717 help: Set a prefix-list to filter route updates to/from this neighbor diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/remote-as/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/remote-as/node.def index ed00b1f5..a91de5a7 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/remote-as/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/remote-as/node.def @@ -1,46 +1,6 @@ type: u32 help: Set neighbor BGP AS number [REQUIRED] - comp_help: possible completions: <1-4294967294> AS number - syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 4294967294; \ "remote-as must be between 1 and 4294967294" - -# Create action so this leaf is done before others -create: vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) remote-as $VAR(@)" || exit 1; - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@) - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) activate" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../@) activate"; - fi - -update: vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) remote-as $VAR(@)" || exit 1; - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@) - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) activate" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../@) activate"; - fi - -#remote-as needs to be set 1st & deleted last - comment out for now -#delete: vtysh -c "configure terminal" \ -# -c "router bgp $VAR(../../@)" \ -# -c "no neighbor $VAR(../@) remote-as $VAR(@)"; -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@) - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) activate" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../@) activate"; - fi diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/remove-private-as/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/remove-private-as/node.def index a2b7b553..c234d2fc 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/remove-private-as/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/remove-private-as/node.def @@ -1,39 +1,3 @@ help: Set to remove private AS numbers from AS path in outbound route updates - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" - commit:expression: $VAR(../peer-group/) == ""; "protocols bgp $VAR(../../@) neighbor $VAR(../../@): you can't set remove-private-as for a neighbor in a peer-group" - -update: if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../@) remove-private-AS" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) remove-private-AS" - fi - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); - then - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../@) remove-private-AS" - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) remove-private-AS" - fi diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/export/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/export/node.def index c73162c6..66e09b24 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/export/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/export/node.def @@ -1,47 +1,10 @@ type: txt help: Set a route-map to filter outgoing route updates to this neighbor - allowed: local -a params params=( /opt/vyatta/config/active/policy/route-map/* ) echo -n ${params[@]##*/} - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../../@) --neighbor $VAR(../../@)" - commit:expression: $VAR(../../peer-group/) == ""; "protocols bgp $VAR(../../../@) neighbor $VAR(../../@): you can't set a route-map for a neighbor in a peer-group" - commit:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy route-map $VAR(@)\" ";"protocols bgp $VAR(../../../@) neighbor $VAR(../../@) export: route-map $VAR(@) doesn't exist" - -update: if [ -n "$VAR(../../remote-as/@)" ]; then - peer="remote-as $VAR(../../remote-as/@)"; - else - peer="peer-group $VAR(../../peer-group/@)"; - fi; - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@) - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../../@) activate" \ - -c "neighbor $VAR(../../@) route-map $VAR(@) out" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "neighbor $VAR(../../@) route-map $VAR(@) out" - fi - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@) - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../../@) route-map $VAR(@) out" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "no neighbor $VAR(../../@) route-map $VAR(@) out" - fi - comp_help: possible completions: <txt> route-map name diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/import/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/import/node.def index 86d50f79..3163940a 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/import/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/import/node.def @@ -1,49 +1,10 @@ type: txt help: Set a route-map to filter incoming route updates from this neighbor - allowed: local -a params params=( /opt/vyatta/config/active/policy/route-map/* ) echo -n ${params[@]##*/} - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../../@) --neighbor $VAR(../../@)" - commit:expression: $VAR(../../peer-group/) == ""; "protocols bgp $VAR(../../../@) neighbor $VAR(../../@): you can't set a route-map for a neighbor in a peer-group" - commit:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy route-map $VAR(@)\" ";"protocols bgp $VAR(../../../@) neighbor $VAR(../../@) import: route-map $VAR(@) doesn't exist" - -update: if [ -n "$VAR(../../remote-as/@)" ]; - then - peer="remote-as $VAR(../../remote-as/@)"; - else - peer="peer-group $VAR(../../peer-group/@)"; - fi; - - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@) - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../../@) activate" \ - -c "neighbor $VAR(../../@) route-map $VAR(@) in" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "neighbor $VAR(../../@) route-map $VAR(@) in" - fi; - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@) - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../../@) route-map $VAR(@) in" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "no neighbor $VAR(../../@) route-map $VAR(@) in" - fi; - comp_help: possible completions: <txt> route-map name diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/node.def index cf400f91..7d581eb7 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/node.def @@ -1,2 +1 @@ -priority: 715 help: Set a route-map to filter route updates to/from this neighbor diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/route-reflector-client/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-reflector-client/node.def index 167d7718..2fce607f 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/route-reflector-client/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-reflector-client/node.def @@ -1,41 +1,4 @@ help: Set neighbor as a route reflector client - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" - commit:expression: $VAR(../peer-group/) == ""; "protocols bgp $VAR(../../@) neighbor $VAR(../@): you can't set route-reflector-client for a neighbor in a peer-group" - commit:expression: $VAR(../../@) == $VAR(../remote-as/@); "protocols bgp $VAR(../../@) neighbor $VAR(../@) route-reflector-client: remote-as must equal local-as" - -update: if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../@) route-reflector-client" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) route-reflector-client" - fi - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); - then - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../@) route-reflector-client" - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) route-reflector-client" - fi diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/route-server-client/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-server-client/node.def index a82b7247..b1cb9e39 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/route-server-client/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-server-client/node.def @@ -1,39 +1,3 @@ help: Set neighbor as route server client - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" - commit:expression: $VAR(../peer-group/) == ""; "protocols bgp $VAR(../../@) neighbor $VAR(../@): you can't set route-server-client for a neighbor in a peer-group" - -update: if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../@) route-server-client" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) route-server-client" - fi - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); - then - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../@) route-server-client" - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) route-server-client" - fi diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/shutdown/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/shutdown/node.def index 4ea19509..21863355 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/shutdown/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/shutdown/node.def @@ -1,13 +1,2 @@ help: Set to administratively shut down neighbor -priority: 705 commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" -update: if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) shutdown" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) shutdown" diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/soft-reconfiguration/inbound/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/soft-reconfiguration/inbound/node.def index ff70de01..b52799a6 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/soft-reconfiguration/inbound/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/soft-reconfiguration/inbound/node.def @@ -1,34 +1,3 @@ help: Set inbound soft reconfiguration for this neighbor [REQUIRED] commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as \ --as $VAR(../../../@) --neighbor $VAR(../../@)" - -update: if [ -n "$VAR(../../remote-as/@)" ]; then - peer="remote-as $VAR(../../remote-as/@)"; - else - peer="peer-group $VAR(../../peer-group/@)"; - fi; - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@) - then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../../@) soft-reconfiguration inbound"; - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "neighbor $VAR(../../@) soft-reconfiguration inbound"; - fi; - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@) - then - vtysh -n -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../../@) soft-reconfiguration inbound"; - else - vtysh -n -c "configure terminal" \ - -c "router bgp $VAR(../../../@)" \ - -c "no neighbor $VAR(../../@) soft-reconfiguration inbound"; - fi; diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/strict-capability-match/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/strict-capability-match/node.def index 45aab6e8..f2eb3e24 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/strict-capability-match/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/strict-capability-match/node.def @@ -1,13 +1,3 @@ help: Enable strict capability negotiation commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" commit:expression: $VAR(../override-capability/) == ""; "protocols bgp $VAR(../../@) neighbor $VAR(../@) strict-capability-match: you can't set both strict-capability and override-capability" -update: if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) strict-capability-match" -delete: vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) strict-capability-match " diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/timers/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/timers/node.def index 2b8d75e8..6fde9bd3 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/timers/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/timers/node.def @@ -1,27 +1,6 @@ help: Set neighbor timers commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" -commit:expression: $VAR(../peer-group/) == ""; "protocols bgp $VAR(../../@) neighbor $VAR(../@): you can't set timers for a neighbor in a peer-group" -delete: touch /tmp/bgp-neighbor-$VAR(../@)-timers.$PPID -end: vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) timers"; - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) timers connect"; - if [ -f "/tmp/bgp-neighbor-$VAR(../@)-timers.$PPID" ]; then - rm -rf /tmp/bgp-neighbor-$VAR(../@)-timers.$PPID; - else - if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - if [ -n "$VAR(./connect/@)" ]; then - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) timers connect $VAR(./connect/@)"; - fi; - if [ -n "$VAR(./keepalive/@)" ] || [ -n "$VAR(./holdtime/@)" ]; then - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) timers $VAR(./keepalive/@) $VAR(./holdtime/@)"; - fi; - fi; +# TODO: fix this. Can set connect &&|| (keepalive && holdtime) +commit:expression: $VAR(./keepalive/) != ""; "protocols bgp $VAR(../../@) timers: you must set a keepalive interval" +commit:expression: $VAR(./holdtime/) != ""; "protocols bgp $VAR(../../@) timers: you must set a holdtime interval" + diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/unsuppress-map/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/unsuppress-map/node.def index 3bc83999..ae2478a5 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/unsuppress-map/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/unsuppress-map/node.def @@ -1,50 +1,9 @@ type: txt -priority: 719 - help: Set a route-map to selectively unsuppress suppressed routes - comp_help: possible completions: <txt> route-map name - allowed: local -a params params=( /opt/vyatta/config/active/policy/route-map/* ) echo -n ${params[@]##*/} - commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" - -commit:expression: $VAR(../peer-group/) == ""; "protocols bgp $VAR(../../@) neighbor $VAR(../@): you can't set unsuppress-map for a neighbor in a peer-group" - commit:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy route-map $VAR(@)\" ";"protocols bgp $VAR(../../@) neighbor $VAR(../@): route-map $VAR(@) doesn't exist" - -update: if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); then - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../@) $peer" \ - -c "address-family ipv6" \ - -c "neighbor $VAR(../@) unsuppress-map $VAR(@)" - else - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) unsuppress-map $VAR(@)" - fi; - -delete: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); then - vtysh --noerror \ - -c "configure terminal" \ - -c "address-family ipv6" \ - -c "router bgp $VAR(../../@)" \ - -c "address-family ipv6" \ - -c "no neighbor $VAR(../@) unsuppress-map $VAR(@)" - else - vtysh --noerror \ - -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) unsuppress-map $VAR(@)" - fi; diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/update-source/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/update-source/node.def index 28239414..63fc633c 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/update-source/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/update-source/node.def @@ -5,14 +5,3 @@ comp_help: <interface> Set interface as route source commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-source $VAR(@)" commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" -update: if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) update-source $VAR(@)" -delete: vtysh --noerror -c "configure terminal" \ - -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) update-source" diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/weight/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/weight/node.def index 75ac0190..e5da2d21 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/weight/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/weight/node.def @@ -3,13 +3,3 @@ help: Set default weight for routes from this neighbor comp_help: \1 <1-65535>\tweight for routes from this neighbor syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 65535; "weight must be between 1 and 65535" commit:expression: exec "/opt/vyatta/sbin/vyatta-bgp.pl --check-as --as $VAR(../../@) --neighbor $VAR(../@)" -update: if [ -n "$VAR(../remote-as/@)" ]; then - peer="remote-as $VAR(../remote-as/@)"; - else - peer="peer-group $VAR(../peer-group/@)"; - fi; - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "neighbor $VAR(../@) $peer" \ - -c "neighbor $VAR(../@) weight $VAR(@)" -delete: vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no neighbor $VAR(../@) weight $VAR(@)" diff --git a/templates/protocols/bgp/node.tag/network/node.def b/templates/protocols/bgp/node.tag/network/node.def index e8262d1b..109312ae 100644 --- a/templates/protocols/bgp/node.tag/network/node.def +++ b/templates/protocols/bgp/node.tag/network/node.def @@ -2,27 +2,6 @@ tag: type: ipv4net help: Set a BGP network comp_help: \1 <x.x.x.x/x>\tnetwork - syntax:expression: exec "${vyatta_sbindir}/check_prefix_boundary $VAR(@)" - commit:expression: !($VAR(./backdoor/) != "" && $VAR(./route-map/) != ""); "protocols bgp $VAR(../@) network $VAR(@): May specify route-map or backdoor but not both" - -delete: touch /tmp/`echo $VAR(@) | sed 's!/!!'`.$PPID - -end: vtysh -n -c "configure terminal" \ - -c "router bgp $VAR(../@)" \ - -c "no network $VAR(@)"; - if [ -f "/tmp/`echo $VAR(@) | sed 's!/!!'`.$PPID" ]; then - rm -rf /tmp/`echo $VAR(@) | sed 's!/!!'`.$PPID; - else - if [ -n "$VAR(./backdoor/)" ]; then - cond="backdoor"; - fi; - if [ -n "$VAR(./route-map/@)" ]; then - cond="route-map $VAR(./route-map/@)"; - fi; - vtysh -c "configure terminal" \ - -c "router bgp $VAR(../@)" \ - -c "network $VAR(@) $cond"; - fi; diff --git a/templates/protocols/bgp/node.tag/parameters/always-compare-med/node.def b/templates/protocols/bgp/node.tag/parameters/always-compare-med/node.def index f91e5743..70c8284a 100644 --- a/templates/protocols/bgp/node.tag/parameters/always-compare-med/node.def +++ b/templates/protocols/bgp/node.tag/parameters/always-compare-med/node.def @@ -1,5 +1 @@ help: Set to compare MEDs from different neighbors -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "bgp always-compare-med" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no bgp always-compare-med" diff --git a/templates/protocols/bgp/node.tag/parameters/bestpath/as-path/confed/node.def b/templates/protocols/bgp/node.tag/parameters/bestpath/as-path/confed/node.def index c5cf317b..194741e6 100644 --- a/templates/protocols/bgp/node.tag/parameters/bestpath/as-path/confed/node.def +++ b/templates/protocols/bgp/node.tag/parameters/bestpath/as-path/confed/node.def @@ -1,6 +1 @@ help: Set to compare AS-path lengths including confederation sets & sequences -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../../../@)" \ - -c "bgp bestpath as-path confed" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../../../@)" \ - -c "no bgp bestpath as-path confed " - diff --git a/templates/protocols/bgp/node.tag/parameters/bestpath/as-path/ignore/node.def b/templates/protocols/bgp/node.tag/parameters/bestpath/as-path/ignore/node.def index bc364db1..07aa6178 100644 --- a/templates/protocols/bgp/node.tag/parameters/bestpath/as-path/ignore/node.def +++ b/templates/protocols/bgp/node.tag/parameters/bestpath/as-path/ignore/node.def @@ -1,5 +1 @@ help: Set to ignore AS-path length in selecting a route -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../../../@)" \ - -c "bgp bestpath as-path ignore" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../../../@)" \ - -c "no bgp bestpath as-path ignore" diff --git a/templates/protocols/bgp/node.tag/parameters/bestpath/compare-routerid/node.def b/templates/protocols/bgp/node.tag/parameters/bestpath/compare-routerid/node.def index cd6da257..6781575e 100644 --- a/templates/protocols/bgp/node.tag/parameters/bestpath/compare-routerid/node.def +++ b/templates/protocols/bgp/node.tag/parameters/bestpath/compare-routerid/node.def @@ -1,6 +1 @@ help: Set to compare the router-id for identical EBGP paths -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \ - -c "bgp bestpath compare-routerid" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \ - -c "no bgp bestpath compare-routerid" - diff --git a/templates/protocols/bgp/node.tag/parameters/bestpath/med/confed/node.def b/templates/protocols/bgp/node.tag/parameters/bestpath/med/confed/node.def index a2e56c64..d65231d3 100644 --- a/templates/protocols/bgp/node.tag/parameters/bestpath/med/confed/node.def +++ b/templates/protocols/bgp/node.tag/parameters/bestpath/med/confed/node.def @@ -1,6 +1 @@ help: Set to compare MEDs among confederation paths -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../../../@)" \ - -c "bgp bestpath med confed" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../../../@)" \ - -c "no bgp bestpath med confed" - diff --git a/templates/protocols/bgp/node.tag/parameters/bestpath/med/missing-as-worst/node.def b/templates/protocols/bgp/node.tag/parameters/bestpath/med/missing-as-worst/node.def index 89ffa368..7c5e2b04 100644 --- a/templates/protocols/bgp/node.tag/parameters/bestpath/med/missing-as-worst/node.def +++ b/templates/protocols/bgp/node.tag/parameters/bestpath/med/missing-as-worst/node.def @@ -1,6 +1 @@ help: Set to treat a route missing a MED as the least preferred one -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../../../@)" \ - -c "bgp bestpath med missing-as-worst" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../../../@)" \ - -c "no bgp bestpath med missing-as-worst" - diff --git a/templates/protocols/bgp/node.tag/parameters/cluster-id/node.def b/templates/protocols/bgp/node.tag/parameters/cluster-id/node.def index 7a413785..a855eb00 100644 --- a/templates/protocols/bgp/node.tag/parameters/cluster-id/node.def +++ b/templates/protocols/bgp/node.tag/parameters/cluster-id/node.def @@ -1,7 +1,3 @@ type: ipv4 help: Set the route-reflector cluster-id comp_help: \1 <x.x.x.x>\tcluster-id IP -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "bgp cluster-id $VAR(@)" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no bgp cluster-id" diff --git a/templates/protocols/bgp/node.tag/parameters/confederation/identifier/node.def b/templates/protocols/bgp/node.tag/parameters/confederation/identifier/node.def index 1cc994b9..2678b08c 100644 --- a/templates/protocols/bgp/node.tag/parameters/confederation/identifier/node.def +++ b/templates/protocols/bgp/node.tag/parameters/confederation/identifier/node.def @@ -2,7 +2,3 @@ type: u32 help: Set confederation AS identifier [REQUIRED] comp_help: \1 <1-4294967294>\tconfederation AS id syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 4294967294; "confederation AS id must be between 1 and 4294967294" -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \ - -c "bgp confederation identifier $VAR(@)" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \ - -c "no bgp confederation identifier" diff --git a/templates/protocols/bgp/node.tag/parameters/confederation/peers/node.def b/templates/protocols/bgp/node.tag/parameters/confederation/peers/node.def index 899d696d..184e1584 100644 --- a/templates/protocols/bgp/node.tag/parameters/confederation/peers/node.def +++ b/templates/protocols/bgp/node.tag/parameters/confederation/peers/node.def @@ -3,7 +3,3 @@ type: u32 help: Set the peer ASs in the BGP confederation comp_help: \1 <1-4294967294>\tpeer AS number numbers (ex: "435 234") syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 4294967294; "confederation AS id must be between 1 and 4294967294" -create: vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \ - -c "bgp confederation peers $VAR(@)" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \ - -c "no bgp confederation peers $VAR(@)" diff --git a/templates/protocols/bgp/node.tag/parameters/dampening/node.def b/templates/protocols/bgp/node.tag/parameters/dampening/node.def index e9513221..6d5f09fe 100644 --- a/templates/protocols/bgp/node.tag/parameters/dampening/node.def +++ b/templates/protocols/bgp/node.tag/parameters/dampening/node.def @@ -2,11 +2,3 @@ help: Enable route-flap dampening delete:expression: "touch /tmp/bgp-dampening.$PPID" # Note that there is a bug in quagga here. If bgpd gets two 'no bgp dampening' # commands in a row it will crash -end: if [ -f "/tmp/bgp-dampening.$PPID" ]; then - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no bgp dampening" ; - rm -f "/tmp/bgp-dampening.$PPID" ; - else - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "bgp dampening $VAR(./half-life/@) $VAR(./re-use/@) $VAR(./start-suppress-time/@) $VAR(./max-suppress-time/@)" ; - fi ; diff --git a/templates/protocols/bgp/node.tag/parameters/default/local-pref/node.def b/templates/protocols/bgp/node.tag/parameters/default/local-pref/node.def index 7915bf52..2435e3c2 100644 --- a/templates/protocols/bgp/node.tag/parameters/default/local-pref/node.def +++ b/templates/protocols/bgp/node.tag/parameters/default/local-pref/node.def @@ -1,7 +1,3 @@ type: u32 help: Set the default local preference (higher=more preferred) comp_help: \1 <0-4294967295>\tlocal preference -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \ - -c "bgp default local-preference $VAR(@)" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \ - -c "no bgp default local-preference" diff --git a/templates/protocols/bgp/node.tag/parameters/default/no-ipv4-unicast/node.def b/templates/protocols/bgp/node.tag/parameters/default/no-ipv4-unicast/node.def index b65bacf3..2f2019c2 100644 --- a/templates/protocols/bgp/node.tag/parameters/default/no-ipv4-unicast/node.def +++ b/templates/protocols/bgp/node.tag/parameters/default/no-ipv4-unicast/node.def @@ -1,5 +1 @@ help: Set to deactivate IPv4 unicast for a peer by default -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \ - -c "no bgp default ipv4-unicast" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \ - -c "bgp default ipv4-unicast " diff --git a/templates/protocols/bgp/node.tag/parameters/deterministic-med/node.def b/templates/protocols/bgp/node.tag/parameters/deterministic-med/node.def index d15fc5ba..ba74d93a 100644 --- a/templates/protocols/bgp/node.tag/parameters/deterministic-med/node.def +++ b/templates/protocols/bgp/node.tag/parameters/deterministic-med/node.def @@ -1,5 +1 @@ help: Set to compare MEDs between different peers in the same AS -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "bgp deterministic-med" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no bgp deterministic-med" diff --git a/templates/protocols/bgp/node.tag/parameters/disable-network-import-check/node.def b/templates/protocols/bgp/node.tag/parameters/disable-network-import-check/node.def index 62adaf91..f4a670a3 100644 --- a/templates/protocols/bgp/node.tag/parameters/disable-network-import-check/node.def +++ b/templates/protocols/bgp/node.tag/parameters/disable-network-import-check/node.def @@ -1,5 +1 @@ help: Set to disable IGP route check for network statements -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no bgp network import-check" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "bgp network import-check" diff --git a/templates/protocols/bgp/node.tag/parameters/enforce-first-as/node.def b/templates/protocols/bgp/node.tag/parameters/enforce-first-as/node.def index 269ec92f..c7f8814f 100644 --- a/templates/protocols/bgp/node.tag/parameters/enforce-first-as/node.def +++ b/templates/protocols/bgp/node.tag/parameters/enforce-first-as/node.def @@ -1,5 +1 @@ help: Set to require first AS in the path to match peer's AS -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "bgp enforce-first-as " -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no bgp enforce-first-as " diff --git a/templates/protocols/bgp/node.tag/parameters/graceful-restart/stalepath-time/node.def b/templates/protocols/bgp/node.tag/parameters/graceful-restart/stalepath-time/node.def index 73cc18c5..df75d416 100644 --- a/templates/protocols/bgp/node.tag/parameters/graceful-restart/stalepath-time/node.def +++ b/templates/protocols/bgp/node.tag/parameters/graceful-restart/stalepath-time/node.def @@ -2,7 +2,3 @@ type: u32 help: Set the maximum time to hold onto restarting peer's stale paths comp_help: \1 <1-3600>\thold time in seconds syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 3600; "stalepath-time must be between 1 and 3600" -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \ - -c "bgp graceful-restart stalepath-time $VAR(@)" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \ - -c "no bgp graceful-restart stalepath-time" diff --git a/templates/protocols/bgp/node.tag/parameters/log-neighbor-changes/node.def b/templates/protocols/bgp/node.tag/parameters/log-neighbor-changes/node.def index b27054f2..f231010f 100644 --- a/templates/protocols/bgp/node.tag/parameters/log-neighbor-changes/node.def +++ b/templates/protocols/bgp/node.tag/parameters/log-neighbor-changes/node.def @@ -1,5 +1 @@ help: Set to log neighbor up/down changes and reset reason -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "bgp log-neighbor-changes" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no bgp log-neighbor-changes" diff --git a/templates/protocols/bgp/node.tag/parameters/no-client-to-client-reflection/node.def b/templates/protocols/bgp/node.tag/parameters/no-client-to-client-reflection/node.def index a0dd5246..30d2de78 100644 --- a/templates/protocols/bgp/node.tag/parameters/no-client-to-client-reflection/node.def +++ b/templates/protocols/bgp/node.tag/parameters/no-client-to-client-reflection/node.def @@ -1,5 +1 @@ help: Set to disable client to client route reflection -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no bgp client-to-client reflection" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "bgp client-to-client reflection" diff --git a/templates/protocols/bgp/node.tag/parameters/no-fast-external-failover/node.def b/templates/protocols/bgp/node.tag/parameters/no-fast-external-failover/node.def index 3c0a8254..37c4a0af 100644 --- a/templates/protocols/bgp/node.tag/parameters/no-fast-external-failover/node.def +++ b/templates/protocols/bgp/node.tag/parameters/no-fast-external-failover/node.def @@ -1,5 +1 @@ help: Set to disable immediate sesison reset if peer's connected link goes down -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no bgp fast-external-failover" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "bgp fast-external-failover" diff --git a/templates/protocols/bgp/node.tag/parameters/node.def b/templates/protocols/bgp/node.tag/parameters/node.def index e99114be..6bb752b5 100644 --- a/templates/protocols/bgp/node.tag/parameters/node.def +++ b/templates/protocols/bgp/node.tag/parameters/node.def @@ -1,2 +1 @@ -priority: 700 help: Set BGP parameters diff --git a/templates/protocols/bgp/node.tag/parameters/router-id/node.def b/templates/protocols/bgp/node.tag/parameters/router-id/node.def index e80d5f19..05beb6cc 100644 --- a/templates/protocols/bgp/node.tag/parameters/router-id/node.def +++ b/templates/protocols/bgp/node.tag/parameters/router-id/node.def @@ -1,7 +1,3 @@ type: ipv4 help: Set BGP router id comp_help: \1 <x.x.x.x>\tBGP router-id IP -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "bgp router-id $VAR(@)" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no bgp router-id" diff --git a/templates/protocols/bgp/node.tag/parameters/scan-time/node.def b/templates/protocols/bgp/node.tag/parameters/scan-time/node.def index 057832f7..9e19626a 100644 --- a/templates/protocols/bgp/node.tag/parameters/scan-time/node.def +++ b/templates/protocols/bgp/node.tag/parameters/scan-time/node.def @@ -2,7 +2,3 @@ type: u32 help: Set BGP route scanner interval comp_help: \1 <5-60>\tscan interval in seconds syntax:expression: $VAR(@) >= 5 && $VAR(@) <= 60; "scan-time must be between 5 and 60 seconds" -update: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "bgp scan-time $VAR(@)" -delete: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no bgp scan-time" diff --git a/templates/protocols/bgp/node.tag/redistribute/connected/node.def b/templates/protocols/bgp/node.tag/redistribute/connected/node.def index a85348f9..acdef3a3 100644 --- a/templates/protocols/bgp/node.tag/redistribute/connected/node.def +++ b/templates/protocols/bgp/node.tag/redistribute/connected/node.def @@ -1,16 +1 @@ help: Set to redistribute connected routes into BGP -delete: touch /tmp/bgp-redist-connected.$PPID -end: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no redistribute connected"; - if [ -f "/tmp/bgp-redist-connected.$PPID" ]; then - rm -rf /tmp/bgp-redist-connected.$PPID; - else - if [ -n "$VAR(./metric/@)" ]; then - cond="metric $VAR(./metric/@)"; - fi; - if [ -n "$VAR(./route-map/@)" ]; then - cond="$cond route-map $VAR(./route-map/@)"; - fi; - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "redistribute connected $cond"; - fi; diff --git a/templates/protocols/bgp/node.tag/redistribute/kernel/node.def b/templates/protocols/bgp/node.tag/redistribute/kernel/node.def index 3f2d4147..45c82dda 100644 --- a/templates/protocols/bgp/node.tag/redistribute/kernel/node.def +++ b/templates/protocols/bgp/node.tag/redistribute/kernel/node.def @@ -1,16 +1 @@ help: Set to redistribute kernel routes into BGP -delete: touch /tmp/bgp-redist-kernel.$PPID -end: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no redistribute kernel "; - if [ -f "/tmp/bgp-redist-kernel.$PPID" ]; then - rm -rf /tmp/bgp-redist-kernel.$PPID; - else - if [ -n "$VAR(./metric/@)" ]; then - cond="metric $VAR(./metric/@)"; - fi; - if [ -n "$VAR(./route-map/@)" ]; then - cond="$cond route-map $VAR(./route-map/@)"; - fi; - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "redistribute kernel $cond"; - fi; diff --git a/templates/protocols/bgp/node.tag/redistribute/ospf/node.def b/templates/protocols/bgp/node.tag/redistribute/ospf/node.def index 8570d8d3..f0f6e8de 100644 --- a/templates/protocols/bgp/node.tag/redistribute/ospf/node.def +++ b/templates/protocols/bgp/node.tag/redistribute/ospf/node.def @@ -1,16 +1 @@ help: Set to redistribute OSPF routes into BGP -delete: touch /tmp/bgp-redist-ospf.$PPID -end: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no redistribute ospf"; - if [ -f "/tmp/bgp-redist-ospf.$PPID" ]; then - rm -rf /tmp/bgp-redist-ospf.$PPID; - else - if [ -n "$VAR(./metric/@)" ]; then - cond="metric $VAR(./metric/@)"; - fi; - if [ -n "$VAR(./route-map/@)" ]; then - cond="$cond route-map $VAR(./route-map/@)"; - fi; - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "redistribute ospf $cond"; - fi; diff --git a/templates/protocols/bgp/node.tag/redistribute/rip/node.def b/templates/protocols/bgp/node.tag/redistribute/rip/node.def index 2695f58e..577b17e9 100644 --- a/templates/protocols/bgp/node.tag/redistribute/rip/node.def +++ b/templates/protocols/bgp/node.tag/redistribute/rip/node.def @@ -1,16 +1 @@ help: Set to redistribute RIP routes into BGP -delete: touch /tmp/bgp-redist-rip.$PPID -end: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no redistribute rip "; - if [ -f "/tmp/bgp-redist-rip.$PPID" ]; then - rm -rf /tmp/bgp-redist-rip.$PPID; - else - if [ -n "$VAR(./metric/@)" ]; then - cond="metric $VAR(./metric/@)"; - fi; - if [ -n "$VAR(./route-map/@)" ]; then - cond="$cond route-map $VAR(./route-map/@)"; - fi; - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "redistribute rip $cond"; - fi; diff --git a/templates/protocols/bgp/node.tag/redistribute/static/node.def b/templates/protocols/bgp/node.tag/redistribute/static/node.def index c2517d07..c196a54b 100644 --- a/templates/protocols/bgp/node.tag/redistribute/static/node.def +++ b/templates/protocols/bgp/node.tag/redistribute/static/node.def @@ -1,16 +1 @@ help: Set to redistribute static routes into BGP -delete: touch /tmp/bgp-redist-static.$PPID -end: vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "no redistribute static"; - if [ -f "/tmp/bgp-redist-static.$PPID" ]; then - rm -rf /tmp/bgp-redist-static.$PPID; - else - if [ -n "$VAR(./metric/@)" ]; then - cond="metric $VAR(./metric/@)"; - fi; - if [ -n "$VAR(./route-map/@)" ]; then - cond="$cond route-map $VAR(./route-map/@)"; - fi; - vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \ - -c "redistribute static $cond"; - fi; diff --git a/templates/protocols/bgp/node.tag/timers/node.def b/templates/protocols/bgp/node.tag/timers/node.def index 97e3a31f..f25de2a5 100644 --- a/templates/protocols/bgp/node.tag/timers/node.def +++ b/templates/protocols/bgp/node.tag/timers/node.def @@ -1,12 +1,3 @@ help: Set BGP protocol timers commit:expression: $VAR(./keepalive/) != ""; "protocols bgp $VAR(../@) timers: you must set a keepalive interval" commit:expression: $VAR(./holdtime/) != ""; "protocols bgp $VAR(../@) timers: you must set a holdtime interval" -delete: touch /tmp/bgp-timers.$PPID -end: vtysh -c "configure terminal" -c "router bgp $VAR(../@)" \ - -c "no timers bgp"; - if [ -f "/tmp/bgp-timers.$PPID" ]; then - rm -rf /tmp/bgp-timers.$PPID; - else - vtysh -c "configure terminal" -c "router bgp $VAR(../@)" \ - -c "timers bgp $VAR(./keepalive/@) $VAR(./holdtime/@)"; - fi; |