File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change 2424# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2525# SUCH DAMAGE.
2626#
27- # This script retrieves entire configuration from a network element via NETCONF
27+ # This script retrieves entire configuration from a network element via NETCONF
2828# prints it out in a "pretty" XML tree.
2929
3030import sys
4444 parser .add_argument ('--port' , type = int , default = 830 ,
4545 help = "Specify this if you want a non-default port" )
4646 args = parser .parse_args ()
47-
47+
4848 m = manager .connect (host = args .host ,
4949 port = args .port ,
5050 username = args .username ,
5151 password = args .password ,
5252 device_params = {'name' :"csr" })
53- # Pretty print the XML reply
54- xmlDom = xml .dom .minidom .parseString ( str ( m .get_config (source = 'running' )))
55- print xmlDom .toprettyxml ( indent = " " )
5653
54+ hostname_filter = '''
55+ <filter>
56+ <native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native">
57+ </native>
58+ </filter>
59+ '''
5760
61+ # Pretty print the XML reply
62+ xmlDom = xml .dom .minidom .parseString ( str ( m .get_config ('running' , hostname_filter )))
63+ print (xmlDom .toprettyxml ( indent = " " ))
You can’t perform that action at this time.
0 commit comments