From edeebf4e82e3f750d35ed19e137b877b6149f107 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Thu, 23 Apr 2020 14:09:34 +0200 Subject: vrf: T2369: support leaking interface-route from default VRF --- .../node.tag/next-hop-interface/node.def | 8 +++++--- .../node.tag/next-hop-vrf/node.def | 20 ++++++++++++++++++++ 2 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 templates/protocols/static/interface-route/node.tag/next-hop-interface/node.tag/next-hop-vrf/node.def (limited to 'templates') 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 019978f9..f8bc9270 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 @@ -17,12 +17,14 @@ end: vtysh -c "configure terminal" \ -c "no ip route $VAR(../@) $VAR(@)" else - if [[ -n "$VAR(./distance/@)" ]] - then + if [[ -n "$VAR(./distance/@)" ]]; then DIST="$VAR(./distance/@)" fi + if [[ -n "$VAR(./next-hop-vrf/@)" ]]; then + NEXTHOP_VRF="nexthop-vrf $VAR(./next-hop-vrf/@)" + fi vtysh -c "configure terminal" \ - -c "ip route $VAR(../@) $VAR(@) $DIST"; + -c "ip route $VAR(../@) $VAR(@) $NEXTHOP_VRF $DIST"; fi else vtysh -c "configure terminal" \ diff --git a/templates/protocols/static/interface-route/node.tag/next-hop-interface/node.tag/next-hop-vrf/node.def b/templates/protocols/static/interface-route/node.tag/next-hop-interface/node.tag/next-hop-vrf/node.def new file mode 100644 index 00000000..c4fee0e0 --- /dev/null +++ b/templates/protocols/static/interface-route/node.tag/next-hop-interface/node.tag/next-hop-vrf/node.def @@ -0,0 +1,20 @@ +type: txt +help: VRF to leak route +allowed: local -a params + eval "params=($(cli-shell-api listNodes vrf name))" + echo -n "${params[@]}" +val_help: ; Name of VRF to leak to +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 + VRF_NAME=$VAR(../../../../@) + vtysh -c "configure terminal" \ + -c "no ip route $VAR(../../@) $VAR(../@) nexthop-vrf $VAR(@)" + fi + fi -- cgit v1.2.3