Skip to content

Fixes to netconf on SSH tunnels#190

Open
Sripadvallabh wants to merge 2 commits into
mainfrom
ssh_tunnel_fixes_araradha
Open

Fixes to netconf on SSH tunnels#190
Sripadvallabh wants to merge 2 commits into
mainfrom
ssh_tunnel_fixes_araradha

Conversation

@Sripadvallabh
Copy link
Copy Markdown

@Sripadvallabh Sripadvallabh commented May 22, 2026

Summary

Fixes NETCONF per-connection logging when the NETCONF connection is established through an SSH tunnel.

Previously, logs emitted during SSH tunnel setup and ncclient session negotiation were not captured in the NETCONF per-connection log file. This change forwards the relevant tunnel and ncclient log records to the NETCONF file handler.

Also fixes a logging error seen when the pyATS tasklog stream is unavailable:

AttributeError: 'NoneType' object has no attribute 'write'

The NETCONF logger now skips attaching the pyATS tasklog adapter when the tasklog stream is not available.

Manual Test

Using a testbed with a NETCONF connection configured with sshtunnel, ran:

device.connect(via='netconf')

Verified that the generated NETCONF per-connection log file contains SSH tunnel setup logs, ncclient session logs, and the NETCONF connected message.

Example sanitized log content:

%NETCONF-INFO: Connecting proxy host <proxy>
%NETCONF-INFO: Adding local tunnel 127.0.0.1:<local-port> for <device-host>:830
%NETCONF-INFO: Device '<device>' connection 'netconf' via new SSH tunnel 127.0.0.1:<local-port>
%NETCONF-INFO: [host 127.0.0.1 ...] Sending:
%NETCONF-INFO: [host 127.0.0.1 ...] Received message from host
%NETCONF-INFO: [host 127.0.0.1 ...] initialized: session-id=<session-id>
%NETCONF-INFO: NETCONF CONNECTED

Automated Tests

python -m unittest discover src/yang/connector/tests -v
# Ran 26 tests: OK, skipped=3

python -m unittest discover . -v
# from ncdiff/src/yang/ncdiff/tests
# Ran 78 tests: OK

Total:

104 tests passed
3 tests skipped

@Sripadvallabh Sripadvallabh requested a review from a team as a code owner May 22, 2026 06:24
@Sripadvallabh Sripadvallabh marked this pull request as draft May 22, 2026 06:40
@Sripadvallabh Sripadvallabh requested a review from dwapstra May 26, 2026 04:01
@Sripadvallabh Sripadvallabh marked this pull request as ready for review May 26, 2026 04:48
@ThomasJRyan ThomasJRyan requested review from ThomasJRyan and removed request for lukemanhakkim May 27, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants