how can I send request in YANG format instead of existing XML format by using netopeer-cli to server

598 views
Skip to first unread message

hellosa...@gmail.com

unread,
Jan 8, 2015, 7:09:24 AM1/8/15
to neto...@googlegroups.com
Hi,
I am very new to the world of netconf. Currently, I am working on a task where client will send the request in YANG format to the server and server will process the request and reply the client with YANG format.

Currently, I have setted up the netopeer project, so that I am able to connect to netopeer server through netopeer-cli and able to send request and receive the response from the netopeer-server. But currently netopeer-cli is sending all the request in XML format and receiving the response in XML format. Could someone help me finding the way such that I will be able to send the request from netopeer-cli to netopeer-server in YANG format and receive the response in YANG format.

Also, is there any way (i.e. some tool or something else) to convert the existing XML messages send by netopeer-cli to YANG format?

Regards,
Sachin Jain

Radek Krejčí

unread,
Jan 8, 2015, 10:40:11 AM1/8/15
to hellosa...@gmail.com, neto...@googlegroups.com
Hi,
YANG is a language for writing data models. In contrast, NETCONF messages contains configuration data that only follows the data models. And they are always in XML format (as well as the NETCONF messages itself), see RFC 6241. So, when using NETCONF you will be always sending XML data.

Only when the server implements ietf-netconf-monitoring data model (RFC 6022), and netopeer server supports it, you can use <get-schema> operation to get a specific data model in YANG format and in that case the content of the returned message is in YANG format. But this is not probably what you want :)

From the YANG tools I recommend pyang[1]. It allows you to convert YANG data models to some other formats and it also allows you to validate your data (in XML) according to the specific YANG data model (search in wiki of the pyang project).

Best regards,
Radek

[1] http://pyang.googlecode.com/


Dne 8.1.2015 v 13:09 hellosa...@gmail.com napsal(a):

hellosa...@gmail.com

unread,
Jan 9, 2015, 8:07:09 AM1/9/15
to neto...@googlegroups.com, hellosa...@gmail.com
Hi Radek,
So basically what I understood is (please correct me if I am wrong) if I use netconf protocol then it is not possible to send the request in YANG format.

Suppose if I removed the netconf protocol and just implement client and servers that are talking to each other over TCP socket, then is it possible to send the request in YANG format and vise-versa?

Just to give you more insight of the project, Basically we have our own configuration management system and what we want to implement is a server such that it listen the request from client in YANG format and parse & process the received request over our own configuration management system and return the response to the client in YANG format.
Request send by client can be one of the followings:
a. login
b. retrieve configuration
c. edit configuration
d. add configuration
e. delete configuration
f. logout

Is it feasible (or possible) to achieve above functionality using the YANG data modeling language?

Regards,
Sachin Jain

Radek Krejčí

unread,
Jan 9, 2015, 9:04:45 AM1/9/15
to hellosa...@gmail.com, neto...@googlegroups.com
Hi,

Dne 9.1.2015 v 14:07 hellosa...@gmail.com napsal(a):
> Hi Radek,
> So basically what I understood is (please correct me if I am wrong) if I use netconf protocol then it is not possible to send the request in YANG format.

it is correct.

> Suppose if I removed the netconf protocol and just implement client and servers that are talking to each other over TCP socket, then is it possible to send the request in YANG format and vise-versa?

But the YANG is _data modeling_ language. How do you want to format a request? I'm not sure that I (and also that you :)) understand (have an idea) how such a request in a YANG format would look like, can you provide me an example of such a request?

> Just to give you more insight of the project, Basically we have our own configuration management system and what we want to implement is a server such that it listen the request from client in YANG format and parse & process the received request over our own configuration management system and return the response to the client in YANG format.
> Request send by client can be one of the followings:
> a. login
> b. retrieve configuration
> c. edit configuration
> d. add configuration
> e. delete configuration
> f. logout
>
> Is it feasible (or possible) to achieve above functionality using the YANG data modeling language?

No, if you want to write down the configuration data in YANG format. Because the YANG language is simply not usable for this. You can use YANG to describe how the configuration data should look like, but you cannot write a set of configuration data in YANG format. There is no way how to specify the value of some parameter in YANG format. Please read the RFC 6020.

You can send data (described by a YANG data model) in XML format and then it is what the NETCONF does. Or you can send the data in JSON format and then it is what the RESTconf does (with a different envelope around the data).

Regards,
Radek
Reply all
Reply to author
Forward
0 new messages