6wind-virtual-accelerator-plugin: adding scripts for simple testing
This patch adds a "tests" folder that includes scripts to be used for plugin testing. Signed-off-by: Francesco Santoro <francesco.santoro@6wind.com> Change-Id: I18d2db1137d1fe76bc1b409f20275a45e09454e7
This commit is contained in:
parent
84de58e02e
commit
59d25cc29e
|
@ -0,0 +1,8 @@
|
||||||
|
.. Copyright 2016, 6WIND S.A.
|
||||||
|
|
||||||
|
Introduction
|
||||||
|
============
|
||||||
|
|
||||||
|
This folder contains scripts to be used when testing the 6WIND virtual accelerator Fuel plugin.
|
||||||
|
Please refer to TestPlan document for more details on how to use these scripts.
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
#cloud-config
|
||||||
|
disable_root: false
|
||||||
|
ssh_pwauth: True
|
||||||
|
chpasswd:
|
||||||
|
list: |
|
||||||
|
root:root
|
||||||
|
expire: False
|
||||||
|
packages:
|
||||||
|
- iperf
|
||||||
|
runcmd:
|
||||||
|
- sed -i -e '/^PermitRootLogin/s/^.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
|
||||||
|
- sed -i -e '/^#UseDNS/s/^.*$/UseDNS no/' /etc/ssh/sshd_config
|
||||||
|
- sed -i -e '/^GSSAPIAuthentication/s/^.*$/GSSAPIAuthentication no/' /etc/ssh/sshd_config
|
||||||
|
- restart ssh
|
||||||
|
- systemctl restart sshd
|
||||||
|
- iperf -s -p 6000 -D
|
|
@ -0,0 +1,28 @@
|
||||||
|
# Copyright 2016 6WIND S.A.
|
||||||
|
#
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TAP_IFACE=$(ip link | grep tap | awk '{print $2}' | sed 's#:##' | tail -n1)
|
||||||
|
|
||||||
|
NB_TAP_PACKETS_BEFORE=$(cat /tmp/6WIND_va_nb_tap_before)
|
||||||
|
NB_FP_VSWITCH_PACKETS_BEFORE=$(cat /tmp/6WIND_va_fp_vswitch_before)
|
||||||
|
NB_EXCEPTIONS_BEFORE=$(cat /tmp/6WIND_va_nb_exc_before)
|
||||||
|
|
||||||
|
NB_TAP_PACKETS_AFTER=$(ethtool -S $TAP_IFACE | grep rx.good_packets | awk '{print $2}')
|
||||||
|
NB_FP_VSWITCH_PACKETS_AFTER=$(fp-cli dump-stats | grep output_ok | sed 's#:# ##' | awk '{print $2}')
|
||||||
|
NB_EXCEPTIONS_AFTER=$(fp-cli dump-stats | grep LocalBasicExceptions | sed 's#:# ##' | awk '{print $2}')
|
||||||
|
|
||||||
|
NB_TAP_PACKETS=$(expr $NB_TAP_PACKETS_AFTER - $NB_TAP_PACKETS_BEFORE)
|
||||||
|
NB_FP_VSWITCH_PACKETS=$(expr $NB_FP_VSWITCH_PACKETS_AFTER - $NB_FP_VSWITCH_PACKETS_BEFORE)
|
||||||
|
NB_EXCEPTIONS=$(expr $NB_EXCEPTIONS_AFTER - $NB_EXCEPTIONS_BEFORE)
|
||||||
|
|
||||||
|
# Here we verify 2 things.
|
||||||
|
# The first check wants to assure that the packets received by the spawned vm
|
||||||
|
# were processed by 6WIND virtual accelerator and not sent to slow path (exception).
|
||||||
|
# The second check wants to assure that this traffic towards the vm correctly
|
||||||
|
# passed via the accelerated ovs.
|
||||||
|
# This is a simple heuristics but it should be enough.
|
||||||
|
if [[ ${NB_EXCEPTIONS} -lt ${NB_TAP_PACKETS} && ${NB_TAP_PACKETS} -le ${NB_FP_VSWITCH_PACKETS} ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
exit 1
|
|
@ -0,0 +1,14 @@
|
||||||
|
# Copyright 2016 6WIND S.A.
|
||||||
|
#
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TAP_IFACE=$(ip link | grep tap | awk '{print $2}' | sed 's#:##' | tail -n1)
|
||||||
|
|
||||||
|
NB_TAP_PACKETS_BEFORE=$(ethtool -S $TAP_IFACE | grep rx.good_packets | awk '{print $2}')
|
||||||
|
NB_FP_VSWITCH_PACKETS_BEFORE=$(fp-cli dump-stats non-zero | grep output_ok | sed 's#:# ##' | awk '{print $2}')
|
||||||
|
NB_EXCEPTIONS_BEFORE=$(fp-cli dump-stats non-zero | grep LocalBasicExceptions | sed 's#:# ##' | awk '{print $2}')
|
||||||
|
|
||||||
|
echo $NB_TAP_PACKETS_BEFORE > /tmp/6WIND_va_nb_tap_before
|
||||||
|
echo $NB_FP_VSWITCH_PACKETS_BEFORE > /tmp/6WIND_va_fp_vswitch_before
|
||||||
|
echo $NB_EXCEPTIONS_BEFORE > /tmp/6WIND_va_nb_exc_before
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
# Copyright 2016 6WIND S.A.
|
||||||
|
#
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
TAP_IFACE=$(ip link | grep tap | awk '{print $2}' | sed 's#:##' | tail -n1)
|
||||||
|
DRIVER=$(ethtool -i $TAP_IFACE | grep driver | awk '{print $2}')
|
||||||
|
|
||||||
|
if [[ ${DRIVER} -eq "dpvi" ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
exit 1
|
|
@ -0,0 +1,15 @@
|
||||||
|
# Copyright 2016 6WIND S.A.
|
||||||
|
#
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source openrc
|
||||||
|
|
||||||
|
glance image-delete ubuntu-cloud
|
||||||
|
nova flavor-delete m1.vm_hugepages
|
||||||
|
|
||||||
|
STATUS=$(nova show test_vm | grep status | awk '{print $4}')
|
||||||
|
if [[ ${STATUS} == "ACTIVE" ]] || [[ ${STATUS} == "ERROR" ]]; then
|
||||||
|
nova delete test_vm
|
||||||
|
fi
|
||||||
|
nova secgroup-delete-rule default tcp 1 65535 0.0.0.0/0
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Copyright 2016 6WIND S.A.
|
||||||
|
#
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source openrc
|
||||||
|
|
||||||
|
FLOATING_IP=$(nova floating-ip-create net04_ext | grep net04_ext | tail -n1 | awk '{print $4}')
|
||||||
|
|
||||||
|
if [[ ! -z ${FLOATING_IP} ]]; then
|
||||||
|
nova floating-ip-associate test_vm ${FLOATING_IP}
|
||||||
|
nova secgroup-add-rule default tcp 1 65535 0.0.0.0/0
|
||||||
|
fi
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
# Copyright 2016 6WIND S.A.
|
||||||
|
#
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
UBUNTU_IMAGE="ubuntu-14.04-server-cloudimg-amd64-disk1.img"
|
||||||
|
IMAGE_NAME="ubuntu-cloud"
|
||||||
|
|
||||||
|
source openrc
|
||||||
|
|
||||||
|
#Required to be able to install iperf package since Cirros image does not provide it
|
||||||
|
curl https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img -o $UBUNTU_IMAGE
|
||||||
|
glance image-create --name $IMAGE_NAME --file $UBUNTU_IMAGE --disk-format qcow2 --container-format bare --is-public True --progress
|
||||||
|
nova flavor-create m1.vm_hugepages auto 512 3 1
|
||||||
|
nova flavor-key m1.vm_hugepages set hw:mem_page_size=large
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
# Copyright 2016 6WIND S.A.
|
||||||
|
#
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source openrc
|
||||||
|
|
||||||
|
NET_ID=$(neutron net-list | grep 192 | tail -n1 | awk '{print $2}')
|
||||||
|
nova boot --flavor m1.vm_hugepages --image ubuntu-cloud test_vm --nic net-id=$NET_ID --user-data /root/cloud.cfg
|
||||||
|
|
||||||
|
while [ $(nova list | grep test_vm | grep BUILD | wc -l) -eq 1 ]; do
|
||||||
|
sleep 1;
|
||||||
|
done
|
||||||
|
|
||||||
|
STATUS=$(nova show test_vm | grep status | awk '{print $4}')
|
||||||
|
|
||||||
|
if [[ ${STATUS} == "ACTIVE" ]]; then
|
||||||
|
echo "Wait 2 minutes to make sure that vm cloud-init has finished"
|
||||||
|
sleep 120
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
exit 1
|
|
@ -0,0 +1,10 @@
|
||||||
|
# Copyright 2016 6WIND S.A.
|
||||||
|
#
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
source openrc
|
||||||
|
floating_ip=$(nova floating-ip-list | grep net04_ext | awk '{print $4}')
|
||||||
|
|
||||||
|
apt-get install -y iperf
|
||||||
|
iperf -c $floating_ip -p 6000
|
||||||
|
|
|
@ -0,0 +1,74 @@
|
||||||
|
# Copyright 2016 6WIND S.A.
|
||||||
|
#
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "Upload scripts to controller node"
|
||||||
|
scp controller_* cloud.cfg root@$CONTROLLER:/root/
|
||||||
|
|
||||||
|
echo "Upload scripts to compute node"
|
||||||
|
scp compute_* root@$COMPUTE:/root/
|
||||||
|
|
||||||
|
function cleanup {
|
||||||
|
echo "Cleanup of testing resources"
|
||||||
|
ssh root@$CONTROLLER 'bash /root/controller_cleanup.sh'
|
||||||
|
}
|
||||||
|
|
||||||
|
echo "Download the ubuntu cloud image to spawn vms and create flavor for hugepages support"
|
||||||
|
ssh root@$CONTROLLER 'bash /root/controller_create_image_and_flavor.sh'
|
||||||
|
if [[ $? -eq 1 ]]; then
|
||||||
|
echo "TEST FAILED: Failed to download test cloud image. Exiting..."
|
||||||
|
cleanup
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Spawn an accelerated vm"
|
||||||
|
ssh root@$CONTROLLER 'bash /root/controller_launch_instance.sh'
|
||||||
|
if [[ $? -eq 1 ]]; then
|
||||||
|
echo "TEST FAILED: Unable to launch accelerated instance. Exiting..."
|
||||||
|
cleanup
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Verify that network interface is managed by virtual accelerator"
|
||||||
|
ssh root@$COMPUTE 'bash /root/compute_verify_driver.sh'
|
||||||
|
if [[ $? -eq 1 ]]; then
|
||||||
|
echo "TEST FAILED: Virtual machine network interface is not managed by 6WIND virtual accelerator. Exiting..."
|
||||||
|
cleanup
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Add security group tcp rule and associate floating ip"
|
||||||
|
ssh root@$CONTROLLER 'bash /root/controller_configure_floating.sh'
|
||||||
|
if [[ $? -eq 1 ]]; then
|
||||||
|
echo "TEST FAILED: Unable to correctly configure floating ip and security group. Exiting..."
|
||||||
|
cleanup
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Check virtual accelerator statistics before traffic"
|
||||||
|
ssh root@$COMPUTE 'bash /root/compute_check_stats_before.sh'
|
||||||
|
if [[ $? -eq 1 ]]; then
|
||||||
|
echo "TEST FAILED: Unable to retrieve virtual interface pre-stats. Exiting..."
|
||||||
|
cleanup
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Send traffic from controller to virtual machine"
|
||||||
|
ssh root@$CONTROLLER 'bash /root/controller_send_traffic.sh'
|
||||||
|
if [[ $? -eq 1 ]]; then
|
||||||
|
echo "TEST FAILED: Unable to correctly send traffic to virtual machine. Exiting..."
|
||||||
|
cleanup
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Check virtual accelerator statistics after traffic"
|
||||||
|
ssh root@$COMPUTE 'bash /root/compute_check_stats_after.sh'
|
||||||
|
if [[ $? -eq 1 ]]; then
|
||||||
|
echo "TEST FAILED: A part or all the traffic sent was not accelerated"
|
||||||
|
cleanup
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "TEST PASSED"
|
||||||
|
cleanup
|
||||||
|
exit 0
|
Loading…
Reference in New Issue