Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from ncclient import manager
- import logging
- # logging.basicConfig(
- # level=logging.DEBUG,
- # )
- with manager.connect(host='172.17.14.242', port=830, username='admin', password='admin',
- device_params={'name': 'alu'},
- hostkey_verify=False) as m:
- # this request uses CLI content layer (i.e. as viewed on CLI)
- # req = '''
- # <oper-data-format-cli-block>
- # <cli-show>router interface</cli-show>
- # </oper-data-format-cli-block>
- # '''
- # c = m.get(('subtree', req))
- req_xml_1 = '''
- <configure xmlns="urn:alcatel-lucent.com:sros:ns:yang:conf-r13">
- <system>
- <netconf>
- </netconf>
- </system>
- </configure>
- '''
- req_xml_2 = '''
- <configure xmlns="urn:alcatel-lucent.com:sros:ns:yang:conf-r13">
- <router/>
- </configure>
- '''
- # prints all running config as XML
- # print(m.get_config(source='running'))
- c = m.get_config(source='running', filter=('subtree', req_xml_3))
- print(c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement