netconf-console2
raw JSON → 3.0.1 verified Fri May 01 auth: no python
Netconf client CLI tool and interactive console for managing NETCONF-enabled devices. Version 3.0.1 provides support for YANG-based operations, SSH and TLS transport, and an interactive shell. Release cadence is irregular.
pip install netconf-console2 Common errors
error ImportError: No module named netconf_console ↓
cause The module was renamed from netconf_console to netconf.console in version 3.0.0.
fix
Use 'from netconf.console import connect' instead of 'from netconf_console import connect'.
error ncclient.operations.errors.MissingCapabilityError: ... get-schema not advertised ↓
cause The device does not support the 'get-schema' capability required by some operations.
fix
Check device capabilities before calling get_schema, or use a different operation like get_config.
Warnings
breaking Version 3.0.0 dropped support for Python 2 and changed import paths (netconf.console instead of netconf_console). ↓
fix Update imports to use netconf.console; Python 2 users must stay on <3.0.0.
deprecated The 'get_config' method's 'source' parameter now expects a string like 'running' instead of a dictionary. Old contract { 'source': 'running' } is deprecated. ↓
fix Pass source as a plain string, e.g., session.get_config('running').
gotcha When using 'connect' inside a 'with' block, the session is automatically closed. Reusing the session after exiting the block raises an error. ↓
fix Perform all NETCONF operations within the 'with' block.
Imports
- connect wrong
from netconf_console import connectcorrectfrom netconf.console import connect - NetconfSession wrong
from netconf import NetconfSessioncorrectfrom netconf.session import NetconfSession
Quickstart
import os
from netconf.console import connect
host = os.environ.get('NETCONF_HOST', '192.168.1.1')
port = int(os.environ.get('NETCONF_PORT', '830'))
username = os.environ.get('NETCONF_USER', 'admin')
password = os.environ.get('NETCONF_PASS', 'admin')
with connect(host=host, port=port, username=username, password=password) as session:
capabilities = session.server_capabilities
print('Connected. Capabilities:', capabilities)