* [dts] [PATCH] framework tester: raise exception when parameter is invalid
@ 2016-07-07 6:36 Marvin Liu
0 siblings, 0 replies; only message in thread
From: Marvin Liu @ 2016-07-07 6:36 UTC (permalink / raw)
To: dts; +Cc: Marvin Liu
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/exception.py b/framework/exception.py
index 0e7a344..654e420 100644
--- a/framework/exception.py
+++ b/framework/exception.py
@@ -62,6 +62,9 @@ class SSHSessionDeadException(Exception):
return 'SSH session with %s has been dead' % self.host
+class ParameterInvalidException(Exception):
+ pass
+
class StartVMFailedException(Exception):
"""
diff --git a/framework/tester.py b/framework/tester.py
index dffb1d5..55942d1 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -43,6 +43,7 @@ from etgen import IxiaPacketGenerator, SoftwarePacketGenerator
from settings import IXIA
import random
from utils import GREEN
+from exception import ParameterInvalidException
class Tester(Crb):
@@ -160,12 +161,18 @@ class Tester(Crb):
"""
Return tester local port pci id.
"""
+ if localPort == -1:
+ raise ParameterInvalidException("local port should not be -1")
+
return self.ports_info[localPort]['pci']
def get_interface(self, localPort):
"""
Return tester local port interface name.
"""
+ if localPort == -1:
+ raise ParameterInvalidException("local port should not be -1")
+
if 'intf' not in self.ports_info[localPort]:
return 'N/A'
@@ -175,6 +182,9 @@ class Tester(Crb):
"""
Return tester local port mac address.
"""
+ if localPort == -1:
+ raise ParameterInvalidException("local port should not be -1")
+
if self.ports_info[localPort]['type'] == 'ixia':
return "00:00:00:00:00:01"
else:
--
1.9.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2016-07-07 6:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-07 6:36 [dts] [PATCH] framework tester: raise exception when parameter is invalid Marvin Liu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).