diff options
author | Luca Muscariello <lumuscar@cisco.com> | 2022-03-30 22:29:28 +0200 |
---|---|---|
committer | Mauro Sardara <msardara@cisco.com> | 2022-03-31 19:51:47 +0200 |
commit | c46e5df56b67bb8ea7a068d39324c640084ead2b (patch) | |
tree | eddeb17785938e09bc42eec98ee09b8a28846de6 /tests/config.sh | |
parent | 18fa668f25d3cc5463417ce7df6637e31578e898 (diff) |
feat: boostrap hicn 22.02
The current patch provides several new features, improvements,
bug fixes and also complete rewrite of entire components.
- lib
The hicn packet parser has been improved with a new packet
format fully based on UDP. The TCP header is still temporarily
supported but the UDP header will replace completely the new hicn
packet format. Improvements have been made to make sure every
packet parsing operation is made via this library. The current
new header can be used as header between the payload and the
UDP header or as trailer in the UDP surplus area to be tested
when UDP options will start to be used.
- hicn-light
The portable packet forwarder has been completely rewritten from
scratch with the twofold objective to improve performance and
code size but also to drop dependencies such as libparc which is
now removed by the current implementation.
- hicn control
the control library is the agent that is used to program the
packet forwarders via their binary API. This component has
benefited from significant improvements in terms of interaction
model which is now event driven and more robust to failures.
- VPP plugin has been updated to support VPP 22.02
- transport
Major improvement have been made to the RTC protocol, to the
support of IO modules and to the security sub system. Signed
manifests are the default data authenticity and integrity framework.
Confidentiality can be enabled by sharing the encryption key to the
prod/cons layer. The library has been tested with group key based
applications such as broadcast/multicast and real-time on-line
meetings with trusted server keys or MLS.
- testing
Unit testing has been introduced using GoogleTest. One third of
the code base is covered by unit testing with priority on
critical features. Functional testing has also been introduce
using Docker, linux bridging and Robot Framework to define
test with Less Code techniques to facilitate the extension
of the coverage.
Co-authored-by: Mauro Sardara <msardara@cisco.com>
Co-authored-by: Jordan Augé <jordan.auge+fdio@cisco.com>
Co-authored-by: Michele Papalini <micpapal@cisco.com>
Co-authored-by: Angelo Mantellini <manangel@cisco.com>
Co-authored-by: Jacques Samain <jsamain@cisco.com>
Co-authored-by: Olivier Roques <oroques+fdio@cisco.com>
Co-authored-by: Enrico Loparco <eloparco@cisco.com>
Co-authored-by: Giulio Grassi <gigrassi@cisco.com>
Change-Id: I75d0ef70f86d921e3ef503c99271216ff583c215
Signed-off-by: Luca Muscariello <muscariello@ieee.org>
Signed-off-by: Mauro Sardara <msardara@cisco.com>
Diffstat (limited to 'tests/config.sh')
-rwxr-xr-x | tests/config.sh | 290 |
1 files changed, 290 insertions, 0 deletions
diff --git a/tests/config.sh b/tests/config.sh new file mode 100755 index 000000000..bcd27e0b9 --- /dev/null +++ b/tests/config.sh @@ -0,0 +1,290 @@ +#!/usr/bin/env bash + +set -euo pipefail + +SCRIPT_PATH=$( + cd "$(dirname "${BASH_SOURCE}")" + pwd -P +) + +# Import test configurations and names +source ${SCRIPT_PATH}/.env + +set -a +DOCKERFILE=${DOCKERFILE:-Dockerfile.dev} +BASE_IMAGE=${BASE_IMAGE:-hicn} +BUILD_SOFTWARE=${BUILD_SOFTWARE:-1} +set +a + +HIPERF_CMD_RTC="hiperf -n 50 -C -H -R ${RTC_PRODUCER}" +HIPERF_CMD_MEMIF_RTC="${HIPERF_CMD_RTC} -z memif_module" +POSTPROCESS_COMMAND_RAAQM_RTC='tail -n +3 | \ + tr -s " " | \ + cut -f 4 -d " " | \ + sort -n | \ + tail -n 40 | \ + head -n 35 | \ + awk "BEGIN { \ + c=0; \ + s=0; \ + }{ \ + a[n++]=\$1; \ + s+=\$1; \ + } END { \ + print int(a[0]), int(a[n-1]), int(s/n) \ + }"' + +HIPERF_CMD_RAAQM="hiperf -n 50 -i 200 -C -H ${RAAQM_PRODUCER}" +HIPERF_CMD_CBR="${HIPERF_CMD_RAAQM} -W 350 -M 0" +HIPERF_CMD_MEMIF_RAAQM="${HIPERF_CMD_RAAQM} -z memif_module" +HIPERF_CMD_MEMIF_CBR="${HIPERF_CMD_CBR} -z memif_module" + +PING_CMD="hicn-ping-client -m 50 -i 200000 -n ${PING_PRODUCER}" +PING_CMD_MEMIF="${PING_CMD} -z memif_module" +POSTPROCESS_COMMAND_PING='grep trip | \ + cut -f 4 -d " " | \ + sort -n | \ + tail -n 40 | \ + head -n 35 | \ + awk "BEGIN { \ + c=0; \ + s=0; \ + }{ \ + a[n++]=\$1; \ + s+=\$1; \ + } END { \ + print int(a[0]), int(a[n-1]), int(s/n) \ + }"' + +declare -a topologies +declare -a configurations + +# Fill topology array using the same values in the .env file +for topology in $(compgen -A variable | grep TOPOLOGY_); do + topologies+=("${!topology}") +done + +# Fill configurations array using the same values in the .env file +for test in $(compgen -A variable | grep TEST_); do + configurations+=("${!test}") +done + +declare -A tests=( + ["hicn-light-rtc"]="${HIPERF_CMD_RTC} | tee >(>&2 cat) | ${POSTPROCESS_COMMAND_RAAQM_RTC}" + ["vpp-bridge-rtc"]="${HIPERF_CMD_MEMIF_RTC} | tee >(>&2 cat) | ${POSTPROCESS_COMMAND_RAAQM_RTC}" + ["vpp-memif-rtc"]="${HIPERF_CMD_MEMIF_RTC} | tee >(>&2 cat) | ${POSTPROCESS_COMMAND_RAAQM_RTC}" + ["vpp-memif-replication-rtc"]="${HIPERF_CMD_MEMIF_RTC} | tee >(>&2 cat) | ${POSTPROCESS_COMMAND_RAAQM_RTC}" + + ["hicn-light-requin"]="${HIPERF_CMD_RAAQM} | tee >(>&2 cat) | ${POSTPROCESS_COMMAND_RAAQM_RTC}" + ["vpp-bridge-requin"]="${HIPERF_CMD_MEMIF_RAAQM} | tee >(>&2 cat) | ${POSTPROCESS_COMMAND_RAAQM_RTC}" + ["vpp-memif-requin"]="${HIPERF_CMD_MEMIF_RAAQM} | tee >(>&2 cat) | ${POSTPROCESS_COMMAND_RAAQM_RTC}" + ["vpp-memif-replication-requin"]="${HIPERF_CMD_MEMIF_RAAQM} | tee >(>&2 cat) | ${POSTPROCESS_COMMAND_RAAQM_RTC}" + + ["hicn-light-cbr"]="${HIPERF_CMD_CBR} | tee >(>&2 cat) | ${POSTPROCESS_COMMAND_RAAQM_RTC}" + ["vpp-bridge-cbr"]="${HIPERF_CMD_MEMIF_CBR} | tee >(>&2 cat) | ${POSTPROCESS_COMMAND_RAAQM_RTC}" + ["vpp-memif-cbr"]="${HIPERF_CMD_MEMIF_CBR} | tee >(>&2 cat) | ${POSTPROCESS_COMMAND_RAAQM_RTC}" + ["vpp-memif-replication-cbr"]="${HIPERF_CMD_MEMIF_CBR} | tee >(>&2 cat) | ${POSTPROCESS_COMMAND_RAAQM_RTC}" + + ["hicn-light-latency"]="${PING_CMD} | tee >(>&2 cat) | ${POSTPROCESS_COMMAND_PING}" + ["vpp-bridge-latency"]="${PING_CMD_MEMIF} | tee >(>&2 cat) | ${POSTPROCESS_COMMAND_PING}" + ["vpp-memif-latency"]="${PING_CMD_MEMIF} | tee >(>&2 cat) | ${POSTPROCESS_COMMAND_PING}" + ["vpp-memif-replication-latency"]="${PING_CMD_MEMIF} | tee >(>&2 cat) | ${POSTPROCESS_COMMAND_PING}" +) + +declare -A link_model=( + ["500-0-0-0"]="500 0 0 0" + ["500-1-0-0"]="500 1 0 0" + ["500-5-0-0"]="500 5 0 0" + ["500-200-0-0"]="500 200 0 0" + ["100-1-0-0"]="100 1 0 0" + ["100-10-0-0"]="100 10 0 0" + ["100-15-0-0"]="100 15 0 0" + ["200-5-0-0"]="200 5 0 0" + ["300-5-0-0"]="300 5 0 0" + ["400-5-0-0"]="400 5 0 0" + ["1000-1-0-0"]="1000 1 0 0" + ["10-50-1-10"]="10 50 1 10" +) + +function topology_exists() { + [[ "${topologies[*]}" =~ ${1} ]] && return 0 || return 1 +} + +function test_exists() { + [[ "${!tests[*]}" =~ ${1} ]] && return 0 || return 1 +} + +function conf_exists() { + [[ "${configurations[*]}" =~ ${1} ]] && return 0 || return 1 +} + + +# test-name client/server link-model +function setchannel() { + if ! conf_exists "${1}"; then + error "Error: topology does not exist." + fi + + if ! test_exists "${1}"; then + error "Error: test does not exist." + fi + docker exec "${1}-${2}" bash -c "/workspace/tests/config.sh link set br0\ + ${link_model[${3}]}" +} +# test-name client/server link-model +function changechannel() { + if ! conf_exists "${1}"; then + error "Error: topology does not exist." + fi + + if ! test_exists "${1}"; then + error "Error: test does not exist." + fi + docker exec "${1}-${2}" bash -c "/workspace/tests/config.sh link change br0\ + ${link_model[${3}]}" +} + +# channel set/change dev rate delay jitter lossrate +function channel() { + DEV=${2} + RATE=${3}mbit + DELAY=${4}ms + JITTER=${5}ms + LOSS=${6} + if [[ $1 == set ]]; then + sudo tc qdisc add dev "${DEV}" root handle 1:0 htb default 1 + sudo tc class add dev "${DEV}" parent 1:0 classid 1:1 htb rate "$RATE" + sudo tc qdisc add dev "${DEV}" parent 1:1 handle 2:0 netem delay "${DELAY}" \ + "${JITTER}" loss random "${LOSS}" + echo "Dev: ${DEV}, rate: ${RATE}, delay: ${DELAY}, jitter: ${JITTER}, loss: ${LOSS}%" + elif [[ ${1} == change ]]; then + sudo tc qdisc change dev "$DEV" parent 1:1 handle 2:0 netem delay "$DELAY" \ + "${JITTER}" loss random "${LOSS}" + echo "Dev: ${DEV}, rate: ${RATE}, delay: ${DELAY}, jitter: ${JITTER}, loss: ${LOSS}%" + else + sudo tc qdisc del dev "${DEV}" root + echo "set or change" + fi +} +function error() { + echo >&2 "${@}" + return 1 +} + +function build() { + docker-compose -f build.yml build + docker-compose -f build.yml up --force-recreate --remove-orphans >/dev/null +} + +function setup() { + topology=${1} + conf=${2} + + if ! topology_exists "${topology}"; then + error "Error: topology does not exist." + fi + + if ! conf_exists "${conf}"; then + error "Error: topology does not exist." + fi + + docker-compose -f "${topology}".yml -f "${topology}-${conf}".yml build + docker-compose -f "${topology}".yml -f "${topology}-${conf}".yml up --remove-orphans --force-recreate -d + + sleep 10 +} + +function start() { + conf=${1} + test=${2} + + if ! conf_exists "${conf}"; then + error "Error: configuration does not exist." + fi + + TESTNAME="${conf}-${test}" + + if ! test_exists "${TESTNAME}"; then + error "Error: test does not exist." + fi + + docker exec "${1}"-client bash -c "/workspace/tests/config.sh runtest ${tests[${TESTNAME}]}" +} + +function stop() { + topology="${1}" + conf="${2}" + + if ! topology_exists "${topology}"; then + error "Error: topology does not exist." + fi + + if ! conf_exists "${conf}"; then + error "Error: tect configuration does not exist." + fi + + LOG_FILE="${SCRIPT_PATH}/${topology}-${conf}.log" + rm -f "${LOG_FILE}" + docker-compose -f "${topology}".yml -f "${topology}-${conf}".yml down || true +} + +function stopall() { + for topology in "${topologies[@]}"; do + for conf in "${configurations[@]}"; do + stop "${topology}" "${conf}" + done + done +} + +function runtest() { + echo "${@}" | sudo -i +} + +while (("${#}")); do + case "$1" in + 'build') + build + shift + ;; + 'link') + shift + channel "$@" + shift 6 + ;; + 'setchannel') + shift + setchannel "$@" + shift 4 + ;; + 'changechannel') + shift + changechannel "$@" + shift 4 + ;; + 'setup') + setup "${2}" "${3}" + shift 3 + ;; + 'start') + start "${2}" "${3}" + shift 3 + ;; + 'stop') + stop "${2}" "${3}" + shift 3 + ;; + 'stopall') + stopall + shift + ;; + 'runtest') + runtest "${@:2}" + break + ;; + *) + break + ;; + esac +done + +exit 0 |