diff options
Diffstat (limited to 'tests/tldk')
18 files changed, 369 insertions, 0 deletions
diff --git a/tests/tldk/func/__init__.robot b/tests/tldk/func/__init__.robot new file mode 100644 index 0000000000..3b71353945 --- /dev/null +++ b/tests/tldk/func/__init__.robot @@ -0,0 +1,18 @@ +# Copyright (c) 2017 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +*** Settings *** +| Resource | resources/libraries/robot/shared/default.robot +| Resource | resources/libraries/robot/shared/interfaces.robot +| Library | resources.libraries.python.TLDK.SetupTLDKTest +| Suite Setup | Setup TLDK Test | ${nodes} diff --git a/tests/tldk/func/ipv4/ipv4_assemble.robot b/tests/tldk/func/ipv4/ipv4_assemble.robot new file mode 100644 index 0000000000..88f43823c8 --- /dev/null +++ b/tests/tldk/func/ipv4/ipv4_assemble.robot @@ -0,0 +1,46 @@ +# Copyright (c) 2017 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +*** Settings *** +| Library | resources.libraries.python.NodePath +| Library | resources.libraries.python.Trace +| Library | resources.libraries.python.TrafficScriptExecutor +| Library | resources.libraries.python.TLDK.UdpTest +| Resource | resources/libraries/robot/shared/default.robot +| Resource | resources/libraries/robot/shared/interfaces.robot +| Resource | resources/libraries/robot/shared/counters.robot +| Resource | resources/libraries/robot/tldk/tldk_utils.robot +| Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | FUNCTEST | TLDK +| Documentation | *TLDK IPv4 assemble test suite.* +| ... +| ... | Test suite uses 3-node topology TG - DUT1 - DUT2 - TG with single link +| ... | between nodes. From this topology only TG and DUT1 nodes are used. +| ... | In VM environment, the DUT2 is not configured since the DUT1 is testing +| ... | with the pcap file that generated with the pcap_gen.py. There is no +| ... | packet going out to DUT2, udpfwd app is verified on DUT1 only. +| ... | This test case just use the pcap file for the UDP functional test. + +*** Variables *** +| ${tc01_file_prefix}= | test_ipv4_assemble + +*** Test Cases *** +| TC01: TLDK IPv4 assemble test case +| | Given Path for 2-node testing is set | ${nodes['TG']} | ${nodes['DUT1']} +| | And Pick out the port used to execute test +| | And Get the pcap data | ${tc01_file_prefix} +| | When Exec the udpfwd test | ${dut_node} | ${dut_port} +| | ... | ${tc01_file_prefix} | ${dest_ip} | ${is_ipv4} +| | ${pkt_count}= | Get the test result | ${dut_node} +| | ... | ${tc01_file_prefix} +| | ${result}= | Convert To Integer | ${pkt_count} +| | Then Should Be Equal As Integers | ${result} | 1 diff --git a/tests/tldk/func/ipv4/ipv4_checksum.robot b/tests/tldk/func/ipv4/ipv4_checksum.robot new file mode 100644 index 0000000000..d0710616fc --- /dev/null +++ b/tests/tldk/func/ipv4/ipv4_checksum.robot @@ -0,0 +1,43 @@ +# Copyright (c) 2017 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +*** Settings *** +| Library | resources.libraries.python.NodePath +| Library | resources.libraries.python.Trace +| Library | resources.libraries.python.TrafficScriptExecutor +| Library | resources.libraries.python.TLDK.UdpTest +| Resource | resources/libraries/robot/shared/default.robot +| Resource | resources/libraries/robot/shared/interfaces.robot +| Resource | resources/libraries/robot/shared/counters.robot +| Resource | resources/libraries/robot/tldk/tldk_utils.robot +| Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | FUNCTEST | TLDK +| Documentation | *TLDK IPv4 checksum test suite.* +| ... +| ... | Test suite uses 3-node topology TG - DUT1 - DUT2 - TG with single link +| ... | between nodes. From this topology only TG and DUT1 nodes are used. +| ... | This test case just use the pcap file for the UDP functional test. + +*** Variables *** +| ${tc01_file_prefix}= | test_ipv4_checksum + +*** Test Cases *** +| TC01: TLDK IPv4 checksum test case +| | Given Path for 2-node testing is set | ${nodes['TG']} | ${nodes['DUT1']} +| | And Pick out the port used to execute test +| | And Get the pcap data | ${tc01_file_prefix} +| | When Exec the udpfwd test | ${dut_node} | ${dut_port} +| | ... | ${tc01_file_prefix} | ${dest_ip} | ${is_ipv4} +| | ${checksum}= | Get the test result | ${dut_node} +| | ... | ${tc01_file_prefix} +| | ${result}= | Convert To Integer | ${checksum} +| | Then Should Be Equal As Integers | ${result} | ${packet_num} diff --git a/tests/tldk/func/ipv4/ipv4_fragment.robot b/tests/tldk/func/ipv4/ipv4_fragment.robot new file mode 100644 index 0000000000..e3c2475c6d --- /dev/null +++ b/tests/tldk/func/ipv4/ipv4_fragment.robot @@ -0,0 +1,43 @@ +# Copyright (c) 2017 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +*** Settings *** +| Library | resources.libraries.python.NodePath +| Library | resources.libraries.python.Trace +| Library | resources.libraries.python.TrafficScriptExecutor +| Library | resources.libraries.python.TLDK.UdpTest +| Resource | resources/libraries/robot/shared/default.robot +| Resource | resources/libraries/robot/shared/interfaces.robot +| Resource | resources/libraries/robot/shared/counters.robot +| Resource | resources/libraries/robot/tldk/tldk_utils.robot +| Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | FUNCTEST | TLDK +| Documentation | *TLDK IPv4 fragment test suite.* +| ... +| ... | Test suite uses 3-node topology TG - DUT1 - DUT2 - TG with single link +| ... | between nodes. From this topology only TG and DUT1 nodes are used. +| ... | This test case just use the pcap file for the UDP functional test. + +*** Variables *** +| ${tc01_file_prefix}= | test_ipv4_fragment + +*** Test Cases *** +| TC01: TLDK IPv4 fragment test case +| | Given Path for 2-node testing is set | ${nodes['TG']} | ${nodes['DUT1']} +| | And Pick out the port used to execute test +| | And Get the pcap data | ${tc01_file_prefix} +| | When Exec the udpfwd test | ${dut_node} | ${dut_port} +| | ... | ${tc01_file_prefix} | ${dest_ip} | ${is_ipv4} +| | ${checksum}= | Get the test result | ${dut_node} +| | ... | ${tc01_file_prefix} +| | ${result}= | Convert To Integer | ${checksum} +| | Then Should Be Equal As Integers | ${result} | 990 diff --git a/tests/tldk/func/ipv6/ipv6_checksum.robot b/tests/tldk/func/ipv6/ipv6_checksum.robot new file mode 100644 index 0000000000..c216f82c40 --- /dev/null +++ b/tests/tldk/func/ipv6/ipv6_checksum.robot @@ -0,0 +1,43 @@ +# Copyright (c) 2016 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +*** Settings *** +| Library | resources.libraries.python.NodePath +| Library | resources.libraries.python.Trace +| Library | resources.libraries.python.TrafficScriptExecutor +| Library | resources.libraries.python.TLDK.UdpTest +| Resource | resources/libraries/robot/shared/default.robot +| Resource | resources/libraries/robot/shared/interfaces.robot +| Resource | resources/libraries/robot/shared/counters.robot +| Resource | resources/libraries/robot/tldk/tldk_utils.robot +| Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | FUNCTEST | TLDK +| Documentation | *TLDK IPv6 checksum test suit.* +| ... +| ... | Test suite uses 3-node topology TG - DUT1 - DUT2 - TG with single link +| ... | between nodes. From this topology only TG and DUT1 nodes are used. +| ... | This test case just use the pcap file for the UDP functional test. + +*** Variables *** +| ${tc01_file_prefix}= | test_ipv6_checksum + +*** Test Cases *** +| TC01: TLDK IPv6 checksum test case +| | Given Path for 2-node testing is set | ${nodes['TG']} | ${nodes['DUT1']} +| | And Pick out the port used to execute test +| | And Get the pcap data | ${tc01_file_prefix} +| | When Exec the udpfwd test | ${dut_node} | ${dut_port} +| | ... | ${tc01_file_prefix} | ${dest_ip} | ${is_ipv4} +| | ${pkt_count}= | Get the test result | ${dut_node} +| | ... | ${tc01_file_prefix} +| | ${result}= | Convert To Integer | ${pkt_count} +| | Then Should Be Equal As Integers | ${result} | ${packet_num} diff --git a/tests/tldk/func/ipv6/ipv6_fragment.robot b/tests/tldk/func/ipv6/ipv6_fragment.robot new file mode 100644 index 0000000000..b8c345f859 --- /dev/null +++ b/tests/tldk/func/ipv6/ipv6_fragment.robot @@ -0,0 +1,43 @@ +# Copyright (c) 2017 Cisco and/or its affiliates. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at: +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +*** Settings *** +| Library | resources.libraries.python.NodePath +| Library | resources.libraries.python.Trace +| Library | resources.libraries.python.TrafficScriptExecutor +| Library | resources.libraries.python.TLDK.UdpTest +| Resource | resources/libraries/robot/shared/default.robot +| Resource | resources/libraries/robot/shared/interfaces.robot +| Resource | resources/libraries/robot/shared/counters.robot +| Resource | resources/libraries/robot/tldk/tldk_utils.robot +| Force Tags | 3_NODE_SINGLE_LINK_TOPO | VM_ENV | FUNCTEST | TLDK +| Documentation | *TLDK IPv6 fragment test suite.* +| ... +| ... | Test suite uses 3-node topology TG - DUT1 - DUT2 - TG with single link +| ... | between nodes. From this topology only TG and DUT1 nodes are used. +| ... | This test case just use the pcap file for the UDP functional test. + +*** Variables *** +| ${tc01_file_prefix}= | test_ipv6_fragment + +*** Test Cases *** +| TC01: TLDK IPv6 fragment test case +| | Given Path for 2-node testing is set | ${nodes['TG']} | ${nodes['DUT1']} +| | And Pick out the port used to execute test +| | And Get the pcap data | ${tc01_file_prefix} +| | When Exec the udpfwd test | ${dut_node} | ${dut_port} +| | ... | ${tc01_file_prefix} | ${dest_ip} | ${is_ipv4} +| | ${pkt_count}= | Get the test result | ${dut_node} +| | ... | ${tc01_file_prefix} +| | ${result}= | Convert To Integer | ${pkt_count} +| | Then Should Be Equal As Integers | ${result} | ${970} diff --git a/tests/tldk/tldk_scripts/install_tldk.sh b/tests/tldk/tldk_scripts/install_tldk.sh new file mode 100755 index 0000000000..0cc65f949e --- /dev/null +++ b/tests/tldk/tldk_scripts/install_tldk.sh @@ -0,0 +1,57 @@ +#!/bin/bash + +set -x + +DPDK_VERSION=16.11.1 + +ROOTDIR=/tmp/TLDK-testing +PWDDIR=$(pwd) +DPDK_DIR=dpdk +DPDK_PACKAGE=${DPDK_DIR}"-"${DPDK_VERSION}.tar.xz + +# compile and install the DPDK +cd ${ROOTDIR} +sudo tar xvf ${DPDK_PACKAGE} +sudo mv dpdk-stable-${DPDK_VERSION} dpdk +echo $PWD +echo ${DPDK_PACKAGE} +cd ./${DPDK_DIR} +sudo sed -i 's/^CONFIG_RTE_LIBRTE_PMD_PCAP=n/CONFIG_RTE_LIBRTE_PMD_PCAP=y/g' ./config/common_base +sudo make install T=x86_64-native-linuxapp-gcc +cd ${PWDDIR} + +# compile the TLDK +export RTE_SDK=${ROOTDIR}/${DPDK_DIR}/ +export RTE_TARGET=x86_64-native-linuxapp-gcc +cd ${ROOTDIR}/tldk +make all +cd ${PWDDIR} + +sudo killall -9 l4fwd 2>/dev/null + +sleep 5 + +pid=`pgrep l4fwd` +if [ "$pid" != "" ]; then + echo "terminate the l4fwd failed!" + exit 1 +fi + +# check and setup the hugepages +SYS_HUGEPAGE=$(cat /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages) +if [ ${SYS_HUGEPAGE} -lt 1024 ]; then + MOUNT=$(mount | grep /mnt/huge) + while [ "${MOUNT}" != "" ] + do + sudo umount /mnt/huge + sleep 1 + MOUNT=$(mount | grep /mnt/huge) + done + + echo 1024 | sudo tee /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages + echo 1024 | sudo tee /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages + + sudo mkdir -p /mnt/huge + sudo mount -t hugetlbfs nodev /mnt/huge/ + test $? -eq 0 || exit 1 +fi diff --git a/tests/tldk/tldk_scripts/run_tldk.sh b/tests/tldk/tldk_scripts/run_tldk.sh new file mode 100755 index 0000000000..0f56f02dfc --- /dev/null +++ b/tests/tldk/tldk_scripts/run_tldk.sh @@ -0,0 +1,53 @@ +#!/bin/bash + +set -x + +ROOTDIR=/tmp/TLDK-testing +PWDDIR=$(pwd) + +rx_file=$1 +tx_file=$2 +nic_pci=$3 +fe_cfg=$4 +be_cfg=$5 +IPv4_addr=$6 +IPv6_addr=$7 + +echo $IPv4_addr + +#kill the l4fwd +sudo killall -9 l4fwd 2>/dev/null + +sleep 2 + +pid=`pgrep l4fwd` +if [ "$pid" != "" ]; then + echo "terminate the l4fwd failed!" + exit 1 +fi + +#mount the hugepages again +sudo umount /mnt/huge +sudo mount -t hugetlbfs nodev /mnt/huge/ +test $? -eq 0 || exit 1 + +sleep 2 + +#run the l4fwd with tag U +# need to install libpcap, libpcap-dev to use --vdev +cd ${ROOTDIR} +if [ "$IPv6_addr" == "NONE" ]; then +sudo sh -c "nohup ./tldk/x86_64-native-linuxapp-gcc/app/l4fwd --lcore='0' \ + -n 2 --vdev 'eth_pcap1,rx_pcap=${rx_file},tx_pcap=${tx_file}' \ + -b ${nic_pci} -- -P -U -R 0x1000 -S 0x1000 -s 0x20 -f ${fe_cfg} -b ${be_cfg} \ + port=0,lcore=0,rx_offload=0,tx_offload=0,ipv4=${IPv4_addr} &" +elif [ "$IPv4_addr" == "NONE" ]; then +sudo sh -c "nohup ./tldk/x86_64-native-linuxapp-gcc/app/l4fwd --lcore='0' \ + -n 2 --vdev 'eth_pcap1,rx_pcap=${rx_file},tx_pcap=${tx_file}' \ + -b ${nic_pci} -- -P -U -R 0x1000 -S 0x1000 -s 0x20 -f ${fe_cfg} -b ${be_cfg} \ + port=0,lcore=0,rx_offload=0,tx_offload=0,ipv6=${IPv6_addr} &" +fi + +cd ${PWDDIR} + +sleep 10 diff --git a/tests/tldk/tldk_testconfig/test_ipv4_assemble_be.cfg b/tests/tldk/tldk_testconfig/test_ipv4_assemble_be.cfg new file mode 100644 index 0000000000..7f7cb8e8fe --- /dev/null +++ b/tests/tldk/tldk_testconfig/test_ipv4_assemble_be.cfg @@ -0,0 +1 @@ +port=0,masklen=24,addr=192.168.1.56,mac=68:05:ca:27:d1:6a diff --git a/tests/tldk/tldk_testconfig/test_ipv4_assemble_fe.cfg b/tests/tldk/tldk_testconfig/test_ipv4_assemble_fe.cfg new file mode 100644 index 0000000000..f3531e0b3a --- /dev/null +++ b/tests/tldk/tldk_testconfig/test_ipv4_assemble_fe.cfg @@ -0,0 +1,2 @@ +#udpfwd config file +lcore=0,op=echo,laddr=0.0.0.0,lport=0x8000,raddr=0.0.0.0,rport=0 diff --git a/tests/tldk/tldk_testconfig/test_ipv4_checksum_be.cfg b/tests/tldk/tldk_testconfig/test_ipv4_checksum_be.cfg new file mode 100644 index 0000000000..c4e39e064f --- /dev/null +++ b/tests/tldk/tldk_testconfig/test_ipv4_checksum_be.cfg @@ -0,0 +1,2 @@ +port=0,masklen=24,addr=192.168.1.56,mac=68:05:ca:27:d1:6a +port=0,addr=2001:4860:b002::56,masklen=64,mac=68:05:ca:27:d1:6a diff --git a/tests/tldk/tldk_testconfig/test_ipv4_checksum_fe.cfg b/tests/tldk/tldk_testconfig/test_ipv4_checksum_fe.cfg new file mode 100644 index 0000000000..9553b7085c --- /dev/null +++ b/tests/tldk/tldk_testconfig/test_ipv4_checksum_fe.cfg @@ -0,0 +1,3 @@ +#udpfwd config file +lcore=0,op=echo,laddr=0.0.0.0,lport=0x8000,raddr=0.0.0.0,rport=0 +lcore=0,op=echo,laddr=::,lport=0x8000,raddr=::,rport=0 diff --git a/tests/tldk/tldk_testconfig/test_ipv4_fragment_be.cfg b/tests/tldk/tldk_testconfig/test_ipv4_fragment_be.cfg new file mode 100644 index 0000000000..e769994319 --- /dev/null +++ b/tests/tldk/tldk_testconfig/test_ipv4_fragment_be.cfg @@ -0,0 +1,2 @@ +port=0,masklen=24,addr=192.168.1.56,mac=68:05:ca:27:d1:6a,mtu=1024 +port=0,addr=2001:4860:b002::56,masklen=64,mac=68:05:ca:27:d1:6a,mtu=1024 diff --git a/tests/tldk/tldk_testconfig/test_ipv4_fragment_fe.cfg b/tests/tldk/tldk_testconfig/test_ipv4_fragment_fe.cfg new file mode 100644 index 0000000000..9553b7085c --- /dev/null +++ b/tests/tldk/tldk_testconfig/test_ipv4_fragment_fe.cfg @@ -0,0 +1,3 @@ +#udpfwd config file +lcore=0,op=echo,laddr=0.0.0.0,lport=0x8000,raddr=0.0.0.0,rport=0 +lcore=0,op=echo,laddr=::,lport=0x8000,raddr=::,rport=0 diff --git a/tests/tldk/tldk_testconfig/test_ipv6_checksum_be.cfg b/tests/tldk/tldk_testconfig/test_ipv6_checksum_be.cfg new file mode 100644 index 0000000000..c4e39e064f --- /dev/null +++ b/tests/tldk/tldk_testconfig/test_ipv6_checksum_be.cfg @@ -0,0 +1,2 @@ +port=0,masklen=24,addr=192.168.1.56,mac=68:05:ca:27:d1:6a +port=0,addr=2001:4860:b002::56,masklen=64,mac=68:05:ca:27:d1:6a diff --git a/tests/tldk/tldk_testconfig/test_ipv6_checksum_fe.cfg b/tests/tldk/tldk_testconfig/test_ipv6_checksum_fe.cfg new file mode 100644 index 0000000000..9553b7085c --- /dev/null +++ b/tests/tldk/tldk_testconfig/test_ipv6_checksum_fe.cfg @@ -0,0 +1,3 @@ +#udpfwd config file +lcore=0,op=echo,laddr=0.0.0.0,lport=0x8000,raddr=0.0.0.0,rport=0 +lcore=0,op=echo,laddr=::,lport=0x8000,raddr=::,rport=0 diff --git a/tests/tldk/tldk_testconfig/test_ipv6_fragment_be.cfg b/tests/tldk/tldk_testconfig/test_ipv6_fragment_be.cfg new file mode 100644 index 0000000000..e769994319 --- /dev/null +++ b/tests/tldk/tldk_testconfig/test_ipv6_fragment_be.cfg @@ -0,0 +1,2 @@ +port=0,masklen=24,addr=192.168.1.56,mac=68:05:ca:27:d1:6a,mtu=1024 +port=0,addr=2001:4860:b002::56,masklen=64,mac=68:05:ca:27:d1:6a,mtu=1024 diff --git a/tests/tldk/tldk_testconfig/test_ipv6_fragment_fe.cfg b/tests/tldk/tldk_testconfig/test_ipv6_fragment_fe.cfg new file mode 100644 index 0000000000..9553b7085c --- /dev/null +++ b/tests/tldk/tldk_testconfig/test_ipv6_fragment_fe.cfg @@ -0,0 +1,3 @@ +#udpfwd config file +lcore=0,op=echo,laddr=0.0.0.0,lport=0x8000,raddr=0.0.0.0,rport=0 +lcore=0,op=echo,laddr=::,lport=0x8000,raddr=::,rport=0 |