* [dts] [PATCH] Optimize execution exit function
@ 2015-07-14 5:04 Yong Liu
0 siblings, 0 replies; only message in thread
From: Yong Liu @ 2015-07-14 5:04 UTC (permalink / raw)
To: dts
From: Marvin Liu <yong.liu@intel.com>
After execution done, dut crb will close all sessions. Restore ipv6 on tester
interface. Logger handler will be exited.
Tester crb will close all sessions. Logger handler will also be exited.
Signed-off-by: Marvin Liu <yong.liu@intel.com>
diff --git a/framework/dts.py b/framework/dts.py
index 212f336..40a3c42 100644
--- a/framework/dts.py
+++ b/framework/dts.py
@@ -260,8 +260,8 @@ def dts_crbs_exit():
"""
Remove logger handler when exit.
"""
- dut.logger.logger_exit()
- tester.logger.logger_exit()
+ dut.crb_exit()
+ tester.crb_exit()
def dts_run_prerequisties(pkgName, patch):
@@ -324,9 +324,7 @@ def dts_run_target(crbInst, targets, test_suites, nic, scenario):
scene = None
dut.restore_interfaces()
- dut.close()
tester.restore_interfaces()
- tester.close()
def dts_run_suite(crbInst, test_suites, target, nic, scene):
diff --git a/framework/dut.py b/framework/dut.py
index d587834..2f33a51 100644
--- a/framework/dut.py
+++ b/framework/dut.py
@@ -864,7 +864,19 @@ class Dut(Crb):
"""
Close ssh session of DUT.
"""
- self.session.close()
- self.alt_session.close()
+ if self.session:
+ self.session.close()
+ self.session = None
+ if self.alt_session:
+ self.alt_session.close()
+ self.alt_session = None
if self.host_init_flag:
self.host_session.close()
+
+ def crb_exit(self):
+ """
+ Recover all resource before crb exit
+ """
+ self.logger.logger_exit()
+ self.enable_tester_ipv6()
+ self.close()
diff --git a/framework/tester.py b/framework/tester.py
index 35581c8..de0bc24 100644
--- a/framework/tester.py
+++ b/framework/tester.py
@@ -467,6 +467,18 @@ class Tester(Crb):
"""
Close ssh session and IXIA tcl session.
"""
- super(Tester, self).close()
+ if self.session:
+ self.session.close()
+ self.session = None
+ if self.alt_session:
+ self.alt_session.close()
+ self.alt_session = None
if self.it_uses_external_generator():
self.ixia_packet_gen.close()
+
+ def crb_exit(self):
+ """
+ Close all resource before crb exit
+ """
+ self.logger.logger_exit()
+ self.close()
--
1.9.3
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2015-07-14 5:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-07-14 5:04 [dts] [PATCH] Optimize execution exit function Yong 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).