Skip to content

Fixes to netconf on SSH tunnels#190

Merged
Sripadvallabh merged 4 commits into
mainfrom
ssh_tunnel_fixes_araradha
Jun 3, 2026
Merged

Fixes to netconf on SSH tunnels#190
Sripadvallabh merged 4 commits into
mainfrom
ssh_tunnel_fixes_araradha

Conversation

@Sripadvallabh

@Sripadvallabh Sripadvallabh commented May 22, 2026

Copy link
Copy Markdown
Contributor

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
Taarini
Taarini previously requested changes Jun 1, 2026

@Taarini Taarini left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please resolve the pipeline failure

@Sripadvallabh

Copy link
Copy Markdown
Contributor Author

Can you please resolve the pipeline failure

Error in dependencies only, not my changes:

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [3 lines of output]
      Building lxml version 4.9.4.
      Building without Cython.
      Error: Please make sure the libxml2 and libxslt development packages are installed.
      [end of output]

@Sripadvallabh Sripadvallabh requested a review from Taarini June 2, 2026 03:06
Comment thread connector/src/yang/connector/netconf.py
Comment thread connector/src/yang/connector/netconf.py Outdated
@Sripadvallabh Sripadvallabh requested a review from dwapstra June 2, 2026 03:57
@Sripadvallabh Sripadvallabh dismissed Taarini’s stale review June 3, 2026 13:05

Pipeline passing now

@Sripadvallabh Sripadvallabh merged commit dcd52f4 into main Jun 3, 2026
10 checks passed
@Sripadvallabh Sripadvallabh deleted the ssh_tunnel_fixes_araradha branch June 3, 2026 13:43
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.

5 participants