17bded7a1SNir Dotan#!/bin/bash
27bded7a1SNir Dotan# SPDX-License-Identifier: GPL-2.0
37bded7a1SNir Dotan
47bded7a1SNir Dotan# Test IP-in-IP GRE tunnel with key.
57bded7a1SNir Dotan# This test uses flat topology for IP tunneling tests. See ipip_lib.sh for more
67bded7a1SNir Dotan# details.
77bded7a1SNir Dotan
87bded7a1SNir DotanALL_TESTS="gre_flat4 gre_mtu_change"
97bded7a1SNir Dotan
107bded7a1SNir DotanNUM_NETIFS=6
117bded7a1SNir Dotansource lib.sh
127bded7a1SNir Dotansource ipip_lib.sh
137bded7a1SNir Dotan
147bded7a1SNir Dotansetup_prepare()
157bded7a1SNir Dotan{
167bded7a1SNir Dotan	h1=${NETIFS[p1]}
177bded7a1SNir Dotan	ol1=${NETIFS[p2]}
187bded7a1SNir Dotan
197bded7a1SNir Dotan	ul1=${NETIFS[p3]}
207bded7a1SNir Dotan	ul2=${NETIFS[p4]}
217bded7a1SNir Dotan
227bded7a1SNir Dotan	ol2=${NETIFS[p5]}
237bded7a1SNir Dotan	h2=${NETIFS[p6]}
247bded7a1SNir Dotan
257bded7a1SNir Dotan	forwarding_enable
267bded7a1SNir Dotan	vrf_prepare
277bded7a1SNir Dotan	h1_create
287bded7a1SNir Dotan	h2_create
297bded7a1SNir Dotan	sw1_flat_create gre $ol1 $ul1 ikey 111 okey 222
307bded7a1SNir Dotan	sw2_flat_create gre $ol2 $ul2 ikey 222 okey 111
317bded7a1SNir Dotan}
327bded7a1SNir Dotan
337bded7a1SNir Dotangre_flat4()
347bded7a1SNir Dotan{
357bded7a1SNir Dotan	RET=0
367bded7a1SNir Dotan
377bded7a1SNir Dotan	ping_test $h1 192.0.2.18 " gre flat with ikey/okey"
387bded7a1SNir Dotan}
397bded7a1SNir Dotan
407bded7a1SNir Dotangre_mtu_change()
417bded7a1SNir Dotan{
427bded7a1SNir Dotan	test_mtu_change	gre
437bded7a1SNir Dotan}
447bded7a1SNir Dotan
457bded7a1SNir Dotancleanup()
467bded7a1SNir Dotan{
477bded7a1SNir Dotan	pre_cleanup
487bded7a1SNir Dotan
497bded7a1SNir Dotan	sw2_flat_destroy $ol2 $ul2
507bded7a1SNir Dotan	sw1_flat_destroy $ol1 $ul1
517bded7a1SNir Dotan	h2_destroy
527bded7a1SNir Dotan	h1_destroy
537bded7a1SNir Dotan	vrf_cleanup
547bded7a1SNir Dotan	forwarding_restore
557bded7a1SNir Dotan}
567bded7a1SNir Dotan
577bded7a1SNir Dotantrap cleanup EXIT
587bded7a1SNir Dotan
597bded7a1SNir Dotansetup_prepare
607bded7a1SNir Dotansetup_wait
617bded7a1SNir Dotantests_run
627bded7a1SNir Dotan
637bded7a1SNir Dotanexit $EXIT_STATUS
64