Introduction to REST API

This topic is to discuss the following lesson:

https://networklessons.com/cisco/ccna-200-301/introduction-to-rest-api

I am new to Python and starting my first lab. In my virtual lab I have a CSR1000v connected to Ubuntu device with Python 3 installed on it and they can talk to each others.
I have no problems with the router config but when it gets to the script I have no idea where and how to write the script and how to push it to the router. Can you clarify the Python part please?
Thank you

Hany

Hello Hany

In order to get a good grasp of Python it would be a good idea to find an online tutorial (there are literally hundreds out there) that can get you started scripting. A suggestion would be to go to https://www.learnpython.org/ which is a start from scratch introduction that can give you the basics you need for scripting. But you can do your own search and find the course that will be best for you.

Once complete, if you have specific questions about how to apply it to networking and your virtual lab, we’ll be able to more specifically help you out.

I hope this has been helpful!

Laz

Hi Rene,

I’m getting the output below, when trying to activate csr_mgmt.

*May 6 19:20:30.764: %VMAN-3-VIRT_INST_INTERFACE: F0: vman: Virtual Service[csr_mgmt]::Network interfaces::The number of network interfaces required do not match the number configured::Number defined: 1, number configured: 0 *May 6 19:20:31.746: %VIRT_SERVICE-5-ACTIVATION_STATE: Failed to activate virtual service csr_mgmt

And I don’t see the “ip shared host-interface” command available:

image

Any ideas?

Thanks.

Hello Luis

That’s interesting… It could be that the syntax is different for a particular feature depending on the IOS being used. In the lesson, Rene is using a CSR1000v router running IOS XE 16.6.1. What device are you using?

Laz

Hi Laz,

I’m running the version below on EVE-NG. I think it was the only image that was available for free on Cisco’s website.

Router#sh ver
Cisco IOS XE Software, Version 03.11.02.S - Standard Support Release
Cisco IOS Software, CSR1000V Software (X86_64_LINUX_IOSD-UNIVERSALK9-M), Version 15.4(1)S2, RELEASE SOFTWARE (fc3)

Thanks,
LP

Hello Luis

It seems that for versions of IOS XE 3.11S and 3.12S, the method of implementation is different than that described in the lesson.

For versions IOS XE 3.13S and later, as well as IOS XE Denali 16.3 and later, the implementation can be performed using either the older method, or that described in Rene’s lesson.

Take a look at the following document that further explains the differences in implementation for the various versions.

I hope this has been helpful!

Laz

morning Team,

Cisco csr 1000v downloaded from gns3 marketplace does not include virtual-service. Does it needs a special license?

Regards,
Jorge

Hello Jorge

The CSR 1000v that is available at GNS3 is version 16.09.05. According to the Cisco Feature Navigator, it supports the RESTconf programmable interface. If this is not the version you have, take a look at the feature navigator to see if your version supports the expected features.

However, in order to enable management by REST API, there are some preliminary configurations that you must apply, and these are described further in this document.

Take a look and let us know your results.

I hope this has been helpful!

Laz

thanks Laz!! I will take a look at the document.
Jorge

1 Like