diff options
author | Robert Bays <rbays@moresby.(none)> | 2007-11-07 19:55:15 -0800 |
---|---|---|
committer | Robert Bays <rbays@moresby.(none)> | 2007-11-07 19:55:15 -0800 |
commit | 0584c5da0f995e0bbbaac1e80f1dc39c108c965a (patch) | |
tree | 9b8e9476b8befe2dd98381db34584e05fdd1fdf4 /templates/protocols/bgp | |
parent | df9e4971d68a6791e3fd498a5d4ae1c57661f80e (diff) | |
download | vyatta-cfg-quagga-0584c5da0f995e0bbbaac1e80f1dc39c108c965a.tar.gz vyatta-cfg-quagga-0584c5da0f995e0bbbaac1e80f1dc39c108c965a.zip |
fix bgp neighbor templates ordering and startup errors.
Diffstat (limited to 'templates/protocols/bgp')
56 files changed, 356 insertions, 124 deletions
diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/advertisement-interval/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/advertisement-interval/node.def index b676b9b3..edb47bb8 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/advertisement-interval/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/advertisement-interval/node.def @@ -2,9 +2,13 @@ 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: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ - -c \"neighbor $(../@) advertisement-interval $(@)\" " -update: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) advertisement-interval $(@)\" " delete: "/usr/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 index 9d8330fb..a1cebf2e 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/allowas-in/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/allowas-in/node.def @@ -1,11 +1,17 @@ help: "Accept as-path with my AS present in it." -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" delete: "touch /tmp/bgp-neighbor-$(../@)-allowas-in.\\$PPID" end: "/usr/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 \ - /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ - -c \"neighbor $(../@) allowas-in $(./number/@)\"; \ - fi; " + -c \"no neighbor $(../@) allowas-in \"; \ + if [ -f \"/tmp/bgp-neighbor-$(../@)-allowas-in.\\$PPID\" ]; then \ + rm -rf /tmp/bgp-neighbor-$(../@)-allowas-in.\\$PPID; \ + else \ + if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ + -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 index ccd3bde2..5069251b 100644 --- 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 @@ -1,4 +1,4 @@ type: u32 help: "Number of occurrences 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" +commit: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" 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 index d9875f1b..b411ce36 100644 --- 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 @@ -1,2 +1,2 @@ help: "AS path attribute" -syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group should be defined first" +commit: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" 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 index 8096b0e6..500ea79c 100644 --- 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 @@ -1,2 +1,2 @@ help: "Multi-exit discriminator attribute" -syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group should be defined first" +commit: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" 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 index fb58ce09..e6c75be3 100644 --- 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 @@ -1,2 +1,2 @@ help: "Nexthop attribute" -syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group should be defined first" +commit: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/node.def index b5af19ae..e10281b6 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/attribute-unchanged/node.def @@ -1,5 +1,5 @@ help: "BGP attribute is propagated unchanged to this neighbor" -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" delete: "touch /tmp/bgp-neighbor-$(../@)-attribute-unchanged.\\$PPID" end: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ -c \"no neighbor $(../@) attribute-unchanged \"; \ @@ -7,14 +7,20 @@ end: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ rm -rf /tmp/bgp-neighbor-$(../@)-attribute-unchanged.\\$PPID; \ else \ if [ -n \"$(./as-path/@)\" ]; then \ - COND=\"as-path \" ; \ + cond=\"as-path \" ; \ fi ; \ if [ -n \"$(./med/@)\" ]; then \ - COND=\"\\$COND med \" ; \ + cond=\"\\$cond med \" ; \ fi ; \ if [ -n \"$(./next-hop/@)\" ]; then \ - COND=\"\\$COND next-hop \" ; \ + cond=\"\\$cond next-hop \" ; \ fi ; \ + if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ - -c \"neighbor $(../@) attribute-unchanged \\$COND\"; \ + -c \"neighbor $(../@) \\$peer\" \ + -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 index a7b2c9ee..54be100a 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/dynamic/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/dynamic/node.def @@ -1,6 +1,12 @@ help: "Advertise dynamic capability to this neighbor" -syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ +commit: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../../remote-as/@)\" ]; then \ + peer=\"remote-as $(../../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ + -c \"neighbor $(../../@) \\$peer\" \ -c \"neighbor $(../../@) capability dynamic\" " delete: "/usr/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/prefix-list/receive/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/receive/node.def index 840ae539..8e1b82f3 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/receive/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/receive/node.def @@ -1,5 +1,12 @@ help: "Capability to RECEIVE the ORF to this neighbor" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../../../@)\" \ +commit: ($(../../../../peer-group/@) != "") || ($(../../../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../../../../remote-as/@)\" ]; then \ + peer=\"remote-as $(../../../../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../../../../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../../../@)\" \ + -c \"neighbor $(../../../../@) \\$peer\" \ -c \"neighbor $(../../../../@) capability orf prefix-list receive\" " delete: "/usr/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 index 4a038e40..369d8f4d 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/send/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/capability/orf/prefix-list/send/node.def @@ -1,5 +1,12 @@ help: "Capability to SEND the ORF to this neighbor" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../../../@)\" \ +commit: ($(../../../../peer-group/@) != "") || ($(../../../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../../../../remote-as/@)\" ]; then \ + peer=\"remote-as $(../../../../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../../../../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../../../@)\" \ + -c \"neighbor $(../../../../@) \\$peer\" \ -c \"neighbor $(../../../../@) capability orf prefix-list send\" " delete: "/usr/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 index fcb9b318..057e78a3 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/default-originate/node.def @@ -1,5 +1,5 @@ help: "Originate default route to this neighbor" -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" delete: "touch /tmp/bgp-neighbor-$(../@)-default-originate.\\$PPID" end: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ -c \"no neighbor $(../@) default-originate \"; \ @@ -7,9 +7,15 @@ end: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ rm -rf /tmp/bgp-neighbor-$(../@)-default-originate.\\$PPID; \ else \ if [ -n \"$(./route-map/@)\" ]; then \ - COND=\"route-map $(./route-map/@) \" ; \ + cond=\"route-map $(./route-map/@) \" ; \ fi ; \ + if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ - -c \"neighbor $(../@) default-originate \\$COND\"; \ + -c \"neighbor $(../@) \\$peer\" \ + -c \"neighbor $(../@) default-originate \\$cond\"; \ fi; " 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 index 00beb26a..35f12c97 100644 --- 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 @@ -1,6 +1,12 @@ help: "One hop distant EBGP peer using loopback address" -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) disable-connected-check\" " delete: "/usr/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 index 7dc26258..aa1614fb 100644 --- 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 @@ -1,10 +1,14 @@ type: u32 help: "Filter incoming updates" -syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first" +commit: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy access-list $(@)\" ";"access-list $(@) doesn't exist" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ - -c \"neighbor $(../../@) distribute-list $(@) in\" " -update: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ +update: "if [ -n \"$(../../remote-as/@)\" ]; then \ + peer=\"remote-as $(../../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ + -c \"neighbor $(../../@) \\$peer\" \ -c \"neighbor $(../../@) distribute-list $(@) in\" " delete: "/usr/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 index 3b9cbb14..0c3731c0 100644 --- 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 @@ -1,2 +1,2 @@ help: "Filter updates to/from this neighbor" -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" 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 index e7531101..8aa6fc1a 100644 --- 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 @@ -1,10 +1,14 @@ type: u32 help: "Filter outgoing updates" -syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first" +commit: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy access-list $(@)\" ";"access-list $(@) doesn't exist" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ - -c \"neighbor $(../../@) distribute-list $(@) out\" " -update: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ +update: "if [ -n \"$(../../remote-as/@)\" ]; then \ + peer=\"remote-as $(../../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ + -c \"neighbor $(../../@) \\$peer\" \ -c \"neighbor $(../../@) distribute-list $(@) out\" " delete: "/usr/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 index 761f5b2a..1e21c981 100644 --- 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 @@ -1,6 +1,12 @@ help: "Do not perform capability negotiation" -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) dont-capability-negotiate \" " delete: "/usr/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 index 5158ff0a..b2317efa 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/ebgp-multihop/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/ebgp-multihop/node.def @@ -1,10 +1,14 @@ 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" +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" syntax: $(@) >=1 && $(@) <= 255; "ebgp-multihop must be between 1 and 255" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ - -c \"neighbor $(../@) ebgp-multihop $(@)\" " -update: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) ebgp-multihop $(@)\" " delete: "/usr/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 index 9e0ea3a7..ecdaef59 100644 --- 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 @@ -1,6 +1,12 @@ help: "Enforce EBGP neighbors perform multihop" -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) enforce-multihop \" " delete: "/usr/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 index 50ec9ae5..710a10b2 100644 --- 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 @@ -1,10 +1,14 @@ 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: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy as-path-list $(@)\" ";"as-path-list $(@) doesn't exist" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ - -c \"neighbor $(../../@) filter-list $(@) in\" " -update: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ +update: "if [ -n \"$(../../remote-as/@)\" ]; then \ + peer=\"remote-as $(../../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ + -c \"neighbor $(../../@) \\$peer\" \ -c \"neighbor $(../../@) filter-list $(@) in\" " delete: "/usr/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 index 85b039f9..62886ac8 100644 --- 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 @@ -1,2 +1,2 @@ help: "Establish BGP filters" -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" 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 index 4dbdf659..8417a1f7 100644 --- 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 @@ -1,10 +1,14 @@ type: txt help: "Filter outgoing updates" -syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first" +commit: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy as-path-list $(@)\" ";"as-path-list $(@) doesn't exist" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ - -c \"neighbor $(../../@) filter-list $(@) out\" " -update: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ +update: "if [ -n \"$(../../remote-as/@)\" ]; then \ + peer=\"remote-as $(../../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ + -c \"neighbor $(../../@) \\$peer\" \ -c \"neighbor $(../../@) filter-list $(@) out\" " delete: "/usr/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 index 1843ccb5..5eb2f638 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/interface/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/interface/node.def @@ -1,14 +1,18 @@ type: txt help: "Interface name" -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" syntax: exec " \ if [ -z \"`ip addr | grep $(@) `\" ]; then \ echo $(@) doesn\\'t exist on this system ; \ exit 1 ; \ fi ; " -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ - -c \"neighbor $(../@) interface $(@)\" " -update: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) interface $(@)\" " delete: "/usr/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 index fd9616b2..cb669e8c 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/local-as/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/local-as/node.def @@ -1,5 +1,5 @@ type: u32 help: "Local AS number" -syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first" +commit: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" 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 index 2712c671..0acc08b6 100644 --- 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 @@ -1,2 +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" +commit: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/node.def index 953cdf68..5d3020e0 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/local-as/node.def @@ -1,5 +1,5 @@ help: "Specify a local-as number" -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" delete: "touch /tmp/bgp-neighbor-$(../@)-local-as.\\$PPID" end: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ -c \"no neighbor $(../@) local-as \"; \ @@ -11,8 +11,14 @@ end: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ exit 1 ; \ fi ; \ if [ -n \"$(./no-prepend/@)\" ]; then \ - COND=\"no-prepend \" ; \ + cond=\"no-prepend \" ; \ fi ; \ + if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ - -c \"neighbor $(../@) local-as $(./local-as/@) \\$COND \"; \ + -c \"neighbor $(../@) \\$peer\" \ + -c \"neighbor $(../@) local-as $(./local-as/@) \\$cond \"; \ fi; " diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/maximum-prefix/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/maximum-prefix/node.def new file mode 100644 index 00000000..c2699fa0 --- /dev/null +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/maximum-prefix/node.def @@ -0,0 +1,14 @@ +type: u32 +help: "Maximum number of prefixes to accept from this neighbor" +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ + -c \"neighbor $(../@) maximum-prefix $(@)\" " +delete: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"no neighbor $(../@) maximum-prefix \" " + diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/nexthop-self/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/nexthop-self/node.def index f052465a..68291954 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/nexthop-self/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/nexthop-self/node.def @@ -1,6 +1,12 @@ help: "Disable the next hop calculation for this neighbor" -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) next-hop-self\" " delete: "/usr/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 index 7ed991ae..541a8ea0 100644 --- 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 @@ -1,6 +1,12 @@ help: "Disable the Address Family for this Neighbor" -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"no neighbor $(../@) activate \" " delete: "/usr/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 index 3b98aef5..ef83f41c 100644 --- 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 @@ -1,6 +1,12 @@ help: "Do not send extended community attributes" -syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ +commit: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../../remote-as/@)\" ]; then \ + peer=\"remote-as $(../../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ + -c \"neighbor $(../../@) \\$peer\" \ -c \"no neighbor $(../../@) send-community extended\" " delete: "/usr/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 index 5a60159b..61ac9384 100644 --- 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 @@ -1,3 +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: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" 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 index ef717a1f..e2ca3140 100644 --- 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 @@ -1,6 +1,12 @@ help: "Do not send standard community attributes" -syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ +commit: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../../remote-as/@)\" ]; then \ + peer=\"remote-as $(../../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ + -c \"neighbor $(../../@) \\$peer\" \ -c \"no neighbor $(../../@) send-community standard\" " delete: "/usr/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 index 7d2beb5e..4f05a76b 100644 --- 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 @@ -1,6 +1,12 @@ help: "Override capability negotiation result" -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) override-capability\" " delete: "/usr/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 index a81ae33a..d9f8babe 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/passive/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/passive/node.def @@ -1,6 +1,12 @@ help: "Don't send open messages to this neighbor" -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) passive\" " delete: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ -c \"no neighbor $(../@) passive \" " diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/password/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/password/node.def index 3a10237a..46a939cc 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/password/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/password/node.def @@ -1,7 +1,13 @@ type: txt help: "Specify BGP neighbor password" -syntax: ($(../peer-group) != "") || ($(../remote-as) != ""); "remote-as or peer-group must be specified first" -update: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) password $(@)\" " delete: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ -c \"no neighbor $(../@) password\" " diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/peer-group/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/peer-group/node.def index 5f67e21a..7b15cce5 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/peer-group/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/peer-group/node.def @@ -5,9 +5,13 @@ syntax: exec "if [ -n \"`echo $(../@) | sed 's/[0-9]\\{1,3\\}.[0-9]\\{1,3\\}.[0- 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: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ - -c \"neighbor $(../@) peer-group $(@)\" " -update: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) peer-group $(@)\" " delete: "/usr/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 index aaa794cd..d13df4dd 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/port/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/port/node.def @@ -1,10 +1,14 @@ 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: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ - -c \"neighbor $(../@) port $(@)\" " -update: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) port $(@)\" " delete: "/usr/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 index ba696ea4..2f5a3ef6 100644 --- 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 @@ -2,9 +2,13 @@ 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: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ - -c \"neighbor $(../../@) prefix-list $(@) in\" " -update: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ +update: "if [ -n \"$(../../remote-as/@)\" ]; then \ + peer=\"remote-as $(../../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ + -c \"neighbor $(../../@) \\$peer\" \ -c \"neighbor $(../../@) prefix-list $(@) in\" " delete: "/usr/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 index 2188730d..0c3731c0 100644 --- 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 @@ -1,2 +1,2 @@ help: "Filter updates to/from this neighbor" -syntax: ($(../peer-group) != "") || ($(../remote-as) != ""); "remote-as or peer-group must be specified first" +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" 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 index 93a55c54..bed1dc41 100644 --- 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 @@ -2,9 +2,13 @@ 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: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ - -c \"neighbor $(../../@) prefix-list $(@) out\" " -update: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ +update: "if [ -n \"$(../../remote-as/@)\" ]; then \ + peer=\"remote-as $(../../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ + -c \"neighbor $(../../@) \\$peer\" \ -c \"neighbor $(../../@) prefix-list $(@) out\" " delete: "/usr/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/remove-private-as/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/remove-private-as/node.def index 2e96dce9..4836e7a2 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/remove-private-as/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/remove-private-as/node.def @@ -1,6 +1,12 @@ help: "Remove private AS number from outbound updates" -syntax: $(../peer-group/@) != "" || $(../remote-as/@) != ""; "remote-as or peer-group must be specified first" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) remove-private-AS \" " delete: "/usr/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 index 9c9d5f43..13f4aa34 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/export/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/export/node.def @@ -1,10 +1,14 @@ 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: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy route-map $(@)\" ";"route-map $(@) doesn't exist" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ - -c \"neighbor $(../../@) route-map $(@) in\" " -update: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ +update: "if [ -n \"$(../../remote-as/@)\" ]; then \ + peer=\"remote-as $(../../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ + -c \"neighbor $(../../@) \\$peer\" \ -c \"neighbor $(../../@) route-map $(@) in\" " delete: "/usr/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 index 9c9d5f43..13f4aa34 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/import/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-map/import/node.def @@ -1,10 +1,14 @@ 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: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy route-map $(@)\" ";"route-map $(@) doesn't exist" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ - -c \"neighbor $(../../@) route-map $(@) in\" " -update: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ +update: "if [ -n \"$(../../remote-as/@)\" ]; then \ + peer=\"remote-as $(../../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ + -c \"neighbor $(../../@) \\$peer\" \ -c \"neighbor $(../../@) route-map $(@) in\" " delete: "/usr/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 index 171252f7..a4f72cd0 100644 --- 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 @@ -1,2 +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" +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" diff --git a/templates/protocols/bgp/node.tag/neighbor/node.tag/route-reflector-client/node.def b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-reflector-client/node.def index 0e0c7574..4840236d 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/route-reflector-client/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-reflector-client/node.def @@ -1,7 +1,13 @@ help: "Configure a neighbor as Route Reflector client" -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" commit: $(../../@) == $(../remote-as/@); "remote-as must equal local-as to be a route-reflector client" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) route-reflector-client \" " delete: "/usr/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 index e72291ed..77cd9f46 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/route-server-client/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/route-server-client/node.def @@ -1,6 +1,12 @@ help: "Configure a neighbor as Route Server client" -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) route-server-client \" " delete: "/usr/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 index 9012c4a1..1e139a3d 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/shutdown/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/shutdown/node.def @@ -1,5 +1,12 @@ help: "Administratively shut down this neighbor" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) shutdown\" " delete: "/usr/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 index e0752fbc..e8e28b9d 100644 --- 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 @@ -1,6 +1,12 @@ help: "Allow inbound soft reconfiguration for this neighbor" -syntax: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified first" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ +commit: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../../remote-as/@)\" ]; then \ + peer=\"remote-as $(../../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../../@)\" \ + -c \"neighbor $(../../@) \\$peer\" \ -c \"no neighbor $(../../@) soft-reconfiguration inbound \" " delete: "/usr/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 index 9f1636eb..880d67dc 100644 --- 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 @@ -1,3 +1,3 @@ help: "Per neighbor soft reconfiguration" -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" 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 index c9d34cf4..061ae999 100644 --- 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 @@ -1,6 +1,12 @@ help: "Strict capability negotiation match" -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) strict-capability-match \" " delete: "/usr/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 index 360a7659..39172334 100644 --- 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 @@ -1,4 +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" +commit: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" 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 index 54bf4026..24e9dd8d 100644 --- 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 @@ -1,4 +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" +commit: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" 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 index bcb2ff0b..8de4e49f 100644 --- 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 @@ -1,4 +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" +commit: ($(../../peer-group/@) != "") || ($(../../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" 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 index b7b7fc16..c08550da 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/timers/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/timers/node.def @@ -1,5 +1,5 @@ help: "BGP per neighbor timers" -syntax: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified first" +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" delete: "touch /tmp/bgp-neighbor-$(../@)-timers.\\$PPID" end: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ -c \"no neighbor $(../@) timers \"; \ @@ -8,12 +8,19 @@ end: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ if [ -f \"/tmp/bgp-neighbor-$(../@)-timers.\\$PPID\" ]; then \ rm -rf /tmp/bgp-neighbor-$(../@)-timers.\\$PPID; \ else \ + if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ if [ -n \"$(./connect/@)\" ]; then \ /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) timers connect $(./connect/@)\" ; \ fi ; \ if [ -n \"$(./keepalive/@)\" ] || [ -n \"$(./holdtime/@)\" ]; then \ /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -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 index 56f14bc4..bf13398b 100644 --- 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 @@ -1,8 +1,14 @@ 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: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" commit: exec "/opt/vyatta/sbin/vyatta_quagga_utils.pl --exists \"policy route-map $(@)\" ";"route-map $(@) doesn't exist" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) unsuppress-map $(@)\" " delete: "/usr/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 index 5f88f887..b1a28ccd 100644 --- 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 @@ -1,12 +1,18 @@ 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: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) update-source $(@)\" " delete: "/usr/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 index ef6aa250..29092100 100644 --- a/templates/protocols/bgp/node.tag/neighbor/node.tag/weight/node.def +++ b/templates/protocols/bgp/node.tag/neighbor/node.tag/weight/node.def @@ -1,8 +1,14 @@ 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: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ +commit: ($(../peer-group/@) != "") || ($(../remote-as/@) != ""); "remote-as or peer-group must be specified before commit" +update: "if [ -n \"$(../remote-as/@)\" ]; then \ + peer=\"remote-as $(../remote-as/@)\"; \ + else \ + peer=\"peer-group $(../peer-group/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ + -c \"neighbor $(../@) \\$peer\" \ -c \"neighbor $(../@) weight $(@)\" " delete: "/usr/bin/vtysh -c \"configure terminal\" -c \"router bgp $(../../@)\" \ -c \"no neighbor $(../@) weight $(@)\" " |