diff options
author | Matus Fabian <matfabia@cisco.com> | 2016-03-17 14:14:22 +0100 |
---|---|---|
committer | Gerrit Code Review <gerrit@fd.io> | 2016-03-18 22:40:54 +0000 |
commit | 2bd0f8299dffb7818d87081f2f7b06d38a8ab620 (patch) | |
tree | c799b5847c21f2da629807a61010d1f90a68aeb0 /resources/libraries/python | |
parent | 2d54ff480b3f135ef4be951c065b4a6d19a138f8 (diff) |
Add SSH disconnect
Change-Id: Ib0efec083aa9ee33b7d15680e5a15989827b8e57
Signed-off-by: Matus Fabian <matfabia@cisco.com>
Diffstat (limited to 'resources/libraries/python')
-rw-r--r-- | resources/libraries/python/ssh.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/resources/libraries/python/ssh.py b/resources/libraries/python/ssh.py index ad5fb27b85..a94eec4e91 100644 --- a/resources/libraries/python/ssh.py +++ b/resources/libraries/python/ssh.py @@ -67,6 +67,17 @@ class SSH(object): format(self._ssh.get_transport().getpeername())) logger.debug('Connections: {0}'.format(str(SSH.__existing_connections))) + def disconnect(self, node): + """Close SSH connection to the node. + + :param node: The node to disconnect from. + :type node: dict + """ + node_hash = self._node_hash(node) + if node_hash in SSH.__existing_connections: + ssh = SSH.__existing_connections.pop(node_hash) + ssh.close() + def exec_command(self, cmd, timeout=10): """Execute SSH command on a new channel on the connected Node. |