diff options
10 files changed, 135 insertions, 80 deletions
diff --git a/templates/protocols/ospf/redistribute/bgp/metric-type/node.def b/templates/protocols/ospf/redistribute/bgp/metric-type/node.def new file mode 100644 index 00000000..07f1e577 --- /dev/null +++ b/templates/protocols/ospf/redistribute/bgp/metric-type/node.def @@ -0,0 +1,8 @@ +type: u32 +help: Set OSPF metric type +default: 2 + +syntax:expression: $VAR(@) in 1, 2 ; "metric-type must be either 1 or 2" + +comp_help: possible completions: + <1-2> Set metric type (default 2) diff --git a/templates/protocols/ospf/redistribute/bgp/node.def b/templates/protocols/ospf/redistribute/bgp/node.def index a3564af4..a997d42b 100644 --- a/templates/protocols/ospf/redistribute/bgp/node.def +++ b/templates/protocols/ospf/redistribute/bgp/node.def @@ -1,18 +1,21 @@ help: Set to redistribute BGP routes delete:expression: "touch /tmp/ospf-redist-bgp.$PPID" -end:expression: "${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"no redistribute bgp \"; \ - if [ -f \"/tmp/ospf-redist-bgp.$PPID\" ]; then \ - rm -f /tmp/ospf-redist-bgp.$PPID; \ - else \ - if [ -n \"$VAR(./metric/@)\" ]; then \ - COND=\"metric $VAR(./metric/@)\"; \ - fi; \ - if [ -n \"$VAR(./route-map/@)\" ]; then \ - COND=\"$COND route-map $VAR(./route-map/@)\"; \ - fi; \ - ${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"redistribute bgp $COND\"; \ - fi; " +end: ${vyatta_sbindir}/vyatta-vtysh.pl -c "configure terminal" \ + -c "router ospf" \ + -c "no redistribute bgp"; + if [ -f "/tmp/ospf-redist-bgp.$PPID" ]; then + rm -f /tmp/ospf-redist-bgp.$PPID; + else + if [ -n "$VAR(./metric/@)" ]; then + COND="metric $VAR(./metric/@)"; + fi; + if [ -n "$VAR(./route-map/@)" ]; then + COND="$COND route-map $VAR(./route-map/@)"; + fi; + if [ -n "$VAR(./metric-type/@)" ]; then + COND="$COND metric-type $VAR(./metric-type/@)"; + fi; + ${vyatta_sbindir}/vyatta-vtysh.pl -c "configure terminal" \ + -c "router ospf" \ + -c "redistribute bgp $COND"; + fi; diff --git a/templates/protocols/ospf/redistribute/connected/metric-type/node.def b/templates/protocols/ospf/redistribute/connected/metric-type/node.def new file mode 100644 index 00000000..07f1e577 --- /dev/null +++ b/templates/protocols/ospf/redistribute/connected/metric-type/node.def @@ -0,0 +1,8 @@ +type: u32 +help: Set OSPF metric type +default: 2 + +syntax:expression: $VAR(@) in 1, 2 ; "metric-type must be either 1 or 2" + +comp_help: possible completions: + <1-2> Set metric type (default 2) diff --git a/templates/protocols/ospf/redistribute/connected/node.def b/templates/protocols/ospf/redistribute/connected/node.def index 6e40db83..ac4f0e00 100644 --- a/templates/protocols/ospf/redistribute/connected/node.def +++ b/templates/protocols/ospf/redistribute/connected/node.def @@ -1,18 +1,21 @@ help: Set to redistribute connected routes delete:expression: "touch /tmp/ospf-redist-connected.$PPID" -end:expression: "${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"no redistribute connected \"; \ - if [ -f \"/tmp/ospf-redist-connected.$PPID\" ]; then \ - rm -rf /tmp/ospf-redist-connected.$PPID; \ - else \ - if [ -n \"$VAR(./metric/@)\" ]; then \ - COND=\"metric $VAR(./metric/@)\"; \ - fi; \ - if [ -n \"$VAR(./route-map/@)\" ]; then \ - COND=\"$COND route-map $VAR(./route-map/@)\"; \ - fi; \ - ${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"redistribute connected $COND\"; \ - fi; " +end: ${vyatta_sbindir}/vyatta-vtysh.pl -c "configure terminal" \ + -c "router ospf" \ + -c "no redistribute connected"; + if [ -f "/tmp/ospf-redist-connected.$PPID" ]; then + rm -f /tmp/ospf-redist-connected.$PPID; + else + if [ -n "$VAR(./metric/@)" ]; then + COND="metric $VAR(./metric/@)"; + fi; + if [ -n "$VAR(./route-map/@)" ]; then + COND="$COND route-map $VAR(./route-map/@)"; + fi; + if [ -n "$VAR(./metric-type/@)" ]; then + COND="$COND metric-type $VAR(./metric-type/@)"; + fi; + ${vyatta_sbindir}/vyatta-vtysh.pl -c "configure terminal" \ + -c "router ospf" \ + -c "redistribute connected $COND"; + fi; diff --git a/templates/protocols/ospf/redistribute/kernel/metric-type/node.def b/templates/protocols/ospf/redistribute/kernel/metric-type/node.def new file mode 100644 index 00000000..07f1e577 --- /dev/null +++ b/templates/protocols/ospf/redistribute/kernel/metric-type/node.def @@ -0,0 +1,8 @@ +type: u32 +help: Set OSPF metric type +default: 2 + +syntax:expression: $VAR(@) in 1, 2 ; "metric-type must be either 1 or 2" + +comp_help: possible completions: + <1-2> Set metric type (default 2) diff --git a/templates/protocols/ospf/redistribute/kernel/node.def b/templates/protocols/ospf/redistribute/kernel/node.def index af19cff1..b4233bc0 100644 --- a/templates/protocols/ospf/redistribute/kernel/node.def +++ b/templates/protocols/ospf/redistribute/kernel/node.def @@ -1,18 +1,21 @@ help: Set to redistribute kernel routes delete:expression: "touch /tmp/ospf-redist-kernel.$PPID" -end:expression: "${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"no redistribute kernel \"; \ - if [ -f \"/tmp/ospf-redist-kernel.$PPID\" ]; then \ - rm -rf /tmp/ospf-redist-kernel.$PPID; \ - else \ - if [ -n \"$VAR(./metric/@)\" ]; then \ - COND=\"metric $VAR(./metric/@)\"; \ - fi; \ - if [ -n \"$VAR(./route-map/@)\" ]; then \ - COND=\"$COND route-map $VAR(./route-map/@)\"; \ - fi; \ - ${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"redistribute kernel $COND\"; \ - fi; " +end: ${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ + -c "router ospf" \ + -c "no redistribute kernel"; + if [ -f "/tmp/ospf-redist-kernel.$PPID" ]; then + rm -f /tmp/ospf-redist-kernel.$PPID; + else + if [ -n "$VAR(./metric/@)" ]; then + COND="metric $VAR(./metric/@)"; + fi; + if [ -n "$VAR(./route-map/@)" ]; then + COND="$COND route-map $VAR(./route-map/@)"; + fi; + if [ -n "$VAR(./metric-type/@)" ]; then + COND="$COND metric-type $VAR(./metric-type/@)"; + fi; + ${vyatta_sbindir}/vyatta-vtysh.pl -c "configure terminal" \ + -c "router ospf" \ + -c "redistribute kernel $COND"; + fi; diff --git a/templates/protocols/ospf/redistribute/rip/metric-type/node.def b/templates/protocols/ospf/redistribute/rip/metric-type/node.def new file mode 100644 index 00000000..07f1e577 --- /dev/null +++ b/templates/protocols/ospf/redistribute/rip/metric-type/node.def @@ -0,0 +1,8 @@ +type: u32 +help: Set OSPF metric type +default: 2 + +syntax:expression: $VAR(@) in 1, 2 ; "metric-type must be either 1 or 2" + +comp_help: possible completions: + <1-2> Set metric type (default 2) diff --git a/templates/protocols/ospf/redistribute/rip/node.def b/templates/protocols/ospf/redistribute/rip/node.def index 58bd8338..4382e22f 100644 --- a/templates/protocols/ospf/redistribute/rip/node.def +++ b/templates/protocols/ospf/redistribute/rip/node.def @@ -1,18 +1,21 @@ help: Set to redistribute RIP routes delete:expression: "touch /tmp/ospf-redist-rip.$PPID" -end:expression: "${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"no redistribute rip \"; \ - if [ -f \"/tmp/ospf-redist-rip.$PPID\" ]; then \ - rm -rf /tmp/ospf-redist-rip.$PPID; \ - else \ - if [ -n \"$VAR(./metric/@)\" ]; then \ - COND=\"metric $VAR(./metric/@)\"; \ - fi; \ - if [ -n \"$VAR(./route-map/@)\" ]; then \ - COND=\"$COND route-map $VAR(./route-map/@)\"; \ - fi; \ - ${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"redistribute rip $COND\"; \ - fi; " +end: ${vyatta_sbindir}/vyatta-vtysh.pl -c "configure terminal" \ + -c "router ospf" \ + -c "no redistribute rip"; + if [ -f "/tmp/ospf-redist-rip.$PPID" ]; then + rm -f /tmp/ospf-redist-rip.$PPID; + else + if [ -n "$VAR(./metric/@)" ]; then + COND="metric $VAR(./metric/@)"; + fi; + if [ -n "$VAR(./route-map/@)" ]; then + COND="$COND route-map $VAR(./route-map/@)"; + fi; + if [ -n "$VAR(./metric-type/@)" ]; then + COND="$COND metric-type $VAR(./metric-type/@)"; + fi; + ${vyatta_sbindir}/vyatta-vtysh.pl -c "configure terminal" \ + -c "router ospf" \ + -c "redistribute rip $COND"; + fi; diff --git a/templates/protocols/ospf/redistribute/static/metric-type/node.def b/templates/protocols/ospf/redistribute/static/metric-type/node.def new file mode 100644 index 00000000..07f1e577 --- /dev/null +++ b/templates/protocols/ospf/redistribute/static/metric-type/node.def @@ -0,0 +1,8 @@ +type: u32 +help: Set OSPF metric type +default: 2 + +syntax:expression: $VAR(@) in 1, 2 ; "metric-type must be either 1 or 2" + +comp_help: possible completions: + <1-2> Set metric type (default 2) diff --git a/templates/protocols/ospf/redistribute/static/node.def b/templates/protocols/ospf/redistribute/static/node.def index 57a227c0..17e46d0e 100644 --- a/templates/protocols/ospf/redistribute/static/node.def +++ b/templates/protocols/ospf/redistribute/static/node.def @@ -1,18 +1,21 @@ help: Set to redistribute static routes delete:expression: "touch /tmp/ospf-redist-static.$PPID" -end:expression: "${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"no redistribute static \"; \ - if [ -f \"/tmp/ospf-redist-static.$PPID\" ]; then \ - rm -rf /tmp/ospf-redist-static.$PPID; \ - else \ - if [ -n \"$VAR(./metric/@)\" ]; then \ - COND=\"metric $VAR(./metric/@)\"; \ - fi; \ - if [ -n \"$VAR(./route-map/@)\" ]; then \ - COND=\"$COND route-map $VAR(./route-map/@)\"; \ - fi; \ - ${vyatta_sbindir}/vyatta-vtysh.pl -c \"configure terminal\" \ - -c \"router ospf\" \ - -c \"redistribute static $COND\"; \ - fi; " +end: ${vyatta_sbindir}/vyatta-vtysh.pl -c "configure terminal" \ + -c "router ospf" \ + -c "no redistribute static"; + if [ -f "/tmp/ospf-redist-static.$PPID" ]; then + rm -f /tmp/ospf-redist-static.$PPID; + else + if [ -n "$VAR(./metric/@)" ]; then + COND="metric $VAR(./metric/@)"; + fi; + if [ -n "$VAR(./route-map/@)" ]; then + COND="$COND route-map $VAR(./route-map/@)"; + fi; + if [ -n "$VAR(./metric-type/@)" ]; then + COND="$COND metric-type $VAR(./metric-type/@)"; + fi; + ${vyatta_sbindir}/vyatta-vtysh.pl -c "configure terminal" \ + -c "router ospf" \ + -c "redistribute static $COND"; + fi; |