diff options
Diffstat (limited to 'templates/protocols')
4 files changed, 8 insertions, 39 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 7e31ef40..019978f9 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,16 +11,9 @@ 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 + if ! ${vyatta_sbindir}/vyatta-next-hop-check $VAR(../@) ipv4 interface; then + 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 84e619cc..279329d6 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,14 +10,8 @@ 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 + if ! ${vyatta_sbindir}/vyatta-next-hop-check $VAR(../@) ipv6 interface; then + exit 1; fi vtysh -c "configure terminal" \ 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 9160dd8d..eb41b4e4 100644 --- a/templates/protocols/static/route/node.tag/next-hop/node.def +++ b/templates/protocols/static/route/node.tag/next-hop/node.def @@ -6,18 +6,9 @@ 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 + 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 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 28b6ec00..e3a668b7 100644 --- a/templates/protocols/static/route6/node.tag/next-hop/node.def +++ b/templates/protocols/static/route6/node.tag/next-hop/node.def @@ -9,18 +9,9 @@ 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 + if ! ${vyatta_sbindir}/vyatta-next-hop-check $VAR(../@) ipv6 address; then + exit 1; fi - if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \ "$VAR(../@)" "$VAR(@)" then |