clixon/example
2017-03-25 18:24:52 +01:00
..
docker dual license 2016-12-30 16:14:48 +01:00
ietf-inet-types@2013-07-15.yang Inital commit 2016-02-22 22:17:30 +01:00
ietf-interfaces@2014-05-08.yang Inital commit 2016-02-22 22:17:30 +01:00
ietf-ip@2014-06-16.yang Change internal protocol from clicon_proto.h to netconf. 2017-03-25 11:10:50 +01:00
ietf-ipsec@2016-03-09.yang order lists according to yang order 2016-12-27 17:31:30 +01:00
ietf-ipv4-unicast-routing@2014-10-26.yang Inital commit 2016-02-22 22:17:30 +01:00
ietf-ipv6-unicast-routing@2014-10-26.yang Inital commit 2016-02-22 22:17:30 +01:00
ietf-routing@2014-10-26.yang Inital commit 2016-02-22 22:17:30 +01:00
ietf-yang-types@2013-07-15.yang Inital commit 2016-02-22 22:17:30 +01:00
Makefile.in dual license 2016-12-30 16:14:48 +01:00
README Change internal protocol from clicon_proto.h to netconf. 2017-03-25 11:10:50 +01:00
routing.conf.local Change internal protocol from clicon_proto.h to netconf. 2017-03-25 11:10:50 +01:00
routing_backend.c Change internal protocol from clicon_proto.h to netconf. 2017-03-25 11:10:50 +01:00
routing_cli.c internal netconf mods 2017-03-25 18:24:52 +01:00
routing_cli.cli internal netconf mods 2017-03-25 18:24:52 +01:00
routing_netconf.c dual license 2016-12-30 16:14:48 +01:00

Clixon yang routing example
+++++++++++++++++++++++++++

0. Compile and run
------------------
cd example
make && sudo make install
# Start backend
clixon_backend -f /usr/local/etc/routing.conf -I
# Edit cli
clixon_cli -f /usr/local/etc/routing.conf
# Send netconf command
clixon_netconf -f /usr/local/etc/routing.conf

1. Setting data example using netconf
-------------------------------------
<rpc><edit-config><target><candidate/></target><config>
      <interfaces>
         <interface>
            <name>eth1</name>
            <enabled>true</enabled>
            <ipv4>
               <address>
                  <ip>9.2.3.4</ip>
                  <prefix-length>24</prefix-length>
               </address>
            </ipv4>
         </interface>
      </interfaces>
</config></edit-config></rpc>]]>]]>

2. Getting data using netconf
-----------------------------

<rpc><get-config><source><candidate/></source></get-config></rpc>]]>]]>

<rpc><get-config><source><candidate/></source><filter/></get-config></rpc>]]>]]>

<rpc><get-config><source><candidate/></source><filter type="xpath"/></get-config></rpc>]]>]]>

<rpc><get-config><source><candidate/></source><filter type="subtree"><configuration><interfaces><interface><ipv4/></interface></interfaces></configuration></filter></get-config></rpc>]]>]]>

<rpc><get-config><source><candidate/></source><filter type="xpath" select="/interfaces/interface/ipv4"/></get-config></rpc>]]>]]>

<rpc><validate><source><candidate/></source></validate></rpc>]]>]]>

3. Creating notification
------------------------
The example has an example notification triggering every 10s. To start a notification 
stream in the session, create a subscription:
<rpc><create-subscription><stream>ROUTING</stream></create-subscription></rpc>]]>]]>
<rpc-reply><ok/></rpc-reply>]]>]]>
<notification><event>Routing notification</event></notification>]]>]]>
<notification><event>Routing notification</event></notification>]]>]]>
...

This can also be triggered via the CLI:
cli> notify 
cli> Routing notification
Routing notification
...

4. Downcall
-----------
Clixon has an extension mechanism which can be used to make extended internal
netconf messages to the backend configuration engine. You may need this to
make some special operation that is not covered by standard
netconf functions. The example has a simple "echo" downcall
mechanism that simply echoes what is sent down and is included for
reference. A more realistic downcall would perform some action, such as
reading some status.

Example:
cli> downcall "This is a  string"
This is a string
cli>p

5. Run as docker container
--------------------------
cd docker
# look in README