- [Instructor] In our previous video,
we took a look at NETCONF.
And that was a way to use Yang data models to send
configuration instructions to a network device,
or to retrieve a configuration information
from a network device.
In this video, we're going to take a look
at a similar utility called a RESTCONF
And RESTCONF is a lot like having
a client point to a web server.
If we're on a client, we've got our browser
and we're securely connecting to a web server,
we're using the HTTPS protocol.
Well, that's the protocol that RESTCONF is going to use.
And when we're sending information to that web server
or pulling down information from that server,
we're using HTTP verbs like post
if we want to send information to the server,
or get if we want to get information from the server.
Well, we can do the same thing with RESTCONF
rest cough is a way for us to send and get information
from a network device using HTTPS.
And the great news is,
it's going to be able to use the same Yang data model
definitions that we used with net comp.
And remember, NETCONF, it represented data in XML format,
well RESTCONF also supports XML formatting.
But instead of XML we've got
the option of using JSON formatting.
That's JavaScript Object Notation.
Now personally, I think JSON formatted data
is a bit easier to read than XML formatted data.
And before we go out and take a live look
at RESTCONF in action,
let's review REST a bit more.
Rest stands for representational state transfer.
And when we're sending these HTTP verbs,
a potential challenge we have is different coders
might get creative and use different verbs
to accomplish the same task.
So instead of just picking whatever verb we want to use,
there's a set of best practice recommendations
for which verb to use,
for which function and the model
that defines that is often referred to as
CRUD, C-R-U-D.
We have create operations, read operations,
update and delete operations.
If you take the first letter from each of those words,
it spells out CRUD, and CRUD originated with databases,
were their best practice recommendations for database use.
But here we're applying it to HTTP.
Here's a table that gives us sort
of a side by side comparison of the CRUD function
along with the HTTP verb that would be used by REST,
and the NETCONF operation that would do the same thing.
If we wanted to create something,
it didn't exist before,
we're not updating it, but we're creating it new with REST,
we could use the verb of post with NETCONF,
we could do edit config,
and the operation would be create.
For the read CRUD function.
We could use the HTTP verb of GET.
With NETCONF we could do a GET or GET config.
GET config, by the way,
that's what we used in our previous video,
when we retrieved the configuration from
this CSR 1000v.
And I won't read through the rest of the table,
I'll just leave it there for your reference.
But what I want to do next is show you RESTCONF in action.
I'm going to go back to that same CSR 1000v.
And I want to pull down some information
about one of the interfaces on that router
Now, we don't want to be rotting to that router.
So we'll do a GET operation.
If I wanted to send information I might do a post or a put,
but we're just going to do a get HTTP verb.
And I'm not going to do it using a Python program
like we did in our previous video.
The reason is this CSR 1000v router in the dev net sandbox,
it's using a self signed certificate for HTTPS.
And if we're using a Python program,
it's going to cause an issue unless we do some extra work
to say that that certificate is okay.
So instead of messing with certificates,
that's not really our purpose in this video,
I want to use another super useful utility
that I want you to know about anyway,
that's called Postman
Postman allows us to send these HTTP verbs to a specific URL
with different parameters that we're going to be setting
to set information on a network device
or retrieve information from that device.
You can get a copy of Postman for free by the way,
you can have it as a standalone application,
or it can be a plugin in the Google Chrome browser.
But you can go to get postman comm to download your copy.
I've already got it installed.
And let's hop out to that interface right now.
Here we're sitting at the main page
after we log into Postman.
By the way, if you don't already have a Postman account
from the initial screen,
it gives you an option to create a free account.
But if you've already got one
and you've already logged in as I have,
you're going to go immediately to this screen.
Now what we want to do in this demonstration
is to send a GET request we're using the get HTTP verb
and we want to get some information about
an interface on that CSR 1000v router.
To do that, I'm going to say create a request.
And notice the default HTTP verb is get.
That's the operation.
Well, if we drop the menu down,
we can see that there are other options.
But we're just going to stick with get,
we don't want to do any rotting to
that always on router that Cisco dev net gives us.
And in order for this to work,
we have to set a couple of headers,
we have to set a content type header,
which says what type of data are we sending from our client?
And we need to set an accept header,
which says what type of data are we requesting.
So let's set those.
Under headers,
I'm going to say the first key is
content type.
And we're going to say the value is application slash.
And we want to support Yang data.
We're using Yang data model still,
I'll say Yang hyphen data.
But in addition to that,
I want to support JSON formatting.
I'll say JSON.
By the way, we could have used XML there instead of JSON.
But personally, I think JSON is easier to read than XML.
So let's go with JSON.
The other key that we need to set is the Accept key.
We'll select that.
And we'll use the same value.
It's going to be application
slash Yang hyphen data
plus JSON.
We also need to go to the authorization tab
and give our login credentials.
Under type, this is just going to be basic off,
we're going to give a username and a password.
And I've already got this set.
This is the username and password
that we have for that CSR 1000v
at the time of this recording anyway,
and we saw how to get that information
in our previous video.
So that information is set.
Now we need to construct our URL.
And just for time sake, I'm going to copy and paste that in.
Let's paste in this URL.
It's HTTPS.
That's what RESTCONF is going to be using.
And we're specifying the domain name of our CSR 1000v.
We're told this domain name
In that always on lab at Cisco's dev net sandbox,
and it says to use Port 9443
for RESTCONF
And then we see the path to the Yang data model
we're going to be using.
the path is RESTCONF data.
And then we have this Yang data model.
Notice it's defined not by Cisco but by the IETF.
So this is a vendor interoperable Yang data model.
We've got this interfaces the Yang data model,
and we're saying that the interface
equals Gigabit Ethernet one.
We want to get information about interface
Gigabit Ethernet one from this router
on this port.
So let's click on send and
send our request out to that router.
And it comes back and says the name of that interfaces
Gigabit Ethernet one.
We see the description is don't touch me.
And we see that the IP version four address is 1010 2048
We've got a slash 24 subnet mask.
And it looks like we don't have any ipv6 information.
And this is a look at how we can use the GET request.
If we did have something that we were allowed to write to,
I could say that I wanted to create a new request.
And I could say that maybe I want to post something.
And I won't take the time to fill out
the headers in the authorization again,
we would still do that.
But in addition to that,
we need to go to the body and specify
the instructions we're sending.
So I might say raw.
And just as a shortcut,
I'm going to go over here
and we're going to grab this information in JSON formatting.
And I'm going to paste it in.
Here.
And using this data model structure,
I can go in and I could change some of the information here,
I might say...
new...
...description.
Now I'm not going to send it.
I don't want to do anything destructive to the router
that Cisco dev net lets us use but if we were
pointing to our own device where
we were allowed to write to it,
I could put in that same URL up here,
and it would write to interface Gigabit Ethernet one.
And by the way, I've already set a parameter,
a preference within Postman that
you might want to set as well,
if you're working with a device that
has a self signed certificate,
otherwise you can get an error.
Here's what I did.
Under postman preferences,
in general,
Id selected SSL certificate verification,
by default that was set to on and
when I would try to run my GET requests,
that would give me an error,
so I had to turn off that SSL certificate validation.
And that's a look at how we can use RESTCONF
to get information from
and send information to a network device using HTTP verbs.