summaryrefslogtreecommitdiff
path: root/templates/protocols/static/route/node.tag/next-hop/node.def
blob: f5d5d4172d17945293bcd64e90836099214b11a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
tag:
type: ipv4
help: Next-hop router [REQUIRED]
end:
  if [[ -z "$VAR(./disable)" ]]
  then 
    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(@)"
      fi
    else
      if [[ -n "$VAR(./distance/@)" ]]
      then
	 	    DIST="$VAR(./distance/@)"
      fi
	    vtysh -c "configure terminal" \
                   -c "ip route $VAR(../@) $VAR(@) $DIST";
    fi
  else
    if ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl \
        "$VAR(../@)" "$VAR(@)"
    then
      vtysh -c "configure terminal" \
                   -c "no ip route $VAR(../@) $VAR(@)"
    fi
  fi
  if [[ "$VAR(../@)" = "0.0.0.0/0" ]]
  then
    ${vyatta_sbindir}/vyatta-gateway-static_route-check.pl warn
  fi