examples/ipsec-segw: add SPDX license tag
[dpdk.git] / examples / ipsec-secgw / test / linux_test6.sh
1 #! /bin/bash
2 # SPDX-License-Identifier: BSD-3-Clause
3
4 # usage:  /bin/bash linux_test6.sh <ipsec_mode>
5 # for list of available modes please refer to run_test.sh.
6 # ipsec-secgw (IPv6 mode) functional test script.
7 #
8 # Note that for most of them you required appropriate crypto PMD/device
9 # to be avaialble.
10 # Also user has to setup properly the following environment variables:
11 #  SGW_PATH - path to the ipsec-secgw binary to test
12 #  REMOTE_HOST - ip/hostname of the DUT
13 #  REMOTE_IFACE - iface name for the test-port on DUT
14 #  ETH_DEV - ethernet device to be used on SUT by DPDK ('-w <pci-id>')
15 # Also user can optonally setup:
16 #  SGW_LCORE - lcore to run ipsec-secgw on (default value is 0)
17 #  CRYPTO_DEV - crypto device to be used ('-w <pci-id>')
18 #  if none specified appropriate vdevs will be created by the scrit
19 #  MULTI_SEG_TEST - ipsec-secgw option to enable reassembly support and
20 #  specify size of reassembly table (i.e. MULTI_SEG_TEST="--reassemble 128")
21 #
22 # The purpose of the script is to automate ipsec-secgw testing
23 # using another system running linux as a DUT.
24 # It expects that SUT and DUT are connected through at least 2 NICs.
25 # One NIC is expected to be managed by linux both machines,
26 # and will be used as a control path.
27 # Make sure user from SUT can ssh to DUT without entering password,
28 # also make sure that sshd over ipv6 is enabled.
29 # Second NIC (test-port) should be reserved for DPDK on SUT,
30 # and should be managed by linux on DUT.
31 # The script starts ipsec-secgw with 2 NIC devices: test-port and tap vdev.
32 # Then configures local tap iface and remote iface and ipsec policies
33 # in the following way:
34 # traffic going over test-port in both directions has to be
35 # protected by ipsec.
36 # raffic going over TAP in both directions doesn't have to be protected.
37 # I.E:
38 # DUT OS(NIC1)--(ipsec)-->(NIC1)ipsec-secgw(TAP)--(plain)-->(TAP)SUT OS
39 # SUT OS(TAP)--(plain)-->(TAP)psec-secgw(NIC1)--(ipsec)-->(NIC1)DUT OS
40 # Then tries to perorm some data transfer using the scheme decribed above.
41 #
42
43 DIR=`dirname $0`
44 MODE=$1
45
46  . ${DIR}/common_defs.sh
47  . ${DIR}/${MODE}_defs.sh
48
49 #make linux to generate fragmented packets
50 if [[ -n "${MULTI_SEG_TEST}" && -n "${SGW_CMD_XPRM}" ]]; then
51         echo "multi-segment test is enabled"
52         SGW_CMD_XPRM="${SGW_CMD_XPRM} ${MULTI_SEG_TEST}"
53         PING_LEN=5000
54         MTU_LEN=1500
55 else
56         PING_LEN=${DEF_PING_LEN}
57         MTU_LEN=${DEF_MTU_LEN}
58 fi
59
60 config_secgw
61
62 secgw_start
63
64 config6_iface
65
66 config6_remote_xfrm
67
68  . ${DIR}/data_rxtx.sh
69
70 set_local_mtu ${MTU_LEN}
71 ping6_test1 ${REMOTE_IPV6} 0 ${PING_LEN}
72 st=$?
73 if [[ $st -eq 0 ]]; then
74         set_local_mtu ${DEF_MTU_LEN}
75         scp_test1 ${REMOTE_IPV6}
76         st=$?
77 fi
78
79 secgw_stop
80 exit $st