cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
746
Views
5
Helpful
2
Replies

Too few yang models to work with Cisco IOS XE

Hi Pals,

I am studying for the CCNA DevNet Certifications and I was testing the YANG models from the Cisco IOS 1000v

 

I am using this code for my home lab.

 

from ncclient import manager
# import logging
# logging.basicConfig(level=logging.DEBUG)

router = {"host": "192.168.50.253", "port": "22",
          "username": "R2", "password":"***"}

with manager.connect(host=router["host"], port=router["port"], username=router["username"], password=router["password"], hostkey_verify=False) as m:
    for capability in m.server_capabilities:
        print('*' * 50)
        print(capability)

and I am getting this response

 

 

XE/netconf-2.py"
**************************************************
urn:ietf:params:netconf:base:1.0
**************************************************
urn:ietf:params:netconf:capability:writeable-running:1.0
**************************************************
urn:ietf:params:netconf:capability:startup:1.0
**************************************************
urn:ietf:params:netconf:capability:url:1.0
**************************************************
urn:cisco:params:netconf:capability:pi-data-model:1.0
**************************************************
urn:cisco:params:netconf:capability:notification:1.0
PS C:\Users\user_\Desktop\CCNA DEVNET> 

 

 

But when I use the Cisco DevNet Sandbox, I get a lot of modules.

 

router = {"host": "ios-xe-mgmt-latest.cisco.com", "port": "10000",
          "username": "developer", "password": "*******"}

 

 

 

XE/netconf-2.py"
**************************************************
urn:ietf:params:netconf:base:1.0
**************************************************
urn:ietf:params:netconf:base:1.1
**************************************************
urn:ietf:params:netconf:capability:candidate:1.0  
**************************************************
urn:ietf:params:netconf:capability:xpath:1.0      
**************************************************
urn:ietf:params:netconf:capability:validate:1.0
**************************************************
urn:ietf:params:netconf:capability:validate:1.1
**************************************************
urn:ietf:params:netconf:capability:rollback-on-error:1.0
**************************************************
urn:ietf:params:netconf:capability:notification:1.0
**************************************************
urn:ietf:params:netconf:capability:interleave:1.0
**************************************************
urn:ietf:params:netconf:capability:with-defaults:1.0?basic-mode=explicit&also-supported=report-all-tagged

...
...
...
etc

I am planning to use this module:

 <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">

 

in the future for reading and configure an interface in my home IOS 1000v Lab, buy seems it does not work.

Could you please help to answer how can I enable more Yang modules in my home lab?

 

This is the IOS version I am using

R2#show ver
Cisco IOS XE Software, Version 16.06.05
Cisco IOS Software [Everest], Virtual XE Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 16.6.5, RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2018 by Cisco Systems, Inc.
Compiled Mon 10-Dec-18 13:07 by mcpre

IOS image

Cisco CSR1000V IOS XE UNIVERSAL - CRYPTO Serial QCOW2
csr1000v-universalk9.16.06.05-serial.qcow2
14-Dec-2018
1469.56 MB
1 Accepted Solution

Accepted Solutions

yangorelik
Spotlight
Spotlight

Hi Juan

I noticed that you specify port 22 for your device. I doubt that is the port for Netconf, because it is reserved for Telnet. If port is not configured, then Netconf is listening on port 840. Please make sure that Netconf is configured on your device properly. You also can try to run ssh command directly to your device:

ssh R2@192.168.50.253 -p 840 -s netconf

If Netconf is configured, the command will return list of capabilities.

Yan Gorelik
YDK Solutions

View solution in original post

2 Replies 2

yangorelik
Spotlight
Spotlight

Hi Juan

I noticed that you specify port 22 for your device. I doubt that is the port for Netconf, because it is reserved for Telnet. If port is not configured, then Netconf is listening on port 840. Please make sure that Netconf is configured on your device properly. You also can try to run ssh command directly to your device:

ssh R2@192.168.50.253 -p 840 -s netconf

If Netconf is configured, the command will return list of capabilities.

Yan Gorelik
YDK Solutions

Thank you very much,

It did not worked with port 840, but I tried 830 and now I can see all the containers I need to read,modify the router.

 

Note: I had errors in my code because (well I used other router and) the current gigabit was lacking of a 'description' and 'ip address', while debugging python it just says there was an error. I just added back and error was gone.

 

#This is MY IOS 1000v Router
router = {"host": "192.168.50.254", "port": "830","username": "R1", "password":"***"}
Exception has occurred: KeyError
'address'
  File "C:\Users\user_\Desktop\CCNA DEVNET\19 NETCONF script IOS XE\netconf-4.py", line 64, in <module>
    print(f"IP: {config['ipv4']['address']['ip']}")

but is working as expected.

Thank you!

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: