aboutsummaryrefslogtreecommitdiffstats
path: root/xtesting/openstack
diff options
context:
space:
mode:
Diffstat (limited to 'xtesting/openstack')
-rw-r--r--xtesting/openstack/Dockerfile61
-rw-r--r--xtesting/openstack/cloud.rc10
-rw-r--r--xtesting/openstack/setup.cfg10
-rw-r--r--xtesting/openstack/setup.py9
-rw-r--r--xtesting/openstack/site.yml13
-rw-r--r--xtesting/openstack/testcases.yaml19
-rw-r--r--xtesting/openstack/vsperfostack.conf80
-rwxr-xr-xxtesting/openstack/vsperfostack.py85
8 files changed, 287 insertions, 0 deletions
diff --git a/xtesting/openstack/Dockerfile b/xtesting/openstack/Dockerfile
new file mode 100644
index 00000000..2e613872
--- /dev/null
+++ b/xtesting/openstack/Dockerfile
@@ -0,0 +1,61 @@
+# Copyright 2020 Spirent Communications.
+#
+# 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.
+
+FROM opnfv/xtesting
+LABEL maintainer="sridhar.rao@spirent.com"
+
+# Install required packages
+RUN apk add --no-cache --update python3 python3-dev \
+ py3-wheel py3-pip git openssh-client python3-tkinter \
+ tk gcc musl-dev libffi-dev openssl-dev make
+
+# Clone VSPERF.
+RUN git clone https://gerrit.opnfv.org/gerrit/vswitchperf /vswitchperf
+
+#
+# Remove unnecessary python packages.
+#
+RUN cd /vswitchperf && \
+ sed -e '/numpy/ s/^#*/#\ /' -i requirements.txt && \
+ sed -e '/matplotlib/ s/^#*/#\ /' -i requirements.txt && \
+ sed -e '/pycrypto/ s/^#*/#\ /' -i requirements.txt && \
+ sed -e '/pypsi/ s/^#*/#\ /' -i requirements.txt && \
+ sed -e '/paramiko/ s/^#*/#\ /' -i requirements.txt && \
+ sed -e '/pyzmq/ s/^#*/#\ /' -i requirements.txt && \
+ sed -e '/kubernetes/ s/^#*/#\ /' -i requirements.txt
+
+#
+# Build VSPERF
+#
+RUN cd /vswitchperf && \
+ pip3 install --ignore-installed distlib -r requirements.txt && \
+ cd /vswitchperf/src/trex && make
+
+# Include vsperf into Path.
+ENV PATH "$PATH:/vswitchperf"
+
+COPY vsperfostack.conf /vsperfostack.conf
+
+# Required step for Xtesting
+ADD . /src/
+RUN git init /src && pip3 install /src
+
+# Copy Testcase
+COPY testcases.yaml /usr/lib/python3.8/site-packages/xtesting/ci/testcases.yaml
+
+# Set working directory - This helps to resolve path to templates.
+WORKDIR /vswitchperf
+
+# Command Run
+CMD ["run_tests", "-t", "all"]
diff --git a/xtesting/openstack/cloud.rc b/xtesting/openstack/cloud.rc
new file mode 100644
index 00000000..3f867743
--- /dev/null
+++ b/xtesting/openstack/cloud.rc
@@ -0,0 +1,10 @@
+export OS_AUTH_URL=http://10.10.180.21/identity
+export OS_PROJECT_ID=0440a230a799460facec0d09dde64497
+export OS_PROJECT_NAME="admin"
+export OS_USER_DOMAIN_NAME="Default"
+export OS_PROJECT_DOMAIN_ID="default"
+export OS_USERNAME="admin"
+export OS_PASSWORD="admin123"
+export OS_REGION_NAME="RegionOne"
+export OS_INTERFACE=public
+export OS_IDENTITY_API_VERSION=3
diff --git a/xtesting/openstack/setup.cfg b/xtesting/openstack/setup.cfg
new file mode 100644
index 00000000..4b98992a
--- /dev/null
+++ b/xtesting/openstack/setup.cfg
@@ -0,0 +1,10 @@
+[metadata]
+name = vsperfostack
+version = 1
+
+[files]
+packages = .
+
+[entry_points]
+xtesting.testcase =
+ vsperfostack = vsperfostack:VsperfOstack
diff --git a/xtesting/openstack/setup.py b/xtesting/openstack/setup.py
new file mode 100644
index 00000000..1394cdfe
--- /dev/null
+++ b/xtesting/openstack/setup.py
@@ -0,0 +1,9 @@
+#!/usr/bin/env python
+
+# pylint: disable=missing-docstring
+
+import setuptools
+
+setuptools.setup(
+ setup_requires=['pbr>=2.0.0'],
+ pbr=True)
diff --git a/xtesting/openstack/site.yml b/xtesting/openstack/site.yml
new file mode 100644
index 00000000..1ca663f4
--- /dev/null
+++ b/xtesting/openstack/site.yml
@@ -0,0 +1,13 @@
+---
+- hosts:
+ - 127.0.0.1
+ roles:
+ - role: collivier.xtesting
+ project: vsperfostack
+ repo: 127.0.0.1
+ dport: 5000
+ gerrit:
+ suites:
+ - container: vsperfos
+ tests:
+ - phy2phy_tput
diff --git a/xtesting/openstack/testcases.yaml b/xtesting/openstack/testcases.yaml
new file mode 100644
index 00000000..aab3b16a
--- /dev/null
+++ b/xtesting/openstack/testcases.yaml
@@ -0,0 +1,19 @@
+---
+tiers:
+ -
+ name: vsperfostack
+ order: 1
+ description: 'VSPERF Openstack Testing'
+ testcases:
+ -
+ case_name: phy2phy_tput
+ project_name: vsperfostack
+ criteria: 100
+ blocking: true
+ clean_flag: false
+ description: 'VSPERF Openstack RFC2544 Throughput Test'
+ run:
+ name: vsperfostack
+ args:
+ conf_file: vsperfostack.conf
+ deploy_tgen: false
diff --git a/xtesting/openstack/vsperfostack.conf b/xtesting/openstack/vsperfostack.conf
new file mode 100644
index 00000000..489054a7
--- /dev/null
+++ b/xtesting/openstack/vsperfostack.conf
@@ -0,0 +1,80 @@
+# Copyright 20202 Spirent Communications.
+#
+# 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.
+
+# OPenstack Information
+
+OS_AUTH_URL="http://10.10.180.21/identity"
+OS_PROJECT_ID="0440a230a799460facec0d09dde64497"
+OS_PROJECT_NAME="admin"
+OS_USER_DOMAIN_NAME="Default"
+OS_PROJECT_DOMAIN_ID="default"
+OS_USERNAME="admin"
+OS_PASSWORD="admin123"
+OS_REGION_NAME="RegionOne"
+OS_INTERFACE="public"
+OS_IDENTITY_API_VERSION=3
+OS_INSECURE=False
+OS_CA_CERT= 'None'
+
+# Deployment Information
+SCENARIOS = ['templates/l2_2c_2i.yaml']
+FLAVOR_NAME = 'm1.large'
+IMAGE_NAME = 'stcv'
+EXTERNAL_NET = 'public'
+
+# Traffic Information
+TRAFFICGEN_PKT_SIZES = (1024,)
+TRAFFICGEN_DURATION = 10
+
+# Traffigen to Use
+TRAFFICGEN='TestCenter'
+
+
+# Trafficgen Specific Information
+# STC
+TRAFFICGEN_STC_LAB_SERVER_ADDR = "10.10.180.245"
+TRAFFICGEN_STC_LICENSE_SERVER_ADDR = "10.10.50.226"
+TRAFFICGEN_STC_EAST_SLOT_NUM = "1"
+TRAFFICGEN_STC_EAST_PORT_NUM = "1"
+TRAFFICGEN_STC_WEST_SLOT_NUM = "1"
+TRAFFICGEN_STC_WEST_PORT_NUM = "1"
+TRAFFICGEN_STC_PYTHON2_PATH = "/usr/bin/python3"
+TRAFFICGEN_STC_RFC2544_TPUT_TEST_FILE_NAME = "testcenter-rfc2544-rest.py"
+TRAFFICGEN_STC_RFC2544_METRIC="throughput"
+
+
+# Ixia
+TRAFFICGEN_EAST_IXIA_CARD = '1'
+TRAFFICGEN_WEST_IXIA_CARD = '1'
+TRAFFICGEN_EAST_IXIA_PORT = '1'
+TRAFFICGEN_WEST_IXIA_PORT = '1'
+TRAFFICGEN_IXIA_LIB_PATH = '/opt/ixia/ixos-api/9.00.0.20/lib/ixTcl1.0'
+TRAFFICGEN_IXNET_LIB_PATH = '/opt/ixia/ixnetwork/9.00.1915.16/lib/TclApi/IxTclNetwork'
+TRAFFICGEN_IXNET_MACHINE = '10.10.180.240' # quad dotted ip address
+TRAFFICGEN_IXNET_PORT = '443'
+TRAFFICGEN_IXNET_USER = 'admin'
+TRAFFICGEN_IXNET_TESTER_RESULT_DIR = 'c:/ixia_results/vsperf_sandbox'
+TRAFFICGEN_IXNET_DUT_RESULT_DIR = '/mnt/ixia_results/vsperf_sandbox'
+
+# Trex
+TRAFFICGEN_TREX_HOST_IP_ADDR = '10.10.120.25'
+TRAFFICGEN_TREX_USER = 'root'
+TRAFFICGEN_TREX_BASE_DIR = '/root/trex_2.86/'
+TRAFFICGEN_TREX_LINE_SPEED_GBPS = '10'
+TRAFFICGEN_TREX_PORT1 = '0000:81:00.0'
+TRAFFICGEN_TREX_PORT2 = '0000:81:00.1'
+TRAFFICGEN_TREX_PROMISCUOUS = False
+TRAFFICGEN_TREX_LATENCY_PPS = 1000
+TRAFFICGEN_TREX_RFC2544_BINARY_SEARCH_LOSS_VERIFICATION = False
+TRAFFICGEN_TREX_RFC2544_MAX_REPEAT = 2
diff --git a/xtesting/openstack/vsperfostack.py b/xtesting/openstack/vsperfostack.py
new file mode 100755
index 00000000..d4a14c06
--- /dev/null
+++ b/xtesting/openstack/vsperfostack.py
@@ -0,0 +1,85 @@
+#!/usr/bin/env python3
+
+# Copyright 2020 Spirent Communications.
+#
+# 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.
+
+"""VSPERF-Xtesting-Openstack Control script.
+"""
+
+import os
+import subprocess
+import sys
+import time
+
+from xtesting.core import testcase
+
+
+class VsperfOstack(testcase.TestCase):
+ """
+ Implement Xtesting's testcase class
+ """
+ def run(self, **kwargs):
+ """
+ Main Run.
+ """
+ custom_conffile = '/vswitchperf/conf/99_xtesting.conf'
+ try:
+ test_params = {}
+ for key in kwargs:
+ test_params[key] = kwargs[key]
+ # Make results directory - Xtesting Requirement
+ os.makedirs(self.res_dir, exist_ok=True)
+ # Start the timer
+ self.start_time = time.time()
+
+ # Get the parameter
+ if 'conf_file' in test_params.keys():
+ conffile = os.path.join('/', test_params['conf_file'])
+ else:
+ conffile = '/vsperfostack.conf'
+
+ # Remove customfile if it exists.
+ if os.path.exists(custom_conffile):
+ os.remove(custom_conffile)
+
+ # Write custom configuration.
+ with open(custom_conffile, 'a+') as fil:
+ fil.writelines("LOG_DIR='{}'".format(self.res_dir))
+ fil.close()
+ # Start the vsperf command
+ if('deploy_tgen' in test_params.keys() and
+ test_params['deploy_tgen']):
+ output = subprocess.check_output(['vsperf',
+ '--conf-file',
+ conffile,
+ '--openstack',
+ '--load-env',
+ '--tests',
+ self.case_name])
+ else:
+ output = subprocess.check_output(['vsperf',
+ '--conf-file',
+ conffile,
+ '--load-env',
+ '--mode',
+ 'traffigen',
+ '--tests',
+ self.case_name])
+ print(output)
+ self.result = 100
+ self.stop_time = time.time()
+ except Exception: # pylint: disable=broad-except
+ print("Unexpected error:", sys.exc_info()[0])
+ self.result = 0
+ self.stop_time = time.time()