Close paramiko ssh agent session after connect and run.
Change-Id: Ic517bfa5c897ad051ea9f457b811ad12cacfe00f
diff --git a/src/test/utils/CordContainer.py b/src/test/utils/CordContainer.py
index 4d0c5bb..fb71403 100644
--- a/src/test/utils/CordContainer.py
+++ b/src/test/utils/CordContainer.py
@@ -430,7 +430,6 @@
started = onos_log.search_log_pattern('ApplicationManager .* Started')
num_tries += 1
- onos_log.close()
if not started:
print('ONOS did not start')
else:
diff --git a/src/test/utils/OnosLog.py b/src/test/utils/OnosLog.py
index 6bdef9f..5baa6f1 100644
--- a/src/test/utils/OnosLog.py
+++ b/src/test/utils/OnosLog.py
@@ -15,10 +15,6 @@
if not OnosLog.last_snapshot_map.has_key(host):
OnosLog.last_snapshot_map[host] = []
- #should be the last function to call for tearing down the log session
- def close(self):
- self.ssh_agent.client.close()
-
@classmethod
def get_last_snapshot(cls, host):
if cls.last_snapshot_map.has_key(host):
@@ -83,7 +79,6 @@
print('Checking for ERROR and INFO')
st, output = onos_log.get_log(('ERROR', 'INFO'))
print(st, output)
- onos_log.close()
pat = onos_log.search_log_pattern('ApplicationManager .* Started')
if pat:
print(pat)
diff --git a/src/test/utils/SSHTestAgent.py b/src/test/utils/SSHTestAgent.py
index 4cd7666..82f20ad 100644
--- a/src/test/utils/SSHTestAgent.py
+++ b/src/test/utils/SSHTestAgent.py
@@ -22,6 +22,9 @@
host_remove = 'ssh-keygen -f "%s" -R [%s]:8101' %(self.hosts_file, self.host)
try:
os.system(host_remove)
+ except: pass
+
+ try:
self.client.connect(self.host, username = self.user, password = self.password,
key_filename = self.key_file, timeout=timeout, port = self.port)
except:
@@ -45,6 +48,7 @@
else:
break
channel.close()
+ self.client.close()
return st, output
if __name__ == '__main__':