summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2010-02-17 11:23:13 -0800
committerStig Thormodsrud <stig@vyatta.com>2010-02-17 11:23:13 -0800
commit0e5af25f8502517e300a94426c9e6325a0eef0a5 (patch)
tree20938e08804b587e3d9ad333414c1a02bf0dfe2c
parent551aac26d5c12f33a6e9951cb55434cd1c166cec (diff)
downloadvyatta-cfg-quagga-0e5af25f8502517e300a94426c9e6325a0eef0a5.tar.gz
vyatta-cfg-quagga-0e5af25f8502517e300a94426c9e6325a0eef0a5.zip
Fix 5344: committing prefix-list6 as bgp ipv6 neighbor prefix-list
got "prefix-list <> doesn't exist"
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/export/node.def48
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/import/node.def48
2 files changed, 82 insertions, 14 deletions
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 4de56dfe..eb8c252c 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,18 +1,52 @@
type: txt
help: Set a prefix-list to filter outgoing route updates to this neighbor
-comp_help: \1 <txt>\t\tprefix-list name
+
+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(@)\" ";"protocols bgp $VAR(../../../@) neighbor $VAR(../../@) prefix-list export: prefix-list $VAR(@) doesn't exist"
+
+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(@)\""; \
+"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;
- vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \
- -c "neighbor $VAR(../../@) $peer" \
- -c "neighbor $VAR(../../@) prefix-list $VAR(@) out"
-delete: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../../@)" \
- -c "no neighbor $VAR(../../@) prefix-list $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(../../@) prefix-list $VAR(@) out"
+ else
+ vyatta-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
+ vyatta-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
+ vyatta-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 5696359c..849a871d 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,18 +1,52 @@
type: txt
help: Set a prefix-list to filter incoming route updates from this neighbor
-comp_help: \1 <txt>\t\tprefix-list name
+
+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(@)\" ";"protocols bgp $VAR(../../../@) neighbor $VAR(../../@) prefix-list import: prefix-list $VAR(@) doesn't exist"
+
+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(@)\""; \
+"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;
- vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \
- -c "neighbor $VAR(../../@) $peer" \
- -c "neighbor $VAR(../../@) prefix-list $VAR(@) in"
-delete: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../../@)" \
- -c "no neighbor $VAR(../../@) prefix-list $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(../../@) prefix-list $VAR(@) in"
+ else
+ vyatta-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
+ vyatta-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
+ vyatta-vtysh --noerror \
+ -c "configure terminal" \
+ -c "router bgp $VAR(../../../@)" \
+ -c "no neighbor $VAR(../../@) prefix-list $VAR(@) in"
+ fi