- [Instructor] Learning to code
and work with programmable infrastructures
is extremely important in today's environment.
You saw the value of using APIs in previous lessons.
You also saw the capabilities of SDN solutions,
and the benefits of an SDN solution.
So whether you actually have configured
a large network in the past
or you're just getting started,
you know that this is actually,
probably, a very challenging task, right?
It involve a lot of clicking around in GUIs, or typing,
or copy and pasting, and many repetitive tasks.
So nowadays, network infrastructure devices and components
are enabled to support APIs
and many programmability capabilities
to complete powerful task
and reduce all that repetitive work,
and save you a lot of time.
So using APIs, you can actually make requests,
like the ones that I'm actually showing in here,
to get a status of an interface,
or get information about the last change that, you know,
that interface was actually changed,
or actually applying different configuration changes
like shutting down the interface,
or shutting down an interface on a thousand devices
at the same time, or enabling an interface
on a thousand devices at the same times, right?
So it allows you to really scale across the organizations.
Now, many modern programming languages,
like Python, and Go, and things like JavaScript,
and Swift, and many others,
are flexible and easier to learn than their predecessors.
Especially Python, right?
A lot of times, you know, I get this question,
"Should I actually learn a programming language
to get into security?"
"Should I learn a programming language
to get into networking?"
And my answer is, "Absolutely."
I always suggest to start with Python.
Python is one of the programming languages
recommended first to learn,
not only because of network programmability,
but many other scenarios.
And it's actually one of the languages that are used
for many different things, from just a quick script,
to automation, to data science, machine learning, and so on.
There are many different sites
that allow you to get started.
And here, I'm actually showing you a few resources.
And I also have, in my GitHub repository,
a lot of different references
that allow you to actually get started with Python.
This training is not a Python class, and it's not gonna,
you know, walk you through how to actually learn Python,
or Go, or Swift, or JavaScript.
But, you know, what I'm doing is, actually,
I'm putting as much information possible
in the GitHub repositories that we have available for you,
that if you're not exposed to these programming languages,
you can actually get started.
Now, combining programming capabilities with developer tools
like get or Git, or GitHub, and GitLab repositories,
and also package management system and virtual environments,
it actually allows you to create
your own set of very powerful tools and workflow.
And later, you're gonna learn more about, actually,
you know, RESTful APIs.
We're gonna go over a brief introduction of Git,
and interpreting basic Python scripts
used to call different security appliances.
And you're gonna learn, also, about pxGrid,
which is a solution that you can take advantage of
to integrate many different capabilities
with devices like the Cisco ISE,
the identity service engine.
Now, another amazing thing is the power of code reuse
and online communities, right?
In the past, if you actually wanted to create some program,
you always have to start from scratch.
But nowadays, you can actually collaborate
and use a lot of open source and a lot of modules,
like I was talking about Python.
So you can take advantage of tons and tons of Python modules
that allows you not only to perform some very quick tasks,
but they're Python modules that are used
for network programmability as well.
For example, here I'm actually showing the package
called requests.
It is a Python package that is installed
using a package manager for Python called pip, right?
And if you're not familiar with pip,
I actually have a reference here for you.
And basically, the requests library allows you to make
HTTP and HTTP requests in Python in very, very easy way.
And the reason that I'm mentioning this
is because Python requests and that package
is actually used a lot nowadays,
whenever we interact with APIs.
So later, whenever we're gonna be introducing APIs
and introducing different Python scripts
to call security appliances
and other devices in the network,
the requests package in Python or the module,
it actually is used fairly often.
And, you know, it will be good for you
to at least become familiar with this package.
For example, here, I'm actually just using
the interactive Python shell interpreter
to import the requests package,
and then send an HTTP GET request to a website.
In this case, it's actually h4cker.org.
And the HTTP request is actually successful,
and that's why you see the 200 message response below.
Now, the W3Schools website has a very good explanation
of the HTTP status code messages, right?
So I mentioned to you the 200 message response.
But I want to actually, at least,
summarize all the response here for your benefit
and for your reference.
The messages in the 100 range are informational.
The 200 range are related to successful transactions,
and that's what you actually want to get
whenever you interact with any HTTP or HTTPS device.
And especially whenever you're interacting
with APIs as well, right?
So we want to get, you know, the status code message 200.
Now, in the 300 range,
that's actually related to HTTP redirection.
So if you actually visit a website
and it redirects you to another one, you might get something
like an HTTP status code of 302, right?
And you also have the messages in the 400 range,
and those are related to client errors.
And the 500 range, those are related to server errors.
Now, I'm spending a little bit of time here
explaining a lot of the HTTP protocol underlying functions.
And the reason for that is because you need to know
or have an understanding
of these functions and functionality
in order to be successful interpreting,
and also interacting, with APIs.
And for, of course, network programmability, right?
Whenever HTTP servers and browsers
communicate to each other,
they perform interactions based on headers,
as well as body content.
Now, the HTTP request,
and in HTTP, there's an HTTP request from the client
and a response from the server.
But in the request, it actually has a different structure.
You have the method,
which is how that request will actually be sent
to the server and the entities, you know?
So things like, for example, GET. A GET request.
And actually, that's used to retrieve information
from the server.
HEAD is basically the same as GET,
but it actually returns only the HTTP headers
and no document body from the server.
You also have POST, which actually sends data to the server,
typically using HTML forms, API requests, and the like.
Now, you also have TRACE to do a message loop-back test
along the path to the target resource.
You also have PUT
to upload a representation of the specified URI.
DELETE, which deletes the specified resource options,
which actually is returning the HTTP methods
that the server supports.
And CONNECT, which converts the request connection
to a transparent TCP/IP tunnel.
And as I mentioned to you,
the server after receiving this request
generates a response, right?
And the server response has three digit status codes
that are a brief, human-readable interpretation
of the status code.
And those are the ones that I explained to you earlier.