RESTCONF TUTORIAL!! Everything you need to know about RESTCONF in 2020

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
all right welcome back to ultra config tutorials let's talk about rest comp today what is it and why was it invented also how can we use rest comp in the real world by managing configuration on a Cisco router these questions will be the topic of today's video before that though let's do a quick recap on two other options for network management so network devices may be managed through several options most network engineers are familiar with the CLI that's the command-line interface the CLI is the most human friendly interface when it comes to automation however the CLI is not the best choice for software to be robust there is a requirement for strict data structures and CLI commands and outputs are usually just strings of data without much structure the Netcom protocol solves this problem it allows network devices to be managed through remote procedure calls these are pcs contain well-defined XML messages that are very easy to handle inside software applications this diagram highlights the major components involved in a net comp transaction looking at the figure there are three key takeaways to remember the net comp client sends RPC messages to the network device under management the net confessor VAR running on the device will then interact with the data store which contains configuration data and state data there attributes inside the data store are defined by yang models if you're not familiar with Yang check out our video on it you'll find it on our channel so with our net kampf recap out of the way let's now define rest comp according to RFC ad 40 rest conf is an HTTP based protocol that provides a programmatic interface for accessing data defined in yang using the data store components defined in net comp your first reaction might be that it sounds very similar to net comp and indeed you would be right check out the conceptual components press conf you will notice there is a great similarity to our net comp diagram in that case why use restaurant when we already have net Kampf well I have another protocol in the first place to answer this we need to think about the trends of the tech industry it's no secret that businesses all around the world are digitizing themselves through automation and what is the most popular protocol used in the modern era for automation the answer to that is HTTP based rest api's and the rest comp protocol is available to satisfy that demand let's think about it with an example imagine a company invested a huge sum of money on automating its business processes through REST API s and once that work was complete they decided to automate their network configuration management they could easily hit a road block at this point the software they used for automation would need to support the Netcom protocol also their software developers will need to be skilled up to learn this protocol you can see the dilemma here businesses want to keep their solutions as simple as possible ideally they would use common applications and protocols across their organization this is where rest comp comes to the rescue it allows users to automate their network infrastructure using familiar restful api patterns now that we understand the need for rest comp let's do a comparison of some of the key low-level differences between the protocols firstly how crud operations differentiated in a request that is your create read update delete operations the Netcom protocol specifies the operation by wrapping the message content in an XML tag for example you might have a get config tag or an edit config tag the rest comp protocol on the other hand specifies the operation using an HTTP method such as get put post patch or delete what about data encoding what former to each use the neck length protocol requires RPC messages to always be encoded with XML the restaurant protocol on the other hand allows data to be encoded with either XML or JSON so ref conf is more powerful in this sense another key difference is the way configuration data and state data are exposed to clients and neck on client will use multiple levels of depth in an XML message to specify the location of data a rest conf client will use the resource path and the URL of the request to specify the location of data with all that said practical examples are the best way to learn so let's manage the configuration on a Cisco router using raskov in our lab we're running a cisco csr router on gns3 to get started we must enable rest comp on our router let's do that now with three lines of configuration we'll create a new user enable a HTTP server and enable the rest conserver itself we'll also need to configure an interface so that we have a layer 3 endpoint for management we can now verify our rest com server is up and running with a quick curl test if everything is well you'll receive a similar response to this one let's now discuss the method for discovering the URL path of a resource if you've studied young models before you'll know that network devices can support multiple young models concurrently these could be native models IETF models open config models if the remainder of this video we'll be using the Cisco IOS XE native model let's start by retrieving the full running configuration you can see here that the restaurant server returned the full configuration as an XML object we can now look through the levels of depth to figure out the URL path of resources alternatively we can also read through the source of the yang models to discover the URL path but this method is a little more difficult most of the time for example looking at the XML data here we can decipher the URL path for an interface let's now use this path to retrieve the configuration of the Gigabit Ethernet one interface using a curl command the configuration is returned as an XML object however one of the best things about rest conf is the support for JSON let's rerun our curl command for retrieving the interface configuration but this time we will include an additional header the accept header tells the restaurant server we want our response returned as JSON as you can see the header did the trick all right let's set one final challenge for the day let's configure an interface using a Python program andres conf first we need to install an HTTP client I'll be using requests for this tutorial will now create a new file for our program entitled breast conf tutorial Pui at the header of the file we'll import our dependencies our router does not have an SSL certificate installed as a result requests vibrato will produce certificate related warnings we can suppress these warnings with a couple lines of code as will be working with JSON we can also define a function that will pretty print our return data before we configure an interface let's redo our earlier request for retrieving interface configuration we can see that our program is running fine we got back the same config as our earlier curl request we are now ready to complete our final challenge we'll use an HTTP request with the method patch the patch method will tell our router to merge our new interface config let's add the code to configure the gigabit ethernet to interface with the address 10.10 10.1 slash 24 let's rerun our program all looks well we got back a response code of 204 finally we can jump onto the CLI of our router to verify the change did indeed occur there we go the config looks good so that's everything essential we need to know about rest conf before I end today's video we'll also shout out ultra config the restaurant protocol is great at pushing configuration to network devices now how do you automate the generation of network config ultra config is a powerful piece of software for automating the generation of network config if you work in the network engineering industry I highly recommend you to check it out the software includes an API to fully enable into n network automation and the best part about it the software is free to use without free forever plan a link to the software will be in the description I'll also put a link in the description to a written form of today's tutorial for you to try it yourself that'll be it for today thanks for watching and I'll see you all in the next video
Info
Channel: Ultra Config
Views: 5,466
Rating: undefined out of 5
Keywords: ietf, netconf, restconf, yang, rest api, restconf tutorial, cisco, cisco automation, network automation
Id: 4VKlplZJBuk
Channel Id: undefined
Length: 10min 14sec (614 seconds)
Published: Wed May 20 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.