diff options
author | Robert Bays <robert@vyatta.com> | 2011-09-29 12:00:10 -0700 |
---|---|---|
committer | Robert Bays <robert@vyatta.com> | 2011-09-29 12:00:10 -0700 |
commit | ff703eb15618b2ebcc1ed85563a73de944d59664 (patch) | |
tree | b82291e56d92cd826bfb094fa2a74d221808a9f0 | |
parent | 33d8cca996a4f8dd1a5d918c57cc4c82696694bb (diff) | |
download | vyatta-cfg-quagga-ff703eb15618b2ebcc1ed85563a73de944d59664.tar.gz vyatta-cfg-quagga-ff703eb15618b2ebcc1ed85563a73de944d59664.zip |
bgp: Bug 6033 - There is no auto completion for "bgp <> neighbor <> peer-group"
3 files changed, 21 insertions, 2 deletions
diff --git a/scripts/bgp/vyatta-bgp.pl b/scripts/bgp/vyatta-bgp.pl index 4f4ac40e..d10a37af 100755 --- a/scripts/bgp/vyatta-bgp.pl +++ b/scripts/bgp/vyatta-bgp.pl @@ -1072,7 +1072,7 @@ my %qcom = ( my $qconfig = new Vyatta::Quagga::Config('protocols', \%qcom); my ( $pg, $as, $neighbor ); -my ( $main, $peername, $isneighbor, $checkpeergroups, $checksource, $isiBGPpeer, $wasiBGPpeer, $confedibgpasn); +my ( $main, $peername, $isneighbor, $checkpeergroups, $checksource, $isiBGPpeer, $wasiBGPpeer, $confedibgpasn, $listpeergroups); GetOptions( "peergroup=s" => \$pg, @@ -1085,6 +1085,7 @@ GetOptions( "is-iBGP" => \$isiBGPpeer, "was-iBGP" => \$wasiBGPpeer, "confed-iBGP-ASN-check=s" => \$confedibgpasn, + "list-peer-groups" => \$listpeergroups, "main" => \$main, ); @@ -1096,10 +1097,20 @@ check_source($checksource) if ($checksource); confed_iBGP_ASN($as, $confedibgpasn) if ($confedibgpasn); is_iBGP_peer($neighbor, $as) if ($isiBGPpeer); was_iBGP_peer($neighbor, $as) if ($wasiBGPpeer); - +list_peer_groups($as) if ($listpeergroups); exit 0; +sub list_peer_groups { + my $as = shift; + my $config = new Vyatta::Config; + + $config->setLevel("protocols bgp $as peer-group"); + my @nodes = $config->listNodes(); + foreach my $node (@nodes) { print "$node "; } + return; +} + # Make sure the peer IP isn't a local system IP sub check_neighbor_ip { my $neighbor = shift; diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/address-family/ipv6-unicast/peer-group/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/address-family/ipv6-unicast/peer-group/node.def index a6e2f658..49b99a60 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/address-family/ipv6-unicast/peer-group/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/address-family/ipv6-unicast/peer-group/node.def @@ -1,2 +1,6 @@ type: txt help: IPv6 peer group for this peer +allowed: local -a params + params=$( /opt/vyatta/sbin/vyatta-bgp.pl --list-peer-groups --as ${COMP_WORDS[3]} ) + echo -n ${params[@]##*/} +commit:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"protocols bgp $VAR(../../../../@) peer-group $VAR(@)\" "; "protocols bgp $VAR(../../../../@) peer-group $VAR(@) doesn't exist" 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 index e407b561..83985e10 100644 --- 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 @@ -1,2 +1,6 @@ type: txt help: IPv4 peer group for this peer +allowed: local -a params + params=$( /opt/vyatta/sbin/vyatta-bgp.pl --list-peer-groups --as ${COMP_WORDS[3]} ) + echo -n ${params[@]##*/} +commit:expression: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"protocols bgp $VAR(../../@) peer-group $VAR(@)\" "; "protocols bgp $VAR(../../@) peer-group $VAR(@) doesn't exist" |