test/automated-pytest-suite/utils/exceptions.py
Yang Liu 33756ac899 Initial submission for starlingx pytest framework.
Include:
- util modules. such as table_parser, ssh/localhost clients, cli module,
exception, logger, etc. Util modules are mostly used by keywords.
- keywords modules. These are helper functions that are used directly by
test functions.
- platform (with platform or platform_sanity marker) and stx-openstack
(with sanity, sx_sanity, cpe_sanity, or storage_sanity marker) sanity
testcases
- pytest config conftest, and test fixture modules
- test config file template/example

Required packages:
- python3.4 or python3.5
- pytest >=3.10,<4.0
- pexpect
- requests
- pyyaml
- selenium (firefox, ffmpeg, pyvirtualdisplay, Xvfb or Xephyr or Xvnc)

Limitations:
- Anything that requires copying from Test File Server will not work until
a public share is configured to shared test files. Tests skipped for now.

Co-Authored-By: Maria Yousaf <maria.yousaf@windriver.com>
Co-Authored-By: Marvin Huang <marvin.huang@windriver.com>
Co-Authored-By: Yosief Gebremariam <yosief.gebremariam@windriver.com>
Co-Authored-By: Paul Warner <paul.warner@windriver.com>
Co-Authored-By: Xueguang Ma <Xueguang.Ma@windriver.com>
Co-Authored-By: Charles Chen <charles.chen@windriver.com>
Co-Authored-By: Daniel Graziano <Daniel.Graziano@windriver.com>
Co-Authored-By: Jordan Li <jordan.li@windriver.com>
Co-Authored-By: Nimalini Rasa <nimalini.rasa@windriver.com>
Co-Authored-By: Senthil Mukundakumar <senthil.mukundakumar@windriver.com>
Co-Authored-By: Anuejyan Manokeran <anujeyan.manokeran@windriver.com>
Co-Authored-By: Peng Peng <peng.peng@windriver.com>
Co-Authored-By: Chris Winnicki <chris.winnicki@windriver.com>
Co-Authored-By: Joe Vimar <Joe.Vimar@windriver.com>
Co-Authored-By: Alex Kozyrev <alex.kozyrev@windriver.com>
Co-Authored-By: Jack Ding <jack.ding@windriver.com>
Co-Authored-By: Ming Lei <ming.lei@windriver.com>
Co-Authored-By: Ankit Jain <ankit.jain@windriver.com>
Co-Authored-By: Eric Barrett <eric.barrett@windriver.com>
Co-Authored-By: William Jia <william.jia@windriver.com>
Co-Authored-By: Joseph Richard <Joseph.Richard@windriver.com>
Co-Authored-By: Aldo Mcfarlane <aldo.mcfarlane@windriver.com>

Story: 2005892
Task: 33750
Signed-off-by: Yang Liu <yang.liu@windriver.com>

Change-Id: I7a88a47e09733d39f024144530f5abb9aee8cad2
2019-07-15 15:30:00 -04:00

262 lines
5.3 KiB
Python

class TiSError(Exception):
"""
Base class for TiS test automation exceptions.
Notes:
Each module (or package depends on which makes more sense) should
have its own sub-base-class that
inherits this class.Then the specific exception for that module/package
should inherit the sub-base-class.
Examples:
sub-base-class for ssh.py: SSHException(TiSError); ssh retry timeout
exception: SSHRetryTimeout(SSHException)
"""
message = "An unknown exception occurred"
def __init__(self, detailed_message="No details provided"):
super(TiSError, self).__init__()
self._error_string = self.message + "\nDetails: " + detailed_message
def __str__(self):
return self._error_string
class NoMatchFoundError(TiSError):
message = "No match found."
class InvalidStructure(TiSError):
message = "Invalid cli output table structure."
class SSHException(TiSError):
"""
Base class for SSH Exceptions. All SSH exceptions thrown from utils >
ssh.py module should inherit this class.
Examples: SSHRetryTimeout(SSHException)
"""
message = "SSH error."
class TelnetError(TiSError):
message = "Telnet Error"
class TelnetTimeout(TelnetError):
message = 'Telnet timeout'
class TelnetEOF(TelnetError):
message = 'Telnet EOF.'
class LocalHostError(TiSError):
message = 'Localhost error.'
class SSHRetryTimeout(SSHException):
message = "Timed out to connect to host."
class IncorrectCredential(SSHException):
message = "Login credential rejected by host."
class SSHExecCommandFailed(SSHException):
"""Raised when remotely executed command returns nonzero status."""
message = "Failed to execute command via SSH."
class TimeoutException(SSHException):
message = "Request(s) timed out"
class ImproperUsage(SSHException):
message = "Improper use of test framework"
class ActiveControllerUnsetException(SSHException):
message = ("Active controller ssh client is not set! "
"Please use ControllerClient.set_active_controller(ssh_client) "
"to set an active controller client.")
class NatBoxClientUnsetException(SSHException):
message = "NatBox ssh client it not set! Please use " \
"NATBoxClient.set_natbox_client(ip) to set an natbox client"
class CLIRejected(TiSError):
"""Throw when cli command is rejected due to unexpected reasons, such as
missing arguments"""
message = "CLI command is rejected."
class HostError(TiSError):
"""Generic Host error"""
message = "Host error."
class HostPostCheckFailed(HostError):
"""Throws when expected host status is not reached after running certain
host action cli command."""
message = "Check failed post host operation."
class HostPreCheckFailed(HostError):
message = "Check failed pre host operation."
class HostTimeout(HostError):
message = "Host operation timed out."
class VMError(TiSError):
message = "VM error."
class VMPostCheckFailed(VMError):
message = "Check failed post VM operation."
class VMNetworkError(VMError):
message = "VM network error."
class VMTimeout(VMError):
message = "VM operation timed out."
class VMOperationFailed(VMError):
"""Failure indicated by CLI output"""
message = "VM operation failed."
class VolumeError(TiSError):
message = "Volume error."
class ImageError(TiSError):
message = "Image error."
class FlavorError(TiSError):
message = "Flavor error."
class CommonError(TiSError):
message = "Setup/Teardown error."
class NovaError(TiSError):
message = "Nova error."
class NeutronError(TiSError):
message = "Neutron error."
class HeatError(TiSError):
message = "Heat error."
class CeilometerError(TiSError):
message = "Ceilometer error."
class SysinvError(TiSError):
message = 'Sysinv error.'
class ContainerError(SysinvError):
message = 'Container error.'
class CinderError(TiSError):
message = 'Cinder error.'
class KeystoneError(TiSError):
message = 'Keystone error.'
class BuildServerError(TiSError):
message = "Build Server error."
class ThreadingError(TiSError):
message = "Multi threading error."
class VLMError(TiSError):
message = "VLM Operation Error."
class SwiftError(TiSError):
message = "Swift error."
class OrchestrationError(TiSError):
message = 'Orchestration error.'
class UpgradeError(TiSError):
message = 'Upgrade error.'
class BackupSystem(TiSError):
message = 'System Backup error.'
class RestoreSystem(TiSError):
message = 'System Restore error.'
class StorageError(TiSError):
message = 'Storage error.'
class HorizonError(TiSError):
message = 'Horizon error.'
class IxiaError(TiSError):
message = 'Ixia error.'
class RefStackError(TiSError):
message = 'RefStack test(s) failed.'
class DovetailError(TiSError):
message = 'Dovetail test(s) failed.'
class MuranoError(TiSError):
message = 'Murano error.'
class DCError(TiSError):
message = 'DC error.'
class PatchError(TiSError):
message = 'Patch error.'
class KubeError(TiSError):
message = 'Kubernetes error.'
class KubeCmdError(KubeError):
message = 'Kubernetes cmd failed.'
class InstallError(TiSError):
message = 'Install error'
class K8sError(TiSError):
message = 'K8s error'