summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2010-02-18 18:40:11 -0800
committerStig Thormodsrud <stig@vyatta.com>2010-02-18 18:40:11 -0800
commit5af25f2a41803cc22b6ea17f414c2f2bea1cf476 (patch)
treef6c299ca9fddcc77f017889a5c9fcc0262a92210
parent828c4e2ae3e9cda7056d38fdb172de42a90e7a3d (diff)
downloadvyatta-cfg-quagga-5af25f2a41803cc22b6ea17f414c2f2bea1cf476.tar.gz
vyatta-cfg-quagga-5af25f2a41803cc22b6ea17f414c2f2bea1cf476.zip
Fixes to support IPv6 BGP peer.
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/advertisement-interval/node.def20
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/allowas-in/node.def35
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/node.def77
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/capability/dynamic/node.def38
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/receive/node.def44
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/send/node.def42
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/node.def3
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/route-map/node.def6
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/disable-send-community/extended/node.def49
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/disable-send-community/standard/node.def45
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/export/node.def65
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/import/node.def58
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/ebgp-multihop/node.def18
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/local-as/node.def9
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/node.def58
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/maximum-prefix/node.def49
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/nexthop-self/node.def45
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/remove-private-as/node.def35
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/export/node.def4
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/import/node.def4
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/route-reflector-client/node.def36
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/route-server-client/node.def35
22 files changed, 596 insertions, 179 deletions
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 7544aeec..e64ab3d6 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,15 +1,25 @@
type: u32
+
help: Set the minimum interval for sending routing updates
-comp_help: \1 <0-600>\tadvertisement interval in seconds
+
+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;
- vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \
- -c "neighbor $VAR(../@) $peer" \
+ vyatta-vtysh -c "configure terminal" \
+ -c "router bgp $VAR(../../@)" \
+ -c "neighbor $VAR(../@) $peer" \
-c "neighbor $VAR(../@) advertisement-interval $VAR(@)"
-delete: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \
- -c "no neighbor $VAR(../@) advertisement-interval"
+
+delete: vyatta-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 f4442693..4ee7ebac 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,17 +1,34 @@
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(../@)"
-delete: touch /tmp/bgp-neighbor-$VAR(../@)-allowas-in.$PPID
-end: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \
+
+end: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); then
+ vyatta-vtysh --noerror \
+ -c "configure terminal" \
+ -c "router bgp $VAR(../../@)" \
+ -c "address-family ipv6" \
-c "no neighbor $VAR(../@) allowas-in ";
- if [ -f "/tmp/bgp-neighbor-$VAR(../@)-allowas-in.$PPID" ]; then
- rm -rf /tmp/bgp-neighbor-$VAR(../@)-allowas-in.$PPID;
- else
+ else
+ vyatta-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;
- vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \
- -c "neighbor $VAR(../@) $peer" \
- -c "neighbor $VAR(../@) allowas-in $VAR(./number/@)";
- fi;
+ if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); then
+ vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \
+ -c "neighbor $VAR(../@) $peer" \
+ -c "address-family ipv6" \
+ -c "neighbor $VAR(../@) allowas-in $VAR(./number/@)";
+ else
+ vyatta-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 37cec991..a04fa398 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,31 +1,52 @@
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"
-delete: touch /tmp/bgp-neighbor-$VAR(../@)-attribute-unchanged.$PPID
-end: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \
- -c "no neighbor $VAR(../@) attribute-unchanged ";
- if [ -f "/tmp/bgp-neighbor-$VAR(../@)-attribute-unchanged.$PPID" ]; then
- rm -rf /tmp/bgp-neighbor-$VAR(../@)-attribute-unchanged.$PPID;
- else
- ## the calls to check-typeless-node should be removed when the type-less node built-in returns correctly
- ${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;
- vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \
- -c "neighbor $VAR(../@) $peer" \
- -c "neighbor $VAR(../@) attribute-unchanged $cond";
- fi;
+
+end: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); then
+ vyatta-vtysh --noerror \
+ -c "configure terminal" \
+ -c "router bgp $VAR(../../@)" \
+ -c "address-family ipv6" \
+ -c "neighbor $VAR(../@) activate" \
+ -c "no neighbor $VAR(../@) attribute-unchanged ";
+ else
+ vyatta-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
+ vyatta-vtysh -c "configure terminal" \
+ -c "router bgp $VAR(../../@)" \
+ -c "neighbor $VAR(../@) $peer" \
+ -c "address-family ipv6" \
+ -c "neighbor $VAR(../@) attribute-unchanged $cond";
+ else
+ vyatta-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 7c41868c..4ec98ef6 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,13 +1,39 @@
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
+
+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(../../@) capability dynamic"
-delete: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../../@)" \
- -c "no neighbor $VAR(../../@) capability dynamic"
+
+ if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../@);
+ then
+ vyatta-vtysh -c "configure terminal" \
+ -c "router bgp $VAR(../../../@)" \
+ -c "neighbor $VAR(../../@) $peer" \
+ -c "address-family ipv6" \
+ -c "neighbor $VAR(../../@) capability dynamic"
+ else
+ vyatta-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
+ vyatta-vtysh --noerror \
+ -c "configure terminal" \
+ -c "router bgp $VAR(../../../@)" \
+ -c "address-family ipv6" \
+ -c "no neighbor $VAR(../../@) capability dynamic"
+ else
+ vyatta-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 693b764e..9e28247b 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,14 +1,38 @@
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;
- vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../../../../@)" \
- -c "neighbor $VAR(../../../../@) $peer" \
- -c "neighbor $VAR(../../../../@) capability orf prefix-list receive"
-delete: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../../../../@)" \
- -c "no neighbor $VAR(../../../../@) capability orf prefix-list receive"
+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
+ vyatta-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
+ vyatta-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
+ vyatta-vtysh --noerror \
+ -c "configure terminal" \
+ -c "router bgp $VAR(../../../../../@)" \
+ -c "address-family ipv6" \
+ -c "no neighbor $VAR(../../../../@) capability orf prefix-list receive"
+ else
+ vyatta-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 8edd77c8..f0cc7193 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,13 +1,41 @@
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/@)"
+ 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(../../../../@) capability orf prefix-list send" "
-delete: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../../../../@)" \
- -c "no neighbor $VAR(../../../../@) capability orf prefix-list send" "
+
+ if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../../../../@);
+ then
+ vyatta-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
+ vyatta-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
+ vyatta-vtysh --noerror \
+ -c "configure terminal" \
+ -c "router bgp $VAR(../../../../../@)" \
+ -c "address-family ipv6" \
+ -c "no neighbor $VAR(../../../../@) capability orf prefix-list send"
+ else
+ vyatta-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 9147464f..e17f499c 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
@@ -16,7 +16,8 @@ end: if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@); then
-c "router bgp $VAR(../../@)" \
-c "no neighbor $VAR(../@) default-originate ";
fi;
- if [ ${COMMIT_ACTION} = 'SET' ]; then
+
+ if [ ${COMMIT_ACTION} = 'SET' -o ${COMMIT_ACTION} = 'ACTIVE' ]; then
if [ -n "$VAR(./route-map/@)" ]; then
cond="route-map $VAR(./route-map/@) " ;
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 9753b7a5..923364b6 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,4 +1,10 @@
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-send-community/extended/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-send-community/extended/node.def
index b480dd29..20897c0d 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,14 +1,41 @@
-help: Se to not send extended community attributes to this neighbor
+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;
- vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \
- -c "neighbor $VAR(../../@) $peer" \
- -c "no neighbor $VAR(../../@) send-community extended"
-delete: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../../@)" \
- -c "neighbor $VAR(../../@) send-community extended"
+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
+ vyatta-vtysh -c "configure terminal" \
+ -c "router bgp $VAR(../../../@)" \
+ -c "neighbor $VAR(../../@) $peer" \
+ -c "address-family ipv6" \
+ -c "no neighbor $VAR(../../@) send-community extended"
+ else
+ vyatta-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
+ vyatta-vtysh --noerror \
+ -c "configure terminal" \
+ -c "router bgp $VAR(../../../@)" \
+ -c "address-family ipv6" \
+ -c "neighbor $VAR(../../@) send-community extended"
+ else
+ vyatta-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 0de7a6c3..4ed4be3c 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,14 +1,39 @@
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;
- vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \
- -c "neighbor $VAR(../../@) $peer" \
- -c "no neighbor $VAR(../../@) send-community standard"
-delete: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../../@)" \
- -c "neighbor $VAR(../../@) send-community standard"
+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
+ vyatta-vtysh -c "configure terminal" \
+ -c "router bgp $VAR(../../../@)" \
+ -c "neighbor $VAR(../../@) $peer" \
+ -c "address-family ipv6" \
+ -c "no neighbor $VAR(../../@) send-community standard"
+ else
+ vyatta-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
+ vyatta-vtysh --noerror \
+ -c "configure terminal" \
+ -c "router bgp $VAR(../../../@)" \
+ -c "address-family ipv6" \
+ -c "neighbor $VAR(../../@) send-community standard"
+ else
+ vyatta-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 35c78cb3..61fbd023 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,18 +1,57 @@
-type: u32
+type: txt
help: Set an access-list to filter outgoing route updates to this neighbor
-comp_help: \1 <1-65535>\taccess-list number
+
+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(@)\" ";"protocols bgp $VAR(../../../@) neighbor $VAR(../../@) export: access-list $VAR(@) doesn't exist"
+
+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(@)\" "; \
+"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;
- vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \
- -c "neighbor $VAR(../../@) $peer" \
- -c "neighbor $VAR(../../@) distribute-list $VAR(@) out"
-delete: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../../@)" \
- -c "no neighbor $VAR(../../@) distribute-list $VAR(@) out"
+
+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
+ vyatta-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
+ vyatta-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
+ vyatta-vtysh --noerror \
+ -c "configure terminal" \
+ -c "router bgp $VAR(../../../@)" \
+ -c "address-family ipv6" \
+ -c "no neighbor $VAR(../../@) distribute-list $VAR(@) out"
+ else
+ vyatta-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 378ea604..76858faa 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,18 +1,50 @@
-type: u32
+type: txt
help: Set an access-list to filter incoming route updates from this neighbor
-comp_help: \1 <1-65535>\taccess-list number
+
+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(@)\" ";"protocols bgp $VAR(../../../@) neighbor $VAR(../../@) import: access-list $VAR(@) doesn't exist"
+
+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(@)\" ";\
+"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;
- vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../../@)" \
- -c "neighbor $VAR(../../@) $peer" \
- -c "neighbor $VAR(../../@) distribute-list $VAR(@) in"
-delete: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../../@)" \
- -c "no neighbor $VAR(../../@) distribute-list $VAR(@) in"
+
+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
+ vyatta-vtysh -c "configure terminal" \
+ -c "router bgp $VAR(../../../@)" \
+ -c "neighbor $VAR(../../@) $peer" \
+ -c "address-family ipv6" \
+ -c "neighbor $VAR(../../@) distribute-list $VAR(@) in"
+ else
+ vyatta-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
+ vyatta-vtysh --noerror \
+ -c "configure terminal" \
+ -c "router bgp $VAR(../../../@)" \
+ -c "address-family ipv6" \
+ -c "no neighbor $VAR(../../@) distribute-list $VAR(@) in"
+ else
+ vyatta-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/ebgp-multihop/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/ebgp-multihop/node.def
index 6f3d4bf6..8658b0c5 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,16 +1,26 @@
type: u32
+
help: Allow this EBGP neighbor to not be on a directly connected network
-comp_help: \1 <1-255>\tnumber of hops
+
+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;
- vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \
- -c "neighbor $VAR(../@) $peer" \
+ vyatta-vtysh -c "configure terminal" \
+ -c "router bgp $VAR(../../@)" \
+ -c "neighbor $VAR(../@) $peer" \
-c "neighbor $VAR(../@) ebgp-multihop $VAR(@)"
-delete: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \
+
+delete: vyatta-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/local-as/local-as/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/local-as/node.def
index daedc282..46bdc386 100644
--- 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
@@ -1,7 +1,14 @@
type: u32
+
help: Set the local AS number [REQUIRED]
-comp_help: \1 <1-4294967294>\tlocal AS number
+
+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 c70da32f..27882373 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,32 +1,40 @@
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"
+
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"
-delete: touch /tmp/bgp-neighbor-$VAR(../@)-local-as.$PPID
-end: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \
- -c "no neighbor $VAR(../@) local-as ";
- if [ -f "/tmp/bgp-neighbor-$VAR(../@)-local-as.$PPID" ]; then
- rm -rf /tmp/bgp-neighbor-$VAR(../@)-local-as.$PPID;
- else
- if [ -z "$VAR(./local-as/@)" ]; then
+
+end: vyatta-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;
- vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \
- -c "neighbor $VAR(../@) $peer" \
- -c "neighbor $VAR(../@) local-as $VAR(./local-as/@) $cond ";
- fi;
+ 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;
+
+ vyatta-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/maximum-prefix/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/maximum-prefix/node.def
index 2d8cd1ef..ab31b9e4 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,15 +1,42 @@
type: u32
+
help: Set the maximum number of prefixes to accept from this neighbor
-comp_help: \1 <1-4294967295>\tprefix limit
+
+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;
- vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \
- -c "neighbor $VAR(../@) $peer" \
- -c "neighbor $VAR(../@) maximum-prefix $VAR(@)"
-delete: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \
- -c "no neighbor $VAR(../@) maximum-prefix"
+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
+ vyatta-vtysh -c "configure terminal" \
+ -c "router bgp $VAR(../../@)" \
+ -c "neighbor $VAR(../@) $peer" \
+ -c "address-family ipv6" \
+ -c "neighbor $VAR(../@) maximum-prefix $VAR(@)"
+ else
+ vyatta-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
+ vyatta-vtysh --noerror \
+ -c "configure terminal" \
+ -c "router bgp $VAR(../../@)" \
+ -c "address-family ipv6" \
+ -c "no neighbor $VAR(../@) maximum-prefix"
+ else
+ vyatta-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 e1bd2ce7..bd4e8b3c 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,14 +1,39 @@
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;
- vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \
- -c "neighbor $VAR(../@) $peer" \
- -c "neighbor $VAR(../@) next-hop-self"
-delete: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \
- -c "no neighbor $VAR(../@) next-hop-self "
+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
+ vyatta-vtysh -c "configure terminal" \
+ -c "router bgp $VAR(../../@)" \
+ -c "neighbor $VAR(../@) $peer" \
+ -c "address-family ipv6" \
+ -c "neighbor $VAR(../@) next-hop-self"
+ else
+ vyatta-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
+ vyatta-vtysh --noerror \
+ -c "configure terminal" \
+ -c "router bgp $VAR(../../@)" \
+ -c "address-family ipv6" \
+ -c "no neighbor $VAR(../@) next-hop-self "
+ else
+ vyatta-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/remove-private-as/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/remove-private-as/node.def
index 70af0e3b..8ea74210 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,14 +1,39 @@
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;
- vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \
- -c "neighbor $VAR(../@) $peer" \
- -c "neighbor $VAR(../@) remove-private-AS"
-delete: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \
- -c "no neighbor $VAR(../@) remove-private-AS"
+ if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@);
+ then
+ vyatta-vtysh -c "configure terminal" \
+ -c "router bgp $VAR(../../@)" \
+ -c "neighbor $VAR(../@) $peer" \
+ -c "address-family ipv6" \
+ -c "neighbor $VAR(../@) remove-private-AS"
+ else
+ vyatta-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
+ vyatta-vtysh --noerror \
+ -c "configure terminal" \
+ -c "router bgp $VAR(../../@)" \
+ -c "address-family ipv6" \
+ -c "no neighbor $VAR(../@) remove-private-AS"
+ else
+ vyatta-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 47e78336..ac48274e 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,6 +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"
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 4bac3854..69c6e055 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,6 +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"
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 405b47d5..42167786 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,15 +1,41 @@
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;
- vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \
- -c "neighbor $VAR(../@) $peer" \
- -c "neighbor $VAR(../@) route-reflector-client"
-delete: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \
- -c "no neighbor $VAR(../@) route-reflector-client"
+ if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@);
+ then
+ vyatta-vtysh -c "configure terminal" \
+ -c "router bgp $VAR(../../@)" \
+ -c "neighbor $VAR(../@) $peer" \
+ -c "address-family ipv6" \
+ -c "neighbor $VAR(../@) route-reflector-client"
+ else
+ vyatta-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
+ vyatta-vtysh --noerror \
+ -c "configure terminal" \
+ -c "router bgp $VAR(../../@)" \
+ -c "address-family ipv6" \
+ -c "no neighbor $VAR(../@) route-reflector-client"
+ else
+ vyatta-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 46848522..40102885 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,14 +1,39 @@
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;
- vyatta-vtysh -c "configure terminal" -c "router bgp $VAR(../../@)" \
- -c "neighbor $VAR(../@) $peer" \
- -c "neighbor $VAR(../@) route-server-client"
-delete: vyatta-vtysh --noerror -c "configure terminal" -c "router bgp $VAR(../../@)" \
- -c "no neighbor $VAR(../@) route-server-client"
+ if /opt/vyatta/sbin/vyatta-validate-type.pl -q ipv6 $VAR(../@);
+ then
+ vyatta-vtysh -c "configure terminal" \
+ -c "router bgp $VAR(../../@)" \
+ -c "neighbor $VAR(../@) $peer" \
+ -c "address-family ipv6" \
+ -c "neighbor $VAR(../@) route-server-client"
+ else
+ vyatta-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
+ vyatta-vtysh --noerror \
+ -c "configure terminal" \
+ -c "router bgp $VAR(../../@)" \
+ -c "address-family ipv6" \
+ -c "no neighbor $VAR(../@) route-server-client"
+ else
+ vyatta-vtysh --noerror \
+ -c "configure terminal" \
+ -c "router bgp $VAR(../../@)" \
+ -c "no neighbor $VAR(../@) route-server-client"
+ fi