diff options
Diffstat (limited to 'templates/protocols/static/route')
6 files changed, 34 insertions, 3 deletions
diff --git a/templates/protocols/static/route/node.tag/blackhole/metric/node.def b/templates/protocols/static/route/node.tag/blackhole/metric/node.def new file mode 100644 index 00000000..938aea1a --- /dev/null +++ b/templates/protocols/static/route/node.tag/blackhole/metric/node.def @@ -0,0 +1,4 @@ +type: u32 +help: "Distance value for this route" +syntax: $(@) >= 1 && $(@) <= 255; "Must be between (1-255)" +#comp_help: <1-255> Distance for this route diff --git a/templates/protocols/static/route/node.tag/blackhole/node.def b/templates/protocols/static/route/node.tag/blackhole/node.def new file mode 100644 index 00000000..aa54eceb --- /dev/null +++ b/templates/protocols/static/route/node.tag/blackhole/node.def @@ -0,0 +1,11 @@ +help: "Silently discard pkts when matched" +delete: "touch /tmp/static.\\$PPID" +end: "if [ -f \"/tmp/static.\\$PPID\" ]; then \ + /usr/bin/vtysh -c \"configure terminal\" -c \"no ip route $(../@) null0\" ; \ + rm /tmp/static.\\$PPID; \ + else \ + if [ -n \"$(./metric/@)\" ]; then \ + MET=\"$(./metric/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"ip route $(../@) null0 \\$MET \" ; \ + fi; " diff --git a/templates/protocols/static/route/node.tag/next-hop/node.def b/templates/protocols/static/route/node.tag/next-hop/node.def index 53de6dc7..46625591 100644 --- a/templates/protocols/static/route/node.tag/next-hop/node.def +++ b/templates/protocols/static/route/node.tag/next-hop/node.def @@ -1,5 +1,13 @@ +tag: type: ipv4 help: "Configure the next-hop router" -create: "/usr/bin/vtysh -c \"configure terminal\" -c \"ip route $(../@) $(@)\" " -update: "/usr/bin/vtysh -c \"configure terminal\" -c \"ip route $(../@) $(@)\" " -delete: "/usr/bin/vtysh -c \"configure terminal\" -c \"no ip route $(../@) $(@)\" " +delete: "touch /tmp/static.\\$PPID" +end: "if [ -f \"/tmp/static.\\$PPID\" ]; then \ + /usr/bin/vtysh -c \"configure terminal\" -c \"no ip route $(../@) $(@)\" ; \ + rm /tmp/static.\\$PPID; \ + else \ + if [ -n \"$(./metric/@)\" ]; then \ + MET=\"$(./metric/@)\"; \ + fi; \ + /usr/bin/vtysh -c \"configure terminal\" -c \"ip route $(../@) $(@) \\$MET \" ; \ + fi; " diff --git a/templates/protocols/static/route/node.tag/next-hop/node.tag/metric/node.def b/templates/protocols/static/route/node.tag/next-hop/node.tag/metric/node.def new file mode 100644 index 00000000..938aea1a --- /dev/null +++ b/templates/protocols/static/route/node.tag/next-hop/node.tag/metric/node.def @@ -0,0 +1,4 @@ +type: u32 +help: "Distance value for this route" +syntax: $(@) >= 1 && $(@) <= 255; "Must be between (1-255)" +#comp_help: <1-255> Distance for this route diff --git a/templates/protocols/static/route/node.tag/next-hop/node.tag/node.def b/templates/protocols/static/route/node.tag/next-hop/node.tag/node.def new file mode 100644 index 00000000..45bb111e --- /dev/null +++ b/templates/protocols/static/route/node.tag/next-hop/node.tag/node.def @@ -0,0 +1,2 @@ +help: "Enter next-hop router" + diff --git a/templates/protocols/static/route/node.tag/node.def b/templates/protocols/static/route/node.tag/node.def index e64fee84..56b1f7c8 100644 --- a/templates/protocols/static/route/node.tag/node.def +++ b/templates/protocols/static/route/node.tag/node.def @@ -1 +1,3 @@ help: "IP network" +commit: $(./next-hop/) != "" || $(./blackhole/) != ""; "Must add either a next-hop or blackhole for route $(@)" + |