summaryrefslogtreecommitdiff
path: root/templates/protocols/static
diff options
context:
space:
mode:
authorhagbard <vyosdev@derith.de>2019-05-14 12:56:09 -0700
committerhagbard <vyosdev@derith.de>2019-05-14 12:56:09 -0700
commit1b620792f687f42b600a2d2330e71e9e3860c1d9 (patch)
tree239aded9f6240530bb68d138972f6fb595d27675 /templates/protocols/static
parent468e19f564023771d774ee32ccffc4ccffed897c (diff)
downloadvyatta-cfg-quagga-1b620792f687f42b600a2d2330e71e9e3860c1d9.tar.gz
vyatta-cfg-quagga-1b620792f687f42b600a2d2330e71e9e3860c1d9.zip
[frr-static] T1267 - Add interface name for static routes
- interface for route table
Diffstat (limited to 'templates/protocols/static')
-rw-r--r--templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.def14
-rw-r--r--templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.tag/next-hop-interface/node.def16
2 files changed, 28 insertions, 2 deletions
diff --git a/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.def b/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.def
index 17f1f0dc..eb99af50 100644
--- a/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.def
+++ b/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.def
@@ -8,6 +8,14 @@ end:
fi
if [[ -z "$VAR(./disable)" ]]
then
+ ### remove the old entry from frr first on an update
+ if [ ${COMMIT_ACTION} = 'ACTIVE' ]
+ then
+ OLD_IF=`cli-shell-api returnEffectiveValue protocols static $table route $VAR(../@) next-hop $VAR(@) next-hop-interface`
+ vtysh -c "configure terminal" \
+ -c "no ip route $VAR(../@) $VAR(@) $OLD_IF $VAR(./distance/@) $table";
+ fi
+
if [[ ${COMMIT_ACTION} = 'DELETE' ]]
then
if ! ${vyatta_sbindir}/vyatta-next-hop-check $VAR(../@) ipv4 address; then
@@ -16,8 +24,10 @@ end:
if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \
"$VAR(../@)" "$VAR(@)"
then
+ DIST=`cli-shell-api returnEffectiveValue protocols static $table route $VAR(../@) next-hop $VAR(@) distance`
+ NHIF=`cli-shell-api returnEffectiveValue protocols static $table route $VAR(../@) next-hop $VAR(@) next-hop-interface`
vtysh -c "configure terminal" \
- -c "no ip route $VAR(../@) $VAR(@) $table"
+ -c "no ip route $VAR(../@) $VAR(@) $NHIF $DIST $table";
fi
else
if [[ -n "$VAR(./distance/@)" ]]
@@ -25,7 +35,7 @@ end:
dist="$VAR(./distance/@)"
fi
vtysh -c "configure terminal" \
- -c "ip route $VAR(../@) $VAR(@) $table $dist";
+ -c "ip route $VAR(../@) $VAR(@) $VAR(./next-hop-interface/@) $table $dist";
fi
else
if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \
diff --git a/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.tag/next-hop-interface/node.def b/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.tag/next-hop-interface/node.def
new file mode 100644
index 00000000..17979d4b
--- /dev/null
+++ b/templates/protocols/static/table/node.tag/route/node.tag/next-hop/node.tag/next-hop-interface/node.def
@@ -0,0 +1,16 @@
+type: txt
+help: network interface
+allowed: sh -c "${vyos_completion_dir}/list_interfaces.py"
+end:
+ if [[ ${COMMIT_ACTION} = 'DELETE' ]]
+ then
+ if ! ${vyatta_sbindir}/vyatta-next-hop-check $VAR(../@) ipv4 address; then
+ exit 1;
+ fi
+ if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \
+ "$VAR(../../@)" "$VAR(../@)"
+ then
+ vtysh -c "configure terminal" \
+ -c "no ip route $VAR(../../@) $VAR(../@) $VAR(@)"
+ fi
+ fi