Introduction to REST API

This topic is to discuss the following lesson:

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

Hi Rene and staff,
i work with “csr1000v-universalk9.16.06.07.ova” in vmware workstation pro 15.5
I tried to set a virtual-service with a different name, not csr_mgmt (the name i used was csr_rest )

The install has not completed
But, when i use the name “csr_mgmt” the install work fine !
Could you clarify this issue ? can it be solved ?
Regards

Hello Dominique

The virtual-service command is used to load a specific virtual services container to be used by a particular virtual services package, which is installed using a particular .ova package file.

The container name, in this case csr_mgmt, must be the same one that has been defined during the installation of the original package. The syntax of such an installation command can be seen below:

virtual-service install name virtual-services-name package file

For example, the installation of the REST API support can look something like this:

virtual-service install name csr_mgmt package bootflash: iosxe-remote-mgmt.2017-08-15_17.21.ova

Notice the csr_mgmt virtual-services-name in the command? Next, you must configure the virtual services container to allow it to run. In order to do this, you must use the same virtual-services-name that was defined during the installation of the application. This is why you can only use the csr_mgmt container name in this command. Otherwise, you are referencing a container for a virtual service that doesn’t exist.

I hope this has been helpful!

Laz