Page Content

Tutorials

What is RESTCONF, Architecture and RESTCONF vs NETCONF

What is RESTCONF?

A standardized HTTP-based protocol called RESTCONF (Representational State Transfer Configuration) was created to give network devices a programmatic way to access data specified in YANG (Yet Another Next Generation).

It serves as the Network Configuration Protocol’s (NETCONF) HTTP/JSON-friendly equivalent and is described by the IETF in RFC 8040. Using a well-known RESTful API approach, it enables network administrators and automation programs to control and configure network components.

What is RESTCONF
What is RESTCONF

You can also read IP Addressing Subnetting

Core Principles and Data Modeling

The REST (Representational State Transfer) principles are followed by RESTCONF:

  • Protocol and Transport: RESTCONF is an HTTP-based protocol. RESTCONF mandates the use of TLS (Transport Layer Security) to ensure data integrity and secrecy due to the sensitive nature of the information transmitted. Usually, HTTPS is used, and port 443 is the default.
  • Resource-Oriented: Each configuration or state data item specified in a YANG module is regarded as a resource with a distinct identifier (a URI).
  • Data Modeling (YANG): The YANG data modelling language is a crucial component of RESTCONF. The structure, syntax, and semantics of the configuration and operational data are explicitly and precisely determined by YANG. Automation across heterogeneous devices is made possible by this model-driven approach, which also offers predictability for APIs.
  • URI Structure: The entire hierarchy of a YANG data model is directly mapped onto a URI (Uniform Resource Identifier) structure. Data nodes are uniquely targeted using URI-encoded path expressions, starting with the RESTCONF root resource. For example, a list entry uses the format listname=key1,key2 in the URI.

Operations (HTTP Methods)

RESTCONF uses standard HTTP methods (REST verbs) to perform CRUD (Create, Read, Update, Delete) operations on resources.

HTTP MethodRESTCONF ActionExample Use
GETRead/RetrieveRetrieves the running configuration or state data for a resource.
POSTCreate or InvokeCreates a new resource within a collection, or invokes a data-model-specific Remote Procedure Call (RPC) operation or action.
PUTReplace/CreateCompletely replaces the data for an existing resource, or creates a new resource if it doesn’t exist.
PATCHModify/UpdatePartially updates an existing resource (e.g., changing only one field).
DELETEDeleteRemoves a specified resource.
HEADRetrieve MetadataRetrieves only the header fields (metadata) for a resource.
OPTIONSDiscover Supported MethodsSent by the client to discover which methods are supported by the server for a specific resource.

You can also read What is Network Configuration Protocol & NETCONF Operations

Architecture and Resources

RESTCONF utilizes the datastore concepts defined in NETCONF. The RESTCONF root resource, often discovered via the /.well-known/host-meta resource, contains several conceptual child resources:

  • API Resource: The top-level resource, typically located at /restconf.
  • Data Resource (/restconf/data): This mandatory resource represents the conceptual datastore, holding all configuration and state data nodes that a client can access. Configuration data and state data are exposed as resources that can be retrieved, and configuration resources can be modified.
  • Operations Resource (/restconf/operations): This optional container provides access to data-model-specific RPC operations defined by YANG. These operations are invoked using the POST method.
  • Event Stream Resource: This resource supports the Server-Sent Events transport mechanism by acting as a source for system-generated event notifications.

Data Encoding and Exchange Request and response messages can be formatted in either JSON (commonly used) or XML. Clients must specify the encoding format using the Content-Type header for requests and the Accept header for responses.

Monitoring and Capabilities

The RESTCONF server must implement the ietf-restconf-monitoring module, which provides monitoring information about the protocol capabilities and available event streams.

A RESTCONF capability is an optional protocol feature advertised by the server. The server includes a capability URI leaf-list entry identifying each supported optional protocol feature, including optional query parameters.

You can also read What is Data Format for Automation and Data Formats Types

RESTCONF supports various Query Parameters that modify how operations are processed, such as:

Query ParameterMethodPurpose
contentGET, HEADSelects whether to return configuration, non-configuration, or all data nodes.
depthGET, HEADLimits the depth of subtrees returned.
fieldsGET, HEADRequests a subset of the target resource contents.
with-defaultsGET, HEADControls the retrieval and reporting of default configuration values.
insert/pointPOST, PUTSpecifies the insertion mode and insertion point for “ordered-by user” lists.
start-time/stop-timeGET, HEADUsed to trigger notification replay features for event streams.

RESTCONF vs NETCONF

While both RESTCONF and NETCONF use YANG data models, they differ significantly in implementation details:

FeatureRESTCONFNETCONF
TransportHTTPSSSH
EncodingJSON or XMLXML only
OperationsREST verbs (CRUD)RPC operations (session-based)
Transactional SupportBasic, non-transactional approachStrong (supports features like commitcandidate)
ComplexityLower, easier to integrate with web toolsHigher, needs more expertise

Because of its simplicity, compatibility with contemporary programming libraries, and ease of interaction with online applications, RESTCONF is typically preferred.

Analogy: Consider the configuration data of a network device (as specified by YANG) as a vast, painstakingly structured digital library catalogue (the datastore). To retrieve or alter books using NETCONF, you must utilize specific remote-procedure commands (such as requesting a reference librarian in a formal, inflexible language) and make sure that each modification is transactionally recorded. In contrast, RESTCONF handles the same catalogue as a contemporary website inventory. Anyone used to working with web services will find it easy to use and familiar because you use conventional web browser actions, such as GET to search up a book’s entry via its URL, POST to submit a new entry to a section, or DELETE to remove an entry.

You can also read Future of Network Automation and Types of Network Automation

Index