Created
February 10, 2017 07:31
-
-
Save hellt/94096b34f1996b59465d4155cd1c418e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment