This tutorial will show you how to compile and start libyang on ESPRESSObin running either Ubuntu 14.04 or 16.04. libyang is a YANG data modelling language parser and toolkit written (and providing API) in C. The library is for example used in projects such as libnetconf2, Netopeer2 or Sysrepo projects.
To install libyang we need to make sure we have all necessary requirements first. Connect to your ESPRESSObin console and install the following packages:
root@localhost:~# apt-get install cmake libpcre3-dev
after this we need to install git in order to clone libyang repository:
root@localhost:~# apt-get install git git-core
and now we can clone libyang in the desired location (e.g. in home):
root@localhost:~# cd /home/ root@localhost:/home# git clone https://github.com/CESNET/libyang.git
NoteIf you're experiencing problem with certificates, make sure to update the date on your ESPRESSObin, e.g. with:
root@localhost:~# dpkg-reconfigure tzdata
After the repo is cloned, enter it and initiate installation with:
root@localhost:/home# cd libyang root@localhost:/home/libyang# mkdir build; cd build root@localhost:/home/libyang/build# cmake .. root@localhost:/home/libyang/build# make root@localhost:/home/libyang/build# make install
and libyang should now be set up on your ESPRESSObin and you can start experimenting with its features. Here we will quickly demonstrate the yanglint tool used for validating and converting schemas and YANG modeled data. For example, let us validate one YANG Data Model, here module2.yin which contains a syntax error:
root@localhost:/home/libyang/build# ./yanglint > clear > add ../tools/lint/examples/module2.yin libyang: Missing argument "name" to keyword "type". libyang: Module "module2" parsing failed.
or validate data using other example modules:
> clear > add ../tools/lint/examples/ietf-netconf-acm.yang > data -t config -s ../tools/lint/examples/datastore.xml libyang: Unknown element "interfaces". Failed to parse data.
That brings us to the end of this tutorial. As was shown here, ESPRESSObin can be used to run Open Source software projects, and it works perfectly. Under the hood, users can rest calm knowing machine code is executed by 64bit Dual Core ARM53 Armada 3700 SoC which clocks up to 1.2 GHz.