aboutsummaryrefslogtreecommitdiffstats
path: root/functest/opnfv_tests/openstack/vgpu/vgpu.py
diff options
context:
space:
mode:
authorValentin Boucher <valentin.boucher@kontron.com>2018-08-07 12:30:50 -0400
committerValentin Boucher <valentin.boucher@kontron.com>2018-08-10 15:26:34 -0400
commit86a239dba6e5c2abced2b1de53e57aba3c04b82c (patch)
tree3b0f271b9191e3fbfbe933a9b8af3360365f0ae3 /functest/opnfv_tests/openstack/vgpu/vgpu.py
parent3d1986d1a8035e93b7ad7e4331cb1cbe126a857f (diff)
Test OpenStack vGPU feature
XCI will be able to deploy this feature on top of pharos lab with GPU so we have test it This test can be improved in the future with OpenCL tests etc | DEPLOY_SCENARIO | os-nosdn-vgpu-ha | +-------------------+-------------------+------------------+----------------+ | TEST CASE | PROJECT | DURATION | RESULT | +-------------------+-------------------+------------------+----------------+ | vgpu | functest | 01:00 | PASS | +-------------------+-------------------+------------------+----------------+ Change-Id: I50618f47097a0257b1834b3966054d20458715df Signed-off-by: Valentin Boucher <valentin.boucher@kontron.com>
Diffstat (limited to 'functest/opnfv_tests/openstack/vgpu/vgpu.py')
-rw-r--r--functest/opnfv_tests/openstack/vgpu/vgpu.py54
1 files changed, 54 insertions, 0 deletions
diff --git a/functest/opnfv_tests/openstack/vgpu/vgpu.py b/functest/opnfv_tests/openstack/vgpu/vgpu.py
new file mode 100644
index 000000000..a900eb203
--- /dev/null
+++ b/functest/opnfv_tests/openstack/vgpu/vgpu.py
@@ -0,0 +1,54 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2018 Kontron 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
+
+"""vGPU testcase implementation."""
+
+from __future__ import division
+
+import logging
+
+from functest.core import singlevm
+
+
+class vGPU(singlevm.SingleVm2):
+ """OpenStack vGPU Test Case."""
+
+ __logger = logging.getLogger(__name__)
+
+ filename = ('/home/opnfv/functest/images/'
+ 'ubuntu-16.04-server-cloudimg-amd64-disk1.img')
+ flavor_ram = 4096
+ flavor_vcpus = 2
+ flavor_disk = 40
+ flavor_extra_specs = {'resources:VGPU': '1'}
+ username = 'ubuntu'
+ ssh_connect_loops = 12
+ create_server_timeout = 300
+
+ def __init__(self, **kwargs):
+ """Initialize vGPU testcase object."""
+ if "case_name" not in kwargs:
+ kwargs["case_name"] = "vgpu"
+ super(vGPU, self).__init__(**kwargs)
+
+ def execute(self):
+ """
+ Test if the vGPU exist.
+ """
+ (_, stdout, stderr) = self.ssh.exec_command('lspci')
+ lspci_output = stdout.read()
+ self.__logger.debug("output:\n%s", stdout.read())
+ self.__logger.debug("error:\n%s", stderr.read())
+ if ('VGA compatible controller: Intel' in lspci_output or
+ 'VGA compatible controller: Nvidia' in lspci_output):
+ self.__logger.info("The VM have a vGPU")
+ return 0
+ else:
+ self.__logger.error("The VM haven't any vGPU")
+ return 1