diff options
-rw-r--r-- | docs/bottlenecks_brahmaputra_docs/userguide/vstf/vstf_installation.rst | 237 | ||||
-rw-r--r-- | utils/infra_setup/heat_template/vstf_heat_template/launch_vstf.sh | 9 | ||||
-rw-r--r-- | utils/infra_setup/heat_template/vstf_heat_template/scp.sh | 93 | ||||
-rw-r--r-- | utils/infra_setup/heat_template/vstf_heat_template/ssh.sh | 28 | ||||
-rwxr-xr-x | utils/infra_setup/heat_template/vstf_heat_template/vstf_HOT_create_instance.sh | 9 | ||||
-rw-r--r-- | utils/infra_setup/heat_template/vstf_heat_template/vstf_test.sh | 14 | ||||
-rwxr-xr-x | vstf/vstf/agent/perf/qperf.py | 2 | ||||
-rwxr-xr-x | vstf/vstf/common/daemon.py | 63 | ||||
-rwxr-xr-x | vstf/vstf/common/perfmark.py | 4 | ||||
-rwxr-xr-x | vstf/vstf/controller/res/logo.jpg | bin | 544271 -> 4713 bytes | |||
-rwxr-xr-x | vstf/vstf/controller/sw_perf/performance.py | 4 |
11 files changed, 297 insertions, 166 deletions
diff --git a/docs/bottlenecks_brahmaputra_docs/userguide/vstf/vstf_installation.rst b/docs/bottlenecks_brahmaputra_docs/userguide/vstf/vstf_installation.rst index 45db9d34..ad3ae397 100644 --- a/docs/bottlenecks_brahmaputra_docs/userguide/vstf/vstf_installation.rst +++ b/docs/bottlenecks_brahmaputra_docs/userguide/vstf/vstf_installation.rst @@ -1,3 +1,238 @@ =================================== -Bottlenecks Vstf Installation Guide +Bottlenecks VSTF Installation Guide =================================== + + +VSTF Introduction +==================== +VSTF(Virtual Switch Test Framework) is a system-level testing framework in the +area of network virtualization, and it could help you estimate the system switch +ability and find out the network bottlenecks by main KPIs(bandwidth, latency, +resource usage and so on), VSTF owns a methodology to define the test scenario and +testcases, Now we could support Tu testcases in the Openstack environment, More +scenarios and cases will be added. + +VSTF TestScenario +----------------- +1. Tu - VM to VM +2. Tn - Physical Nic loopback +3. TnV - VNF loopback +4. Ti - VM to Physical Nic + +Pre-install Packages on the ubuntu 14.04 VM +=========================================== +VSTF VM Preparation Steps +------------------------- +1. Create a ubuntu 14.04 VM +2. Install dependency inside VM +3. Install vstf python package inside VM + +VM preparation +-------------- +Install python2.7 version and git + +:: + + sudo apt-get install python2.7 + sudo apt-get install git + +Download Bottlenecks package + +:: + + sudo cd /home/ + sudo git clone https://gerrit.opnfv.org/gerrit/bottlenecks + +Install the dependency + +:: + + sudo apt-get install python-pip + sudo pip install --upgrade pip + sudo dpkg-reconfigure dash + sudo apt-get install libjpeg-dev + sudo apt-get install libpng-dev + sudo apt-get install python-dev + sudo apt-get install python-testrepository + sudo apt-get install git + sudo apt-get install python-pika + sudo apt-get install python-oslo.config + sudo pip install -r /home/bottlenecks/vstf/requirements.txt + +Install vstf package + +:: + + sudo mkdir -p /var/log/vstf/ + sudo cp -r /home/bottlenecks/vstf/etc/vstf/ /etc/ + sudo mkdir -p /opt/vstf/ + sudo cd /home/bottlenecks;sudo rm -rf build/ + sudo python setup.py install + +Image on the Cloud +------------------ ++-----------+-------------------------------------------------------------+ +| Name | vstf-image | ++===========+=============================================================+ +| URL | http://artifacts.opnfv.org/bottlenecks/vstf-manager-new.img | ++-----------+-------------------------------------------------------------+ +| Format | QCOW2 | ++-----------+-------------------------------------------------------------+ +| Size | 5G | ++-----------+-------------------------------------------------------------+ +| User | root | ++-----------+-------------------------------------------------------------+ +| Passwd | root | ++-----------+-------------------------------------------------------------+ +There is a complete vstf image on the cloud ,you could download it and use it to +deploy and run cases ,but do not need VM preparation steps. + + +How is VSTF Integrated into Installers +======================================== +VM requirements +--------------- ++------------------+----------+--------------------+-----------------------------------------------------+ +| Name | FLAVOR | IMAGE_NAME | NETWORK | ++==================+==========+====================+=====================================================+ +| vstf-manager | m1.large | vstf-image | control-plane=XX.XX.XX.XX | ++------------------+----------+--------------------+-----------------------------------------------------+ +| vstf-tester | m1.large | vstf-image | control-plane(eth0)=XX.XX.XX.XX | +| | | | test-plane(eth1)=XX.XX.XX.XX | ++------------------+----------+--------------------+-----------------------------------------------------+ +| vstf-target | m1.large | vstf-image | control-plane(eth0)=XX.XX.XX.XX | +| | | | test-plane(eth1)=XX.XX.XX.XX | ++------------------+----------+--------------------+-----------------------------------------------------+ +m1.large means 4U4G for the target image Size 5GB +For the network used by VMs,network need two plane ,one plane is control plane and the other plane is test plane. + +OPNFV community Usage in the CI system +-------------------------------------- ++---------------------------------------+---------------------------------------+ +| Project Name | Project Categoty | ++=======================================+=======================================+ +| bottlenecks-daily-fuel-vstf-lf-master | bottlenecks | ++---------------------------------------+---------------------------------------+ +OPNFV community jenkins Project info + +Main Entrance for the ci test: + +:: + + cd /home/bottlenecks/ci; + bash -x vstf_run.sh + +Test on local(Openstack Environment) +------------------------------------ +download the image file + +:: + + curl --connect-timeout 10 -o /tmp/vstf-manager.img \ + http://artifacts.opnfv.org/bottlenecks/vstf-manager-new.img -v + +create the image file by the glance + +:: + + glance image-create --name $MANAGER_IMAGE_NAME \ + --disk-format qcow2 \ + --container-format bare \ + --file /tmp/vstf-manager.img + +create the keypair for the image(anyone will be ok) + +:: + + cd /home/bottlenecks/utils/infra_setup/bottlenecks_key + nova keypair-add --pub_key $KEY_PATH/bottlenecks_key.pub $KEY_NAME + +create the vstf three VMs in the openstack by heat + +:: + + cd /home/bottlenecks/utils/infra_setup/heat_template/vstf_heat_template + heat stack-create vstf -f bottleneck_vstf.yaml + +launch the vstf process inside the vstf-manager vstf-tester vstf-target VMs + +:: + + cd /home/bottlenecks/utils/infra_setup/heat_template/vstf_heat_template + bash -x launch_vstf.sh + +edit the test scenario and test packet list in the vstf_test.sh, now support the Tu-1/2/3 + +:: + + function fn_testing_scenario(){ + ... + local test_length_list="64 128 256 512 1024" + local test_scenario_list="Tu-1 Tu-3" + ... + } + +launch the vstf script + +:: + + cd /home/bottlenecks/utils/infra_setup/heat_template/vstf_heat_template + bash -x vstf_test.sh + +Test Result Description +======================= +Result Format +------------- +For example after the test, The result will display as the following format + +:: + + { u'64': { u'AverageLatency': 0.063, + u'Bandwidth': 0.239, + u'CPU': 0.0, + u'Duration': 20, + u'MaximumLatency': 0.063, + u'MinimumLatency': 0.063, + u'MppspGhz': 0, + u'OfferedLoad': 100.0, + u'PercentLoss': 22.42, + u'RxFrameCount': 4309750.0, + u'RxMbps': 198.28, + u'TxFrameCount': 5555436.0, + u'TxMbps': 230.03}} + +Option Description +------------------ ++---------------------+---------------------------------------------------+ +| Option Name | Description | ++=====================+===================================================+ +| AverageLatency | The average latency data during the packet | +| | transmission (Unit:microsecond) | ++---------------------+---------------------------------------------------+ +| Bandwidth | Network bandwidth(Unit:Million packets per second)| ++---------------------+---------------------------------------------------+ +| CPU | Total Resource Cpu usage(Unit: Ghz) | ++---------------------+---------------------------------------------------+ +| Duration | Test time(Unit: second) | ++---------------------+---------------------------------------------------+ +| MaximumLatency | The maximum packet latency during the packet | +| | transmission (Unit:microsecond) | ++---------------------+---------------------------------------------------+ +| MinimumLatency | The maximum packet latency during the packet | +| | transmission (Unit:microsecond) | ++---------------------+---------------------------------------------------+ +| MppspGhz | Million Packets per second with per CPU | +| | resource Ghz(Unit: Mpps/Ghz) | ++---------------------+---------------------------------------------------+ +| OfferedLoad | The load of network offered | ++---------------------+---------------------------------------------------+ +| PercentLoss | The percent of frame loss rate | ++---------------------+---------------------------------------------------+ +| RxFrameCount | The total frame on Nic rx | ++---------------------+---------------------------------------------------+ +| RxMbps | The received bandwidth per second | ++---------------------+---------------------------------------------------+ +| TxFrameCount | The total frame on Nic rx | ++---------------------+---------------------------------------------------+ +| TxMbps | The send bandwidth per second | ++---------------------+---------------------------------------------------+ diff --git a/utils/infra_setup/heat_template/vstf_heat_template/launch_vstf.sh b/utils/infra_setup/heat_template/vstf_heat_template/launch_vstf.sh index 37754f98..f2a0aeaa 100644 --- a/utils/infra_setup/heat_template/vstf_heat_template/launch_vstf.sh +++ b/utils/infra_setup/heat_template/vstf_heat_template/launch_vstf.sh @@ -1,5 +1,12 @@ #!/bin/bash - +############################################################################## +# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## set -x STACK_NAME="vstf" diff --git a/utils/infra_setup/heat_template/vstf_heat_template/scp.sh b/utils/infra_setup/heat_template/vstf_heat_template/scp.sh deleted file mode 100644 index b3d6a27b..00000000 --- a/utils/infra_setup/heat_template/vstf_heat_template/scp.sh +++ /dev/null @@ -1,93 +0,0 @@ -function scp_cmd() -{ - local ip=$1 - local usr=$2 - local passwd=$3 - srcfile=$4 - desfile=$5 - opt=$6 - case $opt in - file) - expect -c " - spawn scp -r $srcfile $usr@$ip:$desfile - set timeout -1 - expect { - \"*no)?\" { - send \"yes\r\" - exp_continue - } - \"*assword:*\" { - send \"$passwd\r\" - exp_continue - } - } - " - ;; - dir) - expect -c " - spawn scp -r $srcfile $usr@$ip:$desfile - set timeout -1 - expect { - \"*no)?\" { - send \"yes\r\" - exp_continue - } - \"*assword:*\" { - send \"$passwd\r\" - exp_continue - } - } - " - ;; - *) - echo "err" - ;; - esac -} - -function remote_scp_cmd() -{ - local ip=$1 - local usr=$2 - local passwd=$3 - srcfile=$4 - desfile=$5 - opt=$6 - case $opt in - file) - expect -c " - spawn scp -r $usr@$ip:$srcfile $desfile - set timeout -1 - expect { - \"*no)?\" { - send \"yes\r\" - exp_continue - } - \"*assword:*\" { - send \"$passwd\r\" - exp_continue - } - } - " - ;; - dir) - expect -c " - spawn scp -r $usr@$ip:$srcfile $desfile - set timeout -1 - expect { - \"*no)?\" { - send \"yes\r\" - exp_continue - } - \"*assword:*\" { - send \"$passwd\r\" - exp_continue - } - } - " - ;; - *) - echo "err" - ;; - esac -} diff --git a/utils/infra_setup/heat_template/vstf_heat_template/ssh.sh b/utils/infra_setup/heat_template/vstf_heat_template/ssh.sh deleted file mode 100644 index 35600065..00000000 --- a/utils/infra_setup/heat_template/vstf_heat_template/ssh.sh +++ /dev/null @@ -1,28 +0,0 @@ -function run_cmd() -{ - local ip=$1 - local usr=$2 - local passwd=$3 - local cmd=$4 - expect -c " - spawn ssh $usr@$ip - set timeout -1 - expect { - \"*no)?\" { - send \"yes\r\" - exp_continue - } - \"*assword:*\" { - send \"$passwd\r\" - exp_continue - } - \"*#\" { - send \"$cmd\r\" - exec sleep 1 - send \"exit\r\" - expect eof - } - } - " -} - diff --git a/utils/infra_setup/heat_template/vstf_heat_template/vstf_HOT_create_instance.sh b/utils/infra_setup/heat_template/vstf_heat_template/vstf_HOT_create_instance.sh index 45000256..ce8ed439 100755 --- a/utils/infra_setup/heat_template/vstf_heat_template/vstf_HOT_create_instance.sh +++ b/utils/infra_setup/heat_template/vstf_heat_template/vstf_HOT_create_instance.sh @@ -1,5 +1,12 @@ #!/bin/bash - +############################################################################## +# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## set -ex GERRIT_REFSPEC_DEBUG=$1 diff --git a/utils/infra_setup/heat_template/vstf_heat_template/vstf_test.sh b/utils/infra_setup/heat_template/vstf_heat_template/vstf_test.sh index a5f06f8e..d13a6de6 100644 --- a/utils/infra_setup/heat_template/vstf_heat_template/vstf_test.sh +++ b/utils/infra_setup/heat_template/vstf_heat_template/vstf_test.sh @@ -1,12 +1,17 @@ #!/bin/bash +############################################################################## +# Copyright (c) 2015 Huawei Technologies Co.,Ltd and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## set -x VM_MANAGER_USER="root" VM_MANAGER_PASSWD="root" STACK_NAME="vstf" -#load func -source ./ssh.sh -source ./scp.sh function fn_parser_ipaddress(){ #parser and get output ipaddress @@ -35,7 +40,6 @@ function fn_vstf_test_config(){ #setting testting ipaddress local cmd="vstfadm settings ${tester_testing_ip} ${target_testing_ip}" echo "$cmd" - #run_cmd ${manager_control_public_ip} ${VM_MANAGER_USER} ${VM_MANAGER_PASSWD} "${cmd}" ssh-keygen -f "/home/jenkins-ci/.ssh/known_hosts" -R ${manager_control_public_ip} sshpass -p root ssh -o StrictHostKeyChecking=no root@${manager_control_public_ip} "${cmd}" @@ -55,7 +59,6 @@ function fn_testing_scenario(){ echo ${cmd} ssh-keygen -f "/home/jenkins-ci/.ssh/known_hosts" -R ${manager_control_public_ip} - #run_cmd ${manager_control_public_ip} ${VM_MANAGER_USER} ${VM_MANAGER_PASSWD} "${head_cmd} ${scene} ${test_tool} ${protocol} ${test_type} \"${test_length_list}\" > /root/${scene}" sshpass -p root ssh -o StrictHostKeyChecking=no root@${manager_control_public_ip} "${cmd}" sleep 10 done @@ -68,7 +71,6 @@ function fn_result(){ rm -rf ./result/* for scene in ${test_scenario_list} do - #remote_scp_cmd ${manager_control_public_ip} ${VM_MANAGER_USER} ${VM_MANAGER_PASSWD} "/root/${scene}-result.txt" "./result/${scene}" "file" sshpass -p root ssh -o StrictHostKeyChecking=no root@${manager_control_public_ip} "cat /root/${scene}-result.txt" sshpass -p root scp -o StrictHostKeyChecking=no root@${manager_control_public_ip}:/root/${scene}-result.txt "./result/${scene}" done diff --git a/vstf/vstf/agent/perf/qperf.py b/vstf/vstf/agent/perf/qperf.py index f84f9c24..afdf44d7 100755 --- a/vstf/vstf/agent/perf/qperf.py +++ b/vstf/vstf/agent/perf/qperf.py @@ -133,7 +133,7 @@ class Qperf(object): if data[3] == "us": latency = float(data[2]) / 1000 else: - latency = float(data[2]) / 1000 + latency = float(data[2]) result = { mark.minLatency: latency, mark.avgLatency: latency, diff --git a/vstf/vstf/common/daemon.py b/vstf/vstf/common/daemon.py index 1085d36c..35933dad 100755 --- a/vstf/vstf/common/daemon.py +++ b/vstf/vstf/common/daemon.py @@ -20,45 +20,46 @@ class Daemon(object): Usage: subclass the Daemon class and override the run() method """ + def __init__(self, pidfile, stdin='/dev/null', stdout='/dev/null', stderr='/dev/null'): super(Daemon, self).__init__() self.stdin = stdin self.stdout = stdout self.stderr = stderr self.pidfile = pidfile - + def daemonize(self): """ do the UNIX double-fork magic, see Stevens' "Advanced Programming in the UNIX Environment" for details (ISBN 0201563177) http://www.erlenstar.demon.co.uk/unix/faq_2.html#SEC16 """ - try: - pid = os.fork() + try: + pid = os.fork() if pid > 0: - sys.exit(0) - except OSError, e: + sys.exit(0) + except OSError, e: LOG.error("fork #1 failed: %(errno)s, %(strerror)s", - {'errno':e.errno, 'strerror': e.strerror}) + {'errno': e.errno, 'strerror': e.strerror}) sys.exit(1) - + # decouple from parent environment - os.chdir("/") - os.setsid() - os.umask(0) - + os.chdir("/") + os.setsid() + os.umask(0) + # do second fork - try: - pid = os.fork() + try: + pid = os.fork() if pid > 0: # exit from second parent - sys.exit(0) - except OSError, e: + sys.exit(0) + except OSError, e: LOG.error("fork #1 failed: %(errno)s, %(strerror)s", - {'errno':e.errno, 'strerror': e.strerror}) - sys.exit(1) - - # redirect standard file descriptors + {'errno': e.errno, 'strerror': e.strerror}) + sys.exit(1) + + # redirect standard file descriptors sys.stdout.flush() sys.stderr.flush() si = file(self.stdin, 'r') @@ -67,12 +68,12 @@ class Daemon(object): os.dup2(si.fileno(), sys.stdin.fileno()) os.dup2(so.fileno(), sys.stdout.fileno()) os.dup2(se.fileno(), sys.stderr.fileno()) - + # write pidfile atexit.register(self.delpid) pid = str(os.getpid()) - file(self.pidfile,'w+').write("%s\n" % pid) - + file(self.pidfile, 'w+').write("%s\n" % pid) + def delpid(self): os.remove(self.pidfile) @@ -80,15 +81,15 @@ class Daemon(object): """ Start the daemon """ - + # Check for a pidfile to see if the daemon already runs try: - pf = file(self.pidfile,'r') + pf = file(self.pidfile, 'r') pid = int(pf.read().strip()) pf.close() except IOError: pid = None - + if pid: message = "pidfile %s already exist. Daemon already running?\n" sys.stderr.write(message % self.pidfile) @@ -104,16 +105,16 @@ class Daemon(object): """ # Get the pid from the pidfile try: - pf = file(self.pidfile,'r') + pf = file(self.pidfile, 'r') pid = int(pf.read().strip()) pf.close() except IOError: pid = None - + if not pid: message = "pidfile %s does not exist. Daemon not running?\n" sys.stderr.write(message % self.pidfile) - return # not an error in a restart + return # not an error in a restart # Try killing the daemon process try: @@ -144,10 +145,10 @@ class Daemon(object): """ pass - + def daemon_die(self): - """You should this method when you shutdown daemon + """You should override this method when you shutdown daemon this func will be call by stop() before kill the process """ - pass
\ No newline at end of file + pass diff --git a/vstf/vstf/common/perfmark.py b/vstf/vstf/common/perfmark.py index 5edfe3a4..4f5c3978 100755 --- a/vstf/vstf/common/perfmark.py +++ b/vstf/vstf/common/perfmark.py @@ -19,5 +19,5 @@ rxCount = 'RxFrameCount' duration = 'Duration' cpu = 'CPU' mppsGhz = 'MppspGhz' -rxMbps = "RxMbit" -txMbps = 'TxMbit' +rxMbps = "RxMbps" +txMbps = 'TxMbps' diff --git a/vstf/vstf/controller/res/logo.jpg b/vstf/vstf/controller/res/logo.jpg Binary files differindex 683acfe0..9d524829 100755 --- a/vstf/vstf/controller/res/logo.jpg +++ b/vstf/vstf/controller/res/logo.jpg diff --git a/vstf/vstf/controller/sw_perf/performance.py b/vstf/vstf/controller/sw_perf/performance.py index 7e6467ee..3fe91e93 100755 --- a/vstf/vstf/controller/sw_perf/performance.py +++ b/vstf/vstf/controller/sw_perf/performance.py @@ -268,8 +268,8 @@ class Performance(object): record[mark.rxCount] += nic_data['rxpck'] record[mark.txCount] += nic_data['txpck'] record[mark.bandwidth] += nic_data['rxpck/s'] - record[mark.rxMbps] += nic_data['rxmB/s'] - record[mark.txMbps] += nic_data['txmB/s'] + record[mark.rxMbps] += nic_data['rxmB/s'] * 8 + record[mark.txMbps] += nic_data['txmB/s'] * 8 if record[mark.rxMbps] > record[mark.txMbps]: record[mark.rxMbps], record[mark.txMbps] = record[mark.txMbps], record[mark.rxMbps] |