Skip to content

Commit

Permalink
Fix NETCONF disconnect log message
Browse files Browse the repository at this point in the history
Disconnect message doesn't show port as 'None' when the default port
(830) is being used.  If port is left unspecified when the session is
opened, logging doesn't try to specify the port explicitly when
disconnecting.
  • Loading branch information
111pontes committed Oct 27, 2016
1 parent 1479af6 commit 742375c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions sdk/python/core/ydk/providers/native_netconf_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,12 @@ def _connect(self):
def close(self):
""" Closes the netconf session """
self.sp_instance.disconnect()
self.netconf_sp_logger.info('NativeNetconfServiceProvider disconnected from %s:%s using %s'
% (self.address, self.port, self.protocol))
if self.port is not None:
self.netconf_sp_logger.info('NativeNetconfServiceProvider disconnected from %s:%s using %s'
% (self.address, self.port, self.protocol))
else:
self.netconf_sp_logger.info('NativeNetconfServiceProvider disconnected from %s using %s'
% (self.address, self.protocol))

def encode(self, entity, operation, only_config=False):
return self.sp_instance.encode(entity, operation, only_config)
Expand Down
8 changes: 6 additions & 2 deletions sdk/python/core/ydk/providers/netconf_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,12 @@ def _connect(self):
def close(self):
""" Closes the netconf session """
self.sp_instance.disconnect()
self.netconf_sp_logger.info('\nNetconfServiceProvider disconnected from %s:%s using %s'
% (self.address, self.port, self.protocol))
if self.port is not None:
self.netconf_sp_logger.info('NetconfServiceProvider disconnected from %s:%s using %s'
% (self.address, self.port, self.protocol))
else:
self.netconf_sp_logger.info('NetconfServiceProvider disconnected from %s using %s'
% (self.address, self.protocol))

def encode(self, entity, operation, only_config=False):
return self.sp_instance.encode(entity, operation, only_config)
Expand Down

0 comments on commit 742375c

Please sign in to comment.