[SPT] Added downloaded iperf package for vm2vm test
Added possibility to execute vm2vm test in case if
the OpenStack instances have no Internet to install
iperf packages from Internet using apt.
In case if there is no Internet, the deb package is
already dwnloaded and present inside the Docker image.
When VM is ready, the iperf package is transported to
it and installed.
The possibility is configured with 'internet_at_vms'
string option that is 'true' by default.
Change-Id: I45c47f9691f484340e7f4a9decc584dcedb63b6c
Related-PROD: #PROD-32023
diff --git a/Dockerfile b/Dockerfile
index 33f702b..867726d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -61,7 +61,10 @@
# Cleanup
&& apt-get -y purge libx11-data xauth libxmuu1 libxcb1 libx11-6 libxext6 ppp pppconfig pppoeconf popularity-contest cpp gcc g++ libssl-doc && \
apt-get -y autoremove; apt-get -y clean ; rm -rf /root/.cache; rm -rf /var/lib/apt/lists/* && \
- rm -rf /tmp/* ; rm -rf /var/tmp/* ; rm -rfv /etc/apt/sources.list.d/* ; echo > /etc/apt/sources.list
+ rm -rf /tmp/* ; rm -rf /var/tmp/* ; rm -rfv /etc/apt/sources.list.d/* ; echo > /etc/apt/sources.list \
+
+# Download iperf package
+ && wget http://ftp.br.debian.org/debian/pool/main/i/iperf/iperf_2.0.5+dfsg1-2_amd64.deb -O /var/lib/iperf_2.0.5+dfsg1-2_amd64.deb
ENTRYPOINT ["entrypoint.sh"]
# docker build --no-cache -t cvp-sanity-checks:test_latest .
diff --git a/test_set/cvp-spt/global_config.yaml b/test_set/cvp-spt/global_config.yaml
index 3a731c4..ac1edd5 100644
--- a/test_set/cvp-spt/global_config.yaml
+++ b/test_set/cvp-spt/global_config.yaml
@@ -19,19 +19,21 @@
# How many seconds to wait for salt-minion to respond
salt_timeout: 1
-image_name: "Ubuntu"
skipped_nodes: []
# example for Jenkins: networks=net1,net2
networks: "10.101.0.0/24"
-external_network: ''
HW_NODES: []
CMP_HOSTS: []
-nova_timeout: 90
-iperf_prep_string: "sudo /bin/bash -c 'echo \"91.189.88.161 archive.ubuntu.com\" >> /etc/hosts'"
IMAGE_SIZE_MB: 2000
# parameters for vm2vm test
+image_name: "Ubuntu"
flavor_name: 'spt-test'
flavor_ram: 1536
flavor_vcpus: 1
flavor_disk: 5
+nova_timeout: 90
+external_network: ''
+iperf_prep_string: "sudo /bin/bash -c 'echo \"91.189.88.161 archive.ubuntu.com\" >> /etc/hosts'"
+# whether Internet is present at OpenStack VMs and iperf can be installed with apt
+internet_at_vms: 'true'
\ No newline at end of file
diff --git a/test_set/cvp-spt/utils/ssh.py b/test_set/cvp-spt/utils/ssh.py
index 66551eb..dec9ba3 100644
--- a/test_set/cvp-spt/utils/ssh.py
+++ b/test_set/cvp-spt/utils/ssh.py
@@ -136,5 +136,23 @@
config = utils.get_configuration()
preparation_cmd = config.get('iperf_prep_string') or ['']
transport.exec_command(preparation_cmd)
- transport.exec_command('sudo apt-get update; sudo apt-get install -y iperf')
- transport.exec_command('nohup iperf -s > file 2>&1 &')
+
+ # Install iperf using apt or downloaded deb package
+ internet_at_vms = utils.get_configuration().get("internet_at_vms")
+ if internet_at_vms.lower() == 'false':
+ logger.debug("Using downloaded iperf package")
+ transport.put_file("/var/lib/iperf_2.0.5+dfsg1-2_amd64.deb",
+ "/home/ubuntu/iperf_2.0.5+dfsg1-2_amd64.deb")
+ transport.exec_command(
+ 'sudo dpkg -i /home/ubuntu/iperf_2.0.5+dfsg1-2_amd64.deb')
+ else:
+ logger.debug("Installing iperf using apt")
+ transport.exec_command(
+ 'sudo apt-get update; sudo apt-get install -y iperf')
+
+ # Log whether iperf is installed with version
+ check = transport.exec_command('dpkg -l | grep iperf')
+ logger.debug(check)
+
+ # Staring iperf server
+ transport.exec_command('nohup iperf -s > file 2>&1 &')