File: nc10.py

package info (click to toggle)
python-ncclient 0.6.17-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,448 kB
  • sloc: python: 9,548; xml: 476; makefile: 77; sh: 5
file content (24 lines) | stat: -rw-r--r-- 768 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /usr/bin/env python
#
# Connect to NETCONF server using unix socket passed on the command line.
# Then display the servers capabilities. After connecting you can also use 
# all other operations supported by ncclient, example: get(), get_config()...
#
# To test against a example NETCONF server with unix socket support check out:
# https://github.com/CESNET/libnetconf2
# It contains an example server which can listen for connections using a unix 
# socket.
#
# $ ./nc10.py "/path/to/socket"

import sys, warnings
warnings.simplefilter("ignore", DeprecationWarning)
from ncclient import manager

def demo(path):
    with manager.connect_uds(path) as m:
        for c in m.server_capabilities:
            print(c)

if __name__ == '__main__':
    demo(sys.argv[1])