summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore18
-rw-r--r--AUTHORS1
-rw-r--r--COPYING27
-rw-r--r--Makefile.am11
-rw-r--r--NEWS1
-rw-r--r--README1
-rw-r--r--configure.ac28
-rw-r--r--debian/README6
-rwxr-xr-xdebian/autogen.sh37
-rw-r--r--debian/changelog5
-rw-r--r--debian/compat1
-rw-r--r--debian/control21
-rw-r--r--debian/copyright34
-rw-r--r--debian/docs2
-rw-r--r--debian/linda1
-rw-r--r--debian/lintian2
-rwxr-xr-xdebian/rules101
-rwxr-xr-xscripts/bgp/vyatta-bgp.pl22
-rwxr-xr-xscripts/policy/vyatta-policy.pl174
-rw-r--r--templates/policy/access-list/node.def14
-rw-r--r--templates/policy/access-list/node.tag/description/node.def2
-rw-r--r--templates/policy/access-list/node.tag/rule/node.def4
-rw-r--r--templates/policy/access-list/node.tag/rule/node.tag/action/node.def3
-rw-r--r--templates/policy/access-list/node.tag/rule/node.tag/description/node.def2
-rw-r--r--templates/policy/access-list/node.tag/rule/node.tag/destination/any/node.def9
-rw-r--r--templates/policy/access-list/node.tag/rule/node.tag/destination/host/node.def9
-rw-r--r--templates/policy/access-list/node.tag/rule/node.tag/destination/inverse-mask/node.def10
-rw-r--r--templates/policy/access-list/node.tag/rule/node.tag/destination/network/node.def10
-rw-r--r--templates/policy/access-list/node.tag/rule/node.tag/destination/node.def1
-rw-r--r--templates/policy/access-list/node.tag/rule/node.tag/source/any/node.def4
-rw-r--r--templates/policy/access-list/node.tag/rule/node.tag/source/host/node.def4
-rw-r--r--templates/policy/access-list/node.tag/rule/node.tag/source/inverse-mask/node.def5
-rw-r--r--templates/policy/access-list/node.tag/rule/node.tag/source/network/node.def5
-rw-r--r--templates/policy/access-list/node.tag/rule/node.tag/source/node.def1
-rw-r--r--templates/policy/as-path-list/node.def5
-rw-r--r--templates/policy/as-path-list/node.tag/description/node.def2
-rw-r--r--templates/policy/as-path-list/node.tag/rule/node.def4
-rw-r--r--templates/policy/as-path-list/node.tag/rule/node.tag/action/node.def3
-rw-r--r--templates/policy/as-path-list/node.tag/rule/node.tag/description/node.def2
-rw-r--r--templates/policy/as-path-list/node.tag/rule/node.tag/regex/node.def5
-rw-r--r--templates/policy/community-list/node.def8
-rw-r--r--templates/policy/community-list/node.tag/description/node.def2
-rw-r--r--templates/policy/community-list/node.tag/rule/node.def4
-rw-r--r--templates/policy/community-list/node.tag/rule/node.tag/action/node.def3
-rw-r--r--templates/policy/community-list/node.tag/rule/node.tag/description/node.def2
-rw-r--r--templates/policy/community-list/node.tag/rule/node.tag/regex/node.def11
-rw-r--r--templates/policy/node.def1
-rw-r--r--templates/policy/prefix-list/node.def4
-rw-r--r--templates/policy/prefix-list/node.tag/description/node.def2
-rw-r--r--templates/policy/prefix-list/node.tag/rule/node.def35
-rw-r--r--templates/policy/prefix-list/node.tag/rule/node.tag/action/node.def3
-rw-r--r--templates/policy/prefix-list/node.tag/rule/node.tag/description/node.def2
-rw-r--r--templates/policy/prefix-list/node.tag/rule/node.tag/ge/node.def3
-rw-r--r--templates/policy/prefix-list/node.tag/rule/node.tag/le/node.def3
-rw-r--r--templates/policy/prefix-list/node.tag/rule/node.tag/prefix/node.def2
-rw-r--r--templates/policy/route-map/node.def5
-rw-r--r--templates/policy/route-map/node.tag/description/node.def2
-rw-r--r--templates/policy/route-map/node.tag/rule/node.def4
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/action/node.def6
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/call/node.def10
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/continue/node.def3
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/description/node.def2
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/as-path/node.def13
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/community/community-list/node.def3
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/community/exact-match/node.def1
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/community/node.def19
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/interface/node.def18
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/ip/address/access-list/node.def4
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/ip/address/node.def1
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/ip/address/prefix-list/node.def4
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/ip/nexthop/access-list/node.def4
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/ip/nexthop/node.def1
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/ip/nexthop/prefix-list/node.def4
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/ip/node.def1
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/ip/route-source/access-list/node.def4
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/ip/route-source/node.def1
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/ip/route-source/prefix-list/node.def4
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/metric/node.def13
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/origin/node.def14
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/peer/node.def14
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/match/tag/node.def14
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/on-match/goto/node.def14
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/on-match/next/node.def13
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/on-match/node.def2
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/set/aggregator/as/node.def3
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/set/aggregator/ip/node.def3
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/set/aggregator/node.def16
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/set/as-path-prepend/node.def12
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/set/atomic-aggregate/node.def11
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/set/comm-list/comm-list/node.def3
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/set/comm-list/delete/node.def1
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/set/comm-list/node.def19
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/set/community/node.def13
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/set/ip-next-hop/node.def13
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/set/local-preference/node.def12
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/set/metric/node.def13
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/set/node.def1
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/set/origin/node.def13
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/set/originator-id/node.def12
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/set/tag/node.def13
-rw-r--r--templates/policy/route-map/node.tag/rule/node.tag/set/weight/node.def12
-rw-r--r--templates/protocols/bgp/node.def7
-rw-r--r--templates/protocols/bgp/node.tag/aggregate-address/node.def19
-rw-r--r--templates/protocols/bgp/node.tag/aggregate-address/node.tag/as-set/node.def1
-rw-r--r--templates/protocols/bgp/node.tag/aggregate-address/node.tag/summary-only/node.def1
-rw-r--r--templates/protocols/bgp/node.tag/bgp/always-compare-med/node.def5
-rw-r--r--templates/protocols/bgp/node.tag/bgp/bestpath/as-path/confed/node.def6
-rw-r--r--templates/protocols/bgp/node.tag/bgp/bestpath/as-path/ignore/node.def5
-rw-r--r--templates/protocols/bgp/node.tag/bgp/bestpath/as-path/node.def1
-rw-r--r--templates/protocols/bgp/node.tag/bgp/bestpath/compare-routerid/node.def6
-rw-r--r--templates/protocols/bgp/node.tag/bgp/bestpath/med/confed/node.def6
-rw-r--r--templates/protocols/bgp/node.tag/bgp/bestpath/med/missing-as-worst/node.def6
-rw-r--r--templates/protocols/bgp/node.tag/bgp/bestpath/med/node.def1
-rw-r--r--templates/protocols/bgp/node.tag/bgp/bestpath/node.def1
-rw-r--r--templates/protocols/bgp/node.tag/bgp/client-to-client-reflection/node.def6
-rw-r--r--templates/protocols/bgp/node.tag/bgp/cluster-id/node.def8
-rw-r--r--templates/protocols/bgp/node.tag/bgp/confederation/identifier/node.def9
-rw-r--r--templates/protocols/bgp/node.tag/bgp/confederation/node.def1
-rw-r--r--templates/protocols/bgp/node.tag/bgp/confederation/peers/node.def10
-rw-r--r--templates/protocols/bgp/node.tag/bgp/dampening/half-life/node.def3
-rw-r--r--templates/protocols/bgp/node.tag/bgp/dampening/max-suppress-time/node.def5
-rw-r--r--templates/protocols/bgp/node.tag/bgp/dampening/node.def12
-rw-r--r--templates/protocols/bgp/node.tag/bgp/dampening/re-use/node.def5
-rw-r--r--templates/protocols/bgp/node.tag/bgp/dampening/start-suppress-time/node.def5
-rw-r--r--templates/protocols/bgp/node.tag/bgp/default/local-pref/node.def8
-rw-r--r--templates/protocols/bgp/node.tag/bgp/default/no-ipv4-unicast/node.def5
-rw-r--r--templates/protocols/bgp/node.tag/bgp/default/node.def1
-rw-r--r--templates/protocols/bgp/node.tag/bgp/deterministic-med/node.def5
-rw-r--r--templates/protocols/bgp/node.tag/bgp/enforce-first-as/node.def5
-rw-r--r--templates/protocols/bgp/node.tag/bgp/graceful-restart/node.def1
-rw-r--r--templates/protocols/bgp/node.tag/bgp/graceful-restart/stalepath-time/node.def9
-rw-r--r--templates/protocols/bgp/node.tag/bgp/log-neighbor-changes/node.def5
-rw-r--r--templates/protocols/bgp/node.tag/bgp/network/import-check/node.def5
-rw-r--r--templates/protocols/bgp/node.tag/bgp/network/node.def1
-rw-r--r--templates/protocols/bgp/node.tag/bgp/no-fast-external-failover/node.def5
-rw-r--r--templates/protocols/bgp/node.tag/bgp/node.def1
-rw-r--r--templates/protocols/bgp/node.tag/bgp/router-id/node.def8
-rw-r--r--templates/protocols/bgp/node.tag/bgp/scan-time/node.def9
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.def9
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/advertisement-interval/node.def10
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/allowas-in/node.def11
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/allowas-in/number/node.def4
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/as-path/node.def2
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/med/node.def2
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/next-hop/node.def2
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/node.def20
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/capability/dynamic/node.def7
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/node.def1
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/node.def1
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/receive/node.def6
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/send/node.def6
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/node.def15
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/route-map/node.def4
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/description/node.def2
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/disable-connected-check/node.def7
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/in/node.def11
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/node.def2
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/out/node.def11
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/dont-capability-negotiate/node.def7
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/ebgp-multihop/node.def11
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/enforce-multihop/node.def7
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/in/node.def11
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/node.def2
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/out/node.def11
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/interface/node.def14
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/local-as/node.def5
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/no-prepend/node.def2
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/node.def18
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/nexthop-self/node.def7
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/no-activate/node.def6
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/no-send-community/extended/node.def7
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/no-send-community/node.def3
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/no-send-community/standard/node.def7
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/override-capability/node.def7
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/passive/node.def7
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/peer-group/node.def13
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/port/node.def10
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/in/node.def11
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/node.def2
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/out/node.def11
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/remote-as/node.def7
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/remove-private-as/node.def7
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/export/node.def11
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/import/node.def11
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/node.def2
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/route-reflector-client/node.def8
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/route-server-client/node.def7
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/shutdown/node.def5
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/soft-reconfiguration/inbound/node.def7
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/soft-reconfiguration/node.def3
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/strict-capability-match/node.def6
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/timers/connect/node.def4
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/timers/holdtime/node.def4
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/timers/keepalive/node.def4
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/timers/node.def19
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/unsuppress-map/node.def8
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/update-source/node.def12
-rw-r--r--templates/protocols/bgp/node.tag/neighbor/node.tag/weight/node.def8
-rw-r--r--templates/protocols/bgp/node.tag/network/node.def20
-rw-r--r--templates/protocols/bgp/node.tag/network/node.tag/backdoor/node.def1
-rw-r--r--templates/protocols/bgp/node.tag/network/node.tag/backdoor/node.def.#ORIG#15
-rw-r--r--templates/protocols/bgp/node.tag/network/node.tag/route-map/node.def3
-rw-r--r--templates/protocols/bgp/node.tag/redistribute/connected/metric/node.def2
-rw-r--r--templates/protocols/bgp/node.tag/redistribute/connected/node.def16
-rw-r--r--templates/protocols/bgp/node.tag/redistribute/connected/route-map/node.def3
-rw-r--r--templates/protocols/bgp/node.tag/redistribute/kernel/metric/node.def2
-rw-r--r--templates/protocols/bgp/node.tag/redistribute/kernel/node.def16
-rw-r--r--templates/protocols/bgp/node.tag/redistribute/kernel/route-map/node.def3
-rw-r--r--templates/protocols/bgp/node.tag/redistribute/node.def1
-rw-r--r--templates/protocols/bgp/node.tag/redistribute/ospf/metric/node.def2
-rw-r--r--templates/protocols/bgp/node.tag/redistribute/ospf/node.def16
-rw-r--r--templates/protocols/bgp/node.tag/redistribute/ospf/route-map/node.def3
-rw-r--r--templates/protocols/bgp/node.tag/redistribute/rip/metric/node.def2
-rw-r--r--templates/protocols/bgp/node.tag/redistribute/rip/node.def16
-rw-r--r--templates/protocols/bgp/node.tag/redistribute/rip/route-map/node.def3
-rw-r--r--templates/protocols/bgp/node.tag/redistribute/static/metric/node.def2
-rw-r--r--templates/protocols/bgp/node.tag/redistribute/static/node.def16
-rw-r--r--templates/protocols/bgp/node.tag/redistribute/static/route-map/node.def3
-rw-r--r--templates/protocols/bgp/node.tag/timers/holdtime/node.def3
-rw-r--r--templates/protocols/bgp/node.tag/timers/keepalive/node.def3
-rw-r--r--templates/protocols/bgp/node.tag/timers/node.def12
221 files changed, 1855 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..2093aa57
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,18 @@
+*~
+.*.swp
+/aclocal.m4
+/autom4te.cache
+/build-stamp
+/ChangeLog
+/config
+/config.log
+/config.guess
+/config.status
+/config.sub
+/configure
+/debian/files
+/debian/vyatta-cfg-quagga
+/INSTALL
+/Makefile.in
+/Makefile
+
diff --git a/AUTHORS b/AUTHORS
new file mode 100644
index 00000000..ee635b2e
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+eng@vyatta.com
diff --git a/COPYING b/COPYING
new file mode 100644
index 00000000..488ccde4
--- /dev/null
+++ b/COPYING
@@ -0,0 +1,27 @@
+/*
+ * Package: vyatt-op
+ *
+ * **** License ****
+ * Version: VPL 1.0
+ *
+ * The contents of this file are subject to the Vyatta Public License
+ * Version 1.0 ("License"); you may not use this file except in
+ * compliance with the License. You may obtain a copy of the License at
+ * http://www.vyatta.com/vpl
+ *
+ * Software distributed under the License is distributed on an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ * the License for the specific language governing rights and limitations
+ * under the License.
+ *
+ * This code was originally developed by Vyatta, Inc.
+ * Portions created by Vyatta are Copyright (C) "YEAR" Vyatta, Inc.
+ * All Rights Reserved.
+ *
+ * Author: eng@vyatta.com
+ * Date: 2007
+ * Description: Vyatta configuration templates/scripts for Quagga
+ *
+ * **** End License ****
+ *
+ */
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 00000000..955226bc
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,11 @@
+cfgdir = $(datadir)/vyatta-cfg/templates
+
+sbin_SCRIPTS = scripts/bgp/vyatta-bgp.pl
+sbin_SCRIPTS += scripts/policy/vyatta-policy.pl
+
+cpiop = find . ! -regex '\(.*~\|.*\.bak\|.*\.swp\|.*\#.*\#\)' -print0 | \
+ cpio -0pd
+
+install-exec-hook:
+ mkdir -p $(DESTDIR)$(cfgdir)
+ cd templates; $(cpiop) $(DESTDIR)$(cfgdir)
diff --git a/NEWS b/NEWS
new file mode 100644
index 00000000..78fdaa6e
--- /dev/null
+++ b/NEWS
@@ -0,0 +1 @@
+see http://www.vyatta.com/news/
diff --git a/README b/README
new file mode 100644
index 00000000..1dad6e98
--- /dev/null
+++ b/README
@@ -0,0 +1 @@
+This package has the Vyatta configuration templates and scripts for Quagga.
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 00000000..6489ec9a
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,28 @@
+# Process this file with autoconf to produce a configure script.
+AC_PREREQ(2.59)
+
+m4_define([VERSION_ID], [m4_esyscmd([
+ if test -f .version ; then
+ head -n 1 .version | tr -d \\n
+ else
+ echo -n 2.4
+ fi])])
+AC_INIT([vyatta-cfg-quagga], VERSION_ID, [vyatta-support@vyatta.com])
+
+test -n "$VYATTA_VERSION" || VYATTA_VERSION=$PACKAGE_VERSION
+
+AC_CONFIG_AUX_DIR([config])
+AM_INIT_AUTOMAKE([gnu no-dist-gzip dist-bzip2 subdir-objects])
+AC_PREFIX_DEFAULT([/opt/vyatta])
+
+AC_ARG_ENABLE([nostrip],
+ AC_HELP_STRING([--enable-nostrip],
+ [include -nostrip option during packaging]),
+ [NOSTRIP=-nostrip], [NOSTRIP=])
+
+AC_CONFIG_FILES([Makefile])
+
+AC_SUBST(NOSTRIP)
+
+AC_OUTPUT
+
diff --git a/debian/README b/debian/README
new file mode 100644
index 00000000..5ab15255
--- /dev/null
+++ b/debian/README
@@ -0,0 +1,6 @@
+The Debian Package vyatta-cfg-quagga
+----------------------------
+
+This package has the Vyatta configuration templates and scripts for Quagga.
+
+ -- An-Cheng Huang <ancheng@vyatta.com> Mon, 1 Oct 2007
diff --git a/debian/autogen.sh b/debian/autogen.sh
new file mode 100755
index 00000000..ff125d1d
--- /dev/null
+++ b/debian/autogen.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+
+if [ -d .git ] ; then
+# generate GNU/Debian format ChangeLog from git log
+
+ rm -f ChangeLog
+
+ if which git2cl >/dev/null ; then
+ git-log --pretty --numstat --summary | git2cl >> ChangeLog
+ else
+ git-log --pretty=short >> ChangeLog
+ fi
+
+# append repository reference
+
+ url=` git repo-config --get remote.origin.url`
+ test "x$url" = "x" && url=`pwd`
+
+ branch=`git-branch --no-color | sed '/^\* /!d; s/^\* //'`
+ test "x$branch" = "x" && branch=master
+
+ sha=`git log --pretty=oneline --no-color -n 1 | cut -c-8`
+ test "x$sha" = "x" && sha=00000000
+
+ echo "$url#$branch-$sha" >> ChangeLog
+
+fi
+
+rm -rf config
+rm -f aclocal.m4 config.guess config.statusconfig.sub configure INSTALL
+
+autoreconf --force --install
+
+rm -f config.sub config.guess
+ln -s /usr/share/misc/config.sub .
+ln -s /usr/share/misc/config.guess .
diff --git a/debian/changelog b/debian/changelog
new file mode 100644
index 00000000..80e882fa
--- /dev/null
+++ b/debian/changelog
@@ -0,0 +1,5 @@
+vyatta-cfg-quagga (0.1) unstable; urgency=low
+
+ * Initial Release.
+
+ -- An-Cheng Huang <ancheng@vyatta.com> Mon, 1 Oct 2007 11:23:11 -0700
diff --git a/debian/compat b/debian/compat
new file mode 100644
index 00000000..7ed6ff82
--- /dev/null
+++ b/debian/compat
@@ -0,0 +1 @@
+5
diff --git a/debian/control b/debian/control
new file mode 100644
index 00000000..0a1b33aa
--- /dev/null
+++ b/debian/control
@@ -0,0 +1,21 @@
+Source: vyatta-cfg-quagga
+Section: contrib/net
+Priority: extra
+Maintainer: An-Cheng Huang <ancheng@vyatta.com>
+Build-Depends: debhelper (>= 5), autotools-dev
+Standards-Version: 3.7.2
+
+Package: vyatta-cfg-quagga
+Architecture: all
+Depends: bash (>= 3.1),
+ sed (>= 4.1.5),
+ perl (>= 5.8.8),
+ procps (>= 1:3.2.7-3),
+ coreutils (>= 5.97-5.3)
+Suggests: util-linux (>= 2.13-5),
+ net-tools,
+ ethtool,
+ ncurses-bin (>= 5.5-5),
+ ntpdate
+Description: Vyatta configuration templates/scripts for Quagga
+ Vyatta configuration templates and scripts for Quagga
diff --git a/debian/copyright b/debian/copyright
new file mode 100644
index 00000000..b9cb3619
--- /dev/null
+++ b/debian/copyright
@@ -0,0 +1,34 @@
+This package was debianized by An-Cheng Huang <ancheng@vyatta.com> on
+Mon, 1 Oct 2007 11:23:11 -0700.
+
+It's original content from the GIT repository <http://vyatt.com/git/vyatta-cfg-quagga>
+
+Upstream Author:
+
+ <eng@vyatta.com>
+
+Copyright:
+
+ Copyright (C) 2007 Vyatta, Inc.
+ All Rights Reserved.
+
+License:
+
+ The contents of this package are subject to the Vyatta Public License
+ Version 1.0 ("License"); you may not use this file except in
+ compliance with the License. You may obtain a copy of the License at
+ http://www.vyatta.com/vpl
+
+ Software distributed under the License is distributed on an "AS IS"
+ basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
+ the License for the specific language governing rights and limitations
+ under the License.
+
+ This code was originally developed by Vyatta, Inc.
+ Portions created by Vyatta are Copyright (C) 2007 Vyatta, Inc.
+
+On Debian systems, the complete text of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL'.
+
+The Debian packaging is (C) 2007, An-Cheng Huang <ancheng@vyatta.com> and
+is licensed under the GPL, see above.
diff --git a/debian/docs b/debian/docs
new file mode 100644
index 00000000..50bd824b
--- /dev/null
+++ b/debian/docs
@@ -0,0 +1,2 @@
+NEWS
+README
diff --git a/debian/linda b/debian/linda
new file mode 100644
index 00000000..0381d9d0
--- /dev/null
+++ b/debian/linda
@@ -0,0 +1 @@
+Tag: file-in-opt
diff --git a/debian/lintian b/debian/lintian
new file mode 100644
index 00000000..275491da
--- /dev/null
+++ b/debian/lintian
@@ -0,0 +1,2 @@
+vyatta-cfg-quagga: file-in-unusual-dir
+vyatta-cfg-quagga: dir-or-file-in-opt
diff --git a/debian/rules b/debian/rules
new file mode 100755
index 00000000..c865fd4f
--- /dev/null
+++ b/debian/rules
@@ -0,0 +1,101 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+
+# These are used for cross-compiling and for saving the configure script
+# from having to guess our platform (since we know it already)
+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
+PACKAGE=vyatta-cfg-quagga
+PKGDIR=$(CURDIR)/debian/$(PACKAGE)
+
+CFLAGS = -Wall -g
+
+configure = ./configure
+configure += --host=$(DEB_HOST_GNU_TYPE)
+configure += --build=$(DEB_BUILD_GNU_TYPE)
+configure += --prefix=/opt/vyatta
+configure += --mandir=\$${prefix}/share/man
+configure += --infodir=\$${prefix}/share/info
+configure += CFLAGS="$(CFLAGS)"
+configure += LDFLAGS="-Wl,-z,defs"
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+ CFLAGS += -O0
+else
+ CFLAGS += -O2
+endif
+
+configure: configure.ac Makefile.am
+ chmod +x debian/autogen.sh
+ debian/autogen.sh
+
+config.status: configure
+ dh_testdir
+ rm -f config.cache
+ $(configure)
+
+build: build-stamp
+
+build-stamp: config.status
+ dh_testdir
+ $(MAKE)
+ touch $@
+
+clean: clean-patched
+
+# Clean everything up, including everything auto-generated
+# at build time that needs not to be kept around in the Debian diff
+clean-patched:
+ dh_testdir
+ dh_testroot
+ if test -f Makefile ; then $(MAKE) clean distclean ; fi
+ rm -f build-stamp
+ rm -f config.status config.sub config.guess config.log
+ rm -f aclocal.m4 configure Makefile.in Makefile INSTALL
+ rm -rf config
+ dh_clean
+
+install: build
+ dh_testdir
+ dh_testroot
+ dh_clean -k
+ dh_installdirs
+
+ $(MAKE) DESTDIR=$(PKGDIR) install
+
+ install -D --mode=0644 debian/lintian $(PKGDIR)/usr/share/lintian/overrides/$(PACKAGE)
+ install -D --mode=0644 debian/linda $(PKGDIR)/usr/share/linda/overrides/$(PACKAGE)
+
+# Build architecture-independent files here.
+binary-indep: build install
+ dh_testdir
+ dh_testroot
+ dh_installchangelogs ChangeLog
+ dh_installdocs
+ dh_install
+ dh_installdebconf
+ dh_link
+ dh_strip
+ dh_compress
+ dh_fixperms
+ dh_installdeb
+ dh_gencontrol
+ dh_md5sums
+ dh_builddeb
+
+# Build architecture-dependent files here.
+binary-arch: build install
+# This is an architecture independent package
+# so; we have nothing to do by default.
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install
diff --git a/scripts/bgp/vyatta-bgp.pl b/scripts/bgp/vyatta-bgp.pl
new file mode 100755
index 00000000..d20ad8fa
--- /dev/null
+++ b/scripts/bgp/vyatta-bgp.pl
@@ -0,0 +1,22 @@
+#!/usr/bin/perl
+use lib "/opt/vyatta/share/perl5/";
+use VyattaMisc;
+use Getopt::Long;
+
+GetOptions("check-peer-name=s" => \$peername,
+);
+
+if (defined $peername) { check_peer_name($peername); }
+
+exit 0;
+
+sub check_peer_name() {
+ my $neighbor = shift;
+
+ $_ = $neighbor;
+ if ((! isIpAddress("$neighbor")) && (/[\s\W]/g)) {
+ print "malformed neighbor address $neighbor\n";
+ exit 1;
+ }
+ exit 0;
+}
diff --git a/scripts/policy/vyatta-policy.pl b/scripts/policy/vyatta-policy.pl
new file mode 100755
index 00000000..bc4a28e1
--- /dev/null
+++ b/scripts/policy/vyatta-policy.pl
@@ -0,0 +1,174 @@
+#!/usr/bin/perl
+use lib "/opt/vyatta/share/perl5/";
+use VyattaConfig;
+use VyattaMisc;
+use Getopt::Long;
+$VTYSH='/opt/vyatta/bin/vtysh';
+
+GetOptions("update-access-list=s" => \$accesslist,
+ "update-aspath-list=s" => \$aspathlist,
+ "update-community-list=s" => \$communitylist,
+ "check-peer-syntax=s" => \$peer,
+);
+
+if (defined $accesslist) { update_access_list($accesslist); }
+if (defined $aspathlist) { update_as_path($aspathlist); }
+if (defined $communitylist) { update_community_list($communitylist); }
+if (defined $peer) { check_peer_syntax($peer); }
+
+exit 0;
+
+sub numerically { $a <=> $b; }
+
+sub check_peer_syntax() {
+ my $peer = shift;
+
+ $_ = $peer;
+ if (/^local$/) { exit 0; }
+ if (! isIpAddress("$peer")) { exit 0; }
+ exit 1;
+}
+
+sub update_community_list() {
+ my $num = shift;
+ my $config = new VyattaConfig;
+ my @rules = ();
+ my $rule;
+
+ # remove the old rule
+ system ("$VTYSH -c \"configure terminal\" -c \"no ip community-list $num\" ");
+
+ $config->setLevel("policy community-list $num rule");
+ @rules = $config->listNodes();
+
+ foreach $rule (sort numerically @rules) {
+ my $action, $regex = '';
+
+ # set the action
+ $action = $config->returnValue("$rule action");
+ if (! defined $action) {
+ print "You must specify an action for as-path-list $list rule $rule\n";
+ exit 1;
+ }
+
+ # grab the regex
+ if (defined $config->returnValue("$rule regex")) {
+ $regex = $config->returnValue("$rule regex");
+ }
+ else {
+ print "You must specify a regex for community-list $list rule $rule\n";
+ exit 1;
+ }
+
+ system ("$VTYSH -c \"configure terminal\" -c \"ip community-list $num $action $regex\" ");
+ }
+
+ exit 0;
+}
+
+sub update_as_path() {
+ my $word = shift;
+ my $config = new VyattaConfig;
+ my @rules = ();
+ my $rule;
+
+ # remove the old rule
+ system ("$VTYSH -c \"configure terminal\" -c \"no ip as-path access-list $word\" ");
+
+ $config->setLevel("policy as-path-list $word rule");
+ @rules = $config->listNodes();
+
+ foreach $rule (sort numerically @rules) {
+ my $action, $regex = '';
+
+ # set the action
+ $action = $config->returnValue("$rule action");
+ if (! defined $action) {
+ print "You must specify an action for as-path-list $list rule $rule\n";
+ exit 1;
+ }
+
+ # grab the regex
+ if (defined $config->returnValue("$rule regex")) {
+ $regex = $config->returnValue("$rule regex");
+ }
+ else {
+ print "You must specify a regex for as-path-list $list rule $rule\n";
+ exit 1;
+ }
+
+ system ("$VTYSH -c \"configure terminal\" -c \"ip as-path access-list $word $action $regex\" ");
+ }
+
+ exit 0;
+}
+
+sub update_access_list() {
+ my $list = shift;
+ my $config = new VyattaConfig;
+ my @rules = ();
+ my $rule;
+
+ # remove the old rule
+ system ("$VTYSH -c \"configure terminal\" -c \"no access-list $list\" ");
+
+ $config->setLevel("policy access-list $list rule");
+ @rules = $config->listNodes();
+
+ foreach $rule (sort numerically @rules) {
+ my $ip, $action, $src, $dst, $srcmsk, $dstmsk = '';
+
+ # set the action
+ $action = $config->returnValue("$rule action");
+ if (! defined $action) {
+ print "You must specify an action for access-list $list rule $rule\n";
+ exit 1;
+ }
+
+ # TODO: ask someone why config->exists() is returning !0?
+ # set the source filter
+ if (defined $config->returnValue("$rule source host")) {
+ $src = $config->returnValue("$rule source host");
+ $src = "host " . $src;
+ }
+ elsif (defined $config->returnValue("$rule source network")) {
+ $src = $config->returnValue("$rule source network");
+ $srcmsk = $config->returnValue("$rule source inverse-mask");
+ }
+ else {
+ $src = $config->returnValue("$rule source any");
+ if ("$src" eq "true") { $src = "any"; }
+ else {
+ print "error in source section of access-list $list rule $rule\n";
+ exit 1;
+ }
+ }
+
+ # set the destination filter if extended list
+ if ((($list >= 100) && ($list <= 199)) || (($list >= 2000) && ($list <= 2699))) {
+ $ip = 'ip ';
+ # TODO: ask someone why config->exists() is returning !0?
+ if (defined $config->returnValue("$rule destination host")) {
+ $dst = $config->returnValue("$rule destination host");
+ $dst = "host " . $dst;
+ }
+ elsif (defined $config->returnValue("$rule destination network")) {
+ $dst = $config->returnValue("$rule destination network");
+ $dstmsk = $config->returnValue("$rule destination inverse-mask");
+ }
+ else {
+ $dst = $config->returnValue("$rule destination any");
+ if ("$dst" eq "true") { $dst = "any"; }
+ else {
+ print "error in destination section of access-list $list rule $rule\n";
+ exit 1;
+ }
+ }
+ }
+
+ system ("$VTYSH -c \"configure terminal\" -c \"access-list $list $action $ip $src $srcmsk $dst $dstmsk\" ");
+ }
+
+ exit 0;
+}
+
diff --git a/templates/policy/access-list/node.def b/templates/policy/access-list/node.def
new file mode 100644
index 00000000..b97eb0a6
--- /dev/null
+++ b/templates/policy/access-list/node.def
@@ -0,0 +1,14 @@
+tag:
+type: u32
+help: "access-list number must be \n \
+ <1-99> IP standard access list \n \
+ <100-199> IP extended access list \n \
+ <1300-1999> IP standard access list (expanded range) \n \
+ <2000-2699> IP extended access list (expanded range) \n "
+syntax: ($(@) >= 1 && $(@) <= 199) || ($(@) >= 1300 && $(@) <= 2699); \
+"access-list number must be \n \
+ <1-99> IP standard access list \n \
+ <100-199> IP extended access list \n \
+ <1300-1999> IP standard access list (expanded range) \n \
+ <2000-2699> IP extended access list (expanded range) \n "
+end: "/opt/vyatta/sbin/vyatta_policy.pl --update-access-list $(@)"
diff --git a/templates/policy/access-list/node.tag/description/node.def b/templates/policy/access-list/node.tag/description/node.def
new file mode 100644
index 00000000..c5b70286
--- /dev/null
+++ b/templates/policy/access-list/node.tag/description/node.def
@@ -0,0 +1,2 @@
+type: txt
+help: "access-list description"
diff --git a/templates/policy/access-list/node.tag/rule/node.def b/templates/policy/access-list/node.tag/rule/node.def
new file mode 100644
index 00000000..fb9ca24a
--- /dev/null
+++ b/templates/policy/access-list/node.tag/rule/node.def
@@ -0,0 +1,4 @@
+tag:
+type: u32
+help: "Specify access-list rule number"
+syntax: $(@) >= 1 && $(@) <= 65535; "rule number must be between 1 and 65535"
diff --git a/templates/policy/access-list/node.tag/rule/node.tag/action/node.def b/templates/policy/access-list/node.tag/rule/node.tag/action/node.def
new file mode 100644
index 00000000..bca61186
--- /dev/null
+++ b/templates/policy/access-list/node.tag/rule/node.tag/action/node.def
@@ -0,0 +1,3 @@
+type: txt
+help: "action to take on packets matching this rule"
+syntax: $(@) in "permit", "deny"; "must be permit or deny"
diff --git a/templates/policy/access-list/node.tag/rule/node.tag/description/node.def b/templates/policy/access-list/node.tag/rule/node.tag/description/node.def
new file mode 100644
index 00000000..3d61ac85
--- /dev/null
+++ b/templates/policy/access-list/node.tag/rule/node.tag/description/node.def
@@ -0,0 +1,2 @@
+type: txt
+help: "description for this rule"
diff --git a/templates/policy/access-list/node.tag/rule/node.tag/destination/any/node.def b/templates/policy/access-list/node.tag/rule/node.tag/destination/any/node.def
new file mode 100644
index 00000000..6dbee23b
--- /dev/null
+++ b/templates/policy/access-list/node.tag/rule/node.tag/destination/any/node.def
@@ -0,0 +1,9 @@
+help: "filter any IP address"
+# TODO: won't work until 2220 is fixed
+syntax: $(../host/@) == "" && $(../network/@) == ""; "You may only define one filter type. (host|network|any)"
+# TODO: pending 2284
+syntax: ($(../../@) >= 100 && $(../../@) <= 199) || ($(../../@) >= 2000) && $(../../@) <= 2699); " \
+To set destination filter parameters, the access-list rule number must be \n \
+ <100-199> IP extended access list \n \
+ <2000-2699> IP extended access list (expanded range) \n"
+commit: $(../../action/@) != ""; "You must specify an action before committing"
diff --git a/templates/policy/access-list/node.tag/rule/node.tag/destination/host/node.def b/templates/policy/access-list/node.tag/rule/node.tag/destination/host/node.def
new file mode 100644
index 00000000..993c64ea
--- /dev/null
+++ b/templates/policy/access-list/node.tag/rule/node.tag/destination/host/node.def
@@ -0,0 +1,9 @@
+type: ipv4
+help: "filter a host IP address"
+syntax: $(../any/@) == "" && $(../network/@) == ""; "You may only define one filter type. (host|network|any)"
+# TODO: pending 2284
+syntax: ($(../../@) >= 100 && $(../../@) <= 199) || ($(../../@) >= 2000) && $(../../@) <= 2699); " \
+To set destination filter parameters, the access-list rule number must be \n \
+ <100-199> IP extended access list \n \
+ <2000-2699> IP extended access list (expanded range) \n"
+commit: $(../../action/@) != ""; "You must specify an action before committing"
diff --git a/templates/policy/access-list/node.tag/rule/node.tag/destination/inverse-mask/node.def b/templates/policy/access-list/node.tag/rule/node.tag/destination/inverse-mask/node.def
new file mode 100644
index 00000000..37bbc95a
--- /dev/null
+++ b/templates/policy/access-list/node.tag/rule/node.tag/destination/inverse-mask/node.def
@@ -0,0 +1,10 @@
+type: ipv4
+help: "filter a network IP netmask"
+syntax: $(../any/@) == "" && $(../host/@) == ""; "You may only define one filter type. (host|network|any)"
+# TODO: pending 2284
+syntax: ($(../../@) >= 100 && $(../../@) <= 199) || ($(../../@) >= 2000) && $(../../@) <= 2699); " \
+To set destination filter parameters, the access-list rule number must be \n \
+ <100-199> IP extended access list \n \
+ <2000-2699> IP extended access list (expanded range) \n"
+commit: $(../network/@) != ""; "You must specify a network before committing"
+commit: $(../../action/@) != ""; "You must specify an action before committing"
diff --git a/templates/policy/access-list/node.tag/rule/node.tag/destination/network/node.def b/templates/policy/access-list/node.tag/rule/node.tag/destination/network/node.def
new file mode 100644
index 00000000..c016170f
--- /dev/null
+++ b/templates/policy/access-list/node.tag/rule/node.tag/destination/network/node.def
@@ -0,0 +1,10 @@
+type: ipv4
+help: "filter a network IP address"
+syntax: $(../host/@) != "" || $(../any/@) != ""; "You may only define one filter type. (host|network|any)"
+# TODO: pending 2284
+syntax: ($(../../@) >= 100 && $(../../@) <= 199) || ($(../../@) >= 2000) && $(../../@) <= 2699); " \
+To set destination filter parameters, the access-list rule number must be \n \
+ <100-199> IP extended access list \n \
+ <2000-2699> IP extended access list (expanded range) \n"
+commit: $(../inverse-mask/@) != ""; "You must specify an inverse-mask before comitting"
+commit: $(../../action/@) != ""; "You must specify an action before committing"
diff --git a/templates/policy/access-list/node.tag/rule/node.tag/destination/node.def b/templates/policy/access-list/node.tag/rule/node.tag/destination/node.def
new file mode 100644
index 00000000..21f3005a
--- /dev/null
+++ b/templates/policy/access-list/node.tag/rule/node.tag/destination/node.def
@@ -0,0 +1 @@
+help: "define a destination address or network filter"
diff --git a/templates/policy/access-list/node.tag/rule/node.tag/source/any/node.def b/templates/policy/access-list/node.tag/rule/node.tag/source/any/node.def
new file mode 100644
index 00000000..34c30831
--- /dev/null
+++ b/templates/policy/access-list/node.tag/rule/node.tag/source/any/node.def
@@ -0,0 +1,4 @@
+help: "filter any IP address"
+# TODO: won't work until 2220 is fixed
+syntax: $(../host/@) == "" && $(../network/@) == ""; "You may only define one filter type. (host|network|any)"
+commit: $(../../action/@) != ""; "You must specify an action before committing"
diff --git a/templates/policy/access-list/node.tag/rule/node.tag/source/host/node.def b/templates/policy/access-list/node.tag/rule/node.tag/source/host/node.def
new file mode 100644
index 00000000..5b1b6257
--- /dev/null
+++ b/templates/policy/access-list/node.tag/rule/node.tag/source/host/node.def
@@ -0,0 +1,4 @@
+type: ipv4
+help: "filter a host IP address"
+syntax: $(../any/@) == "" && $(../network/@) == ""; "You may only define one filter type. (host|network|any)"
+commit: $(../../action/@) != ""; "You must specify an action before committing"
diff --git a/templates/policy/access-list/node.tag/rule/node.tag/source/inverse-mask/node.def b/templates/policy/access-list/node.tag/rule/node.tag/source/inverse-mask/node.def
new file mode 100644
index 00000000..8b77960d
--- /dev/null
+++ b/templates/policy/access-list/node.tag/rule/node.tag/source/inverse-mask/node.def
@@ -0,0 +1,5 @@
+type: ipv4
+help: "filter a network IP netmask"
+syntax: $(../any/@) == "" || $(../host/@) == ""; "You may only define one filter type. (host|network|any)"
+commit: $(../network/@) != ""; "You must specify a network before committing"
+commit: $(../../action/@) != ""; "You must specify an action before committing"
diff --git a/templates/policy/access-list/node.tag/rule/node.tag/source/network/node.def b/templates/policy/access-list/node.tag/rule/node.tag/source/network/node.def
new file mode 100644
index 00000000..f95182ac
--- /dev/null
+++ b/templates/policy/access-list/node.tag/rule/node.tag/source/network/node.def
@@ -0,0 +1,5 @@
+type: ipv4
+help: "filter a network IP address"
+syntax: $(../host/@) == "" && $(../any/@) == ""; "You may only define one filter type. (host|network|any)"
+commit: $(../inverse-mask/@) != ""; "You must specify an inverse-mask before comitting"
+commit: $(../../action/@) != ""; "You must specify an action before committing"
diff --git a/templates/policy/access-list/node.tag/rule/node.tag/source/node.def b/templates/policy/access-list/node.tag/rule/node.tag/source/node.def
new file mode 100644
index 00000000..69a6c7b4
--- /dev/null
+++ b/templates/policy/access-list/node.tag/rule/node.tag/source/node.def
@@ -0,0 +1 @@
+help: "define a source address or network filter"
diff --git a/templates/policy/as-path-list/node.def b/templates/policy/as-path-list/node.def
new file mode 100644
index 00000000..04ba5e7b
--- /dev/null
+++ b/templates/policy/as-path-list/node.def
@@ -0,0 +1,5 @@
+tag:
+type: txt
+help: "BGP autonomous system path filter"
+syntax: pattern $(@) "^[-a-zA-Z0-9.]+$" ; "as-path-list name must be alpha-numeric"
+end: "/opt/vyatta/sbin/vyatta_policy.pl --update-aspath-list $(@)"
diff --git a/templates/policy/as-path-list/node.tag/description/node.def b/templates/policy/as-path-list/node.tag/description/node.def
new file mode 100644
index 00000000..1d708acb
--- /dev/null
+++ b/templates/policy/as-path-list/node.tag/description/node.def
@@ -0,0 +1,2 @@
+type: txt
+help: "as-path-list description"
diff --git a/templates/policy/as-path-list/node.tag/rule/node.def b/templates/policy/as-path-list/node.tag/rule/node.def
new file mode 100644
index 00000000..3a0c33bd
--- /dev/null
+++ b/templates/policy/as-path-list/node.tag/rule/node.def
@@ -0,0 +1,4 @@
+tag:
+type: u32
+help: "Specify as-path-list rule number"
+syntax: $(@) >= 1 && $(@) <= 65535; "rule number must be between 1 and 65535"
diff --git a/templates/policy/as-path-list/node.tag/rule/node.tag/action/node.def b/templates/policy/as-path-list/node.tag/rule/node.tag/action/node.def
new file mode 100644
index 00000000..26f6c631
--- /dev/null
+++ b/templates/policy/as-path-list/node.tag/rule/node.tag/action/node.def
@@ -0,0 +1,3 @@
+type: txt
+help: "action to take on AS paths matching this rule"
+syntax: $(@) in "permit", "deny"; "action must be permit or deny"
diff --git a/templates/policy/as-path-list/node.tag/rule/node.tag/description/node.def b/templates/policy/as-path-list/node.tag/rule/node.tag/description/node.def
new file mode 100644
index 00000000..3d61ac85
--- /dev/null
+++ b/templates/policy/as-path-list/node.tag/rule/node.tag/description/node.def
@@ -0,0 +1,2 @@
+type: txt
+help: "description for this rule"
diff --git a/templates/policy/as-path-list/node.tag/rule/node.tag/regex/node.def b/templates/policy/as-path-list/node.tag/rule/node.tag/regex/node.def
new file mode 100644
index 00000000..39cc3615
--- /dev/null
+++ b/templates/policy/as-path-list/node.tag/rule/node.tag/regex/node.def
@@ -0,0 +1,5 @@
+type: txt
+help: "AS path regular expression"
+# TODO: check regex syntax; \
+# "invalid chars in regex syntax"
+commit: $(../action/@) != ""; "You must specify an action before committing"
diff --git a/templates/policy/community-list/node.def b/templates/policy/community-list/node.def
new file mode 100644
index 00000000..812dd436
--- /dev/null
+++ b/templates/policy/community-list/node.def
@@ -0,0 +1,8 @@
+tag:
+type: u32
+help: "Add a community list entry"
+syntax: $(@) >= 1 && $(@) <= 500; " \
+community-list must be \
+ <1-99> Community list number (standard) \
+ <100-500> Community list number (expanded) "
+end: "/opt/vyatta/sbin/vyatta_policy.pl --update-community-list $(@)"
diff --git a/templates/policy/community-list/node.tag/description/node.def b/templates/policy/community-list/node.tag/description/node.def
new file mode 100644
index 00000000..c6f76be3
--- /dev/null
+++ b/templates/policy/community-list/node.tag/description/node.def
@@ -0,0 +1,2 @@
+type: txt
+help: "community-list description"
diff --git a/templates/policy/community-list/node.tag/rule/node.def b/templates/policy/community-list/node.tag/rule/node.def
new file mode 100644
index 00000000..3a0c33bd
--- /dev/null
+++ b/templates/policy/community-list/node.tag/rule/node.def
@@ -0,0 +1,4 @@
+tag:
+type: u32
+help: "Specify as-path-list rule number"
+syntax: $(@) >= 1 && $(@) <= 65535; "rule number must be between 1 and 65535"
diff --git a/templates/policy/community-list/node.tag/rule/node.tag/action/node.def b/templates/policy/community-list/node.tag/rule/node.tag/action/node.def
new file mode 100644
index 00000000..92e66ad2
--- /dev/null
+++ b/templates/policy/community-list/node.tag/rule/node.tag/action/node.def
@@ -0,0 +1,3 @@
+type: txt
+help: "action to take on communities matching this rule"
+syntax: $(@) in "permit", "deny"; "action must be permit or deny"
diff --git a/templates/policy/community-list/node.tag/rule/node.tag/description/node.def b/templates/policy/community-list/node.tag/rule/node.tag/description/node.def
new file mode 100644
index 00000000..3d61ac85
--- /dev/null
+++ b/templates/policy/community-list/node.tag/rule/node.tag/description/node.def
@@ -0,0 +1,2 @@
+type: txt
+help: "description for this rule"
diff --git a/templates/policy/community-list/node.tag/rule/node.tag/regex/node.def b/templates/policy/community-list/node.tag/rule/node.tag/regex/node.def
new file mode 100644
index 00000000..6b116123
--- /dev/null
+++ b/templates/policy/community-list/node.tag/rule/node.tag/regex/node.def
@@ -0,0 +1,11 @@
+type: txt
+help: "community list regular expression"
+# pending bug 2285
+syntax: exec " \
+if [ $(../../@) -ge 1 ] && [ $(../../@) -le 99 ]; then \
+ if [ -n \"`echo $(@) | sed 's/[0-9]*:[0-9]*//g' | sed -e 's/internet//g' -e 's/local-AS//g' -e 's/no-advertise//g' -e 's/no-export//g'`\" ]; then \
+ echo regex $(@) is invalid for a standard community list; \
+ exit 1 ; \
+ fi ; \
+fi ; "
+commit: $(../action/@) != ""; "You must specify an action before committing"
diff --git a/templates/policy/node.def b/templates/policy/node.def
new file mode 100644
index 00000000..56991078
--- /dev/null
+++ b/templates/policy/node.def
@@ -0,0 +1 @@
+help: "configure routing policy"
diff --git a/templates/policy/prefix-list/node.def b/templates/policy/prefix-list/node.def
new file mode 100644
index 00000000..de9d34ab
--- /dev/null
+++ b/templates/policy/prefix-list/node.def
@@ -0,0 +1,4 @@
+tag:
+type: txt
+help: "Add a prefix list entry"
+syntax: pattern $(@) "^[-a-zA-Z0-9.]+$" ; "prefix-list name must be alpha-numeric"
diff --git a/templates/policy/prefix-list/node.tag/description/node.def b/templates/policy/prefix-list/node.tag/description/node.def
new file mode 100644
index 00000000..effa9577
--- /dev/null
+++ b/templates/policy/prefix-list/node.tag/description/node.def
@@ -0,0 +1,2 @@
+type: txt
+help: "prefix-list description"
diff --git a/templates/policy/prefix-list/node.tag/rule/node.def b/templates/policy/prefix-list/node.tag/rule/node.def
new file mode 100644
index 00000000..7750cba9
--- /dev/null
+++ b/templates/policy/prefix-list/node.tag/rule/node.def
@@ -0,0 +1,35 @@
+tag:
+type: u32; "prefix-list rule number must be an integer"
+help: "Specify prefix-list rule number"
+delete: "touch /tmp/protocols-$(../@)-$(@).\\$PPID \
+ LEN=`echo $(@) | awk -F/ '{ print \\$2 }'` ; \
+ if [ -n \"$(./ge/@)\" ]; then \
+ COND=\"ge $(./ge/@) \";
+ fi;
+ if [ -n \"$(./le/@)\" ] && [ $(./le/@) -ne 32 ]; then \
+ COND=\"\\$COND le $(./le/@) \"; \
+ fi; \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"no ip prefix-list $(../@) seq $(@) $(./action/@) $(./prefix/@) \\$COND \" "
+end: "LEN=`echo $(@) | awk -F/ '{ print \\$2 }'` ; \
+ if [ -n \"$(./ge/@)\" ]; then \
+ if [ \\$LEN -le $(./ge/@) ]; then \
+ echo ge must be greater than prefix length ;\
+ exit 1 ; \
+ fi ; \
+ COND=\"ge $(./ge/@) \";
+ fi;
+ if [ -n \"$(./le/@)\" ] && [ $(./le/@) -ne 32 ]; then \
+ if [ $(./le/@) -le $(./ge/@) ]; then \
+ echo le must be greater than or equal to ge ; \
+ exit 1 ; \
+ fi ; \
+ COND=\"\\$COND le $(./le/@) \"; \
+ fi; \
+ if [ -f \"/tmp/protocols-$(../@)-$(@).\\$PPID\" ]; then \
+ rm -f \"protocols-$(../@)-$(@).\\$PPID\" ; \
+ else \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"ip prefix-list $(../@) seq $(@) $(./action/@) $(./prefix/@) \\$COND \" ; \
+ fi ; \
+ exit 0 ; "
diff --git a/templates/policy/prefix-list/node.tag/rule/node.tag/action/node.def b/templates/policy/prefix-list/node.tag/rule/node.tag/action/node.def
new file mode 100644
index 00000000..4eada21b
--- /dev/null
+++ b/templates/policy/prefix-list/node.tag/rule/node.tag/action/node.def
@@ -0,0 +1,3 @@
+type: txt
+help: "action to take on prefixes matching this rule"
+syntax: $(@) in "permit", "deny"; "action must be permit or deny"
diff --git a/templates/policy/prefix-list/node.tag/rule/node.tag/description/node.def b/templates/policy/prefix-list/node.tag/rule/node.tag/description/node.def
new file mode 100644
index 00000000..3d61ac85
--- /dev/null
+++ b/templates/policy/prefix-list/node.tag/rule/node.tag/description/node.def
@@ -0,0 +1,2 @@
+type: txt
+help: "description for this rule"
diff --git a/templates/policy/prefix-list/node.tag/rule/node.tag/ge/node.def b/templates/policy/prefix-list/node.tag/rule/node.tag/ge/node.def
new file mode 100644
index 00000000..638c2b61
--- /dev/null
+++ b/templates/policy/prefix-list/node.tag/rule/node.tag/ge/node.def
@@ -0,0 +1,3 @@
+type: u32
+help: "prefix greater than or equal to"
+syntax: $(@) >= 0 && $(@) <= 32; "ge must be between 0 and 32"
diff --git a/templates/policy/prefix-list/node.tag/rule/node.tag/le/node.def b/templates/policy/prefix-list/node.tag/rule/node.tag/le/node.def
new file mode 100644
index 00000000..e83ae034
--- /dev/null
+++ b/templates/policy/prefix-list/node.tag/rule/node.tag/le/node.def
@@ -0,0 +1,3 @@
+type: u32
+help: "prefix less than or equal to"
+syntax: $(@) >= 0 && $(@) <= 32; "le must be between 0 and 32"
diff --git a/templates/policy/prefix-list/node.tag/rule/node.tag/prefix/node.def b/templates/policy/prefix-list/node.tag/rule/node.tag/prefix/node.def
new file mode 100644
index 00000000..ed167d00
--- /dev/null
+++ b/templates/policy/prefix-list/node.tag/rule/node.tag/prefix/node.def
@@ -0,0 +1,2 @@
+type: ipv4net; "prefix-list $(../../@) rule $(../@) prefix: must be an IPv4 prefix"
+help: "prefix to match against this rule"
diff --git a/templates/policy/route-map/node.def b/templates/policy/route-map/node.def
new file mode 100644
index 00000000..9b5a830b
--- /dev/null
+++ b/templates/policy/route-map/node.def
@@ -0,0 +1,5 @@
+tag:
+type: txt
+help: "Create route-map or enter route-map command mode"
+syntax: pattern $(@) "^[-a-zA-Z0-9.]+$" ; "route-map $(@): name must be alpha-numeric"
+delete: "/opt/vyatta/sbin/vtysh -c\"configure terminal\" -c\"no route-map $(@)\" "
diff --git a/templates/policy/route-map/node.tag/description/node.def b/templates/policy/route-map/node.tag/description/node.def
new file mode 100644
index 00000000..b43c9b77
--- /dev/null
+++ b/templates/policy/route-map/node.tag/description/node.def
@@ -0,0 +1,2 @@
+type: txt
+help: "route-map description"
diff --git a/templates/policy/route-map/node.tag/rule/node.def b/templates/policy/route-map/node.tag/rule/node.def
new file mode 100644
index 00000000..b59435f0
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.def
@@ -0,0 +1,4 @@
+tag:
+type: u32
+help: "Specify route-map rule number"
+syntax: $(@) >= 1 && $(@) <= 65535; "route-map $(../@): rule number $(@) must be between 1 and 65535"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/action/node.def b/templates/policy/route-map/node.tag/rule/node.tag/action/node.def
new file mode 100644
index 00000000..f594fdb6
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/action/node.def
@@ -0,0 +1,6 @@
+type: txt
+help: "action to take on prefixes matching this rule"
+syntax: $(@) in "permit", "deny"; "route-map $(../../@) $(@) $(../@) action: must be permit or deny"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"route-map $(../../@) $(@) $(../@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"route-map $(../../@) $(@) $(../@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"no route-map $(../../@) $(@) $(../@)\" "
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/call/node.def b/templates/policy/route-map/node.tag/rule/node.tag/call/node.def
new file mode 100644
index 00000000..bfddaec9
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/call/node.def
@@ -0,0 +1,10 @@
+type: txt
+help: "Target route-map name"
+syntax: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy route-map $(@)\"; "route-map $(@) doesn't exist"
+commit: $(../action/@); "must define an action for route-map $(../../@) rule $(../@)"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"route-map $(../../@) $(../action/@) $(../@)\" \
+ -c \"call $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"route-map $(../../@) $(../action/@) $(../@)\" \
+ -c \"call $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"route-map $(../../@) $(../action/@) $(../@)\" \
+ -c \"no call \" "
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/continue/node.def b/templates/policy/route-map/node.tag/rule/node.tag/continue/node.def
new file mode 100644
index 00000000..e26d72c8
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/continue/node.def
@@ -0,0 +1,3 @@
+type: u32
+help: "Continue on a different entry within the route-map"
+syntax: $(@) >= 1 && $(@) <= 65535; "continue must be between 1 and 65535"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/description/node.def b/templates/policy/route-map/node.tag/rule/node.tag/description/node.def
new file mode 100644
index 00000000..146d4535
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/description/node.def
@@ -0,0 +1,2 @@
+type: txt
+help: "route-map rule description"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/as-path/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/as-path/node.def
new file mode 100644
index 00000000..1054bdb5
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/as-path/node.def
@@ -0,0 +1,13 @@
+type: txt
+help: "Match BGP AS path list"
+commit: $(../../action/@) != ""; "You must specify an action for route-map $(../../../@) rule $(../../@)"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy as-path-list $(@)\"; "aspath-list $(@) doesn't exist"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"match as-path $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"match as-path $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no match as-path $(@)\" "
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/community/community-list/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/community/community-list/node.def
new file mode 100644
index 00000000..6e6687fe
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/community/community-list/node.def
@@ -0,0 +1,3 @@
+type: txt
+help: "Match community list"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy community-list $(@)\"; "community-list $(@) doesn't exist"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/community/exact-match/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/community/exact-match/node.def
new file mode 100644
index 00000000..439b06bb
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/community/exact-match/node.def
@@ -0,0 +1 @@
+help: "Do exact matching of communities"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/community/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/community/node.def
new file mode 100644
index 00000000..64c477ad
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/community/node.def
@@ -0,0 +1,19 @@
+help: "Match BGP community list"
+delete: "touch /tmp/policy-route-map-$(../../../@)-$(../../action/@)-$(../../@)-match-community.\\$PPID"
+end: "if [ -z \"$(./community-list/)\" ]; then \
+ echo You must configure a community-list ; \
+ exit 1 ; \
+ fi ; \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no match community \" ; \
+ if [ -f \"/tmp/policy-route-map-$(../../../@)-$(../../action/@)-$(../../@)-match-community.\\$PPID\" ]; then \
+ rm -rf /tmp/policy-route-map-$(../../../@)-$(../../action/@)-$(../../@)-match-community.\\$PPID; \
+ else \
+ if [ -n \"$(./exact-match/)\" ]; then \
+ COND=\"exact-match \"; \
+ fi ; \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"match community $(./community-list/@) \\$COND\" ; \
+ fi; "
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/interface/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/interface/node.def
new file mode 100644
index 00000000..2db98b6c
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/interface/node.def
@@ -0,0 +1,18 @@
+type: txt
+help: "Match first hop interface of route"
+# TODO: this node isn't returning an error, but it also isn't adding anything to vyatta
+commit: $(../../action/@) != ""; "You must specify an action for route-map $(../../../@) rule $(../../@)"
+syntax: exec " \
+ if [ -z \"`ip addr | grep $(@) `\" ]; then \
+ echo $(@) doesn\\'t exist on this system ; \
+ exit 1 ; \
+ fi ; "
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"match interface $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"match interface $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no match interface $(@)\" "
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/ip/address/access-list/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/address/access-list/node.def
new file mode 100644
index 00000000..fae2c56c
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/address/access-list/node.def
@@ -0,0 +1,4 @@
+type: u32
+help: "IP access-list number"
+syntax: $(../prefix-list/@) == ""; "You can only specify a prefix-list or access-list"
+syntax: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy access-list $(@)\"; "access-list $(@) does not exist"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/ip/address/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/address/node.def
new file mode 100644
index 00000000..d37d5622
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/address/node.def
@@ -0,0 +1 @@
+help: "Match address of route"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/ip/address/prefix-list/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/address/prefix-list/node.def
new file mode 100644
index 00000000..1cf23475
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/address/prefix-list/node.def
@@ -0,0 +1,4 @@
+type: u32
+help: "IP access-list number"
+syntax: $(../access-list/@) == ""; "You can only specify a prefix-list or access-list"
+syntax: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy prefix-list $(@)\"; "prefix-list $(@) does not exist"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/ip/nexthop/access-list/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/nexthop/access-list/node.def
new file mode 100644
index 00000000..fae2c56c
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/nexthop/access-list/node.def
@@ -0,0 +1,4 @@
+type: u32
+help: "IP access-list number"
+syntax: $(../prefix-list/@) == ""; "You can only specify a prefix-list or access-list"
+syntax: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy access-list $(@)\"; "access-list $(@) does not exist"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/ip/nexthop/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/nexthop/node.def
new file mode 100644
index 00000000..f7fbc26c
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/nexthop/node.def
@@ -0,0 +1 @@
+help: "Match nexthop of route"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/ip/nexthop/prefix-list/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/nexthop/prefix-list/node.def
new file mode 100644
index 00000000..1cf23475
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/nexthop/prefix-list/node.def
@@ -0,0 +1,4 @@
+type: u32
+help: "IP access-list number"
+syntax: $(../access-list/@) == ""; "You can only specify a prefix-list or access-list"
+syntax: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy prefix-list $(@)\"; "prefix-list $(@) does not exist"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/ip/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/node.def
new file mode 100644
index 00000000..ce13dd49
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/node.def
@@ -0,0 +1 @@
+help: "IP information"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/ip/route-source/access-list/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/route-source/access-list/node.def
new file mode 100644
index 00000000..fae2c56c
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/route-source/access-list/node.def
@@ -0,0 +1,4 @@
+type: u32
+help: "IP access-list number"
+syntax: $(../prefix-list/@) == ""; "You can only specify a prefix-list or access-list"
+syntax: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy access-list $(@)\"; "access-list $(@) does not exist"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/ip/route-source/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/route-source/node.def
new file mode 100644
index 00000000..61fc71bf
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/route-source/node.def
@@ -0,0 +1 @@
+help: "Match route-source of route"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/ip/route-source/prefix-list/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/route-source/prefix-list/node.def
new file mode 100644
index 00000000..1cf23475
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/ip/route-source/prefix-list/node.def
@@ -0,0 +1,4 @@
+type: u32
+help: "IP access-list number"
+syntax: $(../access-list/@) == ""; "You can only specify a prefix-list or access-list"
+syntax: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy prefix-list $(@)\"; "prefix-list $(@) does not exist"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/metric/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/metric/node.def
new file mode 100644
index 00000000..6b7dcab7
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/metric/node.def
@@ -0,0 +1,13 @@
+type: u32; "route-map $(../../../@) $(../../action/@) $(../../@) metric: must be an integer"
+help: "Match metric of route"
+commit: $(../../action/@) != ""; "You must specify an action for route-map $(../../../@) rule $(../../@)"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"match metric $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"match metric $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no match metric $(@)\" "
+
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/origin/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/origin/node.def
new file mode 100644
index 00000000..84ecc6e4
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/origin/node.def
@@ -0,0 +1,14 @@
+type: txt
+help: "BGP origin code"
+syntax: $(@) in "egp", "igp", "incomplete"; "origin must be egp, igp, or incomplete"
+commit: $(../../action/@) != ""; "You must specify an action for route-map $(../../../@) rule $(../../@)"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"match origin $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"match origin $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no match origin $(@)\" "
+
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/peer/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/peer/node.def
new file mode 100644
index 00000000..a71801c7
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/peer/node.def
@@ -0,0 +1,14 @@
+type: txt
+help: "Match peer address"
+syntax: exec "/opt/vyatta/sbin/vyatta_policy.pl --check-peer-syntax $(@)"; "peer must be either an IP or local"
+commit: $(../../action/@) != ""; "You must specify an action for route-map $(../../../@) rule $(../../@)"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"match peer $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"match peer $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no match peer \" "
+
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/match/tag/node.def b/templates/policy/route-map/node.tag/rule/node.tag/match/tag/node.def
new file mode 100644
index 00000000..14d0c0f9
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/match/tag/node.def
@@ -0,0 +1,14 @@
+type: u32
+help: "Match tag of route"
+syntax: $(@) >= 1 && $(@) <= 65535; "tag must be between 1 and 65535"
+commit: $(../../action/@); "You must specify an action for route-map $(../../../@) rule $(../../@)"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"match tag $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"match tag $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no match tag $(@)\" "
+
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/on-match/goto/node.def b/templates/policy/route-map/node.tag/rule/node.tag/on-match/goto/node.def
new file mode 100644
index 00000000..d4fc4dfc
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/on-match/goto/node.def
@@ -0,0 +1,14 @@
+type: u32
+help: "Goto sequence number"
+syntax: $(../next/@) != ""; "you can set only goto or next"
+syntax: $(@) >= 1 && $(@) <= 65535; "tag must be between 1 and 65535"
+commit: $(../../action/@); "You must specify an action for route-map $(../../../@) rule $(../../@)"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"on-match goto $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"on-match goto $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no on-match goto $(@)\" "
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/on-match/next/node.def b/templates/policy/route-map/node.tag/rule/node.tag/on-match/next/node.def
new file mode 100644
index 00000000..eaffea3c
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/on-match/next/node.def
@@ -0,0 +1,13 @@
+help: "Goto next sequence number"
+syntax: $(../goto/@) != ""; "you can set only goto or next"
+commit: $(../../action/@); "You must specify an action for route-map $(../../../@) rule $(../../@)"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"on-match next \" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"on-match next \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no on-match next \" "
+
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/on-match/node.def b/templates/policy/route-map/node.tag/rule/node.tag/on-match/node.def
new file mode 100644
index 00000000..22ea4938
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/on-match/node.def
@@ -0,0 +1,2 @@
+help: "Exit policy on matches"
+
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/aggregator/as/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/aggregator/as/node.def
new file mode 100644
index 00000000..74b860d2
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/set/aggregator/as/node.def
@@ -0,0 +1,3 @@
+type: u32
+help: "AS number of aggregator"
+syntax: $(@) >= 1 && $(@) <= 65535; "AS number must be between 1 and 65535"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/aggregator/ip/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/aggregator/ip/node.def
new file mode 100644
index 00000000..1bfbe125
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/set/aggregator/ip/node.def
@@ -0,0 +1,3 @@
+type: ipv4
+help: "IP address of aggregator"
+syntax: $(@) >= 1 && $(@) <= 65535; "AS number must be between 1 and 65535"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/aggregator/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/aggregator/node.def
new file mode 100644
index 00000000..f86cfe5d
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/set/aggregator/node.def
@@ -0,0 +1,16 @@
+help: "BGP aggregator attribute"
+delete: "touch /tmp/policy-route-map-$(../../../@)-$(../../action/@)-$(../../@)-set-aggregator.\\$PPID"
+end: "if [ -z \"$(./as/)\" ] || [ -z \"$(./ip/)\" ]; then \
+ echo You must configure as and ip ; \
+ exit 1 ; \
+ fi ; \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no set aggregator \" ; \
+ if [ -f \"/tmp/policy-route-map-$(../../../@)-$(../../action/@)-$(../../@)-set-aggregator.\\$PPID\" ]; then \
+ rm -rf /tmp/policy-route-map-$(../../../@)-$(../../action/@)-$(../../@)-set-aggregator.\\$PPID; \
+ else \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"match community $(./as/@) $(./ip/@)\" ; \
+ fi; "
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/as-path-prepend/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/as-path-prepend/node.def
new file mode 100644
index 00000000..9e602cb2
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/set/as-path-prepend/node.def
@@ -0,0 +1,12 @@
+type: txt;
+help: "Prepend string for a BGP AS-path attribute"
+commit: $(../../action/@) != ""; "You must specify an action for route-map $(../../../@) rule $(../../@)"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set as-path prepend $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set as-path prepend $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no set as-path prepend \" "
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/atomic-aggregate/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/atomic-aggregate/node.def
new file mode 100644
index 00000000..233ee4a5
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/set/atomic-aggregate/node.def
@@ -0,0 +1,11 @@
+help: "BGP atomic aggregate attribute"
+commit: $(../../action/@) != ""; "You must specify an action for route-map $(../../../@) rule $(../../@)"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set atomic-aggregate\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set atomic-aggregate\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no set atomic-aggregate\" "
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/comm-list/comm-list/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/comm-list/comm-list/node.def
new file mode 100644
index 00000000..a8e1029e
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/set/comm-list/comm-list/node.def
@@ -0,0 +1,3 @@
+type: txt
+help: "set BGP community list"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy community-list $(@)\"; "community list $(@) does not exist"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/comm-list/delete/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/comm-list/delete/node.def
new file mode 100644
index 00000000..f8ca6637
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/set/comm-list/delete/node.def
@@ -0,0 +1 @@
+help: "Delete matching communities"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/comm-list/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/comm-list/node.def
new file mode 100644
index 00000000..613897fd
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/set/comm-list/node.def
@@ -0,0 +1,19 @@
+help: "set BGP community list"
+delete: "touch /tmp/policy-route-map-$(../../../@)-$(../../action/@)-$(../../@)-set-comm-list.\\$PPID"
+end: "if [ -z \"$(./comm-list/)\" ]; then \
+ echo You must configure a comm-list ; \
+ exit 1 ; \
+ fi ; \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no set comm-list \" ; \
+ if [ -f \"/tmp/policy-route-map-$(../../../@)-$(../../action/@)-$(../../@)-set-comm-list.\\$PPID\" ]; then \
+ rm -rf /tmp/policy-route-map-$(../../../@)-$(../../action/@)-$(../../@)-set-comm-list.\\$PPID; \
+ else \
+ if [ -n \"$(./delete/)\" ]; then \
+ COND=\"delete\" ; \
+ fi ; \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set comm-list $(./comm-list/@) \\$COND\" ; \
+ fi; "
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/community/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/community/node.def
new file mode 100644
index 00000000..ccac5e10
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/set/community/node.def
@@ -0,0 +1,13 @@
+type: txt
+help: "Community number in aa:nn format or local-AS|no-advertise|no-export|internet|additive or none"
+# TODO: check syntax
+commit: $(../../action/@) != ""; "You must specify an action for route-map $(../../../@) rule $(../../@)"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set community $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set community $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no set community \" "
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/ip-next-hop/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/ip-next-hop/node.def
new file mode 100644
index 00000000..ff440e80
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/set/ip-next-hop/node.def
@@ -0,0 +1,13 @@
+type: ipv4
+help: "Next hop IP address"
+# TODO: can also set to peer for BGP
+commit: $(../../action/@) != ""; "You must specify an action for route-map $(../../../@) rule $(../../@)"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set ip next-hop $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set ip next-hop $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no set ip next-hop \" "
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/local-preference/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/local-preference/node.def
new file mode 100644
index 00000000..929adaf1
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/set/local-preference/node.def
@@ -0,0 +1,12 @@
+type: u32
+help: "BGP local preference path attribute"
+commit: $(../../action/@) != ""; "You must specify an action for route-map $(../../../@) rule $(../../@)"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set local-preference $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set local-preference $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no set local-preference \" "
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/metric/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/metric/node.def
new file mode 100644
index 00000000..47a19621
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/set/metric/node.def
@@ -0,0 +1,13 @@
+type: txt
+help: "Metric value for destination routing protocol"
+syntax: exec "if [ -n `echo $(@) | sed 's/[+0123456789]*-*//g'` ]; then exit 1; fi; "; "metric must be an integer with an optional +/- prepend"
+commit: $(../../action/@) != ""; "You must specify an action for route-map $(../../../@) rule $(../../@)"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set metric $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set metric $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no set metric \" "
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/node.def
new file mode 100644
index 00000000..6d30b42f
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/set/node.def
@@ -0,0 +1 @@
+help: "Set values in destination routing protocol"
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/origin/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/origin/node.def
new file mode 100644
index 00000000..46c33586
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/set/origin/node.def
@@ -0,0 +1,13 @@
+type: txt
+help: "BGP origin code"
+syntax: $(@) in "igp", "egp", "incomplete"; "origin must be one of igp, egp, or incomplete"
+commit: $(../../action/@) != ""; "You must specify an action for route-map $(../../../@) rule $(../../@)"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set origin $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set origin $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no set origin \" "
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/originator-id/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/originator-id/node.def
new file mode 100644
index 00000000..ae749c15
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/set/originator-id/node.def
@@ -0,0 +1,12 @@
+type: ipv4
+help: "BGP originator ID attribute"
+commit: $(../../action/@) != ""; "You must specify an action for route-map $(../../../@) rule $(../../@)"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set originator-id $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set originator-id $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no set originator-id \" "
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/tag/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/tag/node.def
new file mode 100644
index 00000000..a0812733
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/set/tag/node.def
@@ -0,0 +1,13 @@
+type: u32
+help: "Tag value for routing protocol"
+syntax: $(@) >= 1 && $(@) <= 65535; "tag must be between 1 and 65535"
+commit: $(../../action/@) != ""; "You must specify an action for route-map $(../../../@) rule $(../../@)"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set tag $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set tag $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no set tag \" "
diff --git a/templates/policy/route-map/node.tag/rule/node.tag/set/weight/node.def b/templates/policy/route-map/node.tag/rule/node.tag/set/weight/node.def
new file mode 100644
index 00000000..34fed745
--- /dev/null
+++ b/templates/policy/route-map/node.tag/rule/node.tag/set/weight/node.def
@@ -0,0 +1,12 @@
+type: u32
+help: "BGP weight for routing table"
+commit: $(../../action/@) != ""; "You must specify an action for route-map $(../../../@) rule $(../../@)"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set weight $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"set weight $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" \
+ -c \"route-map $(../../../@) $(../../action/@) $(../../@)\" \
+ -c \"no set weight \" "
diff --git a/templates/protocols/bgp/node.def b/templates/protocols/bgp/node.def
new file mode 100644
index 00000000..df0e79a6
--- /dev/null
+++ b/templates/protocols/bgp/node.def
@@ -0,0 +1,7 @@
+tag:
+type: u32
+help: "Configure a BGP Autonomous System on this router"
+# TODO: non-multinode parent
+syntax: $(@) >= 1 && $(@) <= 65535; "AS number must be between 1 and 65535"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c\"router bgp $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c\"no router bgp $(@)\" "
diff --git a/templates/protocols/bgp/node.tag/aggregate-address/node.def b/templates/protocols/bgp/node.tag/aggregate-address/node.def
new file mode 100644
index 00000000..b21ef1b5
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/aggregate-address/node.def
@@ -0,0 +1,19 @@
+tag:
+type: ipv4net; "aggregate-entry must be and IPv4 network"
+help: "Configure BGP aggregate entries"
+syntax: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --check-prefix-boundry $(@)"
+delete: "touch /tmp/`echo $(@) | sed 's!/!!'`.\\$PPID"
+end: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../@)\" \
+ -c \"no aggregate-address $(@)\"; \
+ if [ -f \"/tmp/`echo $(@) | sed 's!/!!'`.\\$PPID\" ]; then \
+ rm -rf /tmp/`echo $(@) | sed 's!/!!'`.\\$PPID; \
+ else \
+ if [ -n \"$(./as-set/@)\" ]; then \
+ COND=\"as-set\";
+ fi; \
+ if [ -n \"$(./summary-only/@)\" ]; then \
+ COND=\"\\$COND summary-only\"; \
+ fi; \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../@)\" \
+ -c \"aggregate-address $(@) \\$COND\"; \
+ fi; "
diff --git a/templates/protocols/bgp/node.tag/aggregate-address/node.tag/as-set/node.def b/templates/protocols/bgp/node.tag/aggregate-address/node.tag/as-set/node.def
new file mode 100644
index 00000000..90c088a1
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/aggregate-address/node.tag/as-set/node.def
@@ -0,0 +1 @@
+help: "Generate AS set path information"
diff --git a/templates/protocols/bgp/node.tag/aggregate-address/node.tag/summary-only/node.def b/templates/protocols/bgp/node.tag/aggregate-address/node.tag/summary-only/node.def
new file mode 100644
index 00000000..ccfbd0fa
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/aggregate-address/node.tag/summary-only/node.def
@@ -0,0 +1 @@
+help: "Filter more specific routes from updates"
diff --git a/templates/protocols/bgp/node.tag/bgp/always-compare-med/node.def b/templates/protocols/bgp/node.tag/bgp/always-compare-med/node.def
new file mode 100644
index 00000000..007de903
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/always-compare-med/node.def
@@ -0,0 +1,5 @@
+help: "Allow comparing MED from different neighbors"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"bgp always-compare-med\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no bgp always-compare-med\" "
diff --git a/templates/protocols/bgp/node.tag/bgp/bestpath/as-path/confed/node.def b/templates/protocols/bgp/node.tag/bgp/bestpath/as-path/confed/node.def
new file mode 100644
index 00000000..7bc02046
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/bestpath/as-path/confed/node.def
@@ -0,0 +1,6 @@
+help: "Compare path lengths including confederation sets & sequences in selecting a route"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../../@)\" \
+ -c \"bgp bestpath as-path confed \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../../@)\" \
+ -c \"no bgp bestpath as-path confed \" "
+
diff --git a/templates/protocols/bgp/node.tag/bgp/bestpath/as-path/ignore/node.def b/templates/protocols/bgp/node.tag/bgp/bestpath/as-path/ignore/node.def
new file mode 100644
index 00000000..5e12c44a
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/bestpath/as-path/ignore/node.def
@@ -0,0 +1,5 @@
+help: "Ignore as-path length in selecting a route"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../../@)\" \
+ -c \"bgp bestpath as-path ignore \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../../@)\" \
+ -c \"no bgp bestpath as-path ignore \" "
diff --git a/templates/protocols/bgp/node.tag/bgp/bestpath/as-path/node.def b/templates/protocols/bgp/node.tag/bgp/bestpath/as-path/node.def
new file mode 100644
index 00000000..72b50839
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/bestpath/as-path/node.def
@@ -0,0 +1 @@
+help: "AS-path attribute"
diff --git a/templates/protocols/bgp/node.tag/bgp/bestpath/compare-routerid/node.def b/templates/protocols/bgp/node.tag/bgp/bestpath/compare-routerid/node.def
new file mode 100644
index 00000000..19d69ddb
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/bestpath/compare-routerid/node.def
@@ -0,0 +1,6 @@
+help: "Compare router-id for identical EBGP paths"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"bgp bestpath compare-routerid \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no bgp bestpath compare-routerid \" "
+
diff --git a/templates/protocols/bgp/node.tag/bgp/bestpath/med/confed/node.def b/templates/protocols/bgp/node.tag/bgp/bestpath/med/confed/node.def
new file mode 100644
index 00000000..42a64027
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/bestpath/med/confed/node.def
@@ -0,0 +1,6 @@
+help: "Compare MED among confederation paths"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../../@)\" \
+ -c \"bgp bestpath med confed \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../../@)\" \
+ -c \"no bgp bestpath med confed \" "
+
diff --git a/templates/protocols/bgp/node.tag/bgp/bestpath/med/missing-as-worst/node.def b/templates/protocols/bgp/node.tag/bgp/bestpath/med/missing-as-worst/node.def
new file mode 100644
index 00000000..5a6f571a
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/bestpath/med/missing-as-worst/node.def
@@ -0,0 +1,6 @@
+help: "Treat missing MED as the least preferred one"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../../@)\" \
+ -c \"bgp bestpath med missing-as-worst \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../../@)\" \
+ -c \"no bgp bestpath med missing-as-worst \" "
+
diff --git a/templates/protocols/bgp/node.tag/bgp/bestpath/med/node.def b/templates/protocols/bgp/node.tag/bgp/bestpath/med/node.def
new file mode 100644
index 00000000..350270bb
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/bestpath/med/node.def
@@ -0,0 +1 @@
+help: "MED attribute"
diff --git a/templates/protocols/bgp/node.tag/bgp/bestpath/node.def b/templates/protocols/bgp/node.tag/bgp/bestpath/node.def
new file mode 100644
index 00000000..b4a1bbe7
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/bestpath/node.def
@@ -0,0 +1 @@
+help: "Change the default bestpath selection"
diff --git a/templates/protocols/bgp/node.tag/bgp/client-to-client-reflection/node.def b/templates/protocols/bgp/node.tag/bgp/client-to-client-reflection/node.def
new file mode 100644
index 00000000..00b4ef71
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/client-to-client-reflection/node.def
@@ -0,0 +1,6 @@
+help: "Configure client to client route reflection"
+# TODO: not showing up in vyatta. Probably needs another setting to be applied.
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"bgp client-to-client reflection \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no bgp client-to-client reflection \" "
diff --git a/templates/protocols/bgp/node.tag/bgp/cluster-id/node.def b/templates/protocols/bgp/node.tag/bgp/cluster-id/node.def
new file mode 100644
index 00000000..741d3761
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/cluster-id/node.def
@@ -0,0 +1,8 @@
+type: ipv4; "protocols bgp $(../../) cluster-id must be and IPv4 address"
+help: "Configure route-reflector cluster-id\n"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"bgp cluster-id $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"bgp cluster-id $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no bgp cluster-id \" "
diff --git a/templates/protocols/bgp/node.tag/bgp/confederation/identifier/node.def b/templates/protocols/bgp/node.tag/bgp/confederation/identifier/node.def
new file mode 100644
index 00000000..eadc9fc9
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/confederation/identifier/node.def
@@ -0,0 +1,9 @@
+type: u32; "protocols bgp $(../../../) confederation identifier must be a u32"
+help: "Configure confederation AS id"
+syntax: $(@) >= 1 && $(@) <= 65535; "confederation AS id must be between 1 and 65535"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"bgp confederation identifier $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"bgp confederation identifier $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no bgp confederation identifier \" "
diff --git a/templates/protocols/bgp/node.tag/bgp/confederation/node.def b/templates/protocols/bgp/node.tag/bgp/confederation/node.def
new file mode 100644
index 00000000..272c946c
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/confederation/node.def
@@ -0,0 +1 @@
+help: "AS confederation parameters"
diff --git a/templates/protocols/bgp/node.tag/bgp/confederation/peers/node.def b/templates/protocols/bgp/node.tag/bgp/confederation/peers/node.def
new file mode 100644
index 00000000..e8c9b7dd
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/confederation/peers/node.def
@@ -0,0 +1,10 @@
+multi:
+type: u32; "protocols bgp $(../../../@) confederation peer must be a u32"
+help: "Peer ASs in BGP confederation"
+syntax: $(@) >= 1 && $(@) <= 65535; "confederation AS id must be between 1 and 65535"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"bgp confederation peers $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"bgp confederation peers $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no bgp confederation peers $(@)\" "
diff --git a/templates/protocols/bgp/node.tag/bgp/dampening/half-life/node.def b/templates/protocols/bgp/node.tag/bgp/dampening/half-life/node.def
new file mode 100644
index 00000000..dbff0dcf
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/dampening/half-life/node.def
@@ -0,0 +1,3 @@
+type: u32; "protocols bgp $(../../../@) dampening half-life must be a u32"
+help: "Half-life time for the penalty"
+syntax: $(@) >= 1 && $(@) <= 45; "Half-life penalty must be between 1 and 45"
diff --git a/templates/protocols/bgp/node.tag/bgp/dampening/max-suppress-time/node.def b/templates/protocols/bgp/node.tag/bgp/dampening/max-suppress-time/node.def
new file mode 100644
index 00000000..5ae075e2
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/dampening/max-suppress-time/node.def
@@ -0,0 +1,5 @@
+type: u32; "protocols bgp $(../../../@) dampening max-suppress-time must be a u32"
+help: "Maximum duration to suppress a stable route"
+syntax: $(@) >= 1 && $(@) <= 255; "Max-suppress-time must be between 1 and 255"
+commit: $(../re-use/@) != ""; "Re-use value must be set"
+commit: $(../start-suppress-time/@) != ""; "Start-suppress-time must be set"
diff --git a/templates/protocols/bgp/node.tag/bgp/dampening/node.def b/templates/protocols/bgp/node.tag/bgp/dampening/node.def
new file mode 100644
index 00000000..9086f275
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/dampening/node.def
@@ -0,0 +1,12 @@
+help: "Enable route-flap dampening"
+delete: "touch /tmp/bgp-dampening.\\$PPID"
+end: "sh -c \"
+ /opt/vyatta/bin/vtysh -c \\\"configure terminal\\\" -c \\\"router bgp $(../../@)\\\" \
+ -c \\\"no bgp dampening\\\" ; \
+ if [ -f \\\"/tmp/bgp-dampening.\\\\$PPID\\\" ]; then \
+ rm -f \\\"/tmp/bgp-dampening.\\\\$PPID\\\" ; \
+ else \
+ /opt/vyatta/bin/vtysh -c \\\"configure terminal\\\" -c \\\"router bgp $(../../@)\\\" \
+ -c \\\"bgp dampening $(./half-life/@) $(./re-use/@) $(./start-suppress-time/@) $(./max-suppress-time/@)\\\" ; \
+ fi ; \
+ \" "
diff --git a/templates/protocols/bgp/node.tag/bgp/dampening/re-use/node.def b/templates/protocols/bgp/node.tag/bgp/dampening/re-use/node.def
new file mode 100644
index 00000000..0555c81f
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/dampening/re-use/node.def
@@ -0,0 +1,5 @@
+type: u32; "protocols bgp $(../../../@) dampening re-use must be a u32"
+help: "Value to start reusing a route"
+syntax: $(@) >= 1 && $(@) <= 20000; "Re-use value must be between 1 and 20000"
+commit: $(../start-suppress-time/@) != ""; "Start-suppress-time must be set"
+commit: $(../max-suppress-time/@) != ""; "Max-suppress-time must be set"
diff --git a/templates/protocols/bgp/node.tag/bgp/dampening/start-suppress-time/node.def b/templates/protocols/bgp/node.tag/bgp/dampening/start-suppress-time/node.def
new file mode 100644
index 00000000..07f8e566
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/dampening/start-suppress-time/node.def
@@ -0,0 +1,5 @@
+type: u32; "protocols bgp $(../../../@) dampening start-suppress-time must be a u32"
+help: "Value to start suppressing a route"
+syntax: $(@) >= 1 && $(@) <= 20000; "Start-suppress-time must be between 1 and 20000"
+commit: $(../re-use/@) != ""; "Re-use value must be set"
+commit: $(../max-suppress-time/@) != ""; "Max-suppress-time must be set"
diff --git a/templates/protocols/bgp/node.tag/bgp/default/local-pref/node.def b/templates/protocols/bgp/node.tag/bgp/default/local-pref/node.def
new file mode 100644
index 00000000..7b5847cc
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/default/local-pref/node.def
@@ -0,0 +1,8 @@
+type: u32; "protocols bgp $(../../../@) bgp default local-pref must be a u32"
+help: "local preference (higher=more preferred)"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"bgp default local-preference $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"bgp default local-preference $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no bgp default local-preference\" "
diff --git a/templates/protocols/bgp/node.tag/bgp/default/no-ipv4-unicast/node.def b/templates/protocols/bgp/node.tag/bgp/default/no-ipv4-unicast/node.def
new file mode 100644
index 00000000..77a49962
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/default/no-ipv4-unicast/node.def
@@ -0,0 +1,5 @@
+help: "De-activate ipv4-unicastfor a peer by default"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no bgp default ipv4-unicast\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"bgp default ipv4-unicast\" "
diff --git a/templates/protocols/bgp/node.tag/bgp/default/node.def b/templates/protocols/bgp/node.tag/bgp/default/node.def
new file mode 100644
index 00000000..f1c90ec3
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/default/node.def
@@ -0,0 +1 @@
+help: "Configure BGP defaults"
diff --git a/templates/protocols/bgp/node.tag/bgp/deterministic-med/node.def b/templates/protocols/bgp/node.tag/bgp/deterministic-med/node.def
new file mode 100644
index 00000000..de476ada
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/deterministic-med/node.def
@@ -0,0 +1,5 @@
+help: "Pick the best-MED path among paths advertised from the neighboring AS"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"bgp deterministic-med \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no bgp deterministic-med \" "
diff --git a/templates/protocols/bgp/node.tag/bgp/enforce-first-as/node.def b/templates/protocols/bgp/node.tag/bgp/enforce-first-as/node.def
new file mode 100644
index 00000000..d54557f4
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/enforce-first-as/node.def
@@ -0,0 +1,5 @@
+help: "Enforce the first AS for EBGP routes"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"bgp enforce-first-as \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no bgp enforce-first-as \" "
diff --git a/templates/protocols/bgp/node.tag/bgp/graceful-restart/node.def b/templates/protocols/bgp/node.tag/bgp/graceful-restart/node.def
new file mode 100644
index 00000000..1e849462
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/graceful-restart/node.def
@@ -0,0 +1 @@
+help: "Graceful restart capability parameters"
diff --git a/templates/protocols/bgp/node.tag/bgp/graceful-restart/stalepath-time/node.def b/templates/protocols/bgp/node.tag/bgp/graceful-restart/stalepath-time/node.def
new file mode 100644
index 00000000..7a928fba
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/graceful-restart/stalepath-time/node.def
@@ -0,0 +1,9 @@
+type: u32; "protocols bgp $(../../../@) bgp graceful-restart stalepath-time must be a u32"
+help: "Set the max time in seconds to hold onto restarting peer's stale paths"
+syntax: $(@) >= 1 && $(@) <= 3600; "stalepath-time must be between 1 and 3600"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"bgp graceful-restart stalepath-time $(@) \" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"bgp graceful-restart stalepath-time $(@) \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no bgp graceful-restart stalepath-time \" "
diff --git a/templates/protocols/bgp/node.tag/bgp/log-neighbor-changes/node.def b/templates/protocols/bgp/node.tag/bgp/log-neighbor-changes/node.def
new file mode 100644
index 00000000..9ae8ec2f
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/log-neighbor-changes/node.def
@@ -0,0 +1,5 @@
+help: "Log neighbor up/down and reset reason"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"bgp log-neighbor-changes \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no bgp log-neighbor-changes \" "
diff --git a/templates/protocols/bgp/node.tag/bgp/network/import-check/node.def b/templates/protocols/bgp/node.tag/bgp/network/import-check/node.def
new file mode 100644
index 00000000..96bae68f
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/network/import-check/node.def
@@ -0,0 +1,5 @@
+help: "Check BGP network route exists in IGP"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"bgp network import-check \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no bgp network import-check \" "
diff --git a/templates/protocols/bgp/node.tag/bgp/network/node.def b/templates/protocols/bgp/node.tag/bgp/network/node.def
new file mode 100644
index 00000000..883e5fe1
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/network/node.def
@@ -0,0 +1 @@
+help: "network parameter options"
diff --git a/templates/protocols/bgp/node.tag/bgp/no-fast-external-failover/node.def b/templates/protocols/bgp/node.tag/bgp/no-fast-external-failover/node.def
new file mode 100644
index 00000000..de7b3815
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/no-fast-external-failover/node.def
@@ -0,0 +1,5 @@
+help: "Immediately reset session if a link to a directly connected external peer goes down"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no bgp fast-external-failover \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"bgp fast-external-failover \" "
diff --git a/templates/protocols/bgp/node.tag/bgp/node.def b/templates/protocols/bgp/node.tag/bgp/node.def
new file mode 100644
index 00000000..b23668f8
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/node.def
@@ -0,0 +1 @@
+help: "Configure BGP parameters"
diff --git a/templates/protocols/bgp/node.tag/bgp/router-id/node.def b/templates/protocols/bgp/node.tag/bgp/router-id/node.def
new file mode 100644
index 00000000..5a65143a
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/router-id/node.def
@@ -0,0 +1,8 @@
+type: ipv4; "protocols bgp $(../../@) bgp router-id must be an IPv4 address"
+help: "Override configured router identifier"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"bgp router-id $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"bgp router-id $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no bgp router-id \" "
diff --git a/templates/protocols/bgp/node.tag/bgp/scan-time/node.def b/templates/protocols/bgp/node.tag/bgp/scan-time/node.def
new file mode 100644
index 00000000..4b4c8814
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/bgp/scan-time/node.def
@@ -0,0 +1,9 @@
+type: u32; "protocols bgp $(../../@) bgp scan-time must be a u32"
+syntax: $(@) >= 5 && $(@) <= 60; "scan-time must be between 5 and 60 seconds"
+help: "Configure background scanner interval"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"bgp scan-time $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"bgp scan-time $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no bgp scan-time \" "
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.def b/templates/protocols/bgp/node.tag/neighbor/node.def
new file mode 100644
index 00000000..40095c19
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.def
@@ -0,0 +1,9 @@
+tag:
+type: txt
+help: "Specify neighbor router"
+syntax: exec "/opt/vyatta/sbin/vyatta_bgp.pl --check-peer-name $(@)"
+# if this neighbor has a text name it is a peer group. setup the peer-group option
+create: "if [ -n \"`echo $(@) | sed 's/[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}//'`\" ]; then \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" -c\"router bgp $(../@)\" -c\"neighbor $(@) peer-group\" ; \
+ fi ; "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c\"router bgp $(../@)\" -c\"no neighbor $(@) \" "
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
new file mode 100644
index 00000000..a6487aab
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/advertisement-interval/node.def
@@ -0,0 +1,10 @@
+type: u32
+help: "Minimum interval between sending BGP routing updates"
+syntax: $(@) >= 0 && $(@) <= 600; "remote-as must be between 0 and 600"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) advertisement-interval $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) advertisement-interval $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) 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
new file mode 100644
index 00000000..4ad43d58
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/allowas-in/node.def
@@ -0,0 +1,11 @@
+help: "Accept as-path with my AS present in it."
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+delete: "touch /tmp/bgp-neighbor-$(../@)-allowas-in.\\$PPID"
+end: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) allowas-in \"; \
+ if [ -f \"/tmp/bgp-neighbor-$(../@)-allowas-in.\\$PPID\" ]; then \
+ rm -rf /tmp/bgp-neighbor-$(../@)-allowas-in.\\$PPID; \
+ else \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) allowas-in $(./number/@)\"; \
+ fi; "
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/allowas-in/number/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/allowas-in/number/node.def
new file mode 100644
index 00000000..f546cf81
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/allowas-in/number/node.def
@@ -0,0 +1,4 @@
+type: u32
+help: "Number of occurances of AS number"
+syntax: $(@) >= 1 && $(@) <= 10; "allowas-in number must be between 1 and 10"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first"
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/as-path/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/as-path/node.def
new file mode 100644
index 00000000..d9875f1b
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/as-path/node.def
@@ -0,0 +1,2 @@
+help: "AS path attribute"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group should be defined first"
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/med/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/med/node.def
new file mode 100644
index 00000000..6ca2dea1
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/med/node.def
@@ -0,0 +1,2 @@
+help: "Multi-exit descriminator attribute"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group should be defined first"
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/next-hop/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/next-hop/node.def
new file mode 100644
index 00000000..fb58ce09
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/next-hop/node.def
@@ -0,0 +1,2 @@
+help: "Nexthop attribute"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group should be defined first"
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
new file mode 100644
index 00000000..6981f0d3
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/node.def
@@ -0,0 +1,20 @@
+help: "BGP attribute is propagated unchanged to this neighbor"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+delete: "touch /tmp/bgp-neighbor-$(../@)-attribute-unchanged.\\$PPID"
+end: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) attribute-unchanged \"; \
+ if [ -f \"/tmp/bgp-neighbor-$(../@)-attribute-unchanged.\\$PPID\" ]; then \
+ rm -rf /tmp/bgp-neighbor-$(../@)-attribute-unchanged.\\$PPID; \
+ else \
+ if [ -n \"$(./as-path/@)\" ]; then \
+ COND=\"as-path \" ; \
+ fi ; \
+ if [ -n \"$(./med/@)\" ]; then \
+ COND=\"\\$COND med \" ; \
+ fi ; \
+ if [ -n \"$(./next-hop/@)\" ]; then \
+ COND=\"\\$COND next-hop \" ; \
+ fi ; \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) attribute-unchanged \\$COND\"; \
+ 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
new file mode 100644
index 00000000..41adb3d3
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/dynamic/node.def
@@ -0,0 +1,7 @@
+help: "Advertise dynamic capability to this neighbor"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) capability dynamic\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no neighbor $(../../@) capability dynamic\" "
+
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/node.def
new file mode 100644
index 00000000..78cab42b
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/node.def
@@ -0,0 +1 @@
+help: "Advertise ORF capability to the peer"
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/node.def
new file mode 100644
index 00000000..06be1587
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/node.def
@@ -0,0 +1 @@
+help: "Advertise prefix-list ORF capability to this neighbor"
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
new file mode 100644
index 00000000..c7844c1d
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/receive/node.def
@@ -0,0 +1,6 @@
+help: "Capability to RECEIVE the ORF to this neighbor"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../../../@)\" \
+ -c \"neighbor $(../../../../@) capability orf prefix-list receive\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../../../@)\" \
+ -c \"no neighbor $(../../../../@) capability orf prefix-list receive\" "
+
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
new file mode 100644
index 00000000..1d632fa7
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/send/node.def
@@ -0,0 +1,6 @@
+help: "Capability to SEND the ORF to this neighbor"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../../../@)\" \
+ -c \"neighbor $(../../../../@) capability orf prefix-list send\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../../../@)\" \
+ -c \"no neighbor $(../../../../@) capability orf prefix-list send\" "
+
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
new file mode 100644
index 00000000..235c871f
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/node.def
@@ -0,0 +1,15 @@
+help: "Originate default route to this neighbor"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+delete: "touch /tmp/bgp-neighbor-$(../@)-default-originate.\\$PPID"
+end: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) default-originate \"; \
+ if [ -f \"/tmp/bgp-neighbor-$(../@)-default-originate.\\$PPID\" ]; then \
+ rm -rf /tmp/bgp-neighbor-$(../@)-default-originate.\\$PPID; \
+ else \
+ if [ -n \"$(./route-map/@)\" ]; then \
+ COND=\"route-map $(./route-map/@) \" ; \
+ fi ; \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) default-originate \\$COND\"; \
+ 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
new file mode 100644
index 00000000..32df685f
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/route-map/node.def
@@ -0,0 +1,4 @@
+type: txt
+help: "Route-map to specify criteria to originate default"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy route-map $(@)\" " "; "route-map $(@) doesn't exist"
+
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/description/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/description/node.def
new file mode 100644
index 00000000..f5ba94f0
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/description/node.def
@@ -0,0 +1,2 @@
+type: txt
+help: "Neighbor specific description"
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-connected-check/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-connected-check/node.def
new file mode 100644
index 00000000..22841ba7
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/disable-connected-check/node.def
@@ -0,0 +1,7 @@
+help: "one-hop away EBGP peer using loopback address"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) disable-connected-check\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) disable-connected-check \" "
+
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/in/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/in/node.def
new file mode 100644
index 00000000..094880f1
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/in/node.def
@@ -0,0 +1,11 @@
+type: u32
+help: "Filter incoming updates"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy access-list $(@)\" ";"access-list $(@) doesn't exist"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) distribute-list $(@) in\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) distribute-list $(@) in\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no neighbor $(../../@) distribute-list $(@) in\" "
+
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/node.def
new file mode 100644
index 00000000..3b9cbb14
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/node.def
@@ -0,0 +1,2 @@
+help: "Filter updates to/from this neighbor"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/out/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/out/node.def
new file mode 100644
index 00000000..4e809cbf
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/distribute-list/out/node.def
@@ -0,0 +1,11 @@
+type: u32
+help: "Filter outgoing updates"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy access-list $(@)\" ";"access-list $(@) doesn't exist"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) distribute-list $(@) out\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) distribute-list $(@) out\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no neighbor $(../../@) distribute-list $(@) out\" "
+
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/dont-capability-negotiate/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/dont-capability-negotiate/node.def
new file mode 100644
index 00000000..af530583
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/dont-capability-negotiate/node.def
@@ -0,0 +1,7 @@
+help: "Do not perform capability negotiation"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) dont-capability-negotiate \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) dont-capability-negotiate \" "
+
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
new file mode 100644
index 00000000..b2867c51
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/ebgp-multihop/node.def
@@ -0,0 +1,11 @@
+type: u32
+help: "Allow EBGP neighbors not on directly connected networks"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+syntax: $(@) >=1 && $(@) <= 255; "ebgp-multihop must be btween 1 and 255"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) ebgp-multihop $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) ebgp-multihop $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) ebgp-multihop \" "
+
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/enforce-multihop/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/enforce-multihop/node.def
new file mode 100644
index 00000000..0a68deab
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/enforce-multihop/node.def
@@ -0,0 +1,7 @@
+help: "Enforce EBGP neighbors perform multihop"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) enforce-multihop \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) enforce-multihop \" "
+
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/in/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/in/node.def
new file mode 100644
index 00000000..d4e6b963
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/in/node.def
@@ -0,0 +1,11 @@
+type: txt
+help: "Filter incoming updates based on AS path"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy as-path-list $(@)\" ";"as-path-list $(@) doesn't exist"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) filter-list $(@) in\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) filter-list $(@) in\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no neighbor $(../../@) filter-list $(@) in\" "
+
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/node.def
new file mode 100644
index 00000000..85b039f9
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/node.def
@@ -0,0 +1,2 @@
+help: "Establish BGP filters"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/out/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/out/node.def
new file mode 100644
index 00000000..fa36d5a0
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/filter-list/out/node.def
@@ -0,0 +1,11 @@
+type: txt
+help: "Filter outgoing updates"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy as-path-list $(@)\" ";"as-path-list $(@) doesn't exist"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) filter-list $(@) out\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) filter-list $(@) out\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no neighbor $(../../@) filter-list $(@) out\" "
+
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/interface/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/interface/node.def
new file mode 100644
index 00000000..fcc3705e
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/interface/node.def
@@ -0,0 +1,14 @@
+type: txt
+help: "Interface name"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+syntax: exec " \
+ if [ -z \"`ip addr | grep $(@) `\" ]; then \
+ echo $(@) doesn\\'t exist on this system ; \
+ exit 1 ; \
+ fi ; "
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) interface $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) interface $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) interface $(@)\" "
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
new file mode 100644
index 00000000..fd9616b2
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/local-as/node.def
@@ -0,0 +1,5 @@
+type: u32
+help: "Local AS number"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+syntax: $(@) >=1 && $(@) <= 65535; "local-as must be between 1 and 65535"
+syntax: $(@) != $(../../../@); "Cannot have local-as same as BGP AS number"
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/no-prepend/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/no-prepend/node.def
new file mode 100644
index 00000000..fbdaecad
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/no-prepend/node.def
@@ -0,0 +1,2 @@
+help: "Do not prepend local-as to updates from ebgp peers"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first"
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
new file mode 100644
index 00000000..29f9d9f7
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/node.def
@@ -0,0 +1,18 @@
+help: "Specify a local-as number"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+delete: "touch /tmp/bgp-neighbor-$(../@)-local-as.\\$PPID"
+end: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) local-as \"; \
+ if [ -f \"/tmp/bgp-neighbor-$(../@)-local-as.\\$PPID\" ]; then \
+ rm -rf /tmp/bgp-neighbor-$(../@)-local-as.\\$PPID; \
+ else \
+ if [ -z \"$(./local-as/@)\" ]; then \
+ echo You must specify local-as local-as ; \
+ exit 1 ; \
+ fi ; \
+ if [ -n \"$(./no-prepend/@)\" ]; then \
+ COND=\"no-prepend \" ; \
+ fi ; \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) local-as $(./local-as/@) \\$COND \"; \
+ 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
new file mode 100644
index 00000000..c5ee473d
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/nexthop-self/node.def
@@ -0,0 +1,7 @@
+help: "Disable the next hop calculation for this neighbor"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) next-hop-self\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) next-hop-self \" "
+
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/no-activate/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/no-activate/node.def
new file mode 100644
index 00000000..1e3dc69f
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/no-activate/node.def
@@ -0,0 +1,6 @@
+help: "Disable the Address Family for this Neighbor"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) activate \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) activate \" "
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/no-send-community/extended/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/no-send-community/extended/node.def
new file mode 100644
index 00000000..2217d559
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/no-send-community/extended/node.def
@@ -0,0 +1,7 @@
+help: "Do not send extended community attributes"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no neighbor $(../../@) send-community extended\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) send-community extended\" "
+
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/no-send-community/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/no-send-community/node.def
new file mode 100644
index 00000000..5a60159b
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/no-send-community/node.def
@@ -0,0 +1,3 @@
+help: "Do not send community attributes to this neighbor"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+commit: ($(./extended/@) != "") || ($(./standard/@) != ""); "You must specify the type of community."
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/no-send-community/standard/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/no-send-community/standard/node.def
new file mode 100644
index 00000000..e1fec957
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/no-send-community/standard/node.def
@@ -0,0 +1,7 @@
+help: "Do not send standard community attributes"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no neighbor $(../../@) send-community standard\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) send-community standard\" "
+
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/override-capability/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/override-capability/node.def
new file mode 100644
index 00000000..68ddeabe
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/override-capability/node.def
@@ -0,0 +1,7 @@
+help: "Override capability negotiation result"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) override-capability\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) override-capability \" "
+
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/passive/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/passive/node.def
new file mode 100644
index 00000000..48a11bbc
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/passive/node.def
@@ -0,0 +1,7 @@
+help: "Don't send open messages to this neighbor"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) passive\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) passive \" "
+
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
new file mode 100644
index 00000000..6c94d7b7
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/peer-group/node.def
@@ -0,0 +1,13 @@
+type: txt
+help: "Member of the peer-group"
+syntax: $(../remote-as/@) == ""; "remote-as must not be defined if putting this neighbor in a peer group"
+syntax: exec "if [ -n \"`echo $(../@) | sed 's/[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0-9]\\{1,3\\}//'`\" ]; then \
+ exit 1; \
+ fi; "; "peer-group token may not be specified for a peer-group"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"protocols bgp $(../../@) neighbor $(@)\" "; "peer-group $(@) doesn't exist"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) peer-group $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) peer-group $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) peer-group $(@)\" "
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/port/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/port/node.def
new file mode 100644
index 00000000..b16839ce
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/port/node.def
@@ -0,0 +1,10 @@
+type: u32
+help: "Neighbor's BGP port"
+syntax: $(@) >= 1 && $(@) <= 65535; "remote-as must be between 1 and 65535"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) port $(@)\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) port $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) port \" "
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/in/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/in/node.def
new file mode 100644
index 00000000..b257d2b5
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/in/node.def
@@ -0,0 +1,11 @@
+type: txt
+help: "Filter incoming updates"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy prefix-list $(@)\" ";"prefix-list $(@) doesn't exist"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) prefix-list $(@) in\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) prefix-list $(@) in\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no neighbor $(../../@) prefix-list $(@) in\" "
+
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/node.def
new file mode 100644
index 00000000..3b9cbb14
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/node.def
@@ -0,0 +1,2 @@
+help: "Filter updates to/from this neighbor"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/out/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/out/node.def
new file mode 100644
index 00000000..6a973c26
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/prefix-list/out/node.def
@@ -0,0 +1,11 @@
+type: txt
+help: "Filter outgoing updates"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy prefix-list $(@)\" ";"prefix-list $(@) doesn't exist"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) prefix-list $(@) out\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) prefix-list $(@) out\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no neighbor $(../../@) prefix-list $(@) out\" "
+
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/remote-as/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/remote-as/node.def
new file mode 100644
index 00000000..847c49f4
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/remote-as/node.def
@@ -0,0 +1,7 @@
+type: u32
+help: "Specify BGP neighbor ASN"
+syntax: $(@) >= 1 && $(@) <= 65535; "remote-as must be between 1 and 65535"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) remote-as $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) remote-as $(@)\" "
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
new file mode 100644
index 00000000..4b6758b0
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/remove-private-as/node.def
@@ -0,0 +1,7 @@
+help: "Remove private AS number from outbound updates"
+syntax: $(../peer-group/@) != "" || $(../remote-as/@) != ""; "remote-as or peer-group must be specified first"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) remove-private-AS \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) remove-private-AS \" "
+
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
new file mode 100644
index 00000000..f6a1f45e
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/export/node.def
@@ -0,0 +1,11 @@
+type: txt
+help: "Route-map to apply to incoming updates"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy route-map $(@)\" ";"route-map $(@) doesn't exist"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) route-map $(@) in\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) route-map $(@) in\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no neighbor $(../../@) route-map $(@) in\" "
+
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
new file mode 100644
index 00000000..f6a1f45e
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/import/node.def
@@ -0,0 +1,11 @@
+type: txt
+help: "Route-map to apply to incoming updates"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy route-map $(@)\" ";"route-map $(@) doesn't exist"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) route-map $(@) in\" "
+update: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) route-map $(@) in\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no neighbor $(../../@) route-map $(@) in\" "
+
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/node.def
new file mode 100644
index 00000000..171252f7
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/node.def
@@ -0,0 +1,2 @@
+help: "Route-map to apply on updates to/from this neighbor"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
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
new file mode 100644
index 00000000..5a596518
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-reflector-client/node.def
@@ -0,0 +1,8 @@
+help: "Configure a neighbor as Route Reflector client"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+commit: $(../../@) == $(../remote-as/@); "remote-as must equal local-as to be a route-reflector client"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) route-reflector-client \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) route-reflector-client \" "
+
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
new file mode 100644
index 00000000..ea07fc71
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-server-client/node.def
@@ -0,0 +1,7 @@
+help: "Configure a neighbor as Route Server client"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) route-server-client \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) route-server-client \" "
+
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/shutdown/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/shutdown/node.def
new file mode 100644
index 00000000..c155ae09
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/shutdown/node.def
@@ -0,0 +1,5 @@
+help: "Administratively shut down this neighbor"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) shutdown\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) shutdown\" "
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/soft-reconfiguration/inbound/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/soft-reconfiguration/inbound/node.def
new file mode 100644
index 00000000..eb0ea4af
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/soft-reconfiguration/inbound/node.def
@@ -0,0 +1,7 @@
+help: "Allow inbound soft reconfiguration for this neighbor"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"no neighbor $(../../@) soft-reconfiguration inbound \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \
+ -c \"neighbor $(../../@) soft-reconfiguration inbound \" "
+
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/soft-reconfiguration/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/soft-reconfiguration/node.def
new file mode 100644
index 00000000..9f1636eb
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/soft-reconfiguration/node.def
@@ -0,0 +1,3 @@
+help: "Per neighbor soft reconfiguration"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+commit: $(./inbound/@) != ""; "You must specify the type of soft-reconfiguration"
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/strict-capability-match/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/strict-capability-match/node.def
new file mode 100644
index 00000000..61aef8c3
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/strict-capability-match/node.def
@@ -0,0 +1,6 @@
+help: "Strict capability negotiation match"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) strict-capability-match \" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) strict-capability-match \" "
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/timers/connect/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/timers/connect/node.def
new file mode 100644
index 00000000..360a7659
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/timers/connect/node.def
@@ -0,0 +1,4 @@
+type: u32
+help: "BGP connect timer"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+syntax: $(@) >=0 && $(@) <= 65535; "BGP connect timer must be between 0 and 65535"
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/timers/holdtime/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/timers/holdtime/node.def
new file mode 100644
index 00000000..54bf4026
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/timers/holdtime/node.def
@@ -0,0 +1,4 @@
+type: u32
+help: "Holdtime interval"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+syntax: $(@) == 0 || ($(@) >= 4 && $(@) <= 65535); "Holdtime interval must be 0 or between 4 and 65535"
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/timers/keepalive/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/timers/keepalive/node.def
new file mode 100644
index 00000000..bcb2ff0b
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/timers/keepalive/node.def
@@ -0,0 +1,4 @@
+type: u32
+help: "Keepalive interval"
+syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+syntax: $(@) >= 1 && $(@) <= 65535; "Keepalive interval must be between 1 and 65535"
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/timers/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/timers/node.def
new file mode 100644
index 00000000..dbfad7ca
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/timers/node.def
@@ -0,0 +1,19 @@
+help: "BGP per neighbor timers"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+delete: "touch /tmp/bgp-neighbor-$(../@)-timers.\\$PPID"
+end: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) timers \"; \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) timers connect \"; \
+ if [ -f \"/tmp/bgp-neighbor-$(../@)-timers.\\$PPID\" ]; then \
+ rm -rf /tmp/bgp-neighbor-$(../@)-timers.\\$PPID; \
+ else \
+ if [ -n \"$(./connect/@)\" ]; then \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) timers connect $(./connect/@)\" ; \
+ fi ; \
+ if [ -n \"$(./keepalive/@)\" ] || [ -n \"$(./holdtime/@)\" ]; then \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) timers $(./keepalive/@) $(./holdtime/@)\"; \
+ fi ; \
+ fi; "
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/unsuppress-map/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/unsuppress-map/node.def
new file mode 100644
index 00000000..bdcd3e34
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/unsuppress-map/node.def
@@ -0,0 +1,8 @@
+type: txt
+help: "Route-map to selectively unsuppress suppressed routes"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy route-map $(@)\" ";"route-map $(@) doesn't exist"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) unsuppress-map $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) unsuppress-map $(@)\" "
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/update-source/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/update-source/node.def
new file mode 100644
index 00000000..3870a105
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/update-source/node.def
@@ -0,0 +1,12 @@
+type: txt
+help: "Source of routing updates"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+syntax: exec " \
+ if [ -z \"`ip addr | grep $(@) `\" ]; then \
+ echo $(@) doesn\\'t exist on this system ; \
+ exit 1 ; \
+ fi ; "
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) update-source $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) update-source $(@)\" "
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/weight/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/weight/node.def
new file mode 100644
index 00000000..f5904a9b
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/weight/node.def
@@ -0,0 +1,8 @@
+type: u32
+help: "Set default weight for routes from this neighbor"
+syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first"
+syntax: $(@) >= 1 && $(@) <= 65535; "weight must be between 1 and 65535"
+create: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"neighbor $(../@) weight $(@)\" "
+delete: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \
+ -c \"no neighbor $(../@) weight $(@)\" "
diff --git a/templates/protocols/bgp/node.tag/network/node.def b/templates/protocols/bgp/node.tag/network/node.def
new file mode 100644
index 00000000..f572df35
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/network/node.def
@@ -0,0 +1,20 @@
+tag:
+type: ipv4net
+help: "Specify a network to announce via BGP"
+syntax: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --check-prefix-boundry $(@)"
+syntax: ($(./backdoor/@) != "") && ($(./route-map/@) != ""); "Must specify route-map or backdoor but not both"
+delete: "touch /tmp/`echo $(@) | sed 's!/!!'`.\\$PPID"
+end: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../@)\" \
+ -c \"no network $(@)\"; \
+ if [ -f \"/tmp/`echo $(@) | sed 's!/!!'`.\\$PPID\" ]; then \
+ rm -rf /tmp/`echo $(@) | sed 's!/!!'`.\\$PPID; \
+ else \
+ if [ -n \"$(./backdoor/@)\" ]; then \
+ COND=\"backdoor\";
+ fi; \
+ if [ -n \"$(./route-map/@)\" ]; then \
+ COND=\"route-map $(./route-map/@)\"; \
+ fi; \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../@)\" \
+ -c \"network $(@) \\$COND\"; \
+ fi; "
diff --git a/templates/protocols/bgp/node.tag/network/node.tag/backdoor/node.def b/templates/protocols/bgp/node.tag/network/node.tag/backdoor/node.def
new file mode 100644
index 00000000..eb1b3ab5
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/network/node.tag/backdoor/node.def
@@ -0,0 +1 @@
+help: "Specify a BGP backdoor route"
diff --git a/templates/protocols/bgp/node.tag/network/node.tag/backdoor/node.def.#ORIG# b/templates/protocols/bgp/node.tag/network/node.tag/backdoor/node.def.#ORIG#
new file mode 100644
index 00000000..3b6ef106
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/network/node.tag/backdoor/node.def.#ORIG#
@@ -0,0 +1,15 @@
+type: bool
+# TODO: this needs to be an exists type
+help: "Specify a BGP backdoor route"
+default: false
+# TODO: back referencing doesn't remove the %2F
+create: "sh -c \" \
+ PREF=`echo $(../@) | sed 's!%2F!/!'`; \
+ /opt/quagga/bin/vtysh -c \\\"configure terminal\\\" -c \\\"router bgp $(../../@)\\\" \
+ -c \\\"network \\\\$PREF backdoor\\\" \
+ \" "
+delete: "sh -c \" \
+ PREF=`echo $(../@) | sed 's!%2F!/!'`; \
+ /opt/quagga/bin/vtysh -c \\\"configure terminal\\\" -c \\\"router bgp $(../../@)\\\" \
+ -c \\\"no network \\\\$PREF backdoor\\\" \
+ \" "
diff --git a/templates/protocols/bgp/node.tag/network/node.tag/route-map/node.def b/templates/protocols/bgp/node.tag/network/node.tag/route-map/node.def
new file mode 100644
index 00000000..a0f6f5fa
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/network/node.tag/route-map/node.def
@@ -0,0 +1,3 @@
+type: txt
+help: "Route-map to modify the attributes"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy route-map $(@)\" ";"route-map $(@) doesn't exist"
diff --git a/templates/protocols/bgp/node.tag/redistribute/connected/metric/node.def b/templates/protocols/bgp/node.tag/redistribute/connected/metric/node.def
new file mode 100644
index 00000000..984a7064
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/redistribute/connected/metric/node.def
@@ -0,0 +1,2 @@
+type: u32
+help: "Metric for redistributed routes"
diff --git a/templates/protocols/bgp/node.tag/redistribute/connected/node.def b/templates/protocols/bgp/node.tag/redistribute/connected/node.def
new file mode 100644
index 00000000..26573a6f
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/redistribute/connected/node.def
@@ -0,0 +1,16 @@
+help: "Redistribute connected routes"
+delete: "touch /tmp/bgp-redist-connected.\\$PPID"
+end: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../@)\" \
+ -c \"no redistribute connected \"; \
+ if [ -f \"/tmp/bgp-redist-connected.\\$PPID\" ]; then \
+ rm -rf /tmp/bgp-redist-connected.\\$PPID; \
+ else \
+ if [ -n \"$(./metric/@)\" ]; then \
+ COND=\"metric $(./metric/@)\";
+ fi; \
+ if [ -n \"$(./route-map/@)\" ]; then \
+ COND=\"\\$COND route-map $(./route-map/@)\"; \
+ fi; \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../@)\" \
+ -c \"redistribute connected \\$COND\"; \
+ fi; "
diff --git a/templates/protocols/bgp/node.tag/redistribute/connected/route-map/node.def b/templates/protocols/bgp/node.tag/redistribute/connected/route-map/node.def
new file mode 100644
index 00000000..5ce5f0ab
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/redistribute/connected/route-map/node.def
@@ -0,0 +1,3 @@
+type: txt
+help: "Route map reference"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy route-map $(@)\" ";"route-map $(@) doesn't exist"
diff --git a/templates/protocols/bgp/node.tag/redistribute/kernel/metric/node.def b/templates/protocols/bgp/node.tag/redistribute/kernel/metric/node.def
new file mode 100644
index 00000000..984a7064
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/redistribute/kernel/metric/node.def
@@ -0,0 +1,2 @@
+type: u32
+help: "Metric for redistributed routes"
diff --git a/templates/protocols/bgp/node.tag/redistribute/kernel/node.def b/templates/protocols/bgp/node.tag/redistribute/kernel/node.def
new file mode 100644
index 00000000..0fc1441c
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/redistribute/kernel/node.def
@@ -0,0 +1,16 @@
+help: "Redistribute kernel routes"
+delete: "touch /tmp/bgp-redist-kernel.\\$PPID"
+end: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../@)\" \
+ -c \"no redistribute kernel \"; \
+ if [ -f \"/tmp/bgp-redist-kernel.\\$PPID\" ]; then \
+ rm -rf /tmp/bgp-redist-kernel.\\$PPID; \
+ else \
+ if [ -n \"$(./metric/@)\" ]; then \
+ COND=\"metric $(./metric/@)\";
+ fi; \
+ if [ -n \"$(./route-map/@)\" ]; then \
+ COND=\"\\$COND route-map $(./route-map/@)\"; \
+ fi; \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../@)\" \
+ -c \"redistribute kernel \\$COND\"; \
+ fi; "
diff --git a/templates/protocols/bgp/node.tag/redistribute/kernel/route-map/node.def b/templates/protocols/bgp/node.tag/redistribute/kernel/route-map/node.def
new file mode 100644
index 00000000..5ce5f0ab
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/redistribute/kernel/route-map/node.def
@@ -0,0 +1,3 @@
+type: txt
+help: "Route map reference"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy route-map $(@)\" ";"route-map $(@) doesn't exist"
diff --git a/templates/protocols/bgp/node.tag/redistribute/node.def b/templates/protocols/bgp/node.tag/redistribute/node.def
new file mode 100644
index 00000000..e46c9122
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/redistribute/node.def
@@ -0,0 +1 @@
+help: "Redistribute information from another routing protocol"
diff --git a/templates/protocols/bgp/node.tag/redistribute/ospf/metric/node.def b/templates/protocols/bgp/node.tag/redistribute/ospf/metric/node.def
new file mode 100644
index 00000000..984a7064
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/redistribute/ospf/metric/node.def
@@ -0,0 +1,2 @@
+type: u32
+help: "Metric for redistributed routes"
diff --git a/templates/protocols/bgp/node.tag/redistribute/ospf/node.def b/templates/protocols/bgp/node.tag/redistribute/ospf/node.def
new file mode 100644
index 00000000..1ac2bf28
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/redistribute/ospf/node.def
@@ -0,0 +1,16 @@
+help: "Redistribute OSPF routes"
+delete: "touch /tmp/bgp-redist-ospf.\\$PPID"
+end: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../@)\" \
+ -c \"no redistribute ospf \"; \
+ if [ -f \"/tmp/bgp-redist-ospf.\\$PPID\" ]; then \
+ rm -rf /tmp/bgp-redist-ospf.\\$PPID; \
+ else \
+ if [ -n \"$(./metric/@)\" ]; then \
+ COND=\"metric $(./metric/@)\";
+ fi; \
+ if [ -n \"$(./route-map/@)\" ]; then \
+ COND=\"\\$COND route-map $(./route-map/@)\"; \
+ fi; \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../@)\" \
+ -c \"redistribute ospf \\$COND\"; \
+ fi; "
diff --git a/templates/protocols/bgp/node.tag/redistribute/ospf/route-map/node.def b/templates/protocols/bgp/node.tag/redistribute/ospf/route-map/node.def
new file mode 100644
index 00000000..5ce5f0ab
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/redistribute/ospf/route-map/node.def
@@ -0,0 +1,3 @@
+type: txt
+help: "Route map reference"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy route-map $(@)\" ";"route-map $(@) doesn't exist"
diff --git a/templates/protocols/bgp/node.tag/redistribute/rip/metric/node.def b/templates/protocols/bgp/node.tag/redistribute/rip/metric/node.def
new file mode 100644
index 00000000..984a7064
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/redistribute/rip/metric/node.def
@@ -0,0 +1,2 @@
+type: u32
+help: "Metric for redistributed routes"
diff --git a/templates/protocols/bgp/node.tag/redistribute/rip/node.def b/templates/protocols/bgp/node.tag/redistribute/rip/node.def
new file mode 100644
index 00000000..619de2ec
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/redistribute/rip/node.def
@@ -0,0 +1,16 @@
+help: "Redistribute RIP routes"
+delete: "touch /tmp/bgp-redist-rip.\\$PPID"
+end: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../@)\" \
+ -c \"no redistribute rip \"; \
+ if [ -f \"/tmp/bgp-redist-rip.\\$PPID\" ]; then \
+ rm -rf /tmp/bgp-redist-rip.\\$PPID; \
+ else \
+ if [ -n \"$(./metric/@)\" ]; then \
+ COND=\"metric $(./metric/@)\";
+ fi; \
+ if [ -n \"$(./route-map/@)\" ]; then \
+ COND=\"\\$COND route-map $(./route-map/@)\"; \
+ fi; \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../@)\" \
+ -c \"redistribute rip \\$COND\"; \
+ fi; "
diff --git a/templates/protocols/bgp/node.tag/redistribute/rip/route-map/node.def b/templates/protocols/bgp/node.tag/redistribute/rip/route-map/node.def
new file mode 100644
index 00000000..5ce5f0ab
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/redistribute/rip/route-map/node.def
@@ -0,0 +1,3 @@
+type: txt
+help: "Route map reference"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy route-map $(@)\" ";"route-map $(@) doesn't exist"
diff --git a/templates/protocols/bgp/node.tag/redistribute/static/metric/node.def b/templates/protocols/bgp/node.tag/redistribute/static/metric/node.def
new file mode 100644
index 00000000..984a7064
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/redistribute/static/metric/node.def
@@ -0,0 +1,2 @@
+type: u32
+help: "Metric for redistributed routes"
diff --git a/templates/protocols/bgp/node.tag/redistribute/static/node.def b/templates/protocols/bgp/node.tag/redistribute/static/node.def
new file mode 100644
index 00000000..98ff7703
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/redistribute/static/node.def
@@ -0,0 +1,16 @@
+help: "Redistribute static routes"
+delete: "touch /tmp/bgp-redist-static.\\$PPID"
+end: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../@)\" \
+ -c \"no redistribute static \"; \
+ if [ -f \"/tmp/bgp-redist-static.\\$PPID\" ]; then \
+ rm -rf /tmp/bgp-redist-static.\\$PPID; \
+ else \
+ if [ -n \"$(./metric/@)\" ]; then \
+ COND=\"metric $(./metric/@)\";
+ fi; \
+ if [ -n \"$(./route-map/@)\" ]; then \
+ COND=\"\\$COND route-map $(./route-map/@)\"; \
+ fi; \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../@)\" \
+ -c \"redistribute static \\$COND\"; \
+ fi; "
diff --git a/templates/protocols/bgp/node.tag/redistribute/static/route-map/node.def b/templates/protocols/bgp/node.tag/redistribute/static/route-map/node.def
new file mode 100644
index 00000000..5ce5f0ab
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/redistribute/static/route-map/node.def
@@ -0,0 +1,3 @@
+type: txt
+help: "Route map reference"
+commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy route-map $(@)\" ";"route-map $(@) doesn't exist"
diff --git a/templates/protocols/bgp/node.tag/timers/holdtime/node.def b/templates/protocols/bgp/node.tag/timers/holdtime/node.def
new file mode 100644
index 00000000..b7da119e
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/timers/holdtime/node.def
@@ -0,0 +1,3 @@
+type: u32
+help: "Holdtime interval"
+syntax: $(@) == 0 || ($(@) >= 4 && $(@) <= 65535); "Holdtime interval must be 0 or between 4 and 65535"
diff --git a/templates/protocols/bgp/node.tag/timers/keepalive/node.def b/templates/protocols/bgp/node.tag/timers/keepalive/node.def
new file mode 100644
index 00000000..59067fdc
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/timers/keepalive/node.def
@@ -0,0 +1,3 @@
+type: u32
+help: "Keepalive interval"
+syntax: $(@) >= 1 && $(@) <= 65535; "Keepalive interval must be between 1 and 65535"
diff --git a/templates/protocols/bgp/node.tag/timers/node.def b/templates/protocols/bgp/node.tag/timers/node.def
new file mode 100644
index 00000000..bf6da0c7
--- /dev/null
+++ b/templates/protocols/bgp/node.tag/timers/node.def
@@ -0,0 +1,12 @@
+help: "Adjust routing timers"
+commit: $(./keepalive/@) != ""; "You must set a keepalive interval"
+commit: $(./holdtime/@) != ""; "You must set a holdtime interval"
+delete: "touch /tmp/bgp-timers.\\$PPID"
+end: "/opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../@)\" \
+ -c \"no timers bgp\"; \
+ if [ -f \"/tmp/bgp-timers.\\$PPID\" ]; then \
+ rm -rf /tmp/bgp-timers.\\$PPID; \
+ else \
+ /opt/vyatta/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../@)\" \
+ -c \"timers bgp $(./keepalive/@) $(./holdtime/@)\"; \
+ fi; "