summaryrefslogtreecommitdiffstats
path: root/scripts/automation/trex_control_plane/common/trex_stl_exceptions.py
diff options
context:
space:
mode:
authorimarom <imarom@cisco.com>2016-02-09 11:18:47 -0500
committerimarom <imarom@cisco.com>2016-02-09 11:18:47 -0500
commitede68c669fde984d6095e9313d49a8af295ae885 (patch)
tree3c3d52457bc94475f413a04b82f6e4e80b48b64f /scripts/automation/trex_control_plane/common/trex_stl_exceptions.py
parent1ab9a175ca7d49f7ae843d46a76c36baa16ff39d (diff)
parent59d48a12d2c2f1e7a42e44265c4a3a4c1c8651fd (diff)
Merge branch 'refactor'
Diffstat (limited to 'scripts/automation/trex_control_plane/common/trex_stl_exceptions.py')
-rw-r--r--scripts/automation/trex_control_plane/common/trex_stl_exceptions.py53
1 files changed, 0 insertions, 53 deletions
diff --git a/scripts/automation/trex_control_plane/common/trex_stl_exceptions.py b/scripts/automation/trex_control_plane/common/trex_stl_exceptions.py
deleted file mode 100644
index 9be20db9..00000000
--- a/scripts/automation/trex_control_plane/common/trex_stl_exceptions.py
+++ /dev/null
@@ -1,53 +0,0 @@
-import os
-import sys
-from common.text_opts import *
-
-# basic error for API
-class STLError(Exception):
- def __init__ (self, msg):
- self.msg = str(msg)
-
- def __str__ (self):
- exc_type, exc_obj, exc_tb = sys.exc_info()
- fname = os.path.split(exc_tb.tb_frame.f_code.co_filename)[1]
-
-
- s = "\n******\n"
- s += "Error at {0}:{1}\n\n".format(format_text(fname, 'bold'), format_text(exc_tb.tb_lineno), 'bold')
- s += "specific error:\n\n{0}\n".format(format_text(self.msg, 'bold'))
-
- return s
-
- def brief (self):
- return self.msg
-
-
-# raised when the client state is invalid for operation
-class STLStateError(STLError):
- def __init__ (self, op, state):
- self.msg = "Operation '{0}' is not valid while '{1}'".format(op, state)
-
-
-# port state error
-class STLPortStateError(STLError):
- def __init__ (self, port, op, state):
- self.msg = "Operation '{0}' on port(s) '{1}' is not valid while port(s) '{2}'".format(op, port, state)
-
-
-# raised when argument is not valid for operation
-class STLArgumentError(STLError):
- def __init__ (self, name, got, valid_values = None, extended = None):
- self.msg = "Argument: '{0}' invalid value: '{1}'".format(name, got)
- if valid_values:
- self.msg += " - valid values are '{0}'".format(valid_values)
-
- if extended:
- self.msg += "\n{0}".format(extended)
-
-# raised when timeout occurs
-class STLTimeoutError(STLError):
- def __init__ (self, timeout):
- self.msg = "Timeout: operation took more than '{0}' seconds".format(timeout)
-
-
-