Log device interaction and push labeled logs back to controller (#50028)

* Add session tracing support for network_cli, netconf and httapi connection

*  Add `persistent_log_messages` configuration option to log device inteaction
   in log file for network_cli, netconf and httapi connection
   type
*  Log jsonrpc request and response in log file is configuration option
   is enabled

* Update docs to talk about warning shown when persistent_log_messages is on
This commit is contained in:
Nathaniel Case
2018-12-21 10:31:43 -05:00
committed by GitHub
parent c093ea5a28
commit b2423e7602
6 changed files with 134 additions and 5 deletions

View File

@@ -131,17 +131,18 @@ class ConnectionProcess(object):
self.exception = None
(s, addr) = self.sock.accept()
signal.alarm(0)
signal.signal(signal.SIGALRM, self.command_timeout)
while True:
data = recv_data(s)
if not data:
break
self.connection._log_messages("jsonrpc request: %s" % data)
signal.alarm(self.connection.get_option('persistent_command_timeout'))
resp = self.srv.handle_request(data)
signal.alarm(0)
self.connection._log_messages("jsonrpc response: %s" % resp)
send_data(s, to_bytes(resp))
s.close()