Introduction to REST API in SDN

REST (Representational State Transfer) is a type of API that allows applications running on different hosts to exchange data using HTTP messages. In a controller-based networking environment, administrators use it to communicate with the northbound interface of the SDN.

There are two types of networking environments: traditional and controller-based. The traditional networking environment uses a flat network architecture. To configure or manage a device, you have to access it directly. The controller-based networking environment uses a hierarchical network architecture. It uses a controller device or software to configure or manage network devices. Since it uses software to manage networking devices, it is also called software-defined networking (SDN).

The controller software or device takes instructions from administrators and implements them on the network devices. It has two key components: a northbound interface and a southbound interface. It uses the southbound interface to connect to the network devices. It uses the northbound interface to connect to the administrator's application. The northbound interface uses the REST API to get instructions from the administrator's application.

REST (Representational State Transfer) is a resource-based API. It transfers a resource's state between a client and a server. The client requests a resource's state. The server provides the requested resource's state. Each offer includes all the information the client needs to complete the operation.

REST API uses HTTP Verbs to receive and send data. An HTTP Verb is a command that performs a specific action. The following table lists HTTP Verbs the REST API uses.

HTTP Verb Action Description
POST Create Used to create a new record within the data.
GET Read Used to perform a call that reads data from the source.
PUT Update/Replace Used to update an existing record within the data.
DELETE Delete Used to delete a record from the data.

Let's take an example to understand how SDN uses REST API. The following image shows a simple SDN network.

rest api

The administrator sends HTTP GET requests to the SDN controller. On the Internet, browsers use the HTTP GET requests to retrieve web pages. However, in SDN implementation, the application uses HTTP GET requests to identify an object on the SDN controller, typically a data structure that the application needs to learn and then process. For example, it might identify an object that lists physical interfaces on a specific network device along with the status of each.

The controller sends back an HTTP GET response message with the object. The response message includes the information the application needs.

The main difference between a browser and an SDN application's HTTP requests is the format of the data they retrieve. Browsers receive web pages, while SDN applications receive structured data.

Structured data contains variable names and their values in a format that can be easily used by the requesting application. JSON (JavaScript Object Notation) and XML (Extensible Markup Language) are common data formats that applications use for network programmability.

There are six criteria for an API to be considered a RESTful API.

Client/Server

A RESTful API uses a client/server model to exchange information. Only clients can initiate connections requesting something from a server.

Stateless

The server doesn’t store any information from previous requests.

Cacheable

The server response includes a version number. Clients use it to decide whether they should use the cached information or make a new request.

Uniform Interface

Each resource must have its own unique URI and support resource representation. Resource representation describes how the server will transfer it to the clients. Usually, it uses JSON or XML to describe resources.

Layered System

It must support the layer system. It should allow administrators to add additional layers between the API and the server data such as a firewall or a load balancer without impacting operations.

Code on Demand

It should allow the server to send executable code responses to the client.

That's all for this tutorial. In this tutorial, we discussed the basic concepts and fundamentals of REST API and learned how it is used in an SDN environment.

ComputerNetworkingNotes CCNA Study Guide Introduction to REST API in SDN