1f08c3bdfSopenharmony_ci#!/bin/sh 2f08c3bdfSopenharmony_ci# SPDX-License-Identifier: GPL-2.0-or-later 3f08c3bdfSopenharmony_ci# Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved. 4f08c3bdfSopenharmony_ci 5f08c3bdfSopenharmony_ciTST_SETUP="setup" 6f08c3bdfSopenharmony_ciTST_TESTFUNC="do_test" 7f08c3bdfSopenharmony_ciTST_CLEANUP="cleanup" 8f08c3bdfSopenharmony_ci 9f08c3bdfSopenharmony_cicleanup() 10f08c3bdfSopenharmony_ci{ 11f08c3bdfSopenharmony_ci ip route del $ip_rmt/$mask > /dev/null 2>&1 12f08c3bdfSopenharmony_ci tst_rhost_run -c "ip route del $ip_loc/$mask" > /dev/null 13f08c3bdfSopenharmony_ci 14f08c3bdfSopenharmony_ci [ -n "$ip_loc" ] && ip addr del $ip_loc/$mask dev lo > /dev/null 2>&1 15f08c3bdfSopenharmony_ci [ -n "$ip_rmt" ] && tst_rhost_run -c "ip addr del $ip_rmt/$mask dev lo" > \ 16f08c3bdfSopenharmony_ci /dev/null 2>&1 17f08c3bdfSopenharmony_ci 18f08c3bdfSopenharmony_ci mpls_cleanup 19f08c3bdfSopenharmony_ci} 20f08c3bdfSopenharmony_ci 21f08c3bdfSopenharmony_cisetup() 22f08c3bdfSopenharmony_ci{ 23f08c3bdfSopenharmony_ci mpls_setup 61 24f08c3bdfSopenharmony_ci 25f08c3bdfSopenharmony_ci ip_loc=$(tst_ipaddr_un) 26f08c3bdfSopenharmony_ci ip_rmt=$(tst_ipaddr_un rhost) 27f08c3bdfSopenharmony_ci [ -n "$TST_IPV6" ] && mask=128 || mask=32 28f08c3bdfSopenharmony_ci 29f08c3bdfSopenharmony_ci ROD ip addr add $ip_loc/$mask dev lo 30f08c3bdfSopenharmony_ci ROD ip route add $ip_rmt/$mask encap mpls 50 via inet$TST_IPV6 $(tst_ipaddr rhost) 31f08c3bdfSopenharmony_ci ROD ip -f mpls route add 60 dev lo 32f08c3bdfSopenharmony_ci 33f08c3bdfSopenharmony_ci tst_rhost_run -s -c "ip addr add $ip_rmt/$mask dev lo" 34f08c3bdfSopenharmony_ci tst_rhost_run -s -c "ip route add $ip_loc/$mask encap mpls 60 via inet$TST_IPV6 $(tst_ipaddr)" 35f08c3bdfSopenharmony_ci tst_rhost_run -s -c "ip -f mpls route add 50 dev lo" 36f08c3bdfSopenharmony_ci} 37f08c3bdfSopenharmony_ci 38f08c3bdfSopenharmony_cido_test() 39f08c3bdfSopenharmony_ci{ 40f08c3bdfSopenharmony_ci local type=$2 41f08c3bdfSopenharmony_ci local max_size=$TST_NET_MAX_PKT 42f08c3bdfSopenharmony_ci 43f08c3bdfSopenharmony_ci if [ "$type" = "icmp" ]; then 44f08c3bdfSopenharmony_ci tst_ping -I $ip_loc -H $ip_rmt -s "10 100 1000 2000 $max_size" 45f08c3bdfSopenharmony_ci else 46f08c3bdfSopenharmony_ci tst_netload -S $ip_loc -H $ip_rmt -T $type -n 10 -N 10 47f08c3bdfSopenharmony_ci tst_netload -S $ip_loc -H $ip_rmt -T $type -A $max_size 48f08c3bdfSopenharmony_ci fi 49f08c3bdfSopenharmony_ci} 50f08c3bdfSopenharmony_ci 51f08c3bdfSopenharmony_ci. mpls_lib.sh 52f08c3bdfSopenharmony_citst_run 53