Advertisement
Guest User

Untitled

a guest
Feb 10th, 2017
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.68 KB | None | 0 0
  1. from ncclient import manager
  2. import logging
  3.  
  4.  
  5. with manager.connect(host='172.17.14.242', port=830, username='admin', password='admin',
  6.                      device_params={'name': 'alu'},
  7.                      hostkey_verify=False) as m:
  8.    
  9.  
  10.     req_xml_2 = '''
  11.                <configure xmlns="urn:alcatel-lucent.com:sros:ns:yang:conf-r13">
  12.                    <router/>
  13.                </configure>
  14.    '''
  15.  
  16.     print("Displaying the whole config as XML")
  17.     print(m.get_config(source='running'))
  18.  
  19.     print("\n\n\n\n\n\n")
  20.     print("Displaying the filtered part as defined by req_xml_2 filter ")
  21.     c = m.get_config(source='running', filter=('subtree', req_xml_2))
  22.     print(c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement