RESTCONF Server implements the RESTCONF protocol [RFC8040]. It communicates with a RESTCONF Client through a Web Server, an Apache HTTP Server.
In case HTTPS protocol is used the TLS channel is managed by the Web Server. Refer to the YumaPro Installation Guide for more details on how to configure TLS.
RESTCONF Client is implemented as a feature of yangcli-pro client. Existing yangcli-pro commands are used to initiate RESTCONF operations. The following list summarizes modifications to yangcli-pro to support the new RESTCONF feature.
- Introduce a new protocol flag - restconf, to distinguish between RESTCONF and NETCONF operations
yangcli-pro> connect protocol=restconf
- Handle HTTP/HTTPS communications with RESTCONF server
- Translate yangcli-pro commands to HTTP Requests and send to RESTCONF Server
- Parse HTTP Response from RESTCONF Server
- Handle error during an operation
- Display RESTCONF related system information
RESTCONF Client uses OpenSSL library to handle secure connection with RESTCONF server. So OpenSSL needs to be installed on machines running RESTCONF Client.
A thin layer of HTTP Generator/Parser is built to handle HTTP request/response, using the underneath OpenSSL connection.
The following programs and libraries are needed for the YumaPro RESTCONF client to work.
The libssl package is needed by the yangcli-pro program, in order to connect to RESTCONF servers using the TLS as a transport and run Apache as a secure server.
This package is called libssl-dev on Ubuntu platforms. This package is not installed by the default Linux installation process.
> sudo apt-get install libssl-dev
To use RESTCONF yangcli-pro client you need to setup and configure Apache2 WEB server.
1) Refer to the RESTCONF Installation section of the YumaPro Installation Guide for details on how to setup and install Apache2
2) Edit Apache site-available restconf.conf to allow sessions to be open for a longer time. Save and exit.
Otherwise, the Apache will terminate the session after the KeepAliveTimeout.
## Set if yangcli-pro is used to keep the session alive ## Note: these values will overwrite master apache.conf values ## if any. KeepAlive on MaxKeepAliveRequests 1000 ## Set KeepAliveTimeout to big number to maintain session alive KeepAliveTimeout 10
3) Now enable the WEB servers:
> sudo a2ensite restconf.conf > sudo apachectl restart > sudo apachectl -S
Now you can access RESTCONF server from the client:
yangcli-pro> connect server=localhost protocol=restconf user=username password=password transport=tls @restconf-dev> get-config
In the WEB browser:
Note: Browsers do not support application/xrd+xml extension. So, either you need to download
response or use URL interactive tool, such as Poster or Postman.
Now you can:
yangcli-pro commands are used to handle RESTCONF operations. The following table summarizes yangcli-pro common commands to be used for RESTCONF Client and their corresponding RESTCONF operations.
|yangcli-pro Command||RESTCONF Operation||Notes|
|create||POST||Create if and only if data does not exist|
|replace||PUT||Replace if data exists or create if data does not exist|
|merge||PATCH||Create or update but not delete|
|insert||POST/PUT/PATCH||HTTP method is decided by the operation parameter|
|DELETE||Delete data if it exists|
Retrieve configuration and operational data with query parameter ?content=all
|get-config||POST||Invoke <get-config> operation|
|any rpc operation||POST||Invoke operation defined with the YANG "rpc" statement|