From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3A6F9A0507; Wed, 6 Apr 2022 16:57:23 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 09AFB4288C; Wed, 6 Apr 2022 16:56:30 +0200 (CEST) Received: from lb.pantheon.sk (lb.pantheon.sk [46.229.239.20]) by mails.dpdk.org (Postfix) with ESMTP id 7966842873 for ; Wed, 6 Apr 2022 16:56:26 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by lb.pantheon.sk (Postfix) with ESMTP id C3E001B1F4B; Wed, 6 Apr 2022 16:56:25 +0200 (CEST) X-Virus-Scanned: amavisd-new at siecit.sk Received: from lb.pantheon.sk ([127.0.0.1]) by localhost (lb.pantheon.sk [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7-Qo93EohgFb; Wed, 6 Apr 2022 16:56:24 +0200 (CEST) Received: from entguard.lab.pantheon.local (unknown [46.229.239.141]) by lb.pantheon.sk (Postfix) with ESMTP id E195B1B1F4E; Wed, 6 Apr 2022 16:56:10 +0200 (CEST) From: =?UTF-8?q?Juraj=20Linke=C5=A1?= To: thomas@monjalon.net, david.marchand@redhat.com, Honnappa.Nagarahalli@arm.com, ohilyard@iol.unh.edu, lijuan.tu@intel.com Cc: dev@dpdk.org, =?UTF-8?q?Juraj=20Linke=C5=A1?= Subject: [RFC PATCH v1 08/15] dts: merge DTS framework/exception.py to DPDK Date: Wed, 6 Apr 2022 14:55:59 +0000 Message-Id: <20220406145606.2913834-9-juraj.linkes@pantheon.tech> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220406145606.2913834-1-juraj.linkes@pantheon.tech> References: <20220406145606.2913834-1-juraj.linkes@pantheon.tech> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --- dts/framework/exception.py | 148 +++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 dts/framework/exception.py diff --git a/dts/framework/exception.py b/dts/framework/exception.py new file mode 100644 index 0000000000..fb0fa72e42 --- /dev/null +++ b/dts/framework/exception.py @@ -0,0 +1,148 @@ +""" +User-defined exceptions used across the framework. +""" +from typing import Any + + +class TimeoutException(Exception): + + """ + Command execution timeout. + """ + + def __init__(self, command, output): + self.command = command + self.output = output + + def __str__(self): + msg = "TIMEOUT on %s" % (self.command) + return msg + + def get_output(self): + return self.output + + +class VerifyFailure(Exception): + + """ + To be used within the test cases to verify if a command output + is as it was expected. + """ + + def __init__(self, value): + self.value = value + + def __str__(self): + return repr(self.value) + + +class VerifySkip(Exception): + + """ + To be used within the test cases to verify if case should be skipped. + """ + + def __init__(self, value): + self.value = value + + def __str__(self): + return repr(self.value) + + +class SSHConnectionException(Exception): + + """ + SSH connection error. + """ + + def __init__(self, host): + self.host = host + + def __str__(self): + return "Error trying to connect with %s" % self.host + + +class SSHSessionDeadException(Exception): + + """ + SSH session is not alive. + It can no longer be used. + """ + + def __init__(self, host): + self.host = host + + def __str__(self): + return "SSH session with %s has been dead" % self.host + + +class ParameterInvalidException(Exception): + pass + + +class StartVMFailedException(Exception): + + """ + Start VM failed. + """ + + def __init__(self, error): + self.error = error + + def __str__(self): + return repr(self.error) + + +class ConfigParseException(Exception): + + """ + Configuration file parse failure exception. + """ + + def __init__(self, conf_file): + self.config = conf_file + + def __str__(self): + return "Faile to parse config file [%s]" % (self.config) + + +class VirtConfigParseException(Exception): + pass + + +class PortConfigParseException(Exception): + pass + + +class VirtConfigParamException(Exception): + + """ + Virtualization param execution exception. + """ + + def __init__(self, param): + self.param = param + + def __str__(self): + return "Faile to execute param [%s]" % (self.param) + + +class VirtDutConnectException(Exception): + pass + + +class VirtDutInitException(Exception): + def __init__(self, vm_dut): + self.vm_dut = vm_dut + + +class VirtDeviceCreateException(Exception): + pass + + +class VirtVmOperationException(Exception): + pass + + +class VirtHostPrepareException(Exception): + pass -- 2.20.1