From 777f544d0361d63c1eea1fa39d4e620fa02ed597 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Fri, 30 Oct 2009 17:17:22 -0700 Subject: Fix 5060: error adding bgp policy to ipv6 peer. --- .../neighbor/node.tag/route-map/export/node.def | 38 ++++++++++++++++---- .../neighbor/node.tag/route-map/import/node.def | 40 ++++++++++++++++++---- 2 files changed, 66 insertions(+), 12 deletions(-) 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 75cd25dc..47e78336 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,17 +1,43 @@ type: txt help: Set a route-map to filter outgoing route updates to this neighbor -comp_help: \1 \t\troute-map 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 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; - vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "neighbor $VAR(../../@) route-map $VAR(@) out" -delete: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../../@)" \ - -c "no neighbor $VAR(../../@) route-map $VAR(@) out" + if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@) + then + vyatta-vtysh -c "configure terminal" \ + -c "router bgp $VAR(../../../@)" \ + -c "address-family ipv6" \ + -c "neighbor $VAR(../../@) $peer" \ + -c "address-family ipv6" \ + -c "neighbor $VAR(../../@) route-map $VAR(@) out" + else + vyatta-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 + vyatta-vtysh -c "configure terminal" \ + -c "router bgp $VAR(../../../@)" \ + -c "address-family ipv6" \ + -c "no neighbor $VAR(../../@) route-map $VAR(@) out" + else + vyatta-vtysh -c "configure terminal" \ + -c "router bgp $VAR(../../../@)" \ + -c "no neighbor $VAR(../../@) route-map $VAR(@) out" + fi +comp_help: possible completions: + 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 d6fa203e..4bac3854 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,17 +1,45 @@ type: txt help: Set a route-map to filter incoming route updates from this neighbor -comp_help: \1 \t\troute-map 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 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; - vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \ - -c "neighbor $VAR(../../@) $peer" \ - -c "neighbor $VAR(../../@) route-map $VAR(@) in" -delete: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../../@)" \ - -c "no neighbor $VAR(../../@) route-map $VAR(@) in" + if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@) + then + vyatta-vtysh -c "configure terminal" \ + -c "router bgp $VAR(../../../@)" \ + -c "address-family ipv6" \ + -c "neighbor $VAR(../../@) $peer" \ + -c "address-family ipv6" \ + -c "neighbor $VAR(../../@) route-map $VAR(@) in" + else + vyatta-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 + vyatta-vtysh -c "configure terminal" \ + -c "router bgp $VAR(../../../@)" \ + -c "address-family ipv6" \ + -c "no neighbor $VAR(../../@) route-map $VAR(@) in" + else + vyatta-vtysh -c "configure terminal" \ + -c "router bgp $VAR(../../../@)" \ + -c "no neighbor $VAR(../../@) route-map $VAR(@) in" + fi + + +comp_help: possible completions: + route-map name -- cgit v1.2.3