adding my yang module to netopeer server

1,247 views
Skip to first unread message

peter...@gmail.com

unread,
Mar 30, 2015, 8:15:08 AM3/30/15
to neto...@googlegroups.com
Hi,

I  want to add my own yang file to the netopeer server. I used pyang to convert the yang file into .yin format. 

I used Netopeer-manager to add the yin file using command:
>netopeer-manager add --name testmodel --model /root/libnetconf/models/testmodel.yin --datastore /usr/local/etc/netopeer/modules.conf.d

>netopeer-manager list
shows that the testmodel is enabled

I want to know if this means I've successfully added the module, or did I miss something?

Thanks.
Peter


Radek Krejčí

unread,
Mar 30, 2015, 8:26:47 AM3/30/15
to peter...@gmail.com, neto...@googlegroups.com
Hi Peter,

Dne 30.3.2015 v 14:15 peter...@gmail.com napsal(a):
this is correct way to add your YANG module. Now, when you create (using NETCONF edit-config or copy-config) some configuration data frollowing your data model, the server (libnetconf) will store them in your datastore file. To get the data, you can use NETCONF get-config or get operation.

Remember, that without transAPI module, you can manipulate the configuration data as specified by NETCONF, but the changes are not applied to anything except the XML document stored in the datastore file.

Radek

Thanks.
Peter


--
You received this message because you are subscribed to the Google Groups "Netopeer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netopeer+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/netopeer.
For more options, visit https://groups.google.com/d/optout.

peter...@gmail.com

unread,
Mar 30, 2015, 9:53:18 PM3/30/15
to neto...@googlegroups.com, peter...@gmail.com
Hi Radek,

Thank you for taking the time to answer my quesiton. 
What additional functions does the TransAPI module provide?
And if I were to turn my module into a TransAPI module, what operations do I need to conduct? 

Thanks.
Peter

在 2015年3月30日星期一 UTC+8下午8:26:47,Radek Krejčí写道:

Michal Vasko

unread,
Mar 31, 2015, 2:57:28 AM3/31/15
to neto...@googlegroups.com, peter...@gmail.com
Hi Peter,

we have a tutorial that is a good starting point for implementing a TransAPI module here. Then you should be ready to create a simple module or if you want to see an existing implementation of a fairly complex YANG models and the resulting module for inspiration, you can find two such modules in "netopeer/transAPI/". Also, the "turing" module from the tutorial is there, all of them fully working.

Regards,
Michal

peter...@gmail.com

unread,
Mar 31, 2015, 8:39:53 AM3/31/15
to neto...@googlegroups.com, peter...@gmail.com
Hi Michal,

Could you explain what additional functions does the TransAPI module provide? 
If I just want to configure the state data of the yang module, is it enough to just add the .yin file using netopeer-manager? 
Also, where could I download Inctool?

Thanks.
Peter

在 2015年3月31日星期二 UTC+8下午2:57:28,Michal Vasko写道:

Radek Krejčí

unread,
Mar 31, 2015, 9:13:33 AM3/31/15
to peter...@gmail.com, neto...@googlegroups.com
Hi Peter,

when you just add the yin file, netopeer-server just stores the _configuration_ data (defined by the model) in the datastore. But nothing else. The state data are supposed to reflect current status of some device, netopeer nor libnetconf are not able to provide them since they do not know meanings of the particular data.

If you want to return the state data, you have to use the transAPI module - one of the callbacks is used to return state data from your module (which gets them from the managed device) to libnetconf. There are also other types of callbacks:

- data callbacks connected with a specific point in the configuration data tree. When something in the subtree (specified by that point) is changed (created/removed/modified/reordered), the specific callback is called by libnetconf and it is supposed to reflect configuration changes to the device

- rpc callbacks, since data model can define new rpcs, the transapi module is supposed to implement such RPC operation. When libnetconf is asked to process such an rpc, the callback from the appropriate transapi module is used

- file monitoring callbacks, libnetconf can be asked to monitor a file for changes, for example /etc/passwd. When the monitored file is modified on the disk, the callback connected with the monitored file is used by libnetconf and it is completely up to the callback implementation what it actually does


It depends on the data model nad the developer which callbacks are actually implemented. libnetconf actually allows completely empty transAPI module with no callback (but then it is useless).

lnctool is part of the libnetconf repository and when you install libnetconf, you also install lnctool.

I hope this helped, but more detailed information can be found in the libnetconf documentation, refferenced by Michal.

Best regards,
Radek


Dne 31.3.2015 v 14:39 peter...@gmail.com napsal(a):
--

peter...@gmail.com

unread,
Apr 1, 2015, 4:35:53 AM4/1/15
to neto...@googlegroups.com, peter...@gmail.com
Hi Radek,

Thank you for answering my question, your advice is really helpful.
I could find the Inctool file in my /libnetconf/Inctool folder, 
but when I use the Inctool command, it still says command not found.

Best regards.
Peter

在 2015年3月31日星期二 UTC+8下午9:13:33,Radek Krejčí写道:

Michal Vasko

unread,
Apr 2, 2015, 3:03:56 AM4/2/15
to neto...@googlegroups.com, peter...@gmail.com
Hi Peter,

in the worst case you can always execute the script from "libnetconf/dev-tools/lnctool/". However, it should be installed and work in a standard way and your mistake is probably in writing Inctool instead of lnctool (the first letter is 'l', not 'i').

peter...@gmail.com

unread,
Apr 2, 2015, 4:10:36 AM4/2/15
to neto...@googlegroups.com, peter...@gmail.com
Hi,

In the transAPI turotial. It says first to create a path file.
Could you explain what should be included in this file?
And is there a standard format for its content?

Thanks.
Peter

在 2015年4月2日星期四 UTC+8下午3:03:56,Michal Vasko写道:

Michal Vasko

unread,
Apr 7, 2015, 2:56:11 AM4/7/15
to neto...@googlegroups.com, peter...@gmail.com
Hi Peter,

abstractly speaking, in the paths file you should include every node (leaf, container, list, whatever) that has a separate configuration meaning. What this means in practice is that for every such path a callback will be called that can set this configuration. This is one of the advantages of our transAPI approach, you don't have to parse and set the whole configuration with every small change, but you can split it into as many parts as you want and handle those independently of each other.

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