diff options
Diffstat (limited to 'VNFs/DPPD-PROX/helper-scripts')
30 files changed, 811 insertions, 215 deletions
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/Dockerfile b/VNFs/DPPD-PROX/helper-scripts/rapid/Dockerfile index a62c5dc4..fef0fcaf 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/Dockerfile +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/Dockerfile @@ -17,37 +17,101 @@ ################################################## # Build all components in separate builder image # ################################################## -FROM centos:7 as builder -ARG BUILD_DIR=/opt/rapid +FROM ubuntu:20.04 as builder -COPY ./port_info ${BUILD_DIR}/port_info +ARG DPDK_VERSION=22.07 +ENV DPDK_VERSION=${DPDK_VERSION} -COPY ./deploycentostools.sh ${BUILD_DIR}/ -RUN chmod +x ${BUILD_DIR}/deploycentostools.sh \ - && ${BUILD_DIR}/deploycentostools.sh -k deploy +ARG BUILD_DIR="/opt/rapid" +ENV BUILD_DIR=${BUILD_DIR} + +ENV DEBIAN_FRONTEND=noninteractive + +# Install Dependencies +RUN apt update && apt -y install git wget gcc unzip libpcap-dev libncurses5-dev \ + libedit-dev liblua5.3-dev linux-headers-generic iperf3 pciutils \ + libnuma-dev vim tuna wireshark make driverctl openssh-server sudo \ + meson python3-pyelftools pkg-config + +WORKDIR ${BUILD_DIR} + +# Install DPDK +RUN wget http://fast.dpdk.org/rel/dpdk-${DPDK_VERSION}.tar.xz \ + && tar -xf ./dpdk-${DPDK_VERSION}.tar.xz \ + && cd dpdk-${DPDK_VERSION} \ + && meson build -Dlibdir=lib/x86_64-linux-gnu -Denable_driver_sdk=true \ + && ninja -C build install + +WORKDIR ${BUILD_DIR} + +# Install Prox +RUN git clone https://gerrit.opnfv.org/gerrit/samplevnf \ + && cd samplevnf/VNFs/DPPD-PROX \ + && COMMIT_ID=$(git rev-parse HEAD) \ + && echo "${COMMIT_ID}" > ${BUILD_DIR}/commit_id \ + && meson build \ + && ninja -C build \ + && cp ${BUILD_DIR}/samplevnf/VNFs/DPPD-PROX/build/prox ${BUILD_DIR}/prox + +# Build and copy port info app +WORKDIR ${BUILD_DIR}/samplevnf/VNFs/DPPD-PROX/helper-scripts/rapid/port_info +RUN meson build \ + && ninja -C build \ + && cp ${BUILD_DIR}/samplevnf/VNFs/DPPD-PROX/helper-scripts/rapid/port_info/build/port_info_app ${BUILD_DIR}/port_info_app + +RUN ldconfig && pkg-config --modversion libdpdk > ${BUILD_DIR}/dpdk_version +# Create Minimal Install +RUN ldd ${BUILD_DIR}/prox | awk '$2 ~ /=>/ {print $3}' >> ${BUILD_DIR}/list_of_install_components \ + && echo "${BUILD_DIR}/prox" >> ${BUILD_DIR}/list_of_install_components \ + && echo "${BUILD_DIR}/port_info_app" >> ${BUILD_DIR}/list_of_install_components \ + && echo "${BUILD_DIR}/commit_id" >> ${BUILD_DIR}/list_of_install_components \ + && echo "${BUILD_DIR}/dpdk_version" >> ${BUILD_DIR}/list_of_install_components \ + && find /usr/local/lib/x86_64-linux-gnu -not -path '*/\.*' >> ${BUILD_DIR}/list_of_install_components \ + && tar -czvhf ${BUILD_DIR}/install_components.tgz -T ${BUILD_DIR}/list_of_install_components ############################# # Create slim runtime image # ############################# -FROM centos:7 +FROM ubuntu:20.04 + +ARG BUILD_DIR="/opt/rapid" +ENV BUILD_DIR=${BUILD_DIR} + +ENV DEBIAN_FRONTEND=noninteractive -ARG BUILD_DIR=/opt/rapid +# Install Runtime Dependencies +RUN apt update -y +# Install required dynamically linked libraries + required packages +RUN apt -y install sudo openssh-server libatomic1 -COPY ./deploycentostools.sh ${BUILD_DIR}/ COPY --from=builder ${BUILD_DIR}/install_components.tgz ${BUILD_DIR}/install_components.tgz -COPY --from=builder ${BUILD_DIR}/src ${BUILD_DIR}/src -RUN chmod a+rwx ${BUILD_DIR} && chmod +x ${BUILD_DIR}/deploycentostools.sh \ - && ${BUILD_DIR}/deploycentostools.sh -k runtime_image +WORKDIR / +RUN tar -xvf ${BUILD_DIR}/install_components.tgz --skip-old-files +RUN ldconfig +RUN rm ${BUILD_DIR}/install_components.tgz # Expose SSH and PROX ports EXPOSE 22 8474 +RUN useradd -rm -d /home/rapid -s /bin/bash -g root -G sudo -u 1000 rapid \ + && chmod 777 ${BUILD_DIR} \ + && echo 'rapid:rapid' | chpasswd \ + && mkdir /home/rapid/.ssh + # Copy SSH keys -COPY ./rapid_rsa_key.pub /home/centos/.ssh/authorized_keys +COPY ./rapid_rsa_key.pub /home/rapid/.ssh/authorized_keys COPY ./rapid_rsa_key.pub /root/.ssh/authorized_keys +RUN chown rapid:root /home/rapid/.ssh/authorized_keys \ + && chmod 600 /home/rapid/.ssh/authorized_keys \ + && chown root:root /root/.ssh/authorized_keys \ + && chmod 600 /root/.ssh/authorized_keys + +#RUN apt-get clean && apt autoremove --purge +RUN apt-get autoremove -y && apt-get clean all && rm -rf /var/cache/apt + # Copy startup script COPY ./start.sh /start.sh RUN chmod +x /start.sh diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/configs/esp.cfg b/VNFs/DPPD-PROX/helper-scripts/rapid/configs/esp.cfg new file mode 100644 index 00000000..31728daf --- /dev/null +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/configs/esp.cfg @@ -0,0 +1,47 @@ +[lua] +dofile("parameters.lua") + +[eal options] +-n=4 ; force number of memory channels +no-output=no ; disable DPDK debug output +eal=--proc-type auto ${eal} + +[port 0] +name=if0 +mac=hardware +rx desc=2048 +tx desc=2048 +vlan=yes +vdev=esp_tap +local ipv4=$local_ip1 + +[defaults] +mempool size=64K + +[global] +name=${name} + +[core $mcore] +mode=master + +[core $cores] +name=enc +task=0 +mode=esp_enc +sub mode=l3 +remote ipv4=$dest_ip1 +rx port=if0 +tx cores=$altcores task=0 +drop=yes + + +[core $altcores] +name=dec +task=0 +mode=esp_dec +sub mode=l3 +remote ipv4=$dest_ip1 +rx ring=yes +tx port=if0 +drop=yes + diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/deploycentostools.sh b/VNFs/DPPD-PROX/helper-scripts/rapid/deploycentostools.sh index c50d7968..a0fe7cb2 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/deploycentostools.sh +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/deploycentostools.sh @@ -44,7 +44,8 @@ function os_pkgs_install() numactl-devel vim tuna openssl-devel wireshark \ make driverctl - ${SUDO} wget https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/linux/nasm-2.14.02-0.fc27.x86_64.rpm + ${SUDO} wget --no-check-certificate \ + https://www.nasm.us/pub/nasm/releasebuilds/2.14.02/linux/nasm-2.14.02-0.fc27.x86_64.rpm ${SUDO} rpm -ivh nasm-2.14.02-0.fc27.x86_64.rpm } @@ -55,6 +56,12 @@ function k8s_os_pkgs_runtime_install() # Install required dynamically linked libraries + required packages ${SUDO} yum install -y numactl-libs libpcap openssh openssh-server \ openssh-clients sudo + + # Install additional packets for universal image + ${SUDO} yum install -y epel-release python3 kubernetes-client + ${SUDO} yum install -y python3-paramiko python3-future + ${SUDO} python3 -m pip install --upgrade pip + ${SUDO} pip3 install scp kubernetes } function os_cfg() diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/dockerimage.sh b/VNFs/DPPD-PROX/helper-scripts/rapid/dockerimage.sh index e0f38ade..e2266e58 100755 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/dockerimage.sh +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/dockerimage.sh @@ -16,7 +16,7 @@ ## PROX_DEPLOY_DIR="." -PROX_IMAGE_NAME="prox_slim" +PROX_IMAGE_NAME="rapid" RSA_KEY_FILE_NAME="rapid_rsa_key" DOCKERFILE="Dockerfile" diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/helper.lua b/VNFs/DPPD-PROX/helper-scripts/rapid/helper.lua index 1b4c657b..a5633409 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/helper.lua +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/helper.lua @@ -21,7 +21,7 @@ function convertIPToHex(ip) return "IP ADDRESS ERROR" end - local chunks = {ip:match("^(%d+)%.(%d+)%.(%d+)%.(%d+)(\/%d+)$")} + local chunks = {ip:match("^(%d+)%.(%d+)%.(%d+)%.(%d+)(/%d+)$")} if #chunks == 5 then for i,v in ipairs(chunks) do if i < 5 then diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/pod-rapid.yaml b/VNFs/DPPD-PROX/helper-scripts/rapid/pod-rapid.yaml index 6d5e8205..9e269f60 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/pod-rapid.yaml +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/pod-rapid.yaml @@ -17,12 +17,12 @@ spec: name: hugepages resources: requests: - hugepages-2Mi: 512Mi + hugepages-2Mi: 1Gi memory: 1Gi cpu: 8 intel.com/intel_sriov_vfio: '1' limits: - hugepages-2Mi: 512Mi + hugepages-2Mi: 1Gi memory: 1Gi cpu: 8 intel.com/intel_sriov_vfio: '1' diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/port_info/meson.build b/VNFs/DPPD-PROX/helper-scripts/rapid/port_info/meson.build new file mode 100644 index 00000000..f2efd667 --- /dev/null +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/port_info/meson.build @@ -0,0 +1,101 @@ +## +## +## 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. +## + +project('port-info', 'C', + version: + run_command(['git', 'describe', + '--abbrev=8', '--dirty', '--always']).stdout().strip(), + license: 'Apache', + default_options: ['buildtype=release', 'c_std=gnu99'], + meson_version: '>= 0.47' +) + +cc = meson.get_compiler('c') + +# Configure options for prox +# Grab the DPDK version here "manually" as it is not available in the dpdk_dep +# object +dpdk_version = run_command('pkg-config', '--modversion', 'libdpdk').stdout() + + +cflags = [ + '-DPROGRAM_NAME="port_info_app"', + '-fno-stack-protector', + '-DGRE_TP', + '-D_GNU_SOURCE'] # for PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP + +# Add configured cflags to arguments +foreach arg: cflags + add_project_arguments(arg, language: 'c') +endforeach + +# enable warning flags if they are supported by the compiler +warning_flags = [ + '-Wno-unused', + '-Wno-unused-parameter', + '-Wno-unused-result', + '-Wno-deprecated-declarations'] + +foreach arg: warning_flags + if cc.has_argument(arg) + add_project_arguments(arg, language: 'c') + endif +endforeach + +has_sym_args = [ + [ 'HAVE_LIBEDIT_EL_RFUNC_T', 'histedit.h', + 'el_rfunc_t' ], +] +config = configuration_data() +foreach arg:has_sym_args + config.set(arg[0], cc.has_header_symbol(arg[1], arg[2])) +endforeach +configure_file(output : 'libedit_autoconf.h', configuration : config) + +# All other dependencies +dpdk_dep = dependency('libdpdk', required: true) +tinfo_dep = dependency('tinfo', required: false) +threads_dep = dependency('threads', required: true) +pcap_dep = dependency('pcap', required: true) +libedit_dep = dependency('libedit', required: true) +math_dep = cc.find_library('m', required : false) +dl_dep = cc.find_library('dl', required : true) + +deps = [dpdk_dep, + tinfo_dep, + threads_dep, + pcap_dep, + libedit_dep, + math_dep, + dl_dep] + +# Explicitly add these to the dependency list +deps += [cc.find_library('rte_bus_pci', required: true)] +deps += [cc.find_library('rte_bus_vdev', required: true)] + +if dpdk_version.version_compare('<20.11.0') +deps += [cc.find_library('rte_pmd_ring', required: true)] +else +deps += [cc.find_library('rte_net_ring', required: true)] +endif + +sources = files( + 'port_info.c') + +executable('port_info_app', + sources, + c_args: cflags, + dependencies: deps, + install: true) diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/port_info/port_info.c b/VNFs/DPPD-PROX/helper-scripts/rapid/port_info/port_info.c index 79bd0c0b..917c0636 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/port_info/port_info.c +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/port_info/port_info.c @@ -21,7 +21,11 @@ #include <rte_version.h> static const uint16_t rx_rings = 1, tx_rings = 1; +#if RTE_VERSION < RTE_VERSION_NUM(21,11,0,0) static const struct rte_eth_conf port_conf = { .link_speeds = ETH_LINK_SPEED_AUTONEG }; +#else +static const struct rte_eth_conf port_conf = { .link_speeds = RTE_ETH_LINK_SPEED_AUTONEG }; +#endif static inline int port_info(void) diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py b/VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py index 40375c54..8754ebc4 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/prox_ctrl.py @@ -26,32 +26,31 @@ import time import subprocess import socket from rapid_log import RapidLog +from rapid_sshclient import SSHClient class prox_ctrl(object): - def __init__(self, ip, key=None, user=None): + def __init__(self, ip, key=None, user=None, password = None): self._ip = ip self._key = key self._user = user + self._password = password self._proxsock = [] + self._sshclient = SSHClient(ip = ip, user = user, password = password, + rsa_private_key = key, timeout = None) def ip(self): return self._ip - def test_connect(self): - """Simply try to run 'true' over ssh on remote system. - On failure, raise RuntimeWarning exception when possibly worth - retrying, and raise RuntimeError exception otherwise. - """ - return self.run_cmd('test -e /opt/rapid/system_ready_for_rapid', True) - - def connect(self): + def test_connection(self): attempts = 1 RapidLog.debug("Trying to connect to machine \ on %s, attempt: %d" % (self._ip, attempts)) while True: try: - self.test_connect() - break + if (self.run_cmd('test -e /opt/rapid/system_ready_for_rapid \ + && echo exists')): + break + time.sleep(2) except RuntimeWarning as ex: RapidLog.debug("RuntimeWarning %d:\n%s" % (ex.returncode, ex.output.strip())) @@ -87,18 +86,9 @@ class prox_ctrl(object): for sock in self._proxsock: sock.quit() - def run_cmd(self, command, _connect=False): - """Execute command over ssh on remote system. - Wait for remote command completion. - Return command output (combined stdout and stderr). - _connect argument is reserved for connect() method. - """ - cmd = self._build_ssh(command) - try: - return subprocess.check_output(cmd, stderr=subprocess.STDOUT) - except subprocess.CalledProcessError as ex: - RapidLog.exception('ssh returned exit status %d:\n%s' - % (ex.returncode, ex.output.strip())) + def run_cmd(self, command): + self._sshclient.run_cmd(command) + return self._sshclient.get_output() def prox_sock(self, port=8474): """Connect to the PROX instance on remote system. @@ -114,64 +104,13 @@ class prox_ctrl(object): return None def scp_put(self, src, dst): - """Copy src file from local system to dst on remote system.""" - cmd = [ 'scp', - '-B', - '-oStrictHostKeyChecking=no', - '-oUserKnownHostsFile=/dev/null', - '-oLogLevel=ERROR' ] - if self._key is not None: - cmd.extend(['-i', self._key]) - cmd.append(src) - remote = '' - if self._user is not None: - remote += self._user + '@' - remote += self._ip + ':' + dst - cmd.append(remote) - try: - # Actually ignore output on success, but capture stderr on failure - subprocess.check_output(cmd, stderr=subprocess.STDOUT) - except subprocess.CalledProcessError as ex: - RapidLog.exception('scp returned exit status %d:\n%s' - % (ex.returncode, ex.output.strip())) + self._sshclient.scp_put(src, dst) + RapidLog.info("Copying from {} to {}:{}".format(src, self._ip, dst)) def scp_get(self, src, dst): - """Copy src file from remote system to dst on local system.""" - cmd = [ 'scp', - '-B', - '-oStrictHostKeyChecking=no', - '-oUserKnownHostsFile=/dev/null', - '-oLogLevel=ERROR' ] - if self._key is not None: - cmd.extend(['-i', self._key]) - remote = '' - if self._user is not None: - remote += self._user + '@' - remote += self._ip + ':/home/' + self._user + src - cmd.append(remote) - cmd.append(dst) - try: - # Actually ignore output on success, but capture stderr on failure - subprocess.check_output(cmd, stderr=subprocess.STDOUT) - except subprocess.CalledProcessError as ex: - RapidLog.exception('scp returned exit status %d:\n%s' - % (ex.returncode, ex.output.strip())) - - def _build_ssh(self, command): - cmd = [ 'ssh', - '-oBatchMode=yes', - '-oStrictHostKeyChecking=no', - '-oUserKnownHostsFile=/dev/null', - '-oLogLevel=ERROR' ] - if self._key is not None: - cmd.extend(['-i', self._key]) - remote = '' - if self._user is not None: - remote += self._user + '@' - remote += self._ip - cmd.append(remote) - cmd.append(command) - return cmd + self._sshclient.scp_get('/home/' + self._user + src, dst) + RapidLog.info("Copying from {}:/home/{}{} to {}".format(self._ip, + self._user, src, dst)) class prox_sock(object): def __init__(self, sock): diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid.pods b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid.pods index f5681397..cd54d507 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid.pods +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid.pods @@ -16,6 +16,7 @@ [DEFAULT] total_number_of_pods=2 +namespace=rapid-testing [POD1] nodeSelector_hostname=k8s-node1 diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_defaults.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_defaults.py index f45b4dcf..27d2430d 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_defaults.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_defaults.py @@ -21,7 +21,7 @@ class RapidDefaults(object): Class to define the test defaults """ test_params = { - 'version' : '2021.03.15', # Please do NOT change, used for debugging + 'version' : '2023.01.16', # Please do NOT change, used for debugging 'environment_file' : 'rapid.env', #Default string for environment 'test_file' : 'tests/basicrapid.test', #Default string for test 'machine_map_file' : 'machine.map', #Default string for machine map file @@ -31,5 +31,6 @@ class RapidDefaults(object): 'configonly' : False, # If True, the system will upload all the necessary config fiels to the VMs, but not start PROX and the actual testing 'rundir' : '/opt/rapid', # Directory where to find the tools in the machines running PROX 'resultsdir' : '.', # Directory where to store log files + 'sleep_time' : 2, # Sleep time between two loop iteration. Minimum is 2 seconds. Might be useful to let SUT clean caches 'lat_percentile' : 0.99 } diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_flowsizetest.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_flowsizetest.py index 0ca7c71f..ea42fc9a 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_flowsizetest.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_flowsizetest.py @@ -32,12 +32,13 @@ class FlowSizeTest(RapidTest): Class to manage the flowsizetesting """ def __init__(self, test_param, lat_percentile, runtime, testname, - environment_file, gen_machine, sut_machine, background_machines): + environment_file, gen_machine, sut_machine, background_machines, sleep_time): super().__init__(test_param, runtime, testname, environment_file) self.gen_machine = gen_machine self.sut_machine = sut_machine self.background_machines = background_machines self.test['lat_percentile'] = lat_percentile + self.test['sleep_time'] = sleep_time if self.test['test'] == 'TST009test': # This test implements some of the testing as defined in # https://docbox.etsi.org/ISG/NFV/open/Publications_pdf/Specs-Reports/NFV-TST%20009v3.2.1%20-%20GS%20-%20NFVI_Benchmarks.pdf @@ -52,7 +53,7 @@ class FlowSizeTest(RapidTest): self.test['TST009_S'].append((m+1) * self.test['stepsize']) elif self.test['test'] == 'fixed_rate': for key in['drop_rate_threshold','lat_avg_threshold', - 'lat_perc_threshold','lat_max_threshold']: + 'lat_perc_threshold','lat_max_threshold','mis_ordered_threshold']: self.test[key] = inf def new_speed(self, speed,size,success): @@ -109,6 +110,11 @@ class FlowSizeTest(RapidTest): FLOWSIZE = self.test['warmupflowsize'] WARMUPSPEED = self.test['warmupspeed'] WARMUPTIME = self.test['warmuptime'] + + if WARMUPTIME == 0: + RapidLog.info(("Not Warming up")) + return + RapidLog.info(("Warming up during {} seconds..., packet size = {}," " flows = {}, speed = {}").format(WARMUPTIME, imix, FLOWSIZE, WARMUPSPEED)) @@ -116,8 +122,9 @@ class FlowSizeTest(RapidTest): self.set_background_speed(self.background_machines, WARMUPSPEED) self.gen_machine.set_udp_packet_size(imix) self.set_background_size(self.background_machines, imix) - _ = self.gen_machine.set_flows(FLOWSIZE) - self.set_background_flows(self.background_machines, FLOWSIZE) + if FLOWSIZE: + _ = self.gen_machine.set_flows(FLOWSIZE) + self.set_background_flows(self.background_machines, FLOWSIZE) self.gen_machine.start() self.start_background_traffic(self.background_machines) time.sleep(WARMUPTIME) @@ -140,31 +147,32 @@ class FlowSizeTest(RapidTest): else: backgroundinfo = '{}{}'.format(bcolors.FLASH,bcolors.ENDC) self.set_background_size(self.background_machines, imix) - RapidLog.info('+' + '-' * 188 + '+') + RapidLog.info('+' + '-' * 200 + '+') RapidLog.info(("| UDP, {:>5} bytes, different number of flows by " - "randomizing SRC & DST UDP port. {:116.116}|"). + "randomizing SRC & DST UDP port. {:128.128}|"). format(round(size), backgroundinfo)) RapidLog.info('+' + '-' * 8 + '+' + '-' * 18 + '+' + '-' * 13 + '+' + '-' * 13 + '+' + '-' * 13 + '+' + '-' * 24 + '+' + '-' * 10 + '+' + '-' * 10 + '+' + '-' * 10 + '+' + '-' * 11 + '+' + '-' * 11 + '+' + '-' * 11 + '+' + '-' * 11 + '+' - + '-' * 7 + '+' + '-' * 4 + '+') + + '-' * 7 + '+' + '-' * 11 + '+' + '-' * 4 + '+') RapidLog.info(('| Flows | Speed requested | Gen by core | Sent by' ' NIC | Fwrd by SUT | Rec. by core | Avg. Lat.|{:.0f}' ' Pcentil| Max. Lat.| Sent | Received | Lost | Total' - ' Lost|L.Ratio|Time|').format(self.test['lat_percentile']*100)) + ' Lost|L.Ratio|Mis-ordered|Time').format(self.test['lat_percentile']*100)) RapidLog.info('+' + '-' * 8 + '+' + '-' * 18 + '+' + '-' * 13 + '+' + '-' * 13 + '+' + '-' * 13 + '+' + '-' * 24 + '+' + '-' * 10 + '+' + '-' * 10 + '+' + '-' * 10 + '+' + '-' * 11 + '+' + '-' * 11 + '+' + '-' * 11 + '+' + '-' * 11 + '+' - + '-' * 7 + '+' + '-' * 4 + '+') + + '-' * 7 + '+' + '-' * 11 + '+' + '-' * 4 + '+') for flow_number in self.test['flows']: attempts = 0 self.gen_machine.reset_stats() if self.sut_machine: self.sut_machine.reset_stats() - flow_number = self.gen_machine.set_flows(flow_number) - self.set_background_flows(self.background_machines, flow_number) + if flow_number != 0: + flow_number = self.gen_machine.set_flows(flow_number) + self.set_background_flows(self.background_machines, flow_number) end_data['speed'] = None speed = self.get_start_speed_and_init(size) while True: @@ -199,6 +207,7 @@ class FlowSizeTest(RapidTest): 'lat_perc' : bcolors.ENDC, 'lat_max' : bcolors.ENDC, 'abs_drop_rate' : bcolors.ENDC, + 'mis_ordered' : bcolors.ENDC, 'drop_rate' : bcolors.ENDC} if self.test['test'] == 'fixed_rate': end_data = copy.deepcopy(iteration_data) @@ -217,30 +226,42 @@ class FlowSizeTest(RapidTest): # the drop rate is below a treshold, either we want that no # packet has been lost during the test. # This can be specified by putting 0 in the .test file - elif ((iteration_data['drop_rate'] < self.test['drop_rate_threshold']) or (iteration_data['abs_dropped']==self.test['drop_rate_threshold']==0)) and (iteration_data['lat_avg']< self.test['lat_avg_threshold']) and (iteration_data['lat_perc']< self.test['lat_perc_threshold']) and (iteration_data['lat_max'] < self.test['lat_max_threshold']): + elif ((self.get_pps(speed,size) - iteration_data['pps_tx']) / self.get_pps(speed,size)) \ + < self.test['generator_threshold'] and \ + ((iteration_data['drop_rate'] < self.test['drop_rate_threshold']) or \ + (iteration_data['abs_dropped']==self.test['drop_rate_threshold']==0)) and \ + (iteration_data['lat_avg']< self.test['lat_avg_threshold']) and \ + (iteration_data['lat_perc']< self.test['lat_perc_threshold']) and \ + (iteration_data['lat_max'] < self.test['lat_max_threshold'] and \ + iteration_data['mis_ordered'] <= self.test['mis_ordered_threshold']): + end_data = copy.deepcopy(iteration_data) + end_prefix = copy.deepcopy(iteration_prefix) + success = True + success_message=' SUCCESS' if (old_div((self.get_pps(speed,size) - iteration_data['pps_tx']),self.get_pps(speed,size)))>0.01: iteration_prefix['speed'] = bcolors.WARNING if iteration_data['abs_tx_fail'] > 0: gen_warning = bcolors.WARNING + ' Network limit?: requesting {:<.3f} Mpps and getting {:<.3f} Mpps - {} failed to be transmitted'.format(self.get_pps(speed,size), iteration_data['pps_tx'], iteration_data['abs_tx_fail']) + bcolors.ENDC else: gen_warning = bcolors.WARNING + ' Generator limit?: requesting {:<.3f} Mpps and getting {:<.3f} Mpps'.format(self.get_pps(speed,size), iteration_data['pps_tx']) + bcolors.ENDC + endwarning = '| | {:186.186} |'.format(retry_warning + lat_warning + gen_warning) + RapidLog.debug(self.report_result(-attempts, size, + iteration_data, iteration_prefix) + success_message + + retry_warning + lat_warning + gen_warning) + break else: iteration_prefix['speed'] = bcolors.ENDC gen_warning = '' - end_data = copy.deepcopy(iteration_data) - end_prefix = copy.deepcopy(iteration_prefix) - if lat_warning or gen_warning or retry_warning: - endwarning = '| | {:186.186} |'.format(retry_warning + lat_warning + gen_warning) - success = True - success_message=' SUCCESS' - RapidLog.debug(self.report_result(-attempts, size, - iteration_data, iteration_prefix) + success_message + - retry_warning + lat_warning + gen_warning) + if lat_warning or retry_warning: + endwarning = '| | {:186.186} |'.format(retry_warning + lat_warning) + RapidLog.debug(self.report_result(-attempts, size, + iteration_data, iteration_prefix) + success_message + + retry_warning + lat_warning + gen_warning) else: success_message=' FAILED' if ((iteration_data['abs_dropped']>0) and (self.test['drop_rate_threshold'] ==0)): iteration_prefix['abs_drop_rate'] = bcolors.FAIL - if (iteration_data['drop_rate'] < self.test['drop_rate_threshold']): + if (iteration_data['drop_rate'] <= self.test['drop_rate_threshold']): iteration_prefix['drop_rate'] = bcolors.ENDC else: iteration_prefix['drop_rate'] = bcolors.FAIL @@ -260,6 +281,11 @@ class FlowSizeTest(RapidTest): iteration_prefix['speed'] = bcolors.ENDC else: iteration_prefix['speed'] = bcolors.FAIL + if (iteration_data['mis_ordered']< self.test['mis_ordered_threshold']): + iteration_prefix['mis_ordered'] = bcolors.ENDC + else: + iteration_prefix['mis_ordered'] = bcolors.FAIL + success = False RapidLog.debug(self.report_result(-attempts, size, iteration_data, iteration_prefix) + @@ -295,5 +321,6 @@ class FlowSizeTest(RapidTest): '+' + '-' * 13 + '+' + '-' * 13 + '+' + '-' * 24 + '+' + '-' * 10 + '+' + '-' * 10 + '+' + '-' * 10 + '+' + '-' * 11 + '+' + '-' * 11 + '+' + '-' * 11 + '+' + '-' * 11 + '+' + + '+' + '-' * 11 + '+' + '-' * 7 + '+' + '-' * 4 + '+') return (TestResult, result_details) diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py index 5d6916a7..e52b17db 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_generator_machine.py @@ -17,7 +17,6 @@ ## from rapid_log import RapidLog -from prox_ctrl import prox_ctrl from rapid_machine import RapidMachine from math import ceil, log2 @@ -49,8 +48,8 @@ class RapidGeneratorMachine(RapidMachine): """ Class to deal with a generator PROX instance (VM, bare metal, container) """ - def __init__(self, key, user, vim, rundir, resultsdir, machine_params, - configonly, ipv6): + def __init__(self, key, user, password, vim, rundir, resultsdir, + machine_params, configonly, ipv6): mac_address_size = 6 ethertype_size = 2 FCS_size = 4 @@ -78,8 +77,8 @@ class RapidGeneratorMachine(RapidMachine): self.bucket_size_exp = machine_params['bucket_size_exp'] else: self.bucket_size_exp = 11 - super().__init__(key, user, vim, rundir, resultsdir, machine_params, - configonly) + super().__init__(key, user, password, vim, rundir, resultsdir, + machine_params, configonly) def get_cores(self): return (self.machine_params['gencores'] + @@ -121,8 +120,6 @@ class RapidGeneratorMachine(RapidMachine): # Start the generator with the -e option so that the cores don't # start automatically super().start_prox('-e') - if self.vim in ['kubernetes']: - self.remap_all_cpus() def set_generator_speed(self, speed): # The assumption is that we only use task 0 for generating diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_helm_chart/.helmignore b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_helm_chart/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_helm_chart/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_helm_chart/Chart.yaml b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_helm_chart/Chart.yaml new file mode 100644 index 00000000..4d210409 --- /dev/null +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_helm_chart/Chart.yaml @@ -0,0 +1,6 @@ +apiVersion: v2 +name: rapid +description: A Helm chart for deploying RAPID test scripts and environment +type: application +version: 0.0.1 +appVersion: "1.0.0" diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_helm_chart/templates/deployment.yaml b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_helm_chart/templates/deployment.yaml new file mode 100644 index 00000000..74fc6297 --- /dev/null +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_helm_chart/templates/deployment.yaml @@ -0,0 +1,26 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: rapid-testing + namespace: {{ .Values.namespace }} + labels: + app: rapid-testing +spec: + replicas: 1 + selector: + matchLabels: + app: rapid-testing + template: + metadata: + labels: + app: rapid-testing + spec: + serviceAccountName: rapid-testing-sa + containers: + - name: rapid-mgmt + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_helm_chart/templates/serviceaccount.yaml b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_helm_chart/templates/serviceaccount.yaml new file mode 100644 index 00000000..7886ade3 --- /dev/null +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_helm_chart/templates/serviceaccount.yaml @@ -0,0 +1,36 @@ +--- +apiVersion: v1 +kind: Namespace +metadata: + name: {{ .Values.namespace }} + +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + name: rapid-testing-sa + namespace: {{ .Values.namespace }} + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: rapid-testing-cr +rules: +- apiGroups: [""] + resources: ["pods", "pods/exec", "pods/status"] + verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] + +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: rapid-testing-crb +subjects: +- kind: ServiceAccount + name: rapid-testing-sa + namespace: {{ .Values.namespace }} +roleRef: + kind: ClusterRole + name: rapid-testing-cr + apiGroup: rbac.authorization.k8s.io diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_helm_chart/values.yaml b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_helm_chart/values.yaml new file mode 100644 index 00000000..76b8037a --- /dev/null +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_helm_chart/values.yaml @@ -0,0 +1,8 @@ +namespace: rapid-testing + +image: + repository: opnfv/rapid + tag: "latest" + pullPolicy: IfNotPresent + +nodeSelector: {} diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_irqtest.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_irqtest.py index b0516eeb..de7e6ae3 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_irqtest.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_irqtest.py @@ -45,7 +45,7 @@ class IrqTest(RapidTest): max_loop_duration = 0 machine_details = {} for machine in self.machines: - buckets=machine.socket.show_irq_buckets(1) + buckets=machine.socket.show_irq_buckets(machine.get_cores()[0]) if max_loop_duration == 0: # First time we go through the loop, we need to initialize # result_details diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py index 2d88cd96..1d1112f7 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py @@ -32,7 +32,7 @@ class K8sDeployment: """ LOG_FILE_NAME = "createrapidk8s.log" SSH_PRIVATE_KEY = "./rapid_rsa_key" - SSH_USER = "centos" + SSH_USER = "rapid" POD_YAML_TEMPLATE_FILE_NAME = "pod-rapid.yaml" @@ -40,6 +40,7 @@ class K8sDeployment: _create_config = None _runtime_config = None _total_number_of_pods = 0 + _namespace = "rapid-testing" _pods = [] def __init__(self): @@ -64,7 +65,11 @@ class K8sDeployment: self._log.addHandler(console_handler) # Initialize k8s plugin - config.load_kube_config() + try: + config.load_kube_config() + except: + config.load_incluster_config() + Pod.k8s_CoreV1Api = client.CoreV1Api() def load_create_config(self, config_file_name): @@ -89,6 +94,15 @@ class K8sDeployment: self._log.debug("Total number of pods %d" % self._total_number_of_pods) + if self._create_config.has_option("DEFAULT", "namespace"): + self._namespace = self._create_config.get( + "DEFAULT", "namespace") + else: + self._log.error("No option namespace in DEFAULT section") + return -1 + + self._log.debug("Using namespace %s" % self._total_number_of_pods) + # Parse [PODx] sections for i in range(1, int(self._total_number_of_pods) + 1): # Search for POD name @@ -97,7 +111,7 @@ class K8sDeployment: pod_name = self._create_config.get( "POD%d" % i, "name") else: - pod_name = "pod-rapid-%d" % i + pod_name = "prox-pod-%d" % i # Search for POD hostname if self._create_config.has_option("POD%d" % i, @@ -107,6 +121,14 @@ class K8sDeployment: else: pod_nodeselector_hostname = None + # Search for POD spec + if self._create_config.has_option("POD%d" % i, + "spec_file_name"): + pod_spec_file_name = self._create_config.get( + "POD%d" % i, "spec_file_name") + else: + pod_spec_file_name = K8sDeployment.POD_YAML_TEMPLATE_FILE_NAME + # Search for POD dataplane static IP if self._create_config.has_option("POD%d" % i, "dp_ip"): @@ -123,8 +145,9 @@ class K8sDeployment: else: pod_dp_subnet = "24" - pod = Pod(pod_name) + pod = Pod(pod_name, self._namespace) pod.set_nodeselector(pod_nodeselector_hostname) + pod.set_spec_file_name(pod_spec_file_name) pod.set_dp_ip(pod_dp_ip) pod.set_dp_subnet(pod_dp_subnet) pod.set_id(i) @@ -143,7 +166,7 @@ class K8sDeployment: # Create PODs using template from yaml file for pod in self._pods: self._log.info("Creating POD %s...", pod.get_name()) - pod.create_from_yaml(K8sDeployment.POD_YAML_TEMPLATE_FILE_NAME) + pod.create_from_yaml() # Wait for PODs to start for pod in self._pods: @@ -153,6 +176,7 @@ class K8sDeployment: for pod in self._pods: pod.set_ssh_credentials(K8sDeployment.SSH_USER, K8sDeployment.SSH_PRIVATE_KEY) pod.get_sriov_dev_mac() + pod.get_qat_dev() def save_runtime_config(self, config_file_name): self._log.info("Saving config %s for runrapid script...", @@ -189,6 +213,10 @@ class K8sDeployment: "dp_mac1", pod.get_dp_mac()) self._runtime_config.set("M%d" % pod.get_id(), "dp_pci_dev", pod.get_dp_pci_dev()) + if (pod.get_qat_pci_dev()): + for qat_index, qat_device in enumerate(pod.get_qat_pci_dev()): + self._runtime_config.set("M%d" % pod.get_id(), + "qat_pci_dev%d" % qat_index, qat_device) self._runtime_config.set("M%d" % pod.get_id(), "dp_ip1", pod.get_dp_ip() + "/" + pod.get_dp_subnet()) diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_pod.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_pod.py index d15fe7ff..beaedd69 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_pod.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_pod.py @@ -32,6 +32,7 @@ class Pod: _name = "pod" _namespace = "default" _nodeSelector_hostname = None + _spec_filename = None _last_status = None _id = None _admin_ip = None @@ -49,6 +50,7 @@ class Pod: self._name = name self._namespace = namespace self._ssh_client = SSHClient(logger_name = logger_name) + self.qat_vf = [] def __del__(self): """Destroy POD. Do a cleanup. @@ -56,10 +58,11 @@ class Pod: if self._ssh_client is not None: self._ssh_client.disconnect() - def create_from_yaml(self, file_name): + def create_from_yaml(self): """Load POD description from yaml file. """ - with open(path.join(path.dirname(__file__), file_name)) as yaml_file: + with open(path.join(path.dirname(__file__), + self._spec_filename)) as yaml_file: self.body = yaml.safe_load(yaml_file) self.body["metadata"]["name"] = self._name @@ -67,14 +70,16 @@ class Pod: if (self._nodeSelector_hostname is not None): if ("nodeSelector" not in self.body["spec"]): self.body["spec"]["nodeSelector"] = {} - self.body["spec"]["nodeSelector"]["kubernetes.io/hostname"] = self._nodeSelector_hostname + self.body["spec"]["nodeSelector"]["kubernetes.io/hostname"] = \ + self._nodeSelector_hostname self._log.debug("Creating POD, body:\n%s" % self.body) try: self.k8s_CoreV1Api.create_namespaced_pod(body = self.body, namespace = self._namespace) except client.rest.ApiException as e: - self._log.error("Couldn't create POD %s!\n%s\n" % (self._name, e)) + self._log.error("Couldn't create POD %s!\n%s\n" % (self._name, + e)) def terminate(self): """Terminate POD. Close SSH connection. @@ -138,6 +143,9 @@ class Pod: def get_dp_pci_dev(self): return self._sriov_vf + def get_qat_pci_dev(self): + return self.qat_vf + def get_id(self): return self._id @@ -153,6 +161,28 @@ class Pod: self._last_status = pod.status.phase return self._last_status + def get_qat_dev(self): + """Get qat devices if any, assigned by k8s QAT device plugin. + """ + self._log.info("Checking assigned QAT VF for POD %s" % self._name) + ret = self._ssh_client.run_cmd("cat /opt/rapid/k8s_qat_device_plugin_envs") + if ret != 0: + self._log.error("Failed to check assigned QAT VF!" + "Error %s" % self._ssh_client.get_error()) + return -1 + + cmd_output = self._ssh_client.get_output().decode("utf-8").rstrip() + + if cmd_output: + self._log.debug("Before: Using QAT VF %s" % self.qat_vf) + self._log.debug("Environment variable %s" % cmd_output) + for line in cmd_output.splitlines(): + self.qat_vf.append(line.split("=")[1]) + self._log.debug("Using QAT VF %s" % self.qat_vf) + else: + self._log.debug("No QAT devices for this pod") + self.qat_vf = None + def get_sriov_dev_mac(self): """Get assigned by k8s SRIOV network device plugin SRIOV VF devices. Return 0 in case of sucessfull configuration. @@ -173,8 +203,24 @@ class Pod: self._sriov_vf = cmd_output.split(",")[0] self._log.debug("Using first SRIOV VF %s" % self._sriov_vf) - self._log.info("Getting MAC address for assigned SRIOV VF %s" % self._sriov_vf) - self._ssh_client.run_cmd("sudo /opt/rapid/port_info_app -n 4 -w %s" % self._sriov_vf) + # find DPDK version + self._log.info("Checking DPDK version for POD %s" % self._name) + ret = self._ssh_client.run_cmd("cat /opt/rapid/dpdk_version") + if ret != 0: + self._log.error("Failed to check DPDK version" + "Error %s" % self._ssh_client.get_error()) + return -1 + dpdk_version = self._ssh_client.get_output().decode("utf-8").rstrip() + self._log.debug("DPDK version %s" % dpdk_version) + if (dpdk_version >= '20.11.0'): + allow_parameter = 'allow' + else: + allow_parameter = 'pci-whitelist' + + self._log.info("Getting MAC address for assigned SRIOV VF %s" % \ + self._sriov_vf) + self._ssh_client.run_cmd("sudo /opt/rapid/port_info_app -n 4 \ + --{} {}".format(allow_parameter, self._sriov_vf)) if ret != 0: self._log.error("Failed to get MAC address!" "Error %s" % self._ssh_client.get_error()) @@ -204,6 +250,11 @@ class Pod: """ self._nodeSelector_hostname = hostname + def set_spec_file_name(self, file_name): + """Set pod spec filename. + """ + self._spec_filename = file_name + def set_ssh_credentials(self, user, rsa_private_key): """Set SSH credentials for the SSH connection to the POD. """ diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py index d0ce8c14..47f858d0 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_machine.py @@ -20,17 +20,19 @@ from rapid_log import RapidLog from prox_ctrl import prox_ctrl import os import re +import uuid class RapidMachine(object): """ Class to deal with a PROX instance (VM, bare metal, container) """ - def __init__(self, key, user, vim, rundir, resultsdir, machine_params, - configonly): + def __init__(self, key, user, password, vim, rundir, resultsdir, + machine_params, configonly): self.name = machine_params['name'] self.ip = machine_params['admin_ip'] self.key = key self.user = user + self.password = password self.rundir = rundir self.resultsdir = resultsdir self.dp_ports = [] @@ -40,8 +42,11 @@ class RapidMachine(object): while True: ip_key = 'dp_ip{}'.format(index) mac_key = 'dp_mac{}'.format(index) - if ip_key in machine_params.keys() and mac_key in machine_params.keys(): - dp_port = {'ip': machine_params[ip_key], 'mac' : machine_params[mac_key]} + if ip_key in machine_params.keys(): + if mac_key in machine_params.keys(): + dp_port = {'ip': machine_params[ip_key], 'mac' : machine_params[mac_key]} + else: + dp_port = {'ip': machine_params[ip_key], 'mac' : None} self.dp_ports.append(dict(dp_port)) self.dpdk_port_index.append(index - 1) index += 1 @@ -56,35 +61,40 @@ class RapidMachine(object): PROXConfigfile.close() self.all_tasks_for_this_cfg = set(re.findall("task\s*=\s*(\d+)",PROXConfig)) - def __del__(self): - if ((not self.configonly) and self.machine_params['prox_socket']): - self._client.scp_get('/prox.log', '{}/{}.prox.log'.format( - self.resultsdir, self.name)) - def get_cores(self): return (self.machine_params['cores']) - def expand_cpuset(self, cpuset): - """Expand cpuset provided as comma-separated list of CPU numbers and - CPU ranges of numbers. For more information please see + def expand_list_format(self, list): + """Expand cpuset list format provided as comma-separated list of + numbers and ranges of numbers. For more information please see https://man7.org/linux/man-pages/man7/cpuset.7.html """ - cpuset_expanded = [] - for cpu in cpuset.split(','): - if '-' in cpu: - cpu_range = cpu.split('-') - cpuset_expanded += range(int(cpu_range[0]), int(cpu_range[1]) + 1) + list_expanded = [] + for num in list.split(','): + if '-' in num: + num_range = num.split('-') + list_expanded += range(int(num_range[0]), int(num_range[1]) + 1) else: - cpuset_expanded.append(int(cpu)) - return cpuset_expanded + list_expanded.append(int(num)) + return list_expanded def read_cpuset(self): """Read list of cpus on which we allowed to execute """ - cmd = 'cat /sys/fs/cgroup/cpuset/cpuset.cpus' + cpu_set_file = '/sys/fs/cgroup/cpuset.cpus' + cmd = 'test -e {0} && echo exists'.format(cpu_set_file) + if (self._client.run_cmd(cmd).decode().rstrip()): + cmd = 'cat {}'.format(cpu_set_file) + else: + cpu_set_file = '/sys/fs/cgroup/cpuset/cpuset.cpus' + cmd = 'test -e {0} && echo exists'.format(cpu_set_file) + if (self._client.run_cmd(cmd).decode().rstrip()): + cmd = 'cat {}'.format(cpu_set_file) + else: + RapidLog.critical('{Cannot determine cpuset') cpuset_cpus = self._client.run_cmd(cmd).decode().rstrip() RapidLog.debug('{} ({}): Allocated cpuset: {}'.format(self.name, self.ip, cpuset_cpus)) - self.cpu_mapping = self.expand_cpuset(cpuset_cpus) + self.cpu_mapping = self.expand_list_format(cpuset_cpus) RapidLog.debug('{} ({}): Expanded cpuset: {}'.format(self.name, self.ip, self.cpu_mapping)) # Log CPU core mapping for user information @@ -120,6 +130,11 @@ class RapidMachine(object): RapidLog.debug('{} ({}): cores {} remapped to {}'.format(self.name, self.ip, self.machine_params['cores'], cpus_remapped)) self.machine_params['cores'] = cpus_remapped + if 'altcores' in self.machine_params.keys(): + cpus_remapped = self.remap_cpus(self.machine_params['altcores']) + RapidLog.debug('{} ({}): altcores {} remapped to {}'.format(self.name, self.ip, self.machine_params['altcores'], cpus_remapped)) + self.machine_params['altcores'] = cpus_remapped + def devbind(self): # Script to bind the right network interface to the poll mode driver for index, dp_port in enumerate(self.dp_ports, start = 1): @@ -141,20 +156,47 @@ class RapidMachine(object): LuaFile.write('local_ip{}="{}"\n'.format(index, dp_port['ip'])) LuaFile.write('local_hex_ip{}=convertIPToHex(local_ip{})\n'.format(index, index)) if self.vim in ['kubernetes']: - LuaFile.write("eal=\"--socket-mem=512,0 --file-prefix %s --pci-whitelist %s\"\n" % (self.name, self.machine_params['dp_pci_dev'])) + cmd = 'cat /opt/rapid/dpdk_version' + dpdk_version = self._client.run_cmd(cmd).decode().rstrip() + if (dpdk_version >= '20.11.0'): + allow_parameter = 'allow' + else: + allow_parameter = 'pci-whitelist' + eal_line = 'eal=\"--file-prefix {}{} --{} {} --force-max-simd-bitwidth=512'.format( + self.name, str(uuid.uuid4()), allow_parameter, + self.machine_params['dp_pci_dev']) + looking_for_qat = True + index = 0 + while (looking_for_qat): + if 'qat_pci_dev{}'.format(index) in self.machine_params: + eal_line += ' --{} {}'.format(allow_parameter, + self.machine_params['qat_pci_dev{}'.format(index)]) + index += 1 + else: + looking_for_qat = False + eal_line += '"\n' + LuaFile.write(eal_line) else: LuaFile.write("eal=\"\"\n") if 'mcore' in self.machine_params.keys(): - LuaFile.write('mcore="%s"\n'% ','.join(map(str, self.machine_params['mcore']))) + LuaFile.write('mcore="%s"\n'% ','.join(map(str, + self.machine_params['mcore']))) if 'cores' in self.machine_params.keys(): - LuaFile.write('cores="%s"\n'% ','.join(map(str, self.machine_params['cores']))) + LuaFile.write('cores="%s"\n'% ','.join(map(str, + self.machine_params['cores']))) + if 'altcores' in self.machine_params.keys(): + LuaFile.write('altcores="%s"\n'% ','.join(map(str, + self.machine_params['altcores']))) if 'ports' in self.machine_params.keys(): - LuaFile.write('ports="%s"\n'% ','.join(map(str, self.machine_params['ports']))) + LuaFile.write('ports="%s"\n'% ','.join(map(str, + self.machine_params['ports']))) if 'dest_ports' in self.machine_params.keys(): for index, dest_port in enumerate(self.machine_params['dest_ports'], start = 1): LuaFile.write('dest_ip{}="{}"\n'.format(index, dest_port['ip'])) LuaFile.write('dest_hex_ip{}=convertIPToHex(dest_ip{})\n'.format(index, index)) - LuaFile.write('dest_hex_mac{}="{}"\n'.format(index , dest_port['mac'].replace(':',' '))) + if dest_port['mac']: + LuaFile.write('dest_hex_mac{}="{}"\n'.format(index , + dest_port['mac'].replace(':',' '))) if 'gw_vm' in self.machine_params.keys(): for index, gw_ip in enumerate(self.machine_params['gw_ips'], start = 1): @@ -167,25 +209,35 @@ class RapidMachine(object): def start_prox(self, autostart=''): if self.machine_params['prox_socket']: - self._client = prox_ctrl(self.ip, self.key, self.user) - self._client.connect() + self._client = prox_ctrl(self.ip, self.key, self.user, + self.password) + self._client.test_connection() if self.vim in ['OpenStack']: self.devbind() if self.vim in ['kubernetes']: self.read_cpuset() self.remap_all_cpus() - _, prox_config_file_name = os.path.split(self.machine_params['config_file']) - self.generate_lua() - self._client.scp_put(self.machine_params['config_file'], '{}/{}'.format(self.rundir, prox_config_file_name)) - if ((not self.configonly) and self.machine_params['prox_launch_exit']): - cmd = 'sudo {}/prox {} -t -o cli -f {}/{}'.format(self.rundir, autostart, self.rundir, prox_config_file_name) - RapidLog.debug("Starting PROX on {}: {}".format(self.name, cmd)) - result = self._client.run_cmd(cmd, 'PROX Testing on {}'.format(self.name)) - RapidLog.debug("Finished PROX on {}: {}".format(self.name, cmd)) + _, prox_config_file_name = os.path.split(self. + machine_params['config_file']) + if self.machine_params['prox_launch_exit']: + self.generate_lua() + self._client.scp_put(self.machine_params['config_file'], '{}/{}'. + format(self.rundir, prox_config_file_name)) + if not self.configonly: + cmd = 'sudo {}/prox {} -t -o cli -f {}/{}'.format(self.rundir, + autostart, self.rundir, prox_config_file_name) + RapidLog.debug("Starting PROX on {}: {}".format(self.name, + cmd)) + result = self._client.run_cmd(cmd) + RapidLog.debug("Finished PROX on {}: {}".format(self.name, + cmd)) def close_prox(self): - if (not self.configonly) and self.machine_params['prox_socket'] and self.machine_params['prox_launch_exit']: + if (not self.configonly) and self.machine_params[ + 'prox_socket'] and self.machine_params['prox_launch_exit']: self.socket.quit_prox() + self._client.scp_get('/prox.log', '{}/{}.prox.log'.format( + self.resultsdir, self.name)) def connect_prox(self): if self.machine_params['prox_socket']: diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py index d7d8fabc..143323b8 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_parser.py @@ -46,6 +46,13 @@ class RapidConfigParser(object): test_params['lat_percentile'] = 0.99 RapidLog.info('Latency percentile at {:.0f}%'.format( test_params['lat_percentile']*100)) + if testconfig.has_option('TestParameters', 'sleep_time'): + test_params['sleep_time'] = int(testconfig.get('TestParameters', 'sleep_time')) + if test_params['sleep_time'] < 2: + test_params['sleep_time'] = 2 + else: + test_params['sleep_time'] = 2 + if testconfig.has_option('TestParameters', 'ipv6'): test_params['ipv6'] = testconfig.getboolean('TestParameters','ipv6') else: @@ -53,14 +60,15 @@ class RapidConfigParser(object): config = configparser.RawConfigParser() config.read(test_params['environment_file']) test_params['vim_type'] = config.get('Varia', 'vim') - test_params['key'] = config.get('ssh', 'key') test_params['user'] = config.get('ssh', 'user') - if test_params['user'] in ['rapid']: - if test_params['key'] != 'rapid_rsa_key': - RapidLog.debug(("Key file {} for user {} overruled by key file:" - " rapid_rsa_key").format(test_params['key'], - test_params['user'])) - test_params['key'] = 'rapid_rsa_key' + if config.has_option('ssh', 'key'): + test_params['key'] = config.get('ssh', 'key') + else: + test_params['key'] = None + if config.has_option('ssh', 'password'): + test_params['password'] = config.get('ssh', 'password') + else: + test_params['password'] = None test_params['total_number_of_machines'] = int(config.get('rapid', 'total_number_of_machines')) tests = [] @@ -77,19 +85,20 @@ class RapidConfigParser(object): 'flowsize','warmupflowsize','warmuptime', 'steps']: test[option] = int(testconfig.get(section, option)) elif option in ['startspeed', 'step', 'drop_rate_threshold', - 'lat_avg_threshold','lat_perc_threshold', + 'generator_threshold','lat_avg_threshold','lat_perc_threshold', 'lat_max_threshold','accuracy','maxr','maxz', - 'ramp_step','warmupspeed']: + 'ramp_step','warmupspeed','mis_ordered_threshold']: test[option] = float(testconfig.get(section, option)) else: test[option] = testconfig.get(section, option) tests.append(dict(test)) for test in tests: - if test['test'] in ['flowsizetest','TST009test']: + if test['test'] in ['flowsizetest', 'TST009test', 'increment_till_fail']: if 'drop_rate_threshold' not in test.keys(): test['drop_rate_threshold'] = 0 - latency_thresholds = ['lat_avg_threshold','lat_perc_threshold','lat_max_threshold'] - for threshold in latency_thresholds: + thresholds = ['generator_threshold','lat_avg_threshold', \ + 'lat_perc_threshold','lat_max_threshold','mis_ordered_threshold'] + for threshold in thresholds: if threshold not in test.keys(): test[threshold] = inf test_params['tests'] = tests @@ -128,7 +137,8 @@ class RapidConfigParser(object): for option in options: if option in ['prox_socket','prox_launch_exit','monitor']: machine[option] = testconfig.getboolean(section, option) - elif option in ['mcore', 'cores', 'gencores','latcores']: + elif option in ['mcore', 'cores', 'gencores', 'latcores', + 'altcores']: machine[option] = ast.literal_eval(testconfig.get( section, option)) elif option in ['bucket_size_exp']: @@ -155,10 +165,13 @@ class RapidConfigParser(object): while True: dp_ip_key = 'dp_ip{}'.format(index) dp_mac_key = 'dp_mac{}'.format(index) - if dp_ip_key in machines[int(machine['dest_vm'])-1].keys() and \ - dp_mac_key in machines[int(machine['dest_vm'])-1].keys(): - dp_port = {'ip': machines[int(machine['dest_vm'])-1][dp_ip_key], - 'mac' : machines[int(machine['dest_vm'])-1][dp_mac_key]} + if dp_ip_key in machines[int(machine['dest_vm'])-1].keys(): + if dp_mac_key in machines[int(machine['dest_vm'])-1].keys(): + dp_port = {'ip': machines[int(machine['dest_vm'])-1][dp_ip_key], + 'mac' : machines[int(machine['dest_vm'])-1][dp_mac_key]} + else: + dp_port = {'ip': machines[int(machine['dest_vm'])-1][dp_ip_key], + 'mac' : None} dp_ports.append(dict(dp_port)) index += 1 else: diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_sshclient.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_sshclient.py index e9fe134c..d8aeacc1 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_sshclient.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_sshclient.py @@ -15,6 +15,7 @@ ## import paramiko +from scp import SCPClient import logging class SSHClient: @@ -32,9 +33,11 @@ class SSHClient: _output = None _error = None - def __init__(self, ip=None, user=None, rsa_private_key=None, timeout=15, logger_name=None): + def __init__(self, ip=None, user=None, rsa_private_key=None, timeout=15, + logger_name=None, password = None): self._ip = ip self._user = user + self._password = password self._rsa_private_key = rsa_private_key self._timeout = timeout @@ -43,19 +46,21 @@ class SSHClient: self._connected = False - def set_credentials(self, ip, user, rsa_private_key): + def set_credentials(self, ip, user, rsa_private_key, password = None): self._ip = ip self._user = user + self._password = password self._rsa_private_key = rsa_private_key def connect(self): + if self._connected: if (self._log is not None): self._log.debug("Already connected!") return - if ((self._ip is None) or (self._user is None) or - (self._rsa_private_key is None)): + ((self._rsa_private_key is None) == + (self._password is None))): if (self._log is not None): self._log.error("Wrong parameter! IP %s, user %s, RSA private key %s" % (self._ip, self._user, self._rsa_private_key)) @@ -64,10 +69,14 @@ class SSHClient: self._ssh = paramiko.SSHClient() self._ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) - private_key = paramiko.RSAKey.from_private_key_file(self._rsa_private_key) + if (self._rsa_private_key is not None): + private_key = paramiko.RSAKey.from_private_key_file(self._rsa_private_key) + else: + private_key = None try: - self._ssh.connect(hostname = self._ip, username = self._user, pkey = private_key) + self._ssh.connect(hostname = self._ip, username = self._user, + password = self._password, pkey = private_key) except Exception as e: if (self._log is not None): self._log.error("Failed to connect to the host! IP %s, user %s, RSA private key %s\n%s" @@ -104,6 +113,50 @@ class SSHClient: return ret + def scp_put(self, src, dst): + self.connect() + + if self._connected is not True: + return -1 + + try: + ret = 0 + scp = SCPClient(self._ssh.get_transport()) + scp.put(src, dst) + self._output = stdout.read() + self._error = stderr.read() + except Exception as e: + if (self._log is not None): + self._log.error("Failed to execute command! IP %s, cmd %s\n%s" + % (self._ip, cmd, e)) + ret = -1 + + self.disconnect() + + return ret + + def scp_get(self, src, dst): + self.connect() + + if self._connected is not True: + return -1 + + try: + ret = 0 + scp = SCPClient(self._ssh.get_transport()) + scp.get(src, dst) + self._output = stdout.read() + self._error = stderr.read() + except Exception as e: + if (self._log is not None): + self._log.error("Failed to execute command! IP %s, cmd %s\n%s" + % (self._ip, cmd, e)) + ret = -1 + + self.disconnect() + + return ret + def get_output(self): return self._output diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py index 16cf9190..deba695f 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_test.py @@ -20,6 +20,7 @@ import yaml import requests import time +import os import copy from past.utils import old_div from rapid_log import RapidLog @@ -27,6 +28,8 @@ from rapid_log import bcolors inf = float("inf") from datetime import datetime as dt +_CURR_DIR = os.path.dirname(os.path.realpath(__file__)) + class RapidTest(object): """ Class to manage the testing @@ -40,7 +43,7 @@ class RapidTest(object): self.test['maxr'] = 1 if 'maxz' not in self.test.keys(): self.test['maxz'] = inf - with open('format.yaml') as f: + with open(os.path.join(_CURR_DIR,'format.yaml')) as f: self.data_format = yaml.load(f, Loader=yaml.FullLoader) @staticmethod @@ -164,6 +167,10 @@ class RapidTest(object): elapsed_time_str = ' NA |' else: elapsed_time_str = '{:>3.0f} |'.format(data['actual_duration']) + if data['mis_ordered'] is None: + mis_ordered_str = ' NA ' + else: + mis_ordered_str = '{:>9.0f} '.format(data['mis_ordered']) return(flow_number_str + '{:>5.1f}'.format(data['speed']) + '% ' + prefix['speed'] + '{:>6.3f}'.format(RapidTest.get_pps(data['speed'],size)) + ' Mpps|' + pps_req_tx_str + pps_tx_str + bcolors.ENDC + pps_sut_tx_str + @@ -172,16 +179,18 @@ class RapidTest(object): + ' us | ' + '{:>9.0f}'.format(data['abs_tx']) + ' | {:>9.0f}'.format(data['abs_rx']) + ' | '+ prefix['abs_drop_rate']+ '{:>9.0f}'.format(data['abs_tx']-data['abs_rx']) + tot_drop_str + prefix['drop_rate'] + - '{:>5.2f}'.format(100*old_div(float(data['abs_tx']-data['abs_rx']),data['abs_tx'])) + bcolors.ENDC + + '{:>5.2f}'.format(100*old_div(float(data['abs_tx']-data['abs_rx']),data['abs_tx'])) + ' |' + + prefix['mis_ordered'] + mis_ordered_str + bcolors.ENDC + ' |' + elapsed_time_str) def run_iteration(self, requested_duration, flow_number, size, speed): BUCKET_SIZE_EXP = self.gen_machine.bucket_size_exp + sleep_time = self.test['sleep_time'] LAT_PERCENTILE = self.test['lat_percentile'] iteration_data= {} time_loop_data= {} iteration_data['r'] = 0; - sleep_time = 2 + while (iteration_data['r'] < self.test['maxr']): self.gen_machine.start_latency_cores() time.sleep(sleep_time) @@ -252,6 +261,7 @@ class RapidTest(object): 'lat_perc' : '', 'lat_max' : '', 'abs_drop_rate' : '', + 'mis_ordered' : '', 'drop_rate' : ''} RapidLog.info(self.report_result(flow_number, size, iteration_data, iteration_prefix )) @@ -337,6 +347,7 @@ class RapidTest(object): 'lat_perc' : '', 'lat_max' : '', 'abs_drop_rate' : '', + 'mis_ordered' : '', 'drop_rate' : ''} RapidLog.info(self.report_result(flow_number, size, time_loop_data, time_loop_prefix)) @@ -370,6 +381,7 @@ class RapidTest(object): iteration_data['avg_bg_rate'] = None #Stop generating self.gen_machine.stop_gen_cores() + time.sleep(3.5) self.gen_machine.stop_latency_cores() iteration_data['r'] += 1 iteration_data['lat_avg'] = old_div(iteration_data['lat_avg'], float(tot_lat_measurement_duration)) diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_warmuptest.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_warmuptest.py index bedf51ab..a86ce806 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_warmuptest.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_warmuptest.py @@ -42,7 +42,8 @@ class WarmupTest(RapidTest): self.gen_machine.set_generator_speed(WARMUPSPEED) self.gen_machine.set_udp_packet_size(imix) # gen_machine['socket'].set_value(gencores,0,56,1,1) - _ = self.gen_machine.set_flows(FLOWSIZE) + if FLOWSIZE: + _ = self.gen_machine.set_flows(FLOWSIZE) self.gen_machine.start() time.sleep(WARMUPTIME) self.gen_machine.stop() diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/runrapid.py b/VNFs/DPPD-PROX/helper-scripts/rapid/runrapid.py index 5f78ec01..7ec270a1 100755 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/runrapid.py +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/runrapid.py @@ -43,6 +43,12 @@ class RapidTestManager(object): """ RapidTestManager Class """ + def __init__(self): + """ + Init Function + """ + self.machines = [] + def __del__(self): for machine in self.machines: machine.close_prox() @@ -53,18 +59,26 @@ class RapidTestManager(object): def run_tests(self, test_params): test_params = RapidConfigParser.parse_config(test_params) - RapidLog.debug(test_params) monitor_gen = monitor_sut = False background_machines = [] sut_machine = gen_machine = None - self.machines = [] configonly = test_params['configonly'] + machine_names = [] + machine_counter = {} for machine_params in test_params['machines']: + if machine_params['name'] not in machine_names: + machine_names.append(machine_params['name']) + machine_counter[machine_params['name']] = 1 + else: + machine_counter[machine_params['name']] += 1 + machine_params['name'] = '{}_{}'.format(machine_params['name'], + machine_counter[machine_params['name']]) if 'gencores' in machine_params.keys(): machine = RapidGeneratorMachine(test_params['key'], - test_params['user'], test_params['vim_type'], - test_params['rundir'], test_params['resultsdir'], - machine_params, configonly, test_params['ipv6']) + test_params['user'], test_params['password'], + test_params['vim_type'], test_params['rundir'], + test_params['resultsdir'], machine_params, configonly, + test_params['ipv6']) if machine_params['monitor']: if monitor_gen: RapidLog.exception("Can only monitor 1 generator") @@ -76,8 +90,9 @@ class RapidTestManager(object): background_machines.append(machine) else: machine = RapidMachine(test_params['key'], test_params['user'], - test_params['vim_type'], test_params['rundir'], - test_params['resultsdir'], machine_params, configonly) + test_params['password'], test_params['vim_type'], + test_params['rundir'], test_params['resultsdir'], + machine_params, configonly) if machine_params['monitor']: if monitor_sut: RapidLog.exception("Can only monitor 1 sut") @@ -87,6 +102,7 @@ class RapidTestManager(object): if machine_params['prox_socket']: sut_machine = machine self.machines.append(machine) + RapidLog.debug(test_params) try: prox_executor = concurrent.futures.ThreadPoolExecutor(max_workers=len(self.machines)) self.future_to_prox = {prox_executor.submit(machine.start_prox): machine for machine in self.machines} @@ -107,7 +123,8 @@ class RapidTestManager(object): test_params['TestName'], test_params['environment_file'], gen_machine, - sut_machine, background_machines) + sut_machine, background_machines, + test_params['sleep_time']) elif test_param['test'] in ['corestatstest']: test = CoreStatsTest(test_param, test_params['runtime'], @@ -166,7 +183,12 @@ def main(): test_params = RapidCli.process_cli(test_params) _, test_file_name = os.path.split(test_params['test_file']) _, environment_file_name = os.path.split(test_params['environment_file']) - log_file = 'RUN{}.{}.log'.format(environment_file_name, test_file_name) + if 'resultsdir' in test_params: + res_dir = test_params['resultsdir'] + log_file = '{}/RUN{}.{}.log'.format(res_dir,environment_file_name, + test_file_name) + else: + log_file = 'RUN{}.{}.log'.format(environment_file_name, test_file_name) RapidLog.log_init(log_file, test_params['loglevel'], test_params['screenloglevel'] , test_params['version'] ) test_manager = RapidTestManager() diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/setup.cfg b/VNFs/DPPD-PROX/helper-scripts/rapid/setup.cfg index 2f9542e1..bac49bd5 100644 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/setup.cfg +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/setup.cfg @@ -6,6 +6,9 @@ version = 1 packages = . package_dir = . +[options.data_files] +. = format.yaml + [entry_points] xtesting.testcase = rapidxt = rapidxt:RapidXt diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/start.sh b/VNFs/DPPD-PROX/helper-scripts/rapid/start.sh index 7fbeedf8..78772dd2 100755 --- a/VNFs/DPPD-PROX/helper-scripts/rapid/start.sh +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/start.sh @@ -17,7 +17,8 @@ function save_k8s_envs() { - printenv | grep "PCIDEVICE_INTEL_COM" > /opt/rapid/k8s_sriov_device_plugin_envs + printenv | grep "PCIDEVICE" > /opt/rapid/k8s_sriov_device_plugin_envs + printenv | grep "QAT[0-9]" > /opt/rapid/k8s_qat_device_plugin_envs } function create_tun() @@ -34,6 +35,9 @@ create_tun touch /opt/rapid/system_ready_for_rapid # Start SSH server in background -/usr/sbin/sshd +echo "mkdir -p /var/run/sshd" >> /etc/rc.local +service ssh start -exec sleep infinity +echo "rapid ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers + +sleep infinity diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/tests/encrypt.test b/VNFs/DPPD-PROX/helper-scripts/rapid/tests/encrypt.test new file mode 100644 index 00000000..bc5e96b8 --- /dev/null +++ b/VNFs/DPPD-PROX/helper-scripts/rapid/tests/encrypt.test @@ -0,0 +1,70 @@ +## +## Copyright (c) 2023 luc.provoost@gmail.com +## +## 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. +## +# CHECK README IN THIS DIRECTORY FOR MORE EXPLANATION +# ON PARAMETERS IN THIS FILE + +[TestParameters] +name = EncryptionDecryption +number_of_tests = 1 +total_number_of_test_machines = 2 +lat_percentile = 99 + +[TestM1] +name = Generator +config_file = configs/gen.cfg +dest_vm = 2 +mcore = [0] +gencores = [1] +latcores = [3] +bucket_size_exp = 16 +#prox_launch_exit = false + +[TestM2] +name = Encrypt +config_file = configs/esp.cfg +dest_vm = 1 +mcore = [0] +cores = [1] +altcores=[2] +#prox_socket = true +#prox_launch_exit = false + +[test1] +test=flowsizetest +warmupflowsize=512 +warmupimix=[64] +warmupspeed=1 +warmuptime=2 +# Each element in the imix list will result in a separate test. Each element +# is on its turn a list of packet sizes which will be used during one test +# execution. If you only want to test 1 size, define a list with only one +# element. +#imixs=[[64],[64,250,800,800]] +imixs=[[1500],[512],[256],[128]] +# the number of flows in the list need to be powers of 2, max 2^30 +# If not a power of 2, we will use the lowest power of 2 that is larger than +# the requested number of flows. e.g. 9 will result in 16 flows +flows=[64] +# Setting one of the following thresholds to infinity (inf) +# results in the criterion not being evaluated to rate the test as succesful +drop_rate_threshold = 0.5 +lat_avg_threshold = inf +lat_perc_threshold = inf +lat_max_threshold = inf +accuracy = 5 +startspeed = 250 +#ramp_step = 1 + |