diff options
Diffstat (limited to 'templates/protocols')
6 files changed, 70 insertions, 2 deletions
diff --git a/templates/protocols/static/interface-route/node.tag/next-hop-interface/node.def b/templates/protocols/static/interface-route/node.tag/next-hop-interface/node.def index 8c7f35fb..7e31ef40 100644 --- a/templates/protocols/static/interface-route/node.tag/next-hop-interface/node.def +++ b/templates/protocols/static/interface-route/node.tag/next-hop-interface/node.def @@ -11,6 +11,16 @@ end: then if [[ ${COMMIT_ACTION} = 'DELETE' ]] then + # Check that there is still a next-hop-interface if the parent is not deleted + ARR=( $(cli-shell-api listNodes protocols static interface-route $VAR(../@) next-hop-interface) ) + cli-shell-api exists protocols static interface-route $VAR(../@) + RETVAL_PARENT=$? + if [ ${#ARR} -eq 0 ] && [ $RETVAL_PARENT -eq 0 ] + then + echo "Must add a next-hop-interface for route $VAR(../@)" + exit 1 + fi + vtysh -c "configure terminal" \ -c "no ip route $VAR(../@) $VAR(@)" else diff --git a/templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.def b/templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.def index 1a5e6709..84e619cc 100644 --- a/templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.def +++ b/templates/protocols/static/interface-route6/node.tag/next-hop-interface/node.def @@ -10,6 +10,16 @@ end: then if [[ ${COMMIT_ACTION} = 'DELETE' ]] then + # Check that there is still a next-hop-interface if the parent is not deleted + ARR=( $(cli-shell-api listNodes protocols static interface-route6 $VAR(../@) next-hop-interface) ) + cli-shell-api exists protocols static interface-route6 $VAR(../@) + RETVAL_PARENT=$? + if [ ${#ARR} -eq 0 ] && [ $RETVAL_PARENT -eq 0 ] + then + echo "Must add a next-hop-interface for route $VAR(../@)" + exit 1 + fi + vtysh -c "configure terminal" \ -c "no ipv6 route $VAR(../@) $VAR(@)" else diff --git a/templates/protocols/static/route/node.tag/blackhole/node.def b/templates/protocols/static/route/node.tag/blackhole/node.def index b6691ed4..c72fabd2 100644 --- a/templates/protocols/static/route/node.tag/blackhole/node.def +++ b/templates/protocols/static/route/node.tag/blackhole/node.def @@ -1,7 +1,19 @@ help: Silently discard pkts when matched end: if [ ${COMMIT_ACTION} = 'DELETE' ]; then - vtysh -c "configure terminal" \ + # Check that there is still a next-hop or blackhole if the parent is not deleted + ARR=( $(cli-shell-api listNodes protocols static route $VAR(../@) next-hop) ) + cli-shell-api exists protocols static route $VAR(../@) blackhole + RETVAL_BH=$? + cli-shell-api exists protocols static route $VAR(../@) + RETVAL_PARENT=$? + if [ ${#ARR} -eq 0 ] && [ $RETVAL_BH -eq 1 ] && [ $RETVAL_PARENT -eq 0 ] + then + echo "Must add either a next-hop or blackhole for route $VAR(../@)" + exit 1 + fi + + vtysh -c "configure terminal" \ -c "no ip route $VAR(../@) null0"; else if [ -n "$VAR(./distance/@)" ]; then 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 1c72e7f5..9160dd8d 100644 --- a/templates/protocols/static/route/node.tag/next-hop/node.def +++ b/templates/protocols/static/route/node.tag/next-hop/node.def @@ -6,6 +6,18 @@ end: then if [[ ${COMMIT_ACTION} = 'DELETE' ]] then + # Check that there is still a next-hop or blackhole if the parent is not deleted + ARR=( $(cli-shell-api listNodes protocols static route $VAR(../@) next-hop) ) + cli-shell-api exists protocols static route $VAR(../@) blackhole + RETVAL_BH=$? + cli-shell-api exists protocols static route $VAR(../@) + RETVAL_PARENT=$? + if [ ${#ARR} -eq 0 ] && [ $RETVAL_BH -eq 1 ] && [ $RETVAL_PARENT -eq 0 ] + then + echo "Must add either a next-hop or blackhole for route $VAR(../@)" + exit 1 + fi + if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \ "$VAR(../@)" "$VAR(@)" then diff --git a/templates/protocols/static/route6/node.tag/blackhole/node.def b/templates/protocols/static/route6/node.tag/blackhole/node.def index bd0918d7..c8e202b2 100644 --- a/templates/protocols/static/route6/node.tag/blackhole/node.def +++ b/templates/protocols/static/route6/node.tag/blackhole/node.def @@ -1,7 +1,19 @@ help: Silently discard pkts when matched end: if [ ${COMMIT_ACTION} = 'DELETE' ]; then - vtysh -c "configure terminal" \ + # Check that there is still a next-hop or blackhole if the parent is not deleted + ARR=( $(cli-shell-api listNodes protocols static route6 $VAR(../@) next-hop) ) + cli-shell-api exists protocols static route6 $VAR(../@) blackhole + RETVAL_BH=$? + cli-shell-api exists protocols static route6 $VAR(../@) + RETVAL_PARENT=$? + if [ ${#ARR} -eq 0 ] && [ $RETVAL_BH -eq 1 ] && [ $RETVAL_PARENT -eq 0 ] + then + echo "Must add either a next-hop or blackhole for route $VAR(../@)" + exit 1 + fi + + vtysh -c "configure terminal" \ -c "no ipv6 route $VAR(../@) null0"; else if [ -n "$VAR(./distance/@)" ]; then diff --git a/templates/protocols/static/route6/node.tag/next-hop/node.def b/templates/protocols/static/route6/node.tag/next-hop/node.def index 55574941..28b6ec00 100644 --- a/templates/protocols/static/route6/node.tag/next-hop/node.def +++ b/templates/protocols/static/route6/node.tag/next-hop/node.def @@ -9,6 +9,18 @@ end: then if [[ ${COMMIT_ACTION} = 'DELETE' ]] then + # Check that there is still a next-hop or blackhole if the parent is not deleted + ARR=( $(cli-shell-api listNodes protocols static route6 $VAR(../@) next-hop) ) + cli-shell-api exists protocols static route6 $VAR(../@) blackhole + RETVAL_BH=$? + cli-shell-api exists protocols static route6 $VAR(../@) + RETVAL_PARENT=$? + if [ ${#ARR} -eq 0 ] && [ $RETVAL_BH -eq 1 ] && [ $RETVAL_PARENT -eq 0 ] + then + echo "Must add either a next-hop or blackhole for route $VAR(../@)" + exit 1 + fi + if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \ "$VAR(../@)" "$VAR(@)" then |