X-Git-Url: https://gerrit.opnfv.org/gerrit/gitweb?a=blobdiff_plain;f=yardstick%2Fcommon%2Fexceptions.py;h=c78fecc2c37424cb7713a8e9f984e6bdc01a8a57;hb=2c77f9d9559b09299f8ef5cc3d07c847c685d79c;hp=402b5b99ca2bacf108ddfa46d67afaf2c72788a0;hpb=221da2200131f617d36f3143e730f9dcfab530d0;p=yardstick.git diff --git a/yardstick/common/exceptions.py b/yardstick/common/exceptions.py index 402b5b99c..c78fecc2c 100644 --- a/yardstick/common/exceptions.py +++ b/yardstick/common/exceptions.py @@ -21,6 +21,16 @@ class ProcessExecutionError(RuntimeError): self.returncode = returncode +class ErrorClass(object): + + def __init__(self, *args, **kwargs): + if 'test' not in kwargs: + raise RuntimeError + + def __getattr__(self, item): + raise AttributeError + + class YardstickException(Exception): """Base Yardstick Exception. @@ -54,6 +64,10 @@ class YardstickException(Exception): return False +class ResourceCommandError(YardstickException): + message = 'Command: "%(command)s" Failed, stderr: "%(stderr)s"' + + class FunctionNotImplemented(YardstickException): message = ('The function "%(function_name)s" is not implemented in ' '"%(class_name)" class.') @@ -82,8 +96,58 @@ class DPDKSetupDriverError(YardstickException): message = '"igb_uio" driver is not loaded' +class OVSUnsupportedVersion(YardstickException): + message = ('Unsupported OVS version "%(ovs_version)s". Please check the ' + 'config. OVS to DPDK version map: %(ovs_to_dpdk_map)s.') + + +class OVSHugepagesInfoError(YardstickException): + message = 'MemInfo cannnot be retrieved.' + + +class OVSHugepagesNotConfigured(YardstickException): + message = 'HugePages are not configured in this system.' + + +class OVSHugepagesZeroFree(YardstickException): + message = ('There are no HugePages free in this system. Total HugePages ' + 'configured: %(total_hugepages)s') + + +class OVSDeployError(YardstickException): + message = 'OVS deploy tool failed with error: %(stderr)s.' + + +class OVSSetupError(YardstickException): + message = 'OVS setup error. Command: %(command)s. Error: %(error)s.' + + +class LibvirtCreateError(YardstickException): + message = 'Error creating the virtual machine. Error: %(error)s.' + + +class SSHError(YardstickException): + message = '%(error_msg)s' + + +class SSHTimeout(SSHError): + pass + + +class IncorrectConfig(YardstickException): + message = '%(error_msg)s' + + +class IncorrectSetup(YardstickException): + message = '%(error_msg)s' + + +class IncorrectNodeSetup(IncorrectSetup): + pass + + class ScenarioConfigContextNameNotFound(YardstickException): - message = 'Context name "%(context_name)s" not found' + message = 'Context for host name "%(host_name)s" not found' class StackCreationInterrupt(YardstickException): @@ -132,3 +196,28 @@ class ScenarioRemoveRouterIntError(YardstickException): class ScenarioCreateFloatingIPError(YardstickException): message = 'Create Neutron Floating IP Scenario failed' + + +class ScenarioDeleteFloatingIPError(YardstickException): + message = 'Delete Neutron Floating IP Scenario failed' + + +class ApiServerError(YardstickException): + message = 'An unkown exception happened to Api Server!' + + +class UploadOpenrcError(ApiServerError): + message = 'Upload openrc ERROR!' + + +class UpdateOpenrcError(ApiServerError): + message = 'Update openrc ERROR!' + + +class AclMissingActionArguments(YardstickException): + message = ('Missing ACL action parameter ' + '[action=%(action_name)s parameter=%(action_param)s]') + + +class AclUknownActionTemplate(YardstickException): + message = 'No ACL CLI template found for "%(action_name)s" action'