diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/.env | 1 | ||||
-rw-r--r-- | tests/2-nodes-vpp-memif-local-remote.yml | 116 | ||||
-rwxr-xr-x | tests/config.sh | 53 | ||||
-rw-r--r-- | tests/functional-tests/2-nodes-vpp-memif-local-remote.robot | 21 |
4 files changed, 188 insertions, 3 deletions
diff --git a/tests/.env b/tests/.env index 8d5d23eca..3eeee90c4 100644 --- a/tests/.env +++ b/tests/.env @@ -7,6 +7,7 @@ TEST_LIGHT=hicn-light TEST_VPP_BRIDGE=vpp-bridge TEST_VPP_MEMIF=vpp-memif TEST_VPP_MEMIF_REPLICATION=vpp-memif-replication +TEST_VPP_MEMIF_LOCALREMOTE=vpp-memif-local-remote # names RTC_PRODUCER=b002:0:0:0:abcd::/80 diff --git a/tests/2-nodes-vpp-memif-local-remote.yml b/tests/2-nodes-vpp-memif-local-remote.yml new file mode 100644 index 000000000..90f4b9ebc --- /dev/null +++ b/tests/2-nodes-vpp-memif-local-remote.yml @@ -0,0 +1,116 @@ +version: "3" +version: "3" +services: + client: + container_name: ${TEST_VPP_MEMIF}-client + networks: [] + volumes: + - /tmp/memif:/memif:z + - ..:/workspace:z + command: + - | + if [ -d /workspace/build-dev ]; then + sudo ninja -C /workspace/build-dev install + fi + + sudo mkdir -p /var/log/vpp + sudo tee /etc/vpp/startup.conf <<EOF + cpu { main-core 1 } + buffers { buffers-per-numa 600000 } + plugins { + path /usr/lib/$$(arch)-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins + plugin default { disable } + plugin acl_plugin.so { enable } + plugin nat_plugin.so { enable } + plugin dhcp_plugin.so { enable } + plugin dpdk_plugin.so { enable } + plugin dns_plugin.so { enable } + plugin ping_plugin.so { enable } + plugin memif_plugin.so { enable } + plugin nsim_plugin.so { enable } + plugin hicn_plugin.so { enable } + } + + unix { + startup-config /etc/vpp/client-up.txt + cli-listen /run/vpp/cli.sock + log ${FORWARDER_LOG_PATH} + } + EOF + + sudo tee /etc/vpp/client-up.txt <<EOF + comment { Creating memif } + create memif socket id 1 filename /memif/memif1.sock + create interface memif id 0 socket-id 1 mode ip master + set int state memif1/0 up + comment { Configuring memif } + set int ip addr memif1/0 ${TOPOLOGY_2_NODES_IP_ADDRESS_CLIENT}/24 + set int ip addr memif1/0 ${TOPOLOGY_2_NODES_IP6_ADDRESS_CLIENT}/64 + comment { Add route } + ip route add ${RAAQM_PRODUCER}/128 via ${TOPOLOGY_2_NODES_IP6_ADDRESS_SERVER} memif1/0 + EOF + + sudo rm /memif/memif1.sock + sudo vpp -c /etc/vpp/startup.conf + sleep 5 + + sudo hiperf -q -S -z memif_module ${RAAQM_PRODUCER}/128 & + sleep 1 + + sudo vppctl hicn strategy set 3 prefix ${RAAQM_PRODUCER}/128 + + tail -f /dev/null + + server: + container_name: ${TEST_VPP_MEMIF}-server + networks: [] + volumes: + - /tmp/memif:/memif:z + - ..:/workspace:z + command: + - | + if [ -d /workspace/build-dev ]; then + sudo ninja -C /workspace/build-dev install + fi + + sudo mkdir -p /var/log/vpp + sudo tee /etc/vpp/startup.conf <<EOF + cpu { main-core 2 } + buffers { buffers-per-numa 600000 } + + plugins { + path /usr/lib/$$(arch)-linux-gnu/vpp_plugins:/usr/lib/vpp_plugins + plugin default { disable } + plugin acl_plugin.so { enable } + plugin nat_plugin.so { enable } + plugin dhcp_plugin.so { enable } + plugin dpdk_plugin.so { enable } + plugin dns_plugin.so { enable } + plugin ping_plugin.so { enable } + plugin memif_plugin.so { enable } + plugin nsim_plugin.so { enable } + plugin hicn_plugin.so { enable } + } + unix { + startup-config /etc/vpp/server-up.txt + cli-listen /run/vpp/cli.sock + log ${FORWARDER_LOG_PATH} + } + EOF + + sudo tee /etc/vpp/server-up.txt <<EOF + comment { Creating memif } + create memif socket id 1 filename /memif/memif1.sock + create interface memif id 0 socket-id 1 mode ip slave + set int state memif1/0 up + comment { Configuring memif } + set int ip addr memif1/0 ${TOPOLOGY_2_NODES_IP_ADDRESS_SERVER}/24 + set int ip addr memif1/0 ${TOPOLOGY_2_NODES_IP6_ADDRESS_SERVER}/64 + EOF + + sudo vpp -c /etc/vpp/startup.conf + sleep 5 + + sudo hiperf -q -S -z memif_module ${RAAQM_PRODUCER}/128 & + + tail -f /dev/null diff --git a/tests/config.sh b/tests/config.sh index 2acb36be3..760de8b08 100755 --- a/tests/config.sh +++ b/tests/config.sh @@ -135,7 +135,7 @@ function setchannel() { error "Error: topology does not exist." fi - DOCKER_COMMAND="docker-compose -f ${topology}.yml -f ${topology}-${configuration}.yml exec -T" + local DOCKER_COMMAND="docker-compose -f ${topology}.yml -f ${topology}-${configuration}.yml exec -T" ${DOCKER_COMMAND} "${service}" bash -c "/workspace/tests/config.sh link set ${device} ${link_model[${3}]}" } @@ -150,7 +150,7 @@ function changechannel() { error "Error: topology does not exist." fi - DOCKER_COMMAND="docker-compose -f ${topology}.yml -f ${topology}-${configuration}.yml exec -T" + local DOCKER_COMMAND="docker-compose -f ${topology}.yml -f ${topology}-${configuration}.yml exec -T" ${DOCKER_COMMAND} "${service}" bash -c "/workspace/tests/config.sh link change ${device} ${link_model[${3}]}" } @@ -231,7 +231,7 @@ function start() { error "Error: test does not exist." fi - DOCKER_COMMAND="docker-compose -f ${topology}.yml -f ${topology}-${conf}.yml exec -T" + local DOCKER_COMMAND="docker-compose -f ${topology}.yml -f ${topology}-${conf}.yml exec -T" ${DOCKER_COMMAND} client bash -x /workspace/tests/config.sh runtest "${tests[${TESTNAME}]}" @@ -593,6 +593,49 @@ function ping() { ${ping_tests[${type}]} } +#--------------------------------------------------------------- +# Tests for local-remote strategy +#--------------------------------------------------------------- + +function localremote() { + local DOCKER_COMMAND="docker-compose -f 2-nodes.yml -f 2-nodes-vpp-memif-local-remote.yml exec -T" + + ${DOCKER_COMMAND} "client" sudo bash -c "${HIPERF_CMD_MEMIF_CBR}" + ${DOCKER_COMMAND} "client" sudo /usr/bin/vppctl hicn face show > /tmp/output + + # Check that producer face has received 0 packets + INTEREST_TX="$(cat /tmp/output | grep -A 9 producer | grep "Interest tx" | awk '{print $4}')" + INTEREST_TX="${INTEREST_TX%%[[:cntrl:]]}" + if [[ ${INTEREST_TX} != "0" ]]; then + echo "Received interest on local interface." + exit 1 + fi + + # Check that producer face has sent 0 packets + DATA_RX="$(cat /tmp/output | grep -A 9 producer | grep "Data rx" | awk '{print $4}')" + DATA_RX="${DATA_RX%%[[:cntrl:]]}" + if [[ ${DATA_RX} != "0" ]]; then + echo "Received data on local interface." + exit 1 + fi + + # Check that remote face has sent > 0 packets + DATA_RX="$(cat /tmp/output | grep -A 9 ${TOPOLOGY_2_NODES_IP6_ADDRESS_CLIENT} | grep "Data rx" | awk '{print $4}')" + DATA_RX="${DATA_RX%%[[:cntrl:]]}" + if [[ ${DATA_RX} == "0" ]]; then + echo "No data received on remote interface." + exit 1 + fi + + # Check that remote face has sent > 0 packets + INTEREST_TX="$(cat /tmp/output | grep -A 9 ${TOPOLOGY_2_NODES_IP6_ADDRESS_CLIENT} | grep "Interest tx" | awk '{print $4}')" + INTEREST_TX="${INTEREST_TX%%[[:cntrl:]]}" + if [[ ${INTEREST_TX} == "0" ]]; then + echo "No interest sent on remote interface." + exit 1 + fi +} + #--------------------------------------------------------------# while (("${#}")); do @@ -644,6 +687,10 @@ while (("${#}")); do ping "${2}" break ;; + 'localremote') + localremote + break + ;; *) exit 1 ;; diff --git a/tests/functional-tests/2-nodes-vpp-memif-local-remote.robot b/tests/functional-tests/2-nodes-vpp-memif-local-remote.robot new file mode 100644 index 000000000..31f5143ea --- /dev/null +++ b/tests/functional-tests/2-nodes-vpp-memif-local-remote.robot @@ -0,0 +1,21 @@ +*** Settings *** +Resource ../resources/libraries/robot/runtest.robot +Resource ../resources/libraries/robot/common.robot + +Suite Setup Run Keywords +... Build Topology +... 2-nodes +... vpp-memif-local-remote +... AND +... Check Environment +Suite Teardown Run Keywords +... Destroy Topology + + +*** Test Cases *** +Test traffic received from local face is forwarded to remote face + Log to console Test traffic received from local face is forwarded to remote face + ${result} = Run Process bash -x ${EXECDIR}/config.sh localremote + Log Many + ... stdout: ${result.stdout} + ... stderr: ${result.stderr} |