RESTCONF¶
NETCONFc supports connecting to a RESTCONF server and perform RESTCONF actions.
Connect to server via RESTCONF over HTTP¶
Start NETCONFc, you will see NETCONFc’ main YANG
Module Explorerwindow.![]()
Click the
Connectbutton, selectRESTCONFto bring up the session creation dialog.![]()
New session parameters
Enter server’s host name or IP address, port number. Enter your user name and password if HTTP Auth is used.
HTTP Authcan be eitherBasic AuthorDigest Authdepending on the server configuration.If
HTTPSscheme is selected, then you must enter thetrusted CA certificatefile with full path, which is needed to validate the server’s certificate and can be a chained certificate file. You can disableVerify Server Certto prevent NETCONFc client from enforcing verifying server’s certficate.If the server requires a valid client certificate, then you must enter
client certificatefile with full path,client private keyfile with full path (this field can be left blank if the client certificate file already contains client’s private key).
YANG Encodecan be eitherJSON-encodingorXML-encodingdepending on what the server supports.Note
timeoutis the time NETCONFc will abort connecting if no response has been received after that period of timeThen click the button “Connect” on the session creation dialog. You should be connected to the server.
If error occurs, check if the server is running on the specified address and port. Also make sure the correct user name and password are used.
Send <Get> requests¶
You can select one or more nodes in the module tree and send a <get> to retrieve current data (state and config) underneath.
Use the key shortcut
Ctrl + Zto quickly perform <get> request.If you
Ctrl + Zon themodulenode, then all state and config data in that module will be retrieved.In the notebook in the window on the right side , you will also see a RPC XML page that shows the XML encoding of the last RPC request and reply.
There is also a notebook page that is either labeled as
datatreeor<Get-config data tree (Value is editable)>. It shows a tree view for the retrieved instance data. We call itdata tree.If the get is not issued for config data, then the
data treeis read-only. In other words, the cells in theValuecolumn will not allow editing. The edit-config in the right-click context menu is also disabled.You can use <Shift + click> or <Ctrl + click> to select multiple nodes for retrieving data
![]()
Note
When you <get> on a leaf node in a list, if the server does not send back the value for the list key nodes at the same time, then you will not make much sense out of the data you received. NETCONFc by default will include all key nodes when querying data. To turn this feature off see Retrieving with list key nodes
Send <Get> requests for config data¶
You can send a <get> to retrieve the config data underneath a node.
Select any node, right click and select ‘Set Retrieval Options | Content | config’ to retrieve the config data under this node.
Then use the key shortcut
Ctrl + Zto perform <get> request.In this case, the data retrieved and shown on the right window pane is read-write. In other words, the cells in the
Valueallows editing. The edit-config in the right-click context menu is also enabled.
Send <Head> and <Options> requests for config data¶
You can select one or more nodes in the module tree and send a <Head> or <Options> requests on them.
Set Retrieval Options¶
Select any node, right click and select ‘Set Retrieval Options’.
You can insert headers such as
If-Match,If-None-Match,If-Modified-Since, andIf-Unmodified-Sinceheaders in your requests by selecting the menuInsert Selected Headers in RequestsYou can insert
depthparammeter by entering a non-zero value in theDepthfield on the top toolbar.You can insert
with-defaultsparameter such astrim,explicit,report-allandreport-all-taggedby selecting the menuWith-defaults.When sending a get request, its
fieldsfilter expression will be built automatically if you use ‘Ctrl + Click’ to select two or more nodes, ” + value, caption=”Set up fields filter expression”)
Send <Post> <Put> <Patch> command¶
We call the YANG module tree on the left side
schema treeTo create or edit a node in the remote server config, just select the node in the module tree, right-click and select
Enter Value to include in RPCor use shortcut keyCtrl + W.![]()
You can also click the
Valuecell to enter or modify the value you want to set.You can choose a target node by right-clicking and select
Set/Unset selected node as edit target. If no target node is chosen the application will try to pick one for you based on the values you entered. However the target node automatically chosen may not be what you intend to use.After you finish entering the value, right-click and select
Post,Put, orPatchto send it.
More Operations¶
You can send the following operations through this pull-down menu.
Get YANG Library version
Send a get on Datastore Resource
Get All Operations Resource
Sending Raw RESTCONF Requests¶
You can send manually edited RESTCONF requests directly in the
Send Request and Show Replytab window.Using this feature you can modify a RESTCONF message and resend it quickly.
For example, you can send a <get> request. Then in the “Send Request and Show Reply” window, you should see the last request and reply message.
You may want to change some fields (e.g. the depth parameter value) and then simply click
Send Request above (Type URL Data)to resend the get request.This can be a handy way to test your server and see how it responds to various requests.