From 674a60ba8dc885f0d1a7775fdfc000c653a76deb Mon Sep 17 00:00:00 2001 From: Robert Bays Date: Sat, 22 May 2010 23:21:48 -0700 Subject: add functionality to skip nodes while in _setConfigTree --- scripts/bgp/vyatta-bgp.pl | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'scripts/bgp/vyatta-bgp.pl') diff --git a/scripts/bgp/vyatta-bgp.pl b/scripts/bgp/vyatta-bgp.pl index 12b1349f..b72deab9 100755 --- a/scripts/bgp/vyatta-bgp.pl +++ b/scripts/bgp/vyatta-bgp.pl @@ -148,7 +148,7 @@ my %qcom = ( del => undef, }, "protocols bgp var neighbor var" => { - set => "router bgp #3 ; neighbor #5", + set => undef, del => "router bgp #3 ; no neighbor #5", }, "protocols bgp var neighbor var address-family" => { @@ -1213,8 +1213,18 @@ sub main { #$qconfig->_reInitialize(); # deletes with priority + # TODO: need to put syntax check in remote-as + # delete everything in neighbhor except for the important nodes + my @skip_array = ('remote-as', 'route-map', 'filter-list', 'prefix-list', 'distribute-list', 'unsuppress-map'); + # notice the extra space in the level string. keeps the parent from being deleted. + $qconfig->deleteConfigTreeRecursive('protocols bgp var neighbor var ', @skip_array) || die "exiting $?\n"; + # now delete everything in neighbor except remote-as + @skip_array = ('remote-as'); + $qconfig->deleteConfigTreeRecursive('protocols bgp var neighbor var ', @skip_array) || die "exiting $?\n"; + # now finish off neighbor + $qconfig->deleteConfigTreeRecursive('protocols bgp var neighbor var') || die "exiting $?\n"; + # now delete everything else $qconfig->deleteConfigTreeRecursive('protocols bgp') || die "exiting $?\n"; - # would be cool if I could add a recursive delete such as everything but (protocols bgp var neigh var remote-as) # sets with priority $qconfig->setConfigTreeRecursive('protocols bgp var parameters') || die "exiting $?\n"; -- cgit v1.2.3