Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ python nc_show_version.py
- Response as XML String:
- <?xml version="1.0" encoding="ISO-8859-1"?>
- <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:if="http://www.cisco.com/nxos:1.0:if_manager" xmlns:nfcli="http://www.cisco.com/nxos:1.0:nfcli" xmlns:nxos="http://www.cisco.com/nxos:1.0" xmlns:vlan_mgr_cli="http://www.cisco.com/nxos:1.0:vlan_mgr_cli" xmlns:mod="http://www.cisco.com/nxos:1.0:sysmgrcli" message-id="urn:uuid:6b917998-4db6-11e6-9d80-080027cee472">
- <data>
- <mod:show>
- <mod:version>
- <mod:__XML__OPT_Cmd_sysmgr_show_version___readonly__>
- <mod:__readonly__>
- <mod:header_str>Cisco Nexus Operating System (NX-OS) Software
- TAC support: http://www.cisco.com/tac
- Documents: http://www.cisco.com/en/US/products/ps9372/tsd_products_support_series_home.html
- Copyright (c) 2002-2016, Cisco Systems, Inc. All rights reserved.
- The copyrights to certain works contained herein are owned by
- other third parties and are used and distributed under license.
- Some parts of this software are covered under the GNU Public
- License. A copy of the license is available at
- http://www.gnu.org/licenses/gpl.html.
- NX-OSv is a demo version of the Nexus Operating System
- </mod:header_str>
- <mod:loader_ver_str>N/A</mod:loader_ver_str>
- <mod:kickstart_ver_str>7.3(1)D1(1) [build 7.3(1)D1(0.10)]</mod:kickstart_ver_str>
- <mod:sys_ver_str>7.3(1)D1(1) [build 7.3(1)D1(0.10)]</mod:sys_ver_str>
- <mod:kick_file_name>bootflash:///titanium-d1-kickstart.7.3.1.D1.0.10.bin</mod:kick_file_name>
- <mod:kick_cmpl_time> 1/11/2016 16:00:00</mod:kick_cmpl_time>
- <mod:kick_tmstmp>02/22/2016 23:39:33</mod:kick_tmstmp>
- <mod:isan_file_name>bootflash:///titanium-d1.7.3.1.D1.0.10.bin</mod:isan_file_name>
- <mod:isan_cmpl_time> 1/11/2016 16:00:00</mod:isan_cmpl_time>
- <mod:isan_tmstmp>02/23/2016 01:43:36</mod:isan_tmstmp>
- <mod:chassis_id>NX-OSv Chassis</mod:chassis_id>
- <mod:module_id>NX-OSv Supervisor Module</mod:module_id>
- <mod:cpu_name>Intel(R) Xeon(R) CPU E5-2670</mod:cpu_name>
- <mod:memory>4002312</mod:memory>
- <mod:mem_type>kB</mod:mem_type>
- <mod:proc_board_id>TM29D1D533B</mod:proc_board_id>
- <mod:host_name>nxosv</mod:host_name>
- <mod:bootflash_size>1582402</mod:bootflash_size>
- <mod:kern_uptm_days>2</mod:kern_uptm_days>
- <mod:kern_uptm_hrs>21</mod:kern_uptm_hrs>
- <mod:kern_uptm_mins>1</mod:kern_uptm_mins>
- <mod:kern_uptm_secs>51</mod:kern_uptm_secs>
- <mod:manufacturer>Cisco Systems, Inc.</mod:manufacturer>
- </mod:__readonly__>
- </mod:__XML__OPT_Cmd_sysmgr_show_version___readonly__>
- </mod:version>
- </mod:show>
- </data>
- </rpc-reply>
- =================================
- Chassis ID: NX-OSv Chassis
- Software Version: 7.3(1)D1(1) [build 7.3(1)D1(0.10)]
- ################################################################
- #!/usr/bin/env python
- from ncclient import manager
- if __name__ == '__main__':
- with manager.connect(host='nxosv', port=22, username='cisco', password='cisco',
- hostkey_verify=False, device_params={'name': 'nexus'},
- allow_agent=False, look_for_keys=False) as device:
- commands = ['config t', 'interface Ethernet2/6', 'switchport', 'description Configured by Python ncclient']
- nc_config_reply = device.exec_command(commands)
- print nc_config_reply.xml
- ################################################################
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement