netconf.xml 9.83 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
<!--
 - Copyright (C) 2018 Internet Systems Consortium, Inc. ("ISC")
 -
 - This Source Code Form is subject to the terms of the Mozilla Public
 - License, v. 2.0. If a copy of the MPL was not distributed with this
 - file, You can obtain one at http://mozilla.org/MPL/2.0/.
-->
<!-- Converted by db4-upgrade version 1.1 -->
<chapter xmlns="http://docbook.org/ns/docbook" version="5.0" xml:id="kea-shell">
  <title>YANG/NETCONF Support</title>

  <section xml:id="netconf-overview">
    <title>Overview</title>
    <para>Kea 1.5.0 introduced an optional support for YANG/NETCONF
    interface. </para>

    <para>As the primary purpose of the Kea Shell is as a tool in scripting environment,
    it is not interactive. However, with simple tricks it can be run manually.
    </para>
  </section>

  <section xml:id="netconf-install">
    <title>Installing NETCONF Dependencies</title>

<para>This bare bones documentation is a work in progress. Its current purpose
is to let engineers joining the project or perhaps advanced early adopters to
get up to speed quickly. Note that to get NETCONF capabilities Kea uses Sysrepo
software, which has many dependencies. Unfortunately, many of them are not
available as packages, so some need to be compiled manually.</para>

<para>The following installation instruction was tested on Ubuntu 18.04.</para>
    
<para>    
STEP 1. Install dependencies. Note that some of those dependencies are likely to
be present in your system already.

<screen>
$ sudo apt-get install git cmake build-essential bison flex libpcre3-dev libev-dev libavl-dev libprotobuf-c-dev protobuf-c-compiler
</screen>      
</para>

<para>
STEP 2. Install libyang. Download libyang from https://github.com/CESNET/libyang/releases.
As of writing this document, the latest version was 0.15-r1.

<screen>
    tar zxvf libyang-0.15-r1.tar.gz
    cd libyang-0.15-r1/
    mkdir build
    cd build
    cmake ..
    make
    sudo make install
</screen>      

For detailed build instructions, see https://github.com/CESNET/libyang/.
</para>

<para>STEP 3. Install syrepo. Download sysrepo from https://github.com/sysrepo/sysrepo/releases.
As of writing this document, the 0.7.4 as the latest version.

<screen>
tar zxvf sysrepo-0.7.4.tar.gz
cd sysrepo-0.7.4
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DGEN_LANGUAGE_BINDINGS=ON -DGEN_CPP_BINDINGS=ON\
      -DGEN_PYTHON_BINDINGS=OFF -DGEN_LUA_BINDINGS=OFF -DENABLE_TESTS=OFF ..
make
sudo make install
</screen>
</para>
</section>

  <section>
    <title>Quick sysrepo overview</title>
    <para>
    This section covers a rather brief overview of a subset of available
    functionality in sysrepo. For more complete document, see sysrepo homepage.
    You may also want to take a look at
    <uri xmlns:xlink="http://www.w3.org/1999/xlink"
         xlink:href="https://github.com/isc-projects/kea-yang">notes made during a series of IETF
    Hackathons</uri>.
    </para>

    <para>
      List currently installed YANG modules:
<screen>
  $ sysrepoctl -l
</screen>

After installation the result should be similar to this:
<screen>
Sysrepo schema directory: /home/thomson/devel/sysrepo-0.7.4/build/repository/yang/
Sysrepo data directory:   /home/thomson/devel/sysrepo-0.7.4/build/repository/data/
(Do not alter contents of these directories manually)

Module Name                | Revision   | Conformance | Data Owner          | Permissions | Submodules                    | Enabled Features
-----------------------------------------------------------------------------------------------------------------------------------------------
ietf-netconf-notifications | 2012-02-06 | Installed   | root:root           | 666         |                               |
ietf-netconf               | 2011-06-01 | Imported    |                     |             |                               |
ietf-netconf-acm           | 2012-02-22 | Imported    |                     |             |                               |
nc-notifications           | 2008-07-14 | Installed   | root:root           | 666         |                               |
notifications              | 2008-07-14 | Installed   | root:root           | 666         |                               |
turing-machine             | 2013-12-27 | Installed   | root:root           | 666         |                               |
iana-if-type               | 2014-05-08 | Installed   |                     |             |                               |
ietf-interfaces            | 2014-05-08 | Installed   | root:root           | 666         |                               |
ietf-ip                    | 2014-06-16 | Installed   |                     |             |                               |
</screen>
    </para>

    <para>
Installing Kea YANG modules. There are two major modules that Kea is able to
support: kea-dhcp4-server and ietf-dhcp6-server. Note that while there is an
active effort at DHC working group at IETF to develop an DHCPv6 YANG model,
similar initiative for DHCPv4 died long time ago. As such, Kea uses IETF model
for DHCPv6 and its own dedicated model for DHCPv4. Those two models have extra
models as dependencies. The dependency models are also provided in
src/lib/libyang/models. To install Kea models, do the following:

<screen>
cd src/lib/yang/models
sudo sysrepoctl -i -g kea-dhcpv4-server.yang -s /home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ -s ./
sudo sysrepoctl -i -g ietf-dhcpv6-server.yang -s /home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ -s ./
</screen>

Note the first -s parameter specifies the location of your YANG schema
directory. You can check it with sysrepoctl -l. This is a parameter that is
configured during sysrepo compilation.


The installation should look similar to the following:
<screen>
$ sudo sysrepoctl -i -g ietf-dhcpv4-server.yang -s /home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ -s ./
Installing a new module from file 'ietf-dhcpv4-server.yang'...
Installing the YANG file to '/home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ietf-dhcpv4-server@2018-07-14.yang'...
Resolving dependency: 'ietf-dhcpv4-server' imports 'ietf-dhcpv4-options'...
Installing the YANG file to '/home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ietf-dhcpv4-options@2018-07-14.yang'...
Resolving dependency: 'ietf-dhcpv4-options' imports 'ietf-dhcpv4-types'...
Installing the YANG file to '/home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ietf-dhcpv4-types@2018-07-14.yang'...
Resolving dependency: 'ietf-dhcpv4-server' imports 'ietf-dhcpv4-types'...
Installing the YANG file to '/home/thomson/devel/sysrepo-0.7.4/build/repository/yang/ietf-dhcpv4-types@2018-07-14.yang'...
Resolving dependency: 'ietf-dhcpv4-server' imports 'ietf-interfaces'...
Schema of the module ietf-interfaces is already installed, skipping...
Installing data files for module 'ietf-dhcpv4-server'...
Resolving dependency: 'ietf-dhcpv4-server' imports 'ietf-dhcpv4-options'...
Skipping installation of data files for module 'ietf-dhcpv4-options'...
Resolving dependency: 'ietf-dhcpv4-options' imports 'ietf-dhcpv4-types'...
Skipping installation of data files for module 'ietf-dhcpv4-types'...
Resolving dependency: 'ietf-dhcpv4-server' imports 'ietf-dhcpv4-types'...
Skipping installation of data files for module 'ietf-dhcpv4-types'...
Resolving dependency: 'ietf-dhcpv4-server' imports 'ietf-interfaces'...
Installing data files for module 'ietf-interfaces'...
Notifying sysrepo about the change...
Install operation completed successfully.
</screen>  

You can confirm whether the models are imported correctly by using sysrepoctl -l

<screen>
$ sysrepoctl -l
Sysrepo schema directory: /home/thomson/devel/sysrepo-0.7.4/build/repository/yang/
Sysrepo data directory:   /home/thomson/devel/sysrepo-0.7.4/build/repository/data/
(Do not alter contents of these directories manually)

Module Name                | Revision   | Conformance | Data Owner          | Permissions | Submodules                    | Enabled Features
-----------------------------------------------------------------------------------------------------------------------------------------------
ietf-netconf-notifications | 2012-02-06 | Installed   | root:root           | 666         |                               |
ietf-netconf               | 2011-06-01 | Imported    |                     |             |                               |
ietf-netconf-acm           | 2012-02-22 | Imported    |                     |             |                               |
nc-notifications           | 2008-07-14 | Installed   | root:root           | 666         |                               |
notifications              | 2008-07-14 | Installed   | root:root           | 666         |                               |
turing-machine             | 2013-12-27 | Installed   | root:root           | 666         |                               |
iana-if-type               | 2014-05-08 | Installed   |                     |             |                               |
ietf-interfaces            | 2014-05-08 | Installed   | root:root           | 666         |                               |
ietf-ip                    | 2014-06-16 | Installed   |                     |             |                               |
kea-dhcpv4-server          | 2018-07-14 | Installed   | root:root           | 666         |                               |
ietf-dhcpv4-options        | 2018-07-14 | Imported    |                     |             |                               |
ietf-dhcpv4-types          | 2018-07-14 | Imported    |                     |             |                               |
ietf-dhcpv6-server         | 2018-03-04 | Installed   | root:root           | 666         |                               |
ietf-dhcpv6-options        | 2018-03-04 | Imported    |                     |             |                               |
ietf-dhcpv6-types          | 2018-01-30 | Imported    |                     |             |                               |
</screen>
</para>

  </section>
</chapter>