Package: ncs-pycli
ncs_pycli (or) ncs-pycliGives you an interactive NSO python shell with tab completion.A power tool for quick prototypingHow to Installpipinstallncs-pycliPrerequisitesPythonIPythonipython.orgIf you already have python you can install IPython withpipinstallipythonUsage#> ncs_pycli (or) ncs-pycliYourmaagicobject'root -> (root)'isnowprepared...gohavesomefun!
trans.compare()toseeyourcurrenttransaction
trans.apply()tocommit
Maapiobjectcanbefoundatm

In[1]:fordeviceinroot.ncs__devices.device:...:print(device.name)...:
ce0
ce1
ce2
ce3
ce4
ce5
pe0
pe1
pe2

In[2]:device=root.ncs__devices.device['ce0']In[3]:type(device)Out[3]:ncs.maagic.ListElement

In[4]:device
Out[4]:ListElementname=devicetag=617911018keys={ce0}In[5]:help(device)In[6]:device.
device.active_settingsdevice.connect_timeoutdevice.netconf_notificationsdevice.snmp_notification_address
device.addressdevice.delete_configdevice.no_lsadevice.source
device.al__alarm_summarydevice.descriptiondevice.out_of_sync_commit_behaviourdevice.ssh
device.apply_templatedevice.device_profiledevice.pingdevice.ssh_keep_alive
device.authgroupdevice.device_typedevice.platformdevice.state
device.capabilitydevice.disconnectdevice.portdevice.sync_from
device.check_syncdevice.instantiate_from_other_devicedevice.read_timeoutdevice.sync_to
device.check_yang_modulesdevice.live_statusdevice.remote_nodedevice.trace
device.choice_lsadevice.live_status_protocoldevice.rpcdevice.use_lsa
device.commit_queuedevice.locationdevice.scp_fromdevice.write_timeout
device.compare_configdevice.moduledevice.scp_to
device.configdevice.namedevice.service_list
device.connectdevice.ned_settingsdevice.session_pool

In[6]:device.config.io
device.config.ios__aaadevice.config.ios__ethernetdevice.config.ios__multilinkdevice.config.ios__snmp_server
device.config.ios__access_listdevice.config.ios__eventdevice.config.ios__nodevice.config.ios__spanning_tree
device.config.ios__alarm_contactdevice.config.ios__fabricdevice.config.ios__ntpdevice.config.ios__system
device.config.ios__archivedevice.config.ios__gatekeeperdevice.config.ios__parameter_mapdevice.config.ios__table_map
device.config.ios__authenticationdevice.config.ios__hostnamedevice.config.ios__platformdevice.config.ios__tacacs_server
device.config.ios__bannerdevice.config.ios__interfacedevice.config.ios__policerdevice.config.ios__tftp_server
device.config.ios__bba_groupdevice.config.ios__ipdevice.config.ios__policy_mapdevice.config.ios__transceiver
device.config.ios__carddevice.config.ios__ipv6device.config.ios__port_channeldevice.config.ios__upgrade
device.config.ios__class_mapdevice.config.ios__l2device.config.ios__powerdevice.config.ios__username
device.config.ios__clockdevice.config.ios__l2protocol_tunneldevice.config.ios__privilegedevice.config.ios__version
device.config.ios__config_registerdevice.config.ios__licensedevice.config.ios__radiusdevice.config.ios__vlan
device.config.ios__control_planedevice.config.ios__linedevice.config.ios__radius_serverdevice.config.ios__vmps
device.config.ios__controllerdevice.config.ios__loggingdevice.config.ios__redundancydevice.config.ios__voice_card
device.config.ios__cryptodevice.config.ios__macdevice.config.ios__repdevice.config.ios__vpdn
device.config.ios__disable_eadidevice.config.ios__memory_sizedevice.config.ios__route_mapdevice.config.ios__vrf
device.config.ios__dot11device.config.ios__mgcpdevice.config.ios__routerdevice.config.ios__vtp
device.config.ios__dot1xdevice.config.ios__mlsdevice.config.ios__schedulerdevice.config.ios__xconnect
device.config.ios__enabledevice.config.ios__monitordevice.config.ios__servicedevice.config.ios__zone
device.config.ios__errdisabledevice.config.ios__mplsdevice.config.ios__snmpdevice.config.ios__zone_pair

In[6]:device.config.ios__hostname='CE0'In[7]:trans.compare()Diffset:kp=/ncs:devices/device{ce0},op=MOP_MODIFIED,oldv=None,newv=Nonekp=/ncs:devices/device{ce0}/config/ios:hostname,op=MOP_VALUE_SET,oldv=None,newv=CE0

In[8]:trans.apply()In[9]:%histfordeviceinroot.ncs__devices.device:print(device.name)device=root.ncs__devices.device['ce0']help(device)type(device)device
device.config.ios__hostname='CE0'trans.compare()trans.apply()ContactContact Hakan Niskahniska@cisco.comwith any suggestions or comments. If you find any bugs please fix them and send me a pull request.