diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-03-17 20:42:42 +0100 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-03-17 20:42:42 +0100 |
commit | 7b0fa43891be1210900038c56bf4ce2cbaf61ce1 (patch) | |
tree | 05c479c865109c20e5d5a4f719b95015b7cbdce1 /templates | |
parent | c0abb63635c854157ee61eb417bb965ee36a472a (diff) | |
download | vyatta-cfg-quagga-7b0fa43891be1210900038c56bf4ce2cbaf61ce1.tar.gz vyatta-cfg-quagga-7b0fa43891be1210900038c56bf4ce2cbaf61ce1.zip |
vrf: T31: add IPv4/IPv6 interface-route option
Diffstat (limited to 'templates')
8 files changed, 86 insertions, 0 deletions
diff --git a/templates/protocols/vrf/node.tag/static/interface-route/node.def b/templates/protocols/vrf/node.tag/static/interface-route/node.def new file mode 100644 index 00000000..2b9d75ad --- /dev/null +++ b/templates/protocols/vrf/node.tag/static/interface-route/node.def @@ -0,0 +1,7 @@ +tag: +type: ipv4net +help: Interface based static route +syntax:expression: exec "ipaddrcheck --verbose --is-ipv4-net $VAR(@)" + +commit:expression: $VAR(./next-hop-interface/) != "" ; \ + "Must add a next-hop-interface for route $VAR(@)" diff --git a/templates/protocols/vrf/node.tag/static/interface-route/node.tag/next-hop-interface/node.def b/templates/protocols/vrf/node.tag/static/interface-route/node.tag/next-hop-interface/node.def new file mode 100644 index 00000000..46f6abc0 --- /dev/null +++ b/templates/protocols/vrf/node.tag/static/interface-route/node.tag/next-hop-interface/node.def @@ -0,0 +1,31 @@ +tag: +type: txt +help: Next-hop interface [REQUIRED] +# show all current interface +# but syntax accepts any interface since it may exist later (ppp etc) +allowed: ${vyatta_sbindir}/vyatta-interfaces.pl --show all + + +end: + if [[ -z "$VAR(./disable)" ]] + then + VRF_NAME=$VAR(../../../@) + if [[ ${COMMIT_ACTION} = 'DELETE' ]] + then + if ! ${vyatta_sbindir}/vyatta-next-hop-check $VAR(../@) ipv4 interface; then + exit 1; + fi + vtysh -c "configure terminal" \ + -c "no ip route $VAR(../@) $VAR(@) vrf $VRF_NAME" + else + if [[ -n "$VAR(./distance/@)" ]] + then + DIST="$VAR(./distance/@)" + fi + vtysh -c "configure terminal" \ + -c "ip route $VAR(../@) $VAR(@) vrf $VRF_NAME $DIST"; + fi + else + vtysh -c "configure terminal" \ + -c "no ip route $VAR(../@) $VAR(@) vrf $VRF_NAME" + fi diff --git a/templates/protocols/vrf/node.tag/static/interface-route/node.tag/next-hop-interface/node.tag/disable/node.def b/templates/protocols/vrf/node.tag/static/interface-route/node.tag/next-hop-interface/node.tag/disable/node.def new file mode 100644 index 00000000..92f2ba51 --- /dev/null +++ b/templates/protocols/vrf/node.tag/static/interface-route/node.tag/next-hop-interface/node.tag/disable/node.def @@ -0,0 +1 @@ +help: Disable IPv4 interface static route diff --git a/templates/protocols/vrf/node.tag/static/interface-route/node.tag/next-hop-interface/node.tag/distance/node.def b/templates/protocols/vrf/node.tag/static/interface-route/node.tag/next-hop-interface/node.tag/distance/node.def new file mode 100644 index 00000000..61abcc65 --- /dev/null +++ b/templates/protocols/vrf/node.tag/static/interface-route/node.tag/next-hop-interface/node.tag/distance/node.def @@ -0,0 +1,4 @@ +type: u32 +help: Distance value for this route +syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 255; "Must be between (1-255)" +val_help: u32:1-255; Distance for this route diff --git a/templates/protocols/vrf/node.tag/static/interface-route6/node.def b/templates/protocols/vrf/node.tag/static/interface-route6/node.def new file mode 100644 index 00000000..e823dbd6 --- /dev/null +++ b/templates/protocols/vrf/node.tag/static/interface-route6/node.def @@ -0,0 +1,7 @@ +tag: +type: ipv6net +help: Interface based IPv6 static route +syntax:expression: exec "ipaddrcheck --verbose --is-ipv6-net $VAR(@)" + +commit:expression: $VAR(./next-hop-interface/) != "" ; \ + "Must add a next-hop-interface for route $VAR(@)" diff --git a/templates/protocols/vrf/node.tag/static/interface-route6/node.tag/next-hop-interface/node.def b/templates/protocols/vrf/node.tag/static/interface-route6/node.tag/next-hop-interface/node.def new file mode 100644 index 00000000..ecdfad84 --- /dev/null +++ b/templates/protocols/vrf/node.tag/static/interface-route6/node.tag/next-hop-interface/node.def @@ -0,0 +1,31 @@ +tag: +type: txt +help: Next-hop interface [REQUIRED] +# show all current interface +# but syntax accepts any interface since it may exist later (ppp etc) +allowed: ${vyatta_sbindir}/vyatta-interfaces.pl --show all + +end: + if [[ -z "$VAR(./disable)" ]] + then + VRF_NAME=$VAR(../../../@) + if [[ ${COMMIT_ACTION} = 'DELETE' ]] + then + if ! ${vyatta_sbindir}/vyatta-next-hop-check $VAR(../@) ipv6 interface; then + exit 1; + fi + + vtysh -c "configure terminal" \ + -c "no ipv6 route $VAR(../@) $VAR(@) vrf $VRF_NAME" + else + if [[ -n "$VAR(./distance/@)" ]] + then + DIST="$VAR(./distance/@)" + fi + vtysh -c "configure terminal" \ + -c "ipv6 route $VAR(../@) $VAR(@) vrf $VRF_NAME $DIST"; + fi + else + vtysh -c "configure terminal" \ + -c "no ipv6 route $VAR(../@) vrf $VRF_NAME $VAR(@)" + fi diff --git a/templates/protocols/vrf/node.tag/static/interface-route6/node.tag/next-hop-interface/node.tag/disable/node.def b/templates/protocols/vrf/node.tag/static/interface-route6/node.tag/next-hop-interface/node.tag/disable/node.def new file mode 100644 index 00000000..bc4b57e6 --- /dev/null +++ b/templates/protocols/vrf/node.tag/static/interface-route6/node.tag/next-hop-interface/node.tag/disable/node.def @@ -0,0 +1 @@ +help: Disable IPv6 interface static route diff --git a/templates/protocols/vrf/node.tag/static/interface-route6/node.tag/next-hop-interface/node.tag/distance/node.def b/templates/protocols/vrf/node.tag/static/interface-route6/node.tag/next-hop-interface/node.tag/distance/node.def new file mode 100644 index 00000000..61abcc65 --- /dev/null +++ b/templates/protocols/vrf/node.tag/static/interface-route6/node.tag/next-hop-interface/node.tag/distance/node.def @@ -0,0 +1,4 @@ +type: u32 +help: Distance value for this route +syntax:expression: $VAR(@) >= 1 && $VAR(@) <= 255; "Must be between (1-255)" +val_help: u32:1-255; Distance for this route |