Giter Club home page Giter Club logo

netopeer2's Introduction

Netopeer2 โ€“ NETCONF Server

BSD license Build Status Coverity Codecov Ohloh Project Status

Netopeer2 is a server for implementing network configuration management based on the NETCONF Protocol. This is the second generation, originally available as the Netopeer project. Netopeer2 is based on the new generation of the NETCONF and YANG libraries - libyang and libnetconf2. The Netopeer2 server uses sysrepo as a NETCONF datastore implementation.

Netopeer2 is maintained and further developed by the Tools for Monitoring and Configuration department of CESNET. Any feedback, testing or feature requests are welcome. Please contact us via the issue tracker.

Branches

The project uses 2 main branches master and devel. Other branches should not be cloned. In master there are files of the last official release. Any latest improvements and changes (of the server), which were tested at least briefly are found in devel. On every new release, devel is merged into master.

This means that when only stable official releases are to be used, either master can be used or specific releases downloaded. If all the latest bugfixes should be applied, devel branch is the one to be used. Note that whenever a new issue is created and it occurs on the master branch, the first response will likely be to use devel before any further provided support.

RFC Compliance

  • RFC 5277 NETCONF Event Notifications
  • RFC 6022 YANG Module for NETCONF Monitoring
  • RFC 6241 Network Configuration Protocol (NETCONF)
  • RFC 6242 Using the NETCONF Protocol over Secure Shell (SSH)
  • RFC 6243 With-defaults Capability for NETCONF
  • RFC 6470 Network Configuration Protocol (NETCONF) Base Notifications
  • RFC 7589 Using the NETCONF Protocol over Transport Layer Security (TLS) with Mutual X.509 Authentication
  • RFC 8071 NETCONF Call Home and RESTCONF Call Home
  • RFC 8341 Network Configuration Access Control Model
  • RFC 8525 YANG Library
  • RFC 8526 NETCONF Extensions to Support the Network Management Datastore Architecture
  • RFC 8639 Subscription to YANG Notifications
  • RFC 8640 Dynamic Subscription to YANG Events and Datastores over NETCONF
  • RFC 8641 Subscription to YANG Notifications for Datastore Updates

Packages

Binary RPM or DEB packages of the latest release can be built locally using apkg, look into README in the distro directory.

Requirements

Optional

  • pkg-config & libsystemd (to support netopeer2-server systemd service)
  • cmocka >= 1.0.1 (for tests)
  • valgrind (for enhanced testing)
  • gcov (for code coverage)
  • lcov (for code coverage)
  • genhtml (for code coverage)

Compilation and installation

$ mkdir build; cd build
$ cmake ..
$ make
# make install

Compilation options

The netopeer2-server requires ietf-netconf-server and all connected YANG modules to be installed in sysrepo to work correctly. This is performed automatically during the installation process. Moreover, default SSH configuration listening on all IPv4 interfaces and a newly generated SSH host key are imported so that it can be connected to the server out-of-the-box. However, it may not always be desired to perform all these steps even though the executed scripts check whether the modules/some configuration already exist and do not repeat/overwrite any modules/configuration.

This is the option that affects the initial setup:

SYSREPO_SETUP:ON

If cross-compiling for a different architecture, you will likely want to turn this option off and then run the scripts setup.sh, merge_hostkey.sh, and merge_config.sh manually.

Server configuration

By default, only SSH listen configuration is imported so to enable any other connection methods, they need to be configured manually. The default SSH listen configuration will define one of the following two means of authentication only for the user that executed the script to install netopeer2. The first is via the SSH public key authentication method, which will be set if authorized_keys file is found and the keys from this file will be used. If authorized_keys file is not found, the second method is via the SSH keyboard-interactive, which leaves the authentication up to the system (and depends on how libnetconf2 was compiled but if it supports PAM, netopeer2.conf PAM configuration file will be used, which can be customized manually).

Example configuration XML files can be found in the example_configuration directory. These files can be easily modified to create configuration specific for a particular environment and configured authentication.

SSH Call Home

To enable SSH Call Home, only ssh_callhome.xml file needs to be imported to sysrepo provided that the default SSH host key genkey was imported into ietf-keystore configuration.

TLS listen

To support clients connecting using TLS, configuration files tls_keystore.xml, tls_truststore.xml, and tls_listen.xml needs to be merged into sysrepo configuration of modules ietf-keystore, ietf-truststore, and ietf-netconf-server, respectively. After doing so, a NETCONF client can connect using client.crt certificate and client.key private key and having ca.pem CA certificate set as trusted. These example certificates can be found in example_configuration/tls_certs. netopeer2-cli can easily be configured this way and the TLS connection tested.

To pass server identity check, the client must be connecting to localhost, which is the default server domain if left empty. Once connected, the client will be identified with tls-test NETCONF username.

TLS Call Home

Using the same certificates and authorization options, a TLS client can be connected to using Call Home when tls_callhome.xml file is imported. But tls_keystore.xml and tls_truststore.xml need to be imported first.

NACM

This NETCONF server uses ietf-netconf-acm access control of sysrepo. NACM is enabled by default, so except for the recovery user, no others will be allowed to write any data but should be granted read and execute permissions unless the access was modified by a NACM extension. When deploying this server, it is strongly advised to configure NACM properly.

Sysrepo callbacks

When implementing a sysrepo application with some callbacks, in case the particular event will be generated by netopeer2, there will be the NETCONF session ID and NETCONF username of the originator NETCONF session provided. It can be retrieved from the event sysrepo session and the originator name will be netopeer2. Following is a table with the exact data format.

Index Type Meaning
0 uint32_t NETCONF session ID
1 char * NETCONF username

It is also possible to communicate a specific NETCONF error back to the server, use sysrepo utility functions to create it.

CLI

A simple command-line NETCONF client netopeer2-cli is included and build/installed by default. This can be adjusted by an option:

BUILD_CLI:ON

There is also a separate netconf-cli project that you may want to give a try if you need an advanced and more user-friendly command-line NETCONF client.

Tests

There are several tests included and built with cmocka. The tests can be found in tests subdirectory and they are designed for checking library functionality after code changes.

The tests are by default built in the Debug build mode by running

$ make

In case of the Release mode, the tests are not built by default (it requires additional dependency), but they can be enabled via cmake option:

$ cmake -DENABLE_TESTS=ON ..

Note that if the necessary cmocka headers are not present in the system include paths, tests are not available despite the build mode or cmake's options.

Tests can be run by the make's test target:

$ make test

Code Coverage

Based on the tests run, it is possible to generate code coverage report. But it must be enabled and these commands are needed to generate the report:

$ cmake -DENABLE_COVERAGE=ON ..
$ make
$ make coverage

netopeer2's People

Contributors

apropp-molex avatar bbergquist0930 avatar brchiu avatar ddanio avatar gwendlan avatar hthiery avatar jeremie6wind avatar jkmuller avatar jktjkt avatar jruzicka-nic avatar lepici avatar michalvasko avatar neheb avatar qupfer avatar rjarry avatar rkrejci avatar rschwebel avatar skolbel avatar sriramkandukuri avatar synther avatar syyyr avatar troglobit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

netopeer2's Issues

netopeer2-server crashes when re-connecting from NETCONF client to my embedded system

Hi
I have noticed a problem when I try to re-connect my NETCONF manager (NETCONFc) to the netopeer2-server running on my embedded platform.
Upon reconnection the netopeer2-server dies with the following messages

[2016/04/05 03:51:07.098245, 3] ssh_packet_socket_callback:  packet: read type 94 [len=172,padding=18,comp=153,payload=153]
[2016/04/05 03:51:07.098548, 3] ssh_packet_process:  Dispatching handler for packet type 94
[2016/04/05 03:51:07.098732, 3] channel_rcv_data:  Channel receiving 144 bytes data in 0 (local win=1280000 remote win=2094620)
[2016/04/05 03:51:07.098897, 3] channel_default_bufferize:  placing 144 bytes into channel buffer (stderr=0)
[2016/04/05 03:51:07.099061, 3] channel_rcv_data:  Channel windows are now (local win=1279856 remote win=2094620)
[2016/04/05 03:51:07.099284, 3] ssh_channel_read_timeout:  Read (1) buffered : 144 bytes. Window: 1279856
[2016/04/05 03:51:07.099462, 3] ssh_channel_read_timeout:  Read (1) buffered : 143 bytes. Window: 1279856
[2016/04/05 03:51:07.099634, 3] ssh_channel_read_timeout:  Read (1) buffered : 142 bytes. Window: 1279856
[2016/04/05 03:51:07.099802, 3] ssh_channel_read_timeout:  Read (1) buffered : 141 bytes. Window: 1279856
[2016/04/05 03:51:07.099968, 3] ssh_channel_read_timeout:  Read (1) buffered : 140 bytes. Window: 1279856
[2016/04/05 03:51:07.100132, 3] ssh_channel_read_timeout:  Read (1) buffered : 139 bytes. Window: 1279856
[2016/04/05 03:51:07.100320, 3] ssh_channel_read_timeout:  Read (134) buffered : 138 bytes. Window: 1279856
[2016/04/05 03:51:07.100500, 3] ssh_channel_read_timeout:  Read (1) buffered : 4 bytes. Window: 1279856
[2016/04/05 03:51:07.100669, 3] ssh_channel_read_timeout:  Read (1) buffered : 3 bytes. Window: 1279856
[2016/04/05 03:51:07.100840, 3] ssh_channel_read_timeout:  Read (1) buffered : 2 bytes. Window: 1279856
[2016/04/05 03:51:07.101010, 3] ssh_channel_read_timeout:  Read (1) buffered : 1 bytes. Window: 1279856
netopeer2-server[5720]: Session 1: received message:
<?xml version='1.0' encoding='UTF-8'?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="0">
  <close-session/>
</rpc>

netopeer2-server[5720]: (cl_request_process:401) Sending rpc request.
netopeer2-server[5720]: (cl_request_process:423) rpc request sent, waiting for response.
netopeer2-server[5720]: (cl_request_process:445) rpc response received, processing.
netopeer2-server[5720]: (cl_request_process:468) Error by processing of the rpc request (session id=1523597785): The item expected to exist is missing.
netopeer2-server[5720]: (sr_rpc_send:2004) Error by processing of the request.

What can be this crash related to?
Thanks in advance
fabio

libyang fails to load yang module

I loaded the yang model into the /etc/sysrepo/yang directory:
and try to install it:

sysrepoctl --install --yang=/etc/sysrepo/yang/ietf-netconf-server.yang --owner=root:root --permissions=666
Installing a new module from file '/etc/sysrepo/yang/ietf-netconf-server.yang' ...
Error: Unable to load the module by libyang.
Install operation cancelled.

Netopeer2 connecting with remote netopeer2-cli but connection is inconsistent

connect to remote server first time

[root@MaestrOS build]# ./netopeer2-cli
> connect --host 10.1.17.37 --port 6001 --login security
Interactive SSH Authentication
Type your password:
Password:
nc ERROR: Session 2: SSH channel unexpected EOF.
nc ERROR: Session 2: failed to receive a reply to <get-schema>.
ly ERROR: User module retrieval callback failed!
nc ERROR: Session 2: invalid session to send RPCs.
nc ERROR: Session 2: failed to send the <get-schema> RPC.
nc ERROR: Session 2: invalid session to send RPCs.
nc ERROR: Session 2: failed to send the <get-schema> RPC.
ly ERROR: User module retrieval callback failed!
ly ERROR: Invalid value "ietf-netconf-acm" of "import".
ly ERROR: Importing "ietf-netconf-acm" module into "ietf-netconf" failed.
ly ERROR: Module "ietf-netconf" parsing failed.
nc ERROR: Loading base NETCONF schema failed.
cmd_connect: Connecting to the 10.1.17.37:6001 as user "security" failed.
> quit

stop the netopeer server and restarts it

root@blr-sol-xn-cg ~]# /usr/sbin/netopeer2-server
[root@blr-sol-xn-cg ~]#
[root@blr-sol-xn-cg ~]#
[root@blr-sol-xn-cg ~]# netstat -plant | grep 6001
tcp        0      0 0.0.0.0:6001            0.0.0.0:*               LISTEN      2339/netopeer2-serv

on Remote Client the cli get stucked

[root@MaestrOS build]# ./netopeer2-cli
> connect --host 10.1.17.37 --port 6001 --login security
nc ERROR: Unable to connect to 10.1.17.37:6001.
cmd_connect: Connecting to the 10.1.17.37:6001 as user "security" failed.
> quit
[root@MaestrOS build]#
[root@MaestrOS build]#
[root@MaestrOS build]#
[root@MaestrOS build]#
[root@MaestrOS build]#
[root@MaestrOS build]#
[root@MaestrOS build]#
[root@MaestrOS build]#
[root@MaestrOS build]# ./netopeer2-cli
> connect --host 10.1.17.37 --port 6001 --login security
Interactive SSH Authentication
Type your password:
Password:

Possible DOS: Netopeer2 crashes by incorrect chunking

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff4f0e700 (LWP 7472)]
0x00007ffff791eadd in lyxml_parse_mem (ctx=0x6281a0, data=0x0, options=0) at /home/rasto/libraries/libyang/src/xml.c:1137
1137        while (*c) {
(gdb) bt
#0  0x00007ffff791eadd in lyxml_parse_mem (ctx=0x6281a0, data=0x0, options=0) at /home/rasto/libraries/libyang/src/xml.c:1137
#1  0x00007ffff76d9cfd in nc_read_msg (session=0x6ad750, data=0x7ffff4f0de30) at /home/rasto/libraries/libnetconf2/src/io.c:334
#2  0x00007ffff76e9c45 in nc_recv_rpc (session=0x6ad750, rpc=0x7ffff4f0de88) at /home/rasto/libraries/libnetconf2/src/session_server.c:815
#3  0x00007ffff76ea66d in nc_ps_poll (ps=0x6acdc0, timeout=500, session=0x7ffff4f0dec8) at /home/rasto/libraries/libnetconf2/src/session_server.c:1080
#4  0x000000000040537b in process_loop (arg=0x0) at /home/rasto/libraries/Netopeer2/server/main.c:422
#5  0x00007ffff7bc4184 in start_thread (arg=0x7ffff4f0e700) at pthread_create.c:312
#6  0x00007ffff718137d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

Steps to reproduce: do not insert line feed before the hash character (#) of a new chunk, e.g. after following rpc-reply:

#170
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <get-config>
        <source>
            <running/>
        </source>
    </get-config>
</rpc>
##

#149
<rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"></data></rpc-reply>
##
#170              <----- LF missing before #
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <get-config>
        <source>
            <running/>
        </source>
    </get-config>
</rpc>
##

Edit-config for augment

having this augment to ietf-interfaces

module def-interfaces {
  namespace "xmlns=http://www.advaoptical.com/ns/def-interfaces";
  prefix def;

  import ietf-interfaces {
    prefix if;
  }

  augment "/if:interfaces/if:interface" {
    container interface-config {
      leaf owner-tag {
        type string;
      }
    }
  }
}

after sending the following edit-config

<rpc message-id="101"
  xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
    <target>
      <running/>
    </target>
    <config>
    <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces" nc:operation="merge">
          <interface nc:operation="merge">
            <name>ip-4</name>
            <description>descr_ip-1</description>
            <type>ethernetCsmacd</type>
            <interface-config xmlns="http://www.advaoptical.com/ns/def-interfaces">
             <owner-tag>my interface</owner-tag>
           </interface-config>
          </interface>
        </interfaces>
    </config>
  </edit-config>
</rpc>

owner-tag leaf is not created. Netopeer sets only the following paths

[INF] (rp_dt_set_item_wrapper:559) Set item request running datastore, xpath: /ietf-interfaces:interfaces/interface[name='ip-4']
[INF] (rp_dt_set_item_wrapper:559) Set item request running datastore, xpath: /ietf-interfaces:interfaces/interface[name='ip-4']/description
[INF] (rp_dt_set_item_wrapper:559) Set item request running datastore, xpath: /ietf-interfaces:interfaces/interface[name='ip-4']/type

Get-config request +response with missing leaf

<?xml version="1.0" encoding="UTF-8"?>
 <rpc message-id="38" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
   <get-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <source>
       <running/>
     </source>
     <filter>
      <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
      <interface>
        <name>ip-4</name>
      </interface>
       </interfaces>
     </filter>
   </get-config>
 </rpc>
#329
<rpc-reply message-id="38" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"><interface><name>ip-4</name><description>descr_ip-1</description><type>ethernetCsmacd</type></interface></interfaces></data></rpc-reply>
##

SSH_SERVER_KNOWN_CHANGED

Please ,

Can you explain me why the message SSH_SERVER_KNOWN_CHANGED arise and cause the ERROR below?

In Attach it is possible to examine the log of comnands:

. verb 3

. connect localhost --port 6002 --ssh --login smo

of Netopeer2 Client .

ThankS in advance

Giuseppe Di Ciaula

Netopeer2Client.Out.txt

Inconsistence in error retrieval for sr_commit

This is really just a minor issue:

op_editconfig retrieves error(s) after a failed sr_commit from the sysrepo session context using sr_get_last_errors:

    case SR_ERR_VALIDATION_FAILED:
        sr_get_last_errors(sessions->srs, &err_info, &err_count);
        for (i = 0; i < err_count; ++i) {
            e = nc_err(NC_ERR_OP_FAILED, NC_ERR_TYPE_PROT);
            nc_err_set_msg(e, err_info[i].message, "en");
            nc_err_set_path(e, err_info[i].xpath);
            if (ereply) {
                nc_server_reply_add_err(ereply, e);
            } else {
                ereply = nc_server_reply_err(e);
            }
            e = NULL;
        }
        goto errorreply;

Whereas op_commit takes the last error from sysrepo logs:

    if (rc != SR_ERR_OK) {
        /* fill the error */
        e = nc_err(NC_ERR_OP_FAILED, NC_ERR_TYPE_APP);
        nc_err_set_msg(e, np2log_lasterr(), "en");
        return nc_server_reply_err(e);
    }

The first approach is better for two reasons:

  • there could be more than one error message
  • the last error message that is printed in sr_commit is actually the number of errors that have occurred:
     if (SR_ERR_OPERATION_FAILED == rc) {
         SR_LOG_ERR("Commit operation failed with %zu error(s).", commit_resp->n_errors);

         /* store commit errors within the session */
         if (commit_resp->n_errors > 0) {
             cl_session_set_errors(session, commit_resp->errors, commit_resp->n_errors);
         }
     }

which results in non-descriptive error message returned from the Netopeer2:

> commit
ERROR
        type:     application
        tag:      operation-failed
        severity: error
        message:  (sr_commit:1897) Commit operation failed with 1 error(s).

While that last error message could be removed, we would prefer if sr_get_last_errors was used instead.

can not delete the whole node of leaflist

Sorry to bother you๏ผŒbut I have a problem when I want to delete the whole leaflist.
model is as follows:

module Sub{
    namespace "urn:ietf:params:xml:ns:yang:sub";
    prefix Sub;
    revision 2016-05-10;

    container RootContainer{

        container secondLevelContainer{
            leaf secondleaf{
                type int8;
            }

            leaf secondleaf2{
                type int8;
                default 2;
            }

            leaf-list leaflist{
                type string;
            }
        }
    }
}

first, I add data for sub model using netopeer2-client๏ผš

<RootContainer xmlns="urn:ietf:params:xml:ns:yang:sub" xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
    <secondLevelContainer>
        <leaflist>a</leaflist>
        <leaflist>b</leaflist>
    </secondLevelContainer>
</RootContainer>

then๏ผŒI delete the whole leaflist with xml file as follows,but netopeer2-client throw an error:

<RootContainer xmlns="urn:ietf:params:xml:ns:yang:sub" xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
    <secondLevelContainer>
       <leaflist xc:operation="delete"></leaflist>
    </secondLevelContainer>
</RootContainer>

netopeer2-client show the infomation is:

ERROR
type: application
tag: data-missing
severity: error
path: /Sub:RootContainer/secondLevelContainer/leaflist[.='']
message: Request could not be completed because the relevant data model content does not exist.

my problem is the protocol of netconf is not exactly to describe "delete operation" of leaflist. Is this normal or a bug? Look forward to your reply to solve my confusion. Thank you very much.

Help to setup netopeer2

Hi
I'm trying to setup a working netopeer2/sysrepo environment to be used as a testbed for my current NETCONF development.
I have successfully run sysrepod:

sysrepod -d -l4

.......
.......

Then I have run an example application provided by the sysrepo package

sudo ./build/examples/application_example

========== READING STARTUP CONFIG: ==========

/ietf-interfaces:interfaces/interface[name='eth0'](list instance)
/ietf-interfaces:interfaces/interface[name='eth0']/name = eth0
/ietf-interfaces:interfaces/interface[name='eth0']/description = Ethernet 0
/ietf-interfaces:interfaces/interface[name='eth0']/type = ethernetCsmacd
/ietf-interfaces:interfaces/interface[name='eth0']/enabled = true
/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4 (container)
/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/enabled = true
/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/mtu = 1500
/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/address[ip='192.168.2.100'](list instance)
/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/address[ip='192.168.2.100']/ip = 192.168.2.100
/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/address[ip='192.168.2.100']/prefix-length = 24
/ietf-interfaces:interfaces/interface[name='eth0']/ietf-ip:ipv4/forwarding = false
/ietf-interfaces:interfaces/interface[name='eth1'](list instance)
/ietf-interfaces:interfaces/interface[name='eth1']/name = eth1
/ietf-interfaces:interfaces/interface[name='eth1']/description = Ethernet 1
/ietf-interfaces:interfaces/interface[name='eth1']/type = ethernetCsmacd
/ietf-interfaces:interfaces/interface[name='eth1']/enabled = true
/ietf-interfaces:interfaces/interface[name='eth1']/ietf-ip:ipv4 (container)
/ietf-interfaces:interfaces/interface[name='eth1']/ietf-ip:ipv4/enabled = true
/ietf-interfaces:interfaces/interface[name='eth1']/ietf-ip:ipv4/mtu = 1500
/ietf-interfaces:interfaces/interface[name='eth1']/ietf-ip:ipv4/address[ip='10.10.1.6'](list instance)
/ietf-interfaces:interfaces/interface[name='eth1']/ietf-ip:ipv4/address[ip='10.10.1.6']/ip = 10.10.1.6
/ietf-interfaces:interfaces/interface[name='eth1']/ietf-ip:ipv4/address[ip='10.10.1.6']/prefix-length = 16
/ietf-interfaces:interfaces/interface[name='eth1']/ietf-ip:ipv4/forwarding = false

My feeling is that the application has succesfully subscribed to sysrepo daemon and that the startup configuration has been shown. The configuration seems to be meaningful.

Now I want to change the MTU for eth0. I have used a javascript script provided by the package testconf

var netconf_client = require('../../../netconf_client')
var util = require('util');

var xml = "<edit-config xmlns:nc='urn:ietf:params:xml:ns:netconf:base:1.0'>" +
        "<target><running/></target>" +
        "<config>" +
            "<interfaces xmlns='urn:ietf:params:xml:ns:yang:ietf-ip'>" +
                "<interface>" +
                    "<name>eth0</name>" +
                        "<ipv4>" +
                            "<mtu>1300</mtu>" +
                        "</ipv4>" +
                "</interface>" +
            "</interfaces>" +
        "</config>" +
    "</edit-config>"

netconf_client.create().then(function(client)
{

    client.send(xml).thenDefault(function(reply)
    {
        console.log(reply)
        console.log(util.inspect(reply, {showHidden: false, depth: null}));
        client.send_close().thenDefault()
    })
}) 

When I run the js script (# nodejs set_mtu.js) netopeer2 complains that the "interfaces" element is unknown, see below, but it should have been registered by the application_example executable in my opinion.

netopeer2-server[15728]: Session 2: received message:
<?xml version="1.0" encoding="UTF-8"?><hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><capabilities><capability>urn:ietf:params:netconf:base:1.0</capability><capability>urn:ietf:params:netconf:base:1.1</capability><capability>urn:ietf:params:netconf:capability:writable-running:1.0</capability><capability>urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring?module=ietf-netconf-monitoring&amp;revision=2010-10-04</capability></capabilities></hello>
netopeer2-server[15728]: DICT: inserting "hello" with collision
netopeer2-server[15728]: DICT: inserting (refcount) "urn:ietf:params:xml:ns:netconf:base:1.0"
netopeer2-server[15728]: DICT: inserting (refcount) "capabilities"
netopeer2-server[15728]: DICT: inserting (refcount) "capability"
netopeer2-server[15728]: DICT: inserting "urn:ietf:params:netconf:base:1.0" with collision
netopeer2-server[15728]: DICT: inserting (refcount) "capability"
netopeer2-server[15728]: DICT: inserting "urn:ietf:params:netconf:base:1.1"
netopeer2-server[15728]: DICT: inserting (refcount) "capability"
netopeer2-server[15728]: DICT: inserting "urn:ietf:params:netconf:capability:writable-running:1.0"
netopeer2-server[15728]: DICT: inserting (refcount) "capability"
netopeer2-server[15728]: DICT: inserting "urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring?module=ietf-netconf-monitoring&revision=2010-10-04" with collision
netopeer2-server[15728]: DICT: inserting (refcount) ""
netopeer2-server[15728]: DICT: inserting (refcount) ""
netopeer2-server[15728]: (cl_request_process:401) Sending session-start request.
netopeer2-server[15728]: (cl_request_process:423) session-start request sent, waiting for response.
netopeer2-server[15728]: (cl_request_process:445) session-start response received, processing.
netopeer2-server[15728]: Session 2: received message:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"><edit-config xmlns:nc='urn:ietf:params:xml:ns:netconf:base:1.0'><target><running/></target><config><interfaces xmlns='urn:ietf:params:xml:ns:yang:ietf-ip'><interface><name>eth0</name><ipv4><mtu>1300</mtu></ipv4></interface></interfaces></config></edit-config></rpc>
netopeer2-server[15728]: DICT: inserting "rpc" with collision
netopeer2-server[15728]: DICT: inserting (refcount) "urn:ietf:params:xml:ns:netconf:base:1.0"
netopeer2-server[15728]: DICT: inserting "message-id" with collision
netopeer2-server[15728]: DICT: inserting (refcount) "1"
netopeer2-server[15728]: DICT: inserting (refcount) "edit-config"
netopeer2-server[15728]: DICT: inserting (refcount) "nc"
netopeer2-server[15728]: DICT: inserting (refcount) "urn:ietf:params:xml:ns:netconf:base:1.0"
netopeer2-server[15728]: DICT: inserting (refcount) "target"
netopeer2-server[15728]: DICT: inserting (refcount) "running"
netopeer2-server[15728]: DICT: inserting (refcount) ""
netopeer2-server[15728]: DICT: inserting (refcount) ""
netopeer2-server[15728]: DICT: inserting (refcount) "config"
netopeer2-server[15728]: DICT: inserting (refcount) "interfaces"
netopeer2-server[15728]: DICT: inserting (refcount) "urn:ietf:params:xml:ns:yang:ietf-ip"
netopeer2-server[15728]: DICT: inserting (refcount) "interface"
netopeer2-server[15728]: DICT: inserting (refcount) "name"
netopeer2-server[15728]: DICT: inserting "eth0" with collision
netopeer2-server[15728]: DICT: inserting (refcount) "ipv4"
netopeer2-server[15728]: DICT: inserting (refcount) "mtu"
netopeer2-server[15728]: DICT: inserting "1300" with collision
netopeer2-server[15728]: DICT: inserting (refcount) ""
netopeer2-server[15728]: DICT: inserting (refcount) ""
netopeer2-server[15728]: DICT: inserting (refcount) ""
netopeer2-server[15728]: DICT: inserting (refcount) ""
netopeer2-server[15728]: DICT: inserting (refcount) ""
netopeer2-server[15728]: DICT: inserting (refcount) ""
netopeer2-server[15728]: XPATH: expression "ietf-netconf:target":
netopeer2-server[15728]: XPATH:    Token NameTest, in expression "ietf-netconf:target"
netopeer2-server[15728]: DICT: inserting (refcount) "target"
netopeer2-server[15728]: XPATH: eval_node_test              parsed NameTest[0]
netopeer2-server[15728]: XPATH: expression "ietf-netconf:default-operation":
netopeer2-server[15728]: XPATH:    Token NameTest, in expression "ietf-netconf:default-operation"
netopeer2-server[15728]: DICT: inserting (refcount) "default-operation"
netopeer2-server[15728]: XPATH: eval_node_test              parsed NameTest[0]
netopeer2-server[15728]: DICT: inserting (refcount) "merge"
netopeer2-server[15728]: XPATH: expression "ietf-netconf:test-option":
netopeer2-server[15728]: XPATH:    Token NameTest, in expression "ietf-netconf:test-option"
netopeer2-server[15728]: DICT: inserting (refcount) "test-option"
netopeer2-server[15728]: XPATH: eval_node_test              parsed NameTest[0]
netopeer2-server[15728]: DICT: inserting (refcount) "test-then-set"
netopeer2-server[15728]: XPATH: expression "ietf-netconf:error-option":
netopeer2-server[15728]: XPATH:    Token NameTest, in expression "ietf-netconf:error-option"
netopeer2-server[15728]: DICT: inserting (refcount) "error-option"
netopeer2-server[15728]: XPATH: eval_node_test              parsed NameTest[0]
netopeer2-server[15728]: DICT: inserting (refcount) "stop-on-error"
netopeer2-server[15728]: XPATH: expression "/ietf-netconf:edit-config/target/*":
netopeer2-server[15728]: XPATH:    Token Operator(Path), in expression "/"
netopeer2-server[15728]: XPATH:    Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[15728]: XPATH:    Token Operator(Path), in expression "/"
netopeer2-server[15728]: XPATH:    Token NameTest, in expression "target"
netopeer2-server[15728]: XPATH:    Token Operator(Path), in expression "/"
netopeer2-server[15728]: XPATH:    Token NameTest, in expression "*"
netopeer2-server[15728]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[15728]: DICT: inserting (refcount) "edit-config"
netopeer2-server[15728]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[15728]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[15728]: DICT: inserting (refcount) "target"
netopeer2-server[15728]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[15728]: XPATH: eval_relative_location_path parsed Operator(Path)[32]
netopeer2-server[15728]: DICT: inserting (refcount) "*"
netopeer2-server[15728]: XPATH: eval_node_test              parsed NameTest[33]
netopeer2-server[15728]: XPATH: expression "/ietf-netconf:edit-config/default-operation":
netopeer2-server[15728]: XPATH:    Token Operator(Path), in expression "/"
netopeer2-server[15728]: XPATH:    Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[15728]: XPATH:    Token Operator(Path), in expression "/"
netopeer2-server[15728]: XPATH:    Token NameTest, in expression "default-operation"
netopeer2-server[15728]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[15728]: DICT: inserting (refcount) "edit-config"
netopeer2-server[15728]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[15728]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[15728]: DICT: inserting (refcount) "default-operation"
netopeer2-server[15728]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[15728]: XPATH: expression "/ietf-netconf:edit-config/test-option":
netopeer2-server[15728]: XPATH:    Token Operator(Path), in expression "/"
netopeer2-server[15728]: XPATH:    Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[15728]: XPATH:    Token Operator(Path), in expression "/"
netopeer2-server[15728]: XPATH:    Token NameTest, in expression "test-option"
netopeer2-server[15728]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[15728]: DICT: inserting (refcount) "edit-config"
netopeer2-server[15728]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[15728]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[15728]: DICT: inserting (refcount) "test-option"
netopeer2-server[15728]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[15728]: XPATH: expression "/ietf-netconf:edit-config/error-option":
netopeer2-server[15728]: XPATH:    Token Operator(Path), in expression "/"
netopeer2-server[15728]: XPATH:    Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[15728]: XPATH:    Token Operator(Path), in expression "/"
netopeer2-server[15728]: XPATH:    Token NameTest, in expression "error-option"
netopeer2-server[15728]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[15728]: DICT: inserting (refcount) "edit-config"
netopeer2-server[15728]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[15728]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[15728]: DICT: inserting (refcount) "error-option"
netopeer2-server[15728]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[15728]: XPATH: expression "/ietf-netconf:edit-config/config":
netopeer2-server[15728]: XPATH:    Token Operator(Path), in expression "/"
netopeer2-server[15728]: XPATH:    Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[15728]: XPATH:    Token Operator(Path), in expression "/"
netopeer2-server[15728]: XPATH:    Token NameTest, in expression "config"
netopeer2-server[15728]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[15728]: DICT: inserting (refcount) "edit-config"
netopeer2-server[15728]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[15728]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[15728]: DICT: inserting (refcount) "config"
netopeer2-server[15728]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[15728]: Unknown element "interfaces". (/)
netopeer2-server[15728]: DICT: inserting "Request could not be completed because the requested_ operation is not supported by this implementation." with collision
netopeer2-server[15728]: DICT: inserting "en" with collision
netopeer2-server[15728]: Session 2: received message:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2"><close-session /></rpc>
netopeer2-server[15728]: DICT: inserting "rpc" with collision
netopeer2-server[15728]: DICT: inserting (refcount) "urn:ietf:params:xml:ns:netconf:base:1.0"
netopeer2-server[15728]: DICT: inserting "message-id" with collision
netopeer2-server[15728]: DICT: inserting "2"
netopeer2-server[15728]: DICT: inserting (refcount) "close-session"
netopeer2-server[15728]: DICT: inserting (refcount) ""
netopeer2-server[15728]: DICT: inserting (refcount) ""
netopeer2-server[15728]: (cl_request_process:401) Sending session-stop request.
netopeer2-server[15728]: (cl_request_process:423) session-stop request sent, waiting for response.
netopeer2-server[15728]: (cl_request_process:445) session-stop response received, processing. 

I can suppose that something is wrong in my javascript query, but what?
Any help will be appreciated.
Kind regards

fabio

server installation fails: Input data are not valid: Leafref "/ietf-system-keychain:keychain/ietf-system-keychain:private-keys/ietf-system-keychain:private-key/ietf-system-keychain:name" of value "ssh_host_rsa_key" points to a non-existing leaf. (/ietf-netconf-server:netconf-server/listen/endpoint[name='main_ssh']/ssh/host-keys/host-key[name='host_key']/public-key)

[root@f25 build-server]# PKG_CONFIG_PATH=/usr/lib/pkgconfig cmake -DCMAKE_BUILD_TYPE=Debug -GNinja -DCMAKE_INSTALL_PREFIX=/usr ../server && ninja-build && ninja-build install 
-- The C compiler identification is GNU 6.2.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
Package authd was not found in the pkg-config search path.
Perhaps you should add the directory containing `authd.pc'
to the PKG_CONFIG_PATH environment variable
No package 'authd' found
-- Failed to learn authd keys directory, set AUTHD_KEYS_DIR manually or server configuration will not work.
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE  
-- Looking for NC_ENABLED_SSH
-- Looking for NC_ENABLED_SSH - found
-- Looking for NC_ENABLED_TLS
-- Looking for NC_ENABLED_TLS - found
-- Found sysrepo: /usr/lib/libsysrepo.so  
-- Configuring done
-- Generating done
-- Build files have been written to: /root/netopeer2/build-server
[13/14] Building C object CMakeFiles/netopeer2-server.dir/main.c.o
/root/netopeer2/server/main.c: In function โ€˜np2srv_init_schemasโ€™:
/root/netopeer2/server/main.c:327:62: warning: passing argument 2 of โ€˜sr_module_install_subscribeโ€™ from incompatible pointer type [-Wincompatible-pointer-types]
         rc = sr_module_install_subscribe(np2srv.sr_sess.srs, np2srv_module_install_clb, NULL, 0, &np2srv.sr_subscr);
                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /root/netopeer2/server/main.c:32:0:
/usr/include/sysrepo.h:1251:5: note: expected โ€˜sr_module_install_cb {aka void (*)(const char *, const char *, enum sr_module_state_e,  void *)}โ€™ but argument is of type โ€˜void (*)(const char *, const char *, _Bool,  void *)โ€™
 int sr_module_install_subscribe(sr_session_ctx_t *session, sr_module_install_cb callback, void *private_ctx,
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~
[14/14] Linking C executable netopeer2-server
[0/1] Install the project...
-- Install configuration: "Debug"
-- Installing: /usr/bin/netopeer2-server
-- Importing module ietf-netconf-server into sysrepo...
CMake Error at cmake_install.cmake:143 (message):
    Command sysrepocfg import failed:
    [ERR] (srcfg_import_datastore:676) Input data are not valid: Leafref "/ietf-system-keychain:keychain/ietf-system-keychain:private-keys/ietf-system-keychain:private-key/ietf-system-keychain:name" of value "ssh_host_rsa_key" points to a non-existing leaf. (/ietf-netconf-server:netconf-server/listen/endpoint[name='main_ssh']/ssh/host-keys/host-key[name='host_key']/public-key)
    Errors were encountered during importing. Cancelling the operation.
    


FAILED: CMakeFiles/install.util 
cd /root/netopeer2/build-server && /usr/bin/cmake -P cmake_install.cmake
ninja: build stopped: subcommand failed.

Failed to resolve identityref by edit-config

Edit-config sent to Netopeer:

#706
     <rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
       <edit-config>
         <target>
           <running/>
         </target>
         <config>
           <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
             <interface>
               <name>GigabitEthernet0/9/0</name>
               <type>ethernetCsmacd</type>
               <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
                 <address>
                   <ip>172.16.0.9</ip>
                   <prefix-length>24</prefix-length>
                 </address>
               </ipv4>
             </interface>
           </interfaces>
         </config>
       </edit-config>
     </rpc>
##

Received an error:

#316
<rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><rpc-error><error-type>application</error-type><error-tag>operation-failed</error-tag><error-severity>error</error-severity><error-message xml:lang="en">Failed to resolve identityref "ethernetCsmacd".</error-message></rpc-error></rpc-reply>
##

Logs:

[2016/11/10 15:56:03.405591, 3] ssh_packet_process:  Dispatching handler for packet type 94
[2016/11/10 15:56:03.405597, 3] channel_rcv_data:  Channel receiving 3 bytes data in 0 (local win=1276731 remote win=2093437)
[2016/11/10 15:56:03.405600, 3] channel_default_bufferize:  placing 3 bytes into channel buffer (stderr=0)
[2016/11/10 15:56:03.405603, 3] channel_rcv_data:  Channel windows are now (local win=1276728 remote win=2093437)
[2016/11/10 15:56:03.405608, 3] ssh_channel_read_timeout:  Read (1) buffered : 2 bytes. Window: 1276728
[2016/11/10 15:56:03.405611, 3] ssh_channel_read_timeout:  Read (1) buffered : 1 bytes. Window: 1276728
netopeer2-server[3854]: Session 1: received message:
     <rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
       <edit-config>
         <target>
           <running/>
         </target>
         <config>
           <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
             <interface>
               <name>GigabitEthernet0/9/0</name>
               <type>ethernetCsmacd</type>
               <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
                 <address>
                   <ip>172.16.0.9</ip>
                   <prefix-length>24</prefix-length>
                 </address>
               </ipv4>
             </interface>
           </interfaces>
         </config>
       </edit-config>
     </rpc>
netopeer2-server[3854]: DICT: inserting "rpc" with collision 
netopeer2-server[3854]: DICT: inserting "message-id" with collision 
netopeer2-server[3854]: DICT: inserting "101" with collision 
netopeer2-server[3854]: DICT: inserting (refcount) "urn:ietf:params:xml:ns:netconf:base:1.0"
netopeer2-server[3854]: DICT: inserting (refcount) "edit-config"
netopeer2-server[3854]: DICT: inserting (refcount) "target"
netopeer2-server[3854]: DICT: inserting (refcount) "running"
netopeer2-server[3854]: DICT: inserting (refcount) ""
netopeer2-server[3854]: DICT: inserting (refcount) ""
netopeer2-server[3854]: DICT: inserting (refcount) "config"
netopeer2-server[3854]: DICT: inserting (refcount) "interfaces"
netopeer2-server[3854]: DICT: inserting (refcount) "urn:ietf:params:xml:ns:yang:ietf-interfaces"
netopeer2-server[3854]: DICT: inserting (refcount) "interface"
netopeer2-server[3854]: DICT: inserting (refcount) "name"
netopeer2-server[3854]: DICT: inserting "GigabitEthernet0/9/0" with collision 
netopeer2-server[3854]: DICT: inserting (refcount) "type"
netopeer2-server[3854]: DICT: inserting (refcount) "ethernetCsmacd"
netopeer2-server[3854]: DICT: inserting (refcount) "ipv4"
netopeer2-server[3854]: DICT: inserting "urn:ietf:params:xml:ns:yang:ietf-ip"
netopeer2-server[3854]: DICT: inserting (refcount) "address"
netopeer2-server[3854]: DICT: inserting "ip" with collision 
netopeer2-server[3854]: DICT: inserting "172.16.0.9" with collision 
netopeer2-server[3854]: DICT: inserting "prefix-length"
netopeer2-server[3854]: DICT: inserting "24"
netopeer2-server[3854]: DICT: inserting (refcount) ""
netopeer2-server[3854]: DICT: inserting (refcount) ""
netopeer2-server[3854]: DICT: inserting (refcount) ""
netopeer2-server[3854]: DICT: inserting (refcount) ""
netopeer2-server[3854]: DICT: inserting (refcount) ""
netopeer2-server[3854]: DICT: inserting (refcount) ""
netopeer2-server[3854]: DICT: inserting (refcount) ""
netopeer2-server[3854]: DICT: inserting (refcount) "merge"
netopeer2-server[3854]: DICT: inserting (refcount) "test-then-set"
netopeer2-server[3854]: DICT: inserting (refcount) "stop-on-error"
netopeer2-server[3854]: Resolving unresolved data nodes and their constraints...
netopeer2-server[3854]: All data nodes and constraints resolved.
netopeer2-server[3854]: XPATH: expression "/ietf-netconf:edit-config/target/*":
netopeer2-server[3854]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[3854]: XPATH:	Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[3854]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[3854]: XPATH:	Token NameTest, in expression "target"
netopeer2-server[3854]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[3854]: XPATH:	Token NameTest, in expression "*"
netopeer2-server[3854]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[3854]: DICT: inserting (refcount) "edit-config"
netopeer2-server[3854]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[3854]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[3854]: DICT: inserting (refcount) "target"
netopeer2-server[3854]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[3854]: XPATH: eval_relative_location_path parsed Operator(Path)[32]
netopeer2-server[3854]: DICT: inserting "*" with collision 
netopeer2-server[3854]: XPATH: eval_node_test              parsed NameTest[33]
netopeer2-server[3854]: XPATH: expression "/ietf-netconf:edit-config/default-operation":
netopeer2-server[3854]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[3854]: XPATH:	Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[3854]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[3854]: XPATH:	Token NameTest, in expression "default-operation"
netopeer2-server[3854]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[3854]: DICT: inserting (refcount) "edit-config"
netopeer2-server[3854]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[3854]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[3854]: DICT: inserting (refcount) "default-operation"
netopeer2-server[3854]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[3854]: XPATH: expression "/ietf-netconf:edit-config/test-option":
netopeer2-server[3854]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[3854]: XPATH:	Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[3854]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[3854]: XPATH:	Token NameTest, in expression "test-option"
netopeer2-server[3854]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[3854]: DICT: inserting (refcount) "edit-config"
netopeer2-server[3854]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[3854]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[3854]: DICT: inserting (refcount) "test-option"
netopeer2-server[3854]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[3854]: XPATH: expression "/ietf-netconf:edit-config/error-option":
netopeer2-server[3854]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[3854]: XPATH:	Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[3854]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[3854]: XPATH:	Token NameTest, in expression "error-option"
netopeer2-server[3854]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[3854]: DICT: inserting (refcount) "edit-config"
netopeer2-server[3854]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[3854]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[3854]: DICT: inserting (refcount) "error-option"
netopeer2-server[3854]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[3854]: XPATH: expression "/ietf-netconf:edit-config/config":
netopeer2-server[3854]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[3854]: XPATH:	Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[3854]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[3854]: XPATH:	Token NameTest, in expression "config"
netopeer2-server[3854]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[3854]: DICT: inserting (refcount) "edit-config"
netopeer2-server[3854]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[3854]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[3854]: DICT: inserting (refcount) "config"
netopeer2-server[3854]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[3854]: DICT: inserting (refcount) "ethernetCsmacd"
netopeer2-server[3854]: Failed to resolve identityref "ethernetCsmacd". (/ietf-interfaces:interfaces/interface[name='GigabitEthernet0/9/0']/type)
netopeer2-server[3854]: DICT: inserting "Request could not be completed because the requested operation failed for a non-specific reason."
netopeer2-server[3854]: DICT: inserting "en" with collision 
netopeer2-server[3854]: DICT: inserting "Failed to resolve identityref "ethernetCsmacd"." with collision 
netopeer2-server[3854]: DICT: inserting "en" with collision 
netopeer2-server[3854]: Session 1: sending message:

#316

[2016/11/10 15:56:03.407001, 3] ssh_socket_unbuffered_write:  Enabling POLLOUT for socket
[2016/11/10 15:56:03.407013, 3] packet_send2:  packet: wrote [len=28,padding=12,comp=15,payload=15]
[2016/11/10 15:56:03.407021, 3] channel_write_common:  channel_write wrote 6 bytes
netopeer2-server[3854]: Session 1: sending message:
<rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><rpc-error><error-type>application</error-type><error-tag>operation-failed</error-tag><error-severity>error</error-severity><error-message xml:lang="en">Failed to resolve identityref "ethernetCsmacd".</error-message></rpc-error></rpc-reply>
[2016/11/10 15:56:03.407045, 3] packet_send2:  packet: wrote [len=332,padding=6,comp=325,payload=325]
[2016/11/10 15:56:03.407053, 3] channel_write_common:  channel_write wrote 316 bytes
[2016/11/10 15:56:03.407081, 3] ssh_socket_unbuffered_write:  Enabling POLLOUT for socket
netopeer2-server[3854]: Session 1: sending message:

##

[2016/11/10 15:56:03.407109, 3] packet_send2:  packet: wrote [len=28,padding=14,comp=13,payload=13]
[2016/11/10 15:56:03.407117, 3] channel_write_common:  channel_write wrote 4 bytes
[2016/11/10 15:56:03.407130, 3] ssh_socket_unbuffered_write:  Enabling POLLOUT for socket

Unable to delete single leaf-list item

When I try to delete a specific leaf-list item

<main xmlns="urn:ietf:params:xml:ns:yang:test-module" xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
        <numbers xc:operation="delete">1</numbers>    
</main>

netopeer sends request to delete all instances
netopeer2-server[23203]: EDIT_CONFIG: leaflist /test-module:main/numbers, operation 4

not able to connect cli to server

Please let me know what I can do to fix this as I am not able to connect the netopeer2 cli to the netopper2 server. Any ideas on what I am doing wrong would be greatly appreciated.

I have sysrepo running with the following yang models:

root@MaestrOS yang]# sysrepoctl -l
Sysrepo schema directory: /etc/sysrepo/yang/
Sysrepo data directory:   /etc/sysrepo/data/
(Do not alter contents of these directories manually)
Module Name                   | Revision   | Data Owner          | Permissions | Submodules                    | Enabled Features
---------------------------------------------------------------------------------------------------------------------------------
ietf-inet-types               | 2013-07-15 |                     |             |                               |
ietf-yang-types               | 2013-07-15 |                     |             |                               |
ietf-netconf                  | 2011-06-01 |                     |             |                               |
ietf-interfaces               | 2014-05-08 | root:root           | 666         |                               |
ietf-ip                       | 2014-06-16 |                     |             |                               |
iana-if-type                  | 2014-05-08 |                     |             |                               |
turing-machine                | 2013-12-27 | root:root           | 666         |                               |
sysrepo-dnsmasq               | 2016-01-22 | root:root           | 666         |                               |
ietf-netconf-with-defaults    | 2011-06-01 |                     |             |                               |

I get this error on the cli console:

[joanl@rdu-vs-frye module]$ netopeer2-cli 
> connect --host 10.64.156.119 --port 6001 --login root
Interactive SSH Authentication
Type your password:
Password: 
nc ERROR: Session 2: reading a full NETCONF message timeout elapsed.
nc ERROR: Session 2: failed to receive a reply to <get-schema>.
ly ERROR: User module retrieval callback failed!
nc ERROR: Session 2: invalid session to send RPCs.
nc ERROR: Session 2: failed to send the <get-schema> RPC.
ly ERROR: User module retrieval callback failed!
nc ERROR: Session 2: invalid session to send RPCs.
nc ERROR: Session 2: failed to send the <get-schema> RPC.
ly ERROR: User module retrieval callback failed!
ly ERROR: Data model "sysrepo-dnsmasq" not found (search path is "/usr/local/share/libnetconf2")
nc ERROR: Session 2: invalid session to send RPCs.
nc ERROR: Session 2: failed to send the <get-schema> RPC.
ly ERROR: User module retrieval callback failed!
> 

and I see this on the server side:

etopeer2-server[335]: Session 2: received message:
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><capabilities><capability>urn:ietf:params:netconf:base:1.0</capability><capability>urn:ietf:params:netconf:base:1.1</capability></capabilities></hello>
netopeer2-server[335]: (cl_request_process:401) Sending session-start request.
netopeer2-server[335]: (cl_request_process:423) session-start request sent, waiting for response.
netopeer2-server[335]: (cl_request_process:445) session-start response received, processing.
netopeer2-server[335]: Session 2: received message:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1"><get-schema xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"><identifier>ietf-netconf</identifier><format>yin</format></get-schema></rpc>
netopeer2-server[335]: Session 2: received message:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2"><get-schema xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"><identifier>ietf-netconf-acm</identifier><format>yin</format></get-schema></rpc>
netopeer2-server[335]: Session 2: received message:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="3"><get-schema xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"><identifier>ietf-interfaces</identifier><version>2014-05-08</version><format>yin</format></get-schema></rpc>
netopeer2-server[335]: Session 2: received message:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="4"><get-schema xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"><identifier>ietf-ip</identifier><version>2014-06-16</version><format>yin</format></get-schema></rpc>
netopeer2-server[335]: Session 2: received message:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="5"><get-schema xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"><identifier>ietf-interfaces</identifier><format>yin</format></get-schema></rpc>
netopeer2-server[335]: Session 2: received message:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="6"><get-schema xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring"><identifier>iana-if-type</identifier><version>2014-05-08</version><format>yin</format></get-schema></rpc>

rpc uses grouping outside rpc node will report operation-not-supported error

Use test_err.yang, and test.xml will report error, while use test_ok.yang which grouping is in rpc node will success.

The reason is:
In function server_init in file main.c line 222:
LY_TREE_DFS_BEGIN(mod->data, next, snode) {
if (snode->nodetype & (LYS_RPC | LYS_ACTION)) {
lys_set_private(snode, op_generic);
}
LY_TREE_DFS_END(mod->data, next, snode);
}
Use LY_TREE_DFS_BEGIN macro, after deal the leaf fb, it can't get the next node which is rpc's child.

issue.txt

Error occurred when use get-config to get state data

If there ars some state yang model and data(config=false) in sysrepo,when using get --filter-xpath=/stateModel:stateModel in netopeer2-cli๏ผŒit get some correct data,but using get-config --source running,it response error msg back.
like this,dataAid is a leaf with config=false property.

get-config --source running
ly ERROR: Unknown element "dataAid". (/stateModel:stateModel/dataAid)
nc ERROR: Failed to parse reply.
cli_send_recv: Failed to receive a reply.

Netopeer crashes by get / get-config request

Netopeer crashes by get / get-config request. Logs + backtrace:

netopeer2-server[17615]: Session 1: received message:
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <get/>
</rpc>
netopeer2-server[17615]: DICT: inserting "rpc" with collision 
netopeer2-server[17615]: DICT: inserting "message-id" with collision 
netopeer2-server[17615]: DICT: inserting "101" with collision 
netopeer2-server[17615]: DICT: inserting (refcount) "urn:ietf:params:xml:ns:netconf:base:1.0"
netopeer2-server[17615]: DICT: inserting (refcount) "get"
netopeer2-server[17615]: DICT: inserting (refcount) ""
netopeer2-server[17615]: DICT: inserting (refcount) ""

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff4fce700 (LWP 17616)]
0x00007ffff7965fd5 in lys_parent (node=0x63f648) at /home/rasto/libraries/libyang/src/tree_schema.c:2854
2854        if (node->parent->nodetype == LYS_AUGMENT) {
(gdb) bt
#0  0x00007ffff7965fd5 in lys_parent (node=0x63f648) at /home/rasto/libraries/libyang/src/tree_schema.c:2854
#1  0x00007ffff795e986 in ly_check_mandatory (data=0x7fffec0017d0, schema=0x640920, status=1) at /home/rasto/libraries/libyang/src/tree_schema.c:594
#2  0x00007ffff7966350 in lyd_check_topmandatory (data=0x7fffec0017d0, ctx=0x6212c0, rpc=0x0, options=528) at /home/rasto/libraries/libyang/src/tree_data.c:88
#3  0x00007ffff79400f1 in lyd_parse_xml (ctx=0x6212c0, root=0x7fffec0008d8, options=528) at /home/rasto/libraries/libyang/src/parser_xml.c:562
#4  0x00007ffff76f27ae in nc_recv_rpc (session=0x670f90, rpc=0x7ffff4fcde88) at /home/rasto/libraries/libnetconf2/src/session_server.c:820
#5  0x00007ffff76f2fa5 in nc_ps_poll (ps=0x670600, timeout=500) at /home/rasto/libraries/libnetconf2/src/session_server.c:1039
#6  0x0000000000404211 in process_loop (arg=0x0) at /home/rasto/libraries/Netopeer2/server/main.c:382
#7  0x00007ffff7bc4182 in start_thread (arg=0x7ffff4fce700) at pthread_create.c:312
#8  0x00007ffff71c847d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

List of modules installed in sysrepo (minimal set required by Netopeer + turing-machine):

Module Name                   | Revision   | Data Owner          | Permissions | Submodules                    | Enabled Features
---------------------------------------------------------------------------------------------------------------------------------
turing-machine                | 2013-12-27 | root:root           | 644         |                               |
ietf-netconf-monitoring       | 2010-10-04 | root:root           | 644         |                               |
ietf-netconf-acm              | 2012-02-22 |                     |             |                               |
ietf-netconf                  | 2011-06-01 | root:root           | 644         |                               |
ietf-netconf-with-defaults    | 2011-06-01 | root:root           | 644         |                               |

Incorrect handling of the replace op. in edit-config request

Request to replace GigabitEthernet0/8/0 config (that already exists in the datastore) with new values:

#779
     <rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
       <edit-config>
         <target>
           <running/>
         </target>
         <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
           <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
             <interface xc:operation="replace">
               <name>GigabitEthernet0/8/0</name>
               <type>ethernetCsmacd</type>
               <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
                 <address>
                   <ip>192.0.2.4</ip>
                   <prefix-length>24</prefix-length>
                 </address>
               </ipv4>
             </interface>
           </interfaces>
         </config>
       </edit-config>
     </rpc>
##

#93
<rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><ok/></rpc-reply>
##

The only edit-like operation that comes to sysrepo is this one set-item:

[INF] (rp_dt_set_item_wrapper:559) Set item request running datastore, xpath: /ietf-interfaces:interfaces/interface[name='GigabitEthernet0/8/0']

And nothing actually changes in the datastore...

Full Netopeer2 logs:

[2016/11/02 15:09:26.164570, 3] ssh_packet_socket_callback:  packet: read type 94 [len=28,padding=15,comp=12,payload=12]
[2016/11/02 15:09:26.164579, 3] ssh_packet_process:  Dispatching handler for packet type 94
[2016/11/02 15:09:26.164585, 3] channel_rcv_data:  Channel receiving 3 bytes data in 0 (local win=1278787 remote win=2094207)
[2016/11/02 15:09:26.164592, 3] channel_default_bufferize:  placing 3 bytes into channel buffer (stderr=0)
[2016/11/02 15:09:26.164597, 3] channel_rcv_data:  Channel windows are now (local win=1278784 remote win=2094207)
[2016/11/02 15:09:26.164604, 3] ssh_channel_read_timeout:  Read (1) buffered : 2 bytes. Window: 1278784
[2016/11/02 15:09:26.164612, 3] ssh_channel_read_timeout:  Read (1) buffered : 1 bytes. Window: 1278784
netopeer2-server[25700]: Session 1: received message:
     <rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
       <edit-config>
         <target>
           <running/>
         </target>
         <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
           <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
             <interface xc:operation="replace">
               <name>GigabitEthernet0/8/0</name>
               <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
                 <address>
                   <ip>192.0.2.4</ip>
                   <prefix-length>24</prefix-length>
                 </address>
               </ipv4>
             </interface>
           </interfaces>
         </config>
       </edit-config>
     </rpc>
netopeer2-server[25700]: DICT: inserting "rpc" with collision 
netopeer2-server[25700]: DICT: inserting "message-id" with collision 
netopeer2-server[25700]: DICT: inserting "101" with collision 
netopeer2-server[25700]: DICT: inserting (refcount) "urn:ietf:params:xml:ns:netconf:base:1.0"
netopeer2-server[25700]: DICT: inserting (refcount) "edit-config"
netopeer2-server[25700]: DICT: inserting (refcount) "target"
netopeer2-server[25700]: DICT: inserting (refcount) "running"
netopeer2-server[25700]: DICT: inserting (refcount) ""
netopeer2-server[25700]: DICT: inserting (refcount) ""
netopeer2-server[25700]: DICT: inserting (refcount) "config"
netopeer2-server[25700]: DICT: inserting "xc" with collision 
netopeer2-server[25700]: DICT: inserting (refcount) "urn:ietf:params:xml:ns:netconf:base:1.0"
netopeer2-server[25700]: DICT: inserting (refcount) "interfaces"
netopeer2-server[25700]: DICT: inserting (refcount) "urn:ietf:params:xml:ns:yang:ietf-interfaces"
netopeer2-server[25700]: DICT: inserting (refcount) "interface"
netopeer2-server[25700]: DICT: inserting "operation" with collision 
netopeer2-server[25700]: DICT: inserting (refcount) "replace"
netopeer2-server[25700]: DICT: inserting (refcount) "name"
netopeer2-server[25700]: DICT: inserting "GigabitEthernet0/8/0" with collision 
netopeer2-server[25700]: DICT: inserting (refcount) "ipv4"
netopeer2-server[25700]: DICT: inserting (refcount) "urn:ietf:params:xml:ns:yang:ietf-ip"
netopeer2-server[25700]: DICT: inserting (refcount) "address"
netopeer2-server[25700]: DICT: inserting (refcount) "ip"
netopeer2-server[25700]: DICT: inserting "192.0.2.4" with collision 
netopeer2-server[25700]: DICT: inserting (refcount) "prefix-length"
netopeer2-server[25700]: DICT: inserting "24" with collision 
netopeer2-server[25700]: DICT: inserting (refcount) ""
netopeer2-server[25700]: DICT: inserting (refcount) ""
netopeer2-server[25700]: DICT: inserting (refcount) ""
netopeer2-server[25700]: DICT: inserting (refcount) ""
netopeer2-server[25700]: DICT: inserting (refcount) ""
netopeer2-server[25700]: DICT: inserting (refcount) ""
netopeer2-server[25700]: DICT: inserting (refcount) ""
netopeer2-server[25700]: DICT: inserting (refcount) "urn:ietf:params:xml:ns:netconf:base:1.0"
netopeer2-server[25700]: DICT: inserting (refcount) "xc"
netopeer2-server[25700]: DICT: inserting (refcount) "merge"
netopeer2-server[25700]: DICT: inserting (refcount) "test-then-set"
netopeer2-server[25700]: DICT: inserting (refcount) "stop-on-error"
netopeer2-server[25700]: Resolving unresolved data nodes and their constraints...
netopeer2-server[25700]: All data nodes and constraints resolved.
netopeer2-server[25700]: XPATH: expression "/ietf-netconf:edit-config/target/*":
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "target"
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "*"
netopeer2-server[25700]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[25700]: DICT: inserting (refcount) "edit-config"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[25700]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[25700]: DICT: inserting (refcount) "target"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[25700]: XPATH: eval_relative_location_path parsed Operator(Path)[32]
netopeer2-server[25700]: DICT: inserting "*" with collision 
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[33]
netopeer2-server[25700]: XPATH: expression "/ietf-netconf:edit-config/default-operation":
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "default-operation"
netopeer2-server[25700]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[25700]: DICT: inserting (refcount) "edit-config"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[25700]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[25700]: DICT: inserting (refcount) "default-operation"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[25700]: XPATH: expression "/ietf-netconf:edit-config/test-option":
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "test-option"
netopeer2-server[25700]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[25700]: DICT: inserting (refcount) "edit-config"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[25700]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[25700]: DICT: inserting (refcount) "test-option"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[25700]: XPATH: expression "/ietf-netconf:edit-config/error-option":
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "error-option"
netopeer2-server[25700]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[25700]: DICT: inserting (refcount) "edit-config"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[25700]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[25700]: DICT: inserting (refcount) "error-option"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[25700]: XPATH: expression "/ietf-netconf:edit-config/config":
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "config"
netopeer2-server[25700]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[25700]: DICT: inserting (refcount) "edit-config"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[25700]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[25700]: DICT: inserting (refcount) "config"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[25700]: EDIT_CONFIG: ds 30661888, defop 1, testopt 0, config:
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
  <interface nc:operation="replace">
    <name>GigabitEthernet0/8/0</name>
    <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
      <address>
        <ip>192.0.2.4</ip>
        <prefix-length>24</prefix-length>
      </address>
    </ipv4>
  </interface>
</interfaces>
netopeer2-server[25700]: (cl_request_process:416) Sending session-refresh request.
netopeer2-server[25700]: (cl_request_process:438) session-refresh request sent, waiting for response.
netopeer2-server[25700]: (cl_request_process:460) session-refresh response received, processing.
netopeer2-server[25700]: EDIT_CONFIG: list /ietf-interfaces:interfaces/interface[name='GigabitEthernet0/8/0'], operation 3
netopeer2-server[25700]: (cl_request_process:416) Sending set-item request.
netopeer2-server[25700]: (cl_request_process:438) set-item request sent, waiting for response.
netopeer2-server[25700]: (cl_request_process:460) set-item response received, processing.
netopeer2-server[25700]: EDIT_CONFIG: success (/ietf-interfaces:interfaces/interface[name='GigabitEthernet0/8/0']).
netopeer2-server[25700]: (cl_request_process:416) Sending commit request.
netopeer2-server[25700]: (cl_request_process:438) commit request sent, waiting for response.
netopeer2-server[25700]: (cl_request_process:460) commit response received, processing.
netopeer2-server[25700]: EDIT_CONFIG: done.
netopeer2-server[25700]: Session 1: sending message:

#93

[2016/11/02 15:09:26.204926, 3] ssh_socket_unbuffered_write:  Enabling POLLOUT for socket
[2016/11/02 15:09:26.204942, 3] packet_send2:  packet: wrote [len=28,padding=13,comp=14,payload=14]
[2016/11/02 15:09:26.204950, 3] channel_write_common:  channel_write wrote 5 bytes
netopeer2-server[25700]: Session 1: sending message:
<rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><ok/></rpc-reply>
[2016/11/02 15:09:26.204976, 3] packet_send2:  packet: wrote [len=108,padding=5,comp=102,payload=102]
[2016/11/02 15:09:26.205001, 3] channel_write_common:  channel_write wrote 93 bytes
[2016/11/02 15:09:26.205049, 3] ssh_socket_unbuffered_write:  Enabling POLLOUT for socket
netopeer2-server[25700]: Session 1: sending message:

##

[2016/11/02 15:09:26.205097, 3] packet_send2:  packet: wrote [len=28,padding=14,comp=13,payload=13]
[2016/11/02 15:09:26.205149, 3] channel_write_common:  channel_write wrote 4 bytes
[2016/11/02 15:09:26.205203, 3] ssh_socket_unbuffered_write:  Enabling POLLOUT for socket

Dummy auth backend for prototyping (privilege separation)

I'm prototyping an application which uses sysrepo, and using netopeer2-server as a NETCONF interface along with its client for actual modifications sounds like an obvious choice. However, the server cannot be used in an privilege-separated environment without affecting the rest of the system.

  • The systemwide SSH host key is being read. That might be convenient, but SSH handles spearate host keys just fine. This can be easily hacked around by modifying the config.h.in.
  • libnetconf2 (should I file a bug in there, or is it just a matter of configuring it from the app, ie., netopeer2?) uses the C library functions for retrieving of user account information, including an attempt to read the shadow entries for password access. I would expect that a real-world production deployment would use PAM (if working on a full Linux and not on embedded) to allow for stuff like LDAP. On the other hand, for manual testing it would be nice to have some dummy auth backend with plaintext usernames/password. I'll see if I can fake this with some LD_PRELOAD trickery after the weekend.

(Please feel free to tell me to use another method for contacting you. I'm also at CESNET after all. However, as this is a FLOSS project I'm going through the default FLOSS route for now.)

ly ERROR: Unknown element "algorithm". (/ietf-system-keychain:keychain/private-keys/private-key[name='ssh_host_rsa_key']/algorithm)

When talking to the devel-server version which was built with support for authd, with devel of libyang & sysrepo:

> get-config --source running
ly DEBUG: DICT: inserting (refcount) ""
ly VERBOSE: Resolving unresolved data nodes and their constraints...
ly VERBOSE: All data nodes and constraints resolved.
nc DEBUG: Session 2: sending message:

#175


[2016/11/04 22:59:06.657434, 3] ssh_socket_unbuffered_write:  Enabling POLLOUT for socket
[2016/11/04 22:59:06.657663, 3] packet_send2:  packet: wrote [len=28,padding=12,comp=15,payload=15]
[2016/11/04 22:59:06.657713, 3] channel_write_common:  channel_write wrote 6 bytes
nc DEBUG: Session 2: sending message:
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="27"><get-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><source><running/></source></get-config></rpc>

[2016/11/04 22:59:06.657885, 3] packet_send2:  packet: wrote [len=204,padding=19,comp=184,payload=184]
[2016/11/04 22:59:06.657925, 3] channel_write_common:  channel_write wrote 175 bytes
[2016/11/04 22:59:06.657972, 3] ssh_socket_unbuffered_write:  Enabling POLLOUT for socket
nc DEBUG: Session 2: sending message:

##


[2016/11/04 22:59:06.658085, 3] packet_send2:  packet: wrote [len=28,padding=14,comp=13,payload=13]
[2016/11/04 22:59:06.658166, 3] channel_write_common:  channel_write wrote 4 bytes
[2016/11/04 22:59:06.658209, 3] ssh_socket_unbuffered_write:  Enabling POLLOUT for socket
[2016/11/04 22:59:06.709133, 3] ssh_packet_socket_callback:  packet: read type 94 [len=28,padding=11,comp=16,payload=16]
[2016/11/04 22:59:06.709162, 3] ssh_packet_process:  Dispatching handler for packet type 94
[2016/11/04 22:59:06.709181, 3] channel_rcv_data:  Channel receiving 7 bytes data in 0 (local win=846430 remote win=1273401)
[2016/11/04 22:59:06.709189, 3] channel_default_bufferize:  placing 7 bytes into channel buffer (stderr=0)
[2016/11/04 22:59:06.709197, 3] channel_rcv_data:  Channel windows are now (local win=846423 remote win=1273401)
[2016/11/04 22:59:06.709212, 3] ssh_channel_read_timeout:  Read (1) buffered : 7 bytes. Window: 846423
[2016/11/04 22:59:06.709220, 3] ssh_channel_read_timeout:  Read (1) buffered : 6 bytes. Window: 846423
[2016/11/04 22:59:06.709228, 3] ssh_channel_read_timeout:  Read (1) buffered : 5 bytes. Window: 846423
[2016/11/04 22:59:06.709235, 3] ssh_channel_read_timeout:  Read (1) buffered : 4 bytes. Window: 846423
[2016/11/04 22:59:06.709241, 3] ssh_channel_read_timeout:  Read (1) buffered : 3 bytes. Window: 846423
[2016/11/04 22:59:06.709248, 3] ssh_channel_read_timeout:  Read (1) buffered : 2 bytes. Window: 846423
[2016/11/04 22:59:06.709255, 3] ssh_channel_read_timeout:  Read (1) buffered : 1 bytes. Window: 846423
[2016/11/04 22:59:06.709264, 3] ssh_channel_read_timeout:  Read (1020) buffered : 0 bytes. Window: 846423
[2016/11/04 22:59:06.709309, 3] ssh_packet_socket_callback:  packet: read type 94 [len=1036,padding=6,comp=1029,payload=1029]
[2016/11/04 22:59:06.709318, 3] ssh_packet_process:  Dispatching handler for packet type 94
[2016/11/04 22:59:06.709327, 3] channel_rcv_data:  Channel receiving 1020 bytes data in 0 (local win=846423 remote win=1273401)
[2016/11/04 22:59:06.709338, 3] channel_default_bufferize:  placing 1020 bytes into channel buffer (stderr=0)
[2016/11/04 22:59:06.709346, 3] channel_rcv_data:  Channel windows are now (local win=845403 remote win=1273401)
[2016/11/04 22:59:06.709352, 3] ssh_packet_socket_callback:  Processing 1072 bytes left in socket buffer
[2016/11/04 22:59:06.709373, 3] ssh_packet_socket_callback:  packet: read type 94 [len=28,padding=12,comp=15,payload=15]
[2016/11/04 22:59:06.709379, 3] ssh_packet_process:  Dispatching handler for packet type 94
[2016/11/04 22:59:06.709385, 3] channel_rcv_data:  Channel receiving 6 bytes data in 0 (local win=845403 remote win=1273401)
[2016/11/04 22:59:06.709390, 3] channel_default_bufferize:  placing 6 bytes into channel buffer (stderr=0)
[2016/11/04 22:59:06.709396, 3] channel_rcv_data:  Channel windows are now (local win=845397 remote win=1273401)
[2016/11/04 22:59:06.709401, 3] ssh_packet_socket_callback:  Processing 1008 bytes left in socket buffer
[2016/11/04 22:59:06.709434, 3] ssh_packet_socket_callback:  packet: read type 94 [len=908,padding=17,comp=890,payload=890]
[2016/11/04 22:59:06.709439, 3] ssh_packet_process:  Dispatching handler for packet type 94
[2016/11/04 22:59:06.709446, 3] channel_rcv_data:  Channel receiving 881 bytes data in 0 (local win=845397 remote win=1273401)
[2016/11/04 22:59:06.709452, 3] channel_default_bufferize:  placing 881 bytes into channel buffer (stderr=0)
[2016/11/04 22:59:06.709458, 3] channel_rcv_data:  Channel windows are now (local win=844516 remote win=1273401)
[2016/11/04 22:59:06.709464, 3] ssh_packet_socket_callback:  Processing 64 bytes left in socket buffer
[2016/11/04 22:59:06.709478, 3] ssh_packet_socket_callback:  packet: read type 94 [len=28,padding=14,comp=13,payload=13]
[2016/11/04 22:59:06.709483, 3] ssh_packet_process:  Dispatching handler for packet type 94
[2016/11/04 22:59:06.709489, 3] channel_rcv_data:  Channel receiving 4 bytes data in 0 (local win=844516 remote win=1273401)
[2016/11/04 22:59:06.709495, 3] channel_default_bufferize:  placing 4 bytes into channel buffer (stderr=0)
[2016/11/04 22:59:06.709500, 3] channel_rcv_data:  Channel windows are now (local win=844512 remote win=1273401)
[2016/11/04 22:59:06.709509, 3] ssh_channel_read_timeout:  Read (1) buffered : 891 bytes. Window: 844512
[2016/11/04 22:59:06.709514, 3] ssh_channel_read_timeout:  Read (1) buffered : 890 bytes. Window: 844512
[2016/11/04 22:59:06.709523, 3] ssh_channel_read_timeout:  Read (1) buffered : 889 bytes. Window: 844512
[2016/11/04 22:59:06.709529, 3] ssh_channel_read_timeout:  Read (1) buffered : 888 bytes. Window: 844512
[2016/11/04 22:59:06.709534, 3] ssh_channel_read_timeout:  Read (1) buffered : 887 bytes. Window: 844512
[2016/11/04 22:59:06.709538, 3] ssh_channel_read_timeout:  Read (1) buffered : 886 bytes. Window: 844512
[2016/11/04 22:59:06.709545, 3] ssh_channel_read_timeout:  Read (881) buffered : 885 bytes. Window: 844512
[2016/11/04 22:59:06.709552, 3] ssh_channel_read_timeout:  Read (1) buffered : 4 bytes. Window: 844512
[2016/11/04 22:59:06.709557, 3] ssh_channel_read_timeout:  Read (1) buffered : 3 bytes. Window: 844512
[2016/11/04 22:59:06.709562, 3] ssh_channel_read_timeout:  Read (1) buffered : 2 bytes. Window: 844512
[2016/11/04 22:59:06.709567, 3] ssh_channel_read_timeout:  Read (1) buffered : 1 bytes. Window: 844512
nc DEBUG: Session 2: received message:
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="27"><data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><turing-machine xmlns="http://example.net/turing-machine"><transition-function><delta><label>left summand</label><input><state>0</state><symbol>1</symbol></input><output><head-move>right</head-move></output></delta><delta><label>separator</label><input><state>0</state><symbol>0</symbol></input><output><state>1</state><symbol>1</symbol><head-move>right</head-move></output></delta><delta><label>right summand</label><input><state>1</state><symbol>1</symbol></input><output><head-move>right</head-move></output></delta><delta><label>right end</label><input><state>1</state><symbol/></input><output><state>2</state><head-move>left</head-move></output></delta><delta><label>write separator</label><input><state>2</state><symbol>1</symbol></input><output><state>3</state><symbol>0</symbol><head-move>left</head-move></output></delta><delta><label>go home</label><input><state>3</state><symbol>1</symbol></input><output><head-move>left</head-move></output></delta><delta><label>final step</label><input><state>3</state><symbol/></input><output><state>4</state><head-move>right</head-move></output></delta></transition-function></turing-machine><keychain xmlns="urn:ietf:params:xml:ns:yang:ietf-system-keychain"><private-keys><private-key><name>ssh_host_rsa_key</name><algorithm>rsa</algorithm><public-key>MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0VonVw+eHQCzq052GaHT
tmowcsI9b1tFKdrqTWTRJDLMiYwBBFU/WeyurCgafBuJ+IDtif2mYYnwm4EyP6xU
xwjo1BGY4lzP+X1cGs1eMvWI90zbbj6DzoZejkhCWU8lc8hnSAjV5Aiku3muSy92
YJUMC2cLiNldKUt1QZCVP6PKrI4f9PSfaryBVd9gg/UlHwLkUdLPBRwTcQP6UATY
h2hWr/HtG03970RmCzR/+OO4qtXRFi+CR3EHFzcbFwf/0RhV7AUxmHXbO7CCBA5a
hI+4Rp5pPycnrfKki9g3BTJOvyn7FUf+tVlA+9wQS6GX3idP3K69vSMxX/YwOBaV
SQIDAQAB
</public-key></private-key></private-keys></keychain></data></rpc-reply>

ly DEBUG: DICT: inserting "rpc-reply" with collision 
ly DEBUG: DICT: inserting (refcount) "urn:ietf:params:xml:ns:netconf:base:1.0"
ly DEBUG: DICT: inserting "message-id" with collision 
ly DEBUG: DICT: inserting "27" with collision 
ly DEBUG: DICT: inserting (refcount) "data"
ly DEBUG: DICT: inserting (refcount) "urn:ietf:params:xml:ns:netconf:base:1.0"
ly DEBUG: DICT: inserting (refcount) "turing-machine"
ly DEBUG: DICT: inserting (refcount) "http://example.net/turing-machine"
ly DEBUG: DICT: inserting (refcount) "transition-function"
ly DEBUG: DICT: inserting (refcount) "delta"
ly DEBUG: DICT: inserting (refcount) "label"
ly DEBUG: DICT: inserting "left summand"
ly DEBUG: DICT: inserting (refcount) "input"
ly DEBUG: DICT: inserting (refcount) "state"
ly DEBUG: DICT: inserting (refcount) "0"
ly DEBUG: DICT: inserting (refcount) "symbol"
ly DEBUG: DICT: inserting (refcount) "1"
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) "output"
ly DEBUG: DICT: inserting (refcount) "head-move"
ly DEBUG: DICT: inserting (refcount) "right"
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) "delta"
ly DEBUG: DICT: inserting (refcount) "label"
ly DEBUG: DICT: inserting "separator"
ly DEBUG: DICT: inserting (refcount) "input"
ly DEBUG: DICT: inserting (refcount) "state"
ly DEBUG: DICT: inserting (refcount) "0"
ly DEBUG: DICT: inserting (refcount) "symbol"
ly DEBUG: DICT: inserting (refcount) "0"
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) "output"
ly DEBUG: DICT: inserting (refcount) "state"
ly DEBUG: DICT: inserting (refcount) "1"
ly DEBUG: DICT: inserting (refcount) "symbol"
ly DEBUG: DICT: inserting (refcount) "1"
ly DEBUG: DICT: inserting (refcount) "head-move"
ly DEBUG: DICT: inserting (refcount) "right"
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) "delta"
ly DEBUG: DICT: inserting (refcount) "label"
ly DEBUG: DICT: inserting "right summand" with collision 
ly DEBUG: DICT: inserting (refcount) "input"
ly DEBUG: DICT: inserting (refcount) "state"
ly DEBUG: DICT: inserting (refcount) "1"
ly DEBUG: DICT: inserting (refcount) "symbol"
ly DEBUG: DICT: inserting (refcount) "1"
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) "output"
ly DEBUG: DICT: inserting (refcount) "head-move"
ly DEBUG: DICT: inserting (refcount) "right"
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) "delta"
ly DEBUG: DICT: inserting (refcount) "label"
ly DEBUG: DICT: inserting "right end" with collision 
ly DEBUG: DICT: inserting (refcount) "input"
ly DEBUG: DICT: inserting (refcount) "state"
ly DEBUG: DICT: inserting (refcount) "1"
ly DEBUG: DICT: inserting (refcount) "symbol"
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) "output"
ly DEBUG: DICT: inserting (refcount) "state"
ly DEBUG: DICT: inserting (refcount) "2"
ly DEBUG: DICT: inserting (refcount) "head-move"
ly DEBUG: DICT: inserting (refcount) "left"
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) "delta"
ly DEBUG: DICT: inserting (refcount) "label"
ly DEBUG: DICT: inserting "write separator" with collision 
ly DEBUG: DICT: inserting (refcount) "input"
ly DEBUG: DICT: inserting (refcount) "state"
ly DEBUG: DICT: inserting (refcount) "2"
ly DEBUG: DICT: inserting (refcount) "symbol"
ly DEBUG: DICT: inserting (refcount) "1"
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) "output"
ly DEBUG: DICT: inserting (refcount) "state"
ly DEBUG: DICT: inserting (refcount) "3"
ly DEBUG: DICT: inserting (refcount) "symbol"
ly DEBUG: DICT: inserting (refcount) "0"
ly DEBUG: DICT: inserting (refcount) "head-move"
ly DEBUG: DICT: inserting (refcount) "left"
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) "delta"
ly DEBUG: DICT: inserting (refcount) "label"
ly DEBUG: DICT: inserting "go home" with collision 
ly DEBUG: DICT: inserting (refcount) "input"
ly DEBUG: DICT: inserting (refcount) "state"
ly DEBUG: DICT: inserting (refcount) "3"
ly DEBUG: DICT: inserting (refcount) "symbol"
ly DEBUG: DICT: inserting (refcount) "1"
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) "output"
ly DEBUG: DICT: inserting (refcount) "head-move"
ly DEBUG: DICT: inserting (refcount) "left"
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) "delta"
ly DEBUG: DICT: inserting (refcount) "label"
ly DEBUG: DICT: inserting "final step" with collision 
ly DEBUG: DICT: inserting (refcount) "input"
ly DEBUG: DICT: inserting (refcount) "state"
ly DEBUG: DICT: inserting (refcount) "3"
ly DEBUG: DICT: inserting (refcount) "symbol"
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) "output"
ly DEBUG: DICT: inserting (refcount) "state"
ly DEBUG: DICT: inserting "4"
ly DEBUG: DICT: inserting (refcount) "head-move"
ly DEBUG: DICT: inserting (refcount) "right"
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) "keychain"
ly DEBUG: DICT: inserting (refcount) "urn:ietf:params:xml:ns:yang:ietf-system-keychain"
ly DEBUG: DICT: inserting (refcount) "private-keys"
ly DEBUG: DICT: inserting (refcount) "private-key"
ly DEBUG: DICT: inserting (refcount) "name"
ly DEBUG: DICT: inserting "ssh_host_rsa_key" with collision 
ly DEBUG: DICT: inserting (refcount) "algorithm"
ly DEBUG: DICT: inserting (refcount) "rsa"
ly DEBUG: DICT: inserting (refcount) "public-key"
ly DEBUG: DICT: inserting "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0VonVw+eHQCzq052GaHT
tmowcsI9b1tFKdrqTWTRJDLMiYwBBFU/WeyurCgafBuJ+IDtif2mYYnwm4EyP6xU
xwjo1BGY4lzP+X1cGs1eMvWI90zbbj6DzoZejkhCWU8lc8hnSAjV5Aiku3muSy92
YJUMC2cLiNldKUt1QZCVP6PKrI4f9PSfaryBVd9gg/UlHwLkUdLPBRwTcQP6UATY
h2hWr/HtG03970RmCzR/+OO4qtXRFi+CR3EHFzcbFwf/0RhV7AUxmHXbO7CCBA5a
hI+4Rp5pPycnrfKki9g3BTJOvyn7FUf+tVlA+9wQS6GX3idP3K69vSMxX/YwOBaV
SQIDAQAB
" with collision 
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) ""
ly DEBUG: DICT: inserting (refcount) "rsa"
ly ERROR: Unknown element "algorithm". (/ietf-system-keychain:keychain/private-keys/private-key[name='ssh_host_rsa_key']/algorithm)
nc ERROR: Failed to parse <get-config> reply.
cli_send_recv: Failed to receive a reply.

call Home

Creating the new ticket as earlier was closed related to it .
can you please let us know when is call home support available in Master branch.

DOS by not sending hello

Open an SSH session, observe server hello:

root@t460s:~/ietf962/libnetconf2# ssh -s -p6001 localhost netconf
Interactive SSH Authentication
Type your password:
Password: tmp
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><capabilities><capability>urn:ietf:params:netconf:base:1.0</capability><capability>urn:ietf:params:netconf:base:1.1</capability><capability>urn:ietf:params:netconf:capability:writable-running:1.0</capability><capability>urn:ietf:params:netconf:capability:candidate:1.0</capability><capability>urn:ietf:params:netconf:capability:rollback-on-error:1.0</capability><capability>urn:ietf:params:netconf:capability:validate:1.1</capability><capability>urn:ietf:params:netconf:capability:startup:1.0</capability><capability>urn:ietf:params:netconf:capability:xpath:1.0</capability><capability>urn:ietf:params:netconf:capability:with-defaults:1.0?basic-mode=explicit&amp;also-supported=report-all,report-all-tagged,trim,explicit</capability><capability>urn:ietf:params:xml:ns:yang:1?module=yang&amp;revision=2016-02-11</capability><capability>urn:ietf:params:xml:ns:yang:ietf-inet-types?module=ietf-inet-types&amp;revision=2013-07-15</capability><capability>urn:ietf:params:xml:ns:yang:ietf-yang-types?module=ietf-yang-types&amp;revision=2013-07-15</capability><capability>urn:ietf:params:xml:ns:yang:ietf-yang-library?module=ietf-yang-library&amp;revision=2016-02-01</capability><capability>http://example.net/turing-machine?module=turing-machine&amp;revision=2013-12-27</capability><capability>urn:ietf:params:xml:ns:yang:ietf-interfaces?module=ietf-interfaces&amp;revision=2014-05-08</capability><capability>urn:ietf:params:xml:ns:yang:iana-if-type?module=iana-if-type&amp;revision=2014-05-08</capability><capability>urn:ietf:params:xml:ns:yang:ietf-ip?module=ietf-ip&amp;revision=2014-06-16</capability><capability>urn:ietf:params:xml:ns:yang:ietf-netconf-acm?module=ietf-netconf-acm&amp;revision=2012-02-22</capability><capability>urn:ietf:params:xml:ns:yang:iana-crypt-hash?module=iana-crypt-hash&amp;revision=2014-04-04</capability><capability>urn:ietf:params:xml:ns:yang:ietf-system?module=ietf-system&amp;revision=2014-08-06</capability><capability>urn:ietf:params:xml:ns:netconf:base:1.0?module=ietf-netconf&amp;revision=2011-06-01&amp;features=writable-running,candidate,rollback-on-error,validate,startup,xpath</capability><capability>urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring?module=ietf-netconf-monitoring&amp;revision=2010-10-04</capability><capability>urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults?module=ietf-netconf-with-defaults&amp;revision=2011-06-01</capability></capabilities><session-id>1</session-id></hello>]]>]]>

Then open another one, in another terminal, and observe this one hangs before authentication:

root@t460s:~/ietf962/libnetconf2# ssh -s -p6001 localhost netconf

The second session will proceed to authentication once the server receives to hello from the first session.

status

Would it be possible to find out the status and projected time frame for netopeer2 server availability.
Specifically when the missing parts might be available?
Notifications
Call home
NACM

Not able to connect to netopeer2-server via remote machine

I have sysrepod and netopeer2-server running on my system.
When i run netopeer2-cli on local machine, i am able to connect to netopeer2-server and sysrepo and able to perform multiple operations.

Same is not possible when using netopeer2-cli on remote machine.
Please suggest.
ping/ssh to remote host is fine.
Do i need to edit remote host's sshd_config file etc..

command i am using to connect is as follows
[root@adv-ca85 ~]# ./netopeer2-cli

connect --host 10.1.17.84 --port 6001 --login root
nc ERROR: Unable to connect to 10.1.17.84:6001.
cmd_connect: Connecting to the 10.1.17.84:6001 as user "root" failed.

Segfault when executing an action

I sent this to netopeer2, connected to sysrepo, and netopeer2 crashed:

<?xml version="1.0" encoding="UTF-8"?><hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<capabilities>
    <capability>conf:base:1.0</capability>
    <capability>urn:ietf:params:netconf:base:1.1</capability>
    <capability>urn:ietf:params:netconf:capability:writable-running:1.0</capability>
    <capability>urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring?module=ietf-netconf-monitoring&amp;revision=2010-10-04</capability>
</capabilities>
</hello>]]>]]>


#142
<rpc message-id="103" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><system-shutdown xmlns="urn:ietf:params:xml:ns:yang:ietf-system"/></rpc>
##

Log and GDB output:

netopeer2-server[2689]: Session 1: received message:
<?xml version="1.0" encoding="UTF-8"?><hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<capabilities>
    <capability>conf:base:1.0</capability>
    <capability>urn:ietf:params:netconf:base:1.1</capability>
    <capability>urn:ietf:params:netconf:capability:writable-running:1.0</capability>
    <capability>urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring?module=ietf-netconf-monitoring&amp;revision=2010-10-04</capability>
</capabilities>
</hello>
netopeer2-server[2689]: (cl_request_process:401) Sending session-start request.
netopeer2-server[2689]: (cl_request_process:423) session-start request sent, waiting for response.
netopeer2-server[2689]: (cl_request_process:445) session-start response received, processing.
netopeer2-server[2689]: Session 1: received message:
<rpc message-id="103" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><system-shutdown xmlns="urn:ietf:params:xml:ns:yang:ietf-system"/></rpc>
netopeer2-server[2689]: (cl_request_process:401) Sending rpc request.
netopeer2-server[2689]: (cl_request_process:423) rpc request sent, waiting for response.
netopeer2-server[2689]: (cl_request_process:445) rpc response received, processing.
netopeer2-server[2689]: (sr_rpc_send:2032) Error by processing of the request.

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff4f06700 (LWP 2693)]
0x000000000040d09d in op_generic (rpc=0x7fffec000980, ncs=0x6b4ce0)
    at /home/mpilka/ietf962/Netopeer2/server/op_generic.c:125
125     for (i = 0; i < strs->number; i++) {
(gdb) bt
#0  0x000000000040d09d in op_generic (rpc=0x7fffec000980, ncs=0x6b4ce0)
    at /home/mpilka/ietf962/Netopeer2/server/op_generic.c:125
#1  0x00007ffff76e8ec2 in nc_send_reply (session=0x6b4ce0, rpc=0x7fffec001830)
    at /home/mpilka/ietf962/libnetconf2/src/session_server.c:893
#2  0x00007ffff76e9697 in nc_ps_poll (ps=0x6b4310, timeout=500, 
    session=0x7ffff4f05ec8)
    at /home/mpilka/ietf962/libnetconf2/src/session_server.c:1092
#3  0x000000000040535b in process_loop (arg=0x0)
    at /home/mpilka/ietf962/Netopeer2/server/main.c:422
#4  0x00007ffff7bc4182 in start_thread (arg=0x7ffff4f06700)
    at pthread_create.c:312
#5  0x00007ffff718047d in clone ()
    at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

It may be relevant that this action was not subscribed to in sysrepo.

Core dump: netopeer2-server.core.zip

call home

Is call home supported - if not is there an expected time frame when it will be available?

cli: Segault in lyd_insert_common (parent=0x606000007b80, sibling=0x0, node=0x60700004cfb0) at ../src/tree_data.c:3076

I'm connecting to a netopeer2-server built yesterday with nothing but sysrepo-plugin-ietf-system. The CLI segfaults when it attempts to dereference a null pointer lys_node while fetching config with defaults:

jkt@kolibrik ~/work/prog/netopeer2/build-cli[devel] $ LD_LIBRARY_PATH=/opt/libnetconf/lib ASAN_OPTIONS=abort_on_error=1 gdb --ex run ./netopeer2-cli
[...] 
> connect --ssh --login root --port 830 --host ...
Interactive SSH Authentication
Type your password:
Password: 
nc ERROR: Session 2: timeout for receiving reply to a <get-schema> expired.
nc ERROR: Session 2: received a <rpc-reply> with an unexpected message-id "1".
nc ERROR: Session 2: received a <rpc-reply> with an unexpected message-id "2".
nc ERROR: Session 2: received a <rpc-reply> with an unexpected message-id "3".
nc ERROR: Session 2: received a <rpc-reply> with an unexpected message-id "4".
nc ERROR: Session 2: received a <rpc-reply> with an unexpected message-id "5".
nc ERROR: Session 2: received a <rpc-reply> with an unexpected message-id "6".
nc ERROR: Session 2: received a <rpc-reply> with an unexpected message-id "7".
ly ERROR: Failed to resolve augment "/ietf-netconf-acm:get-config/ietf-netconf-acm:input". (/ietf-netconf-with-defaults:/ietf-netconf-acm:get-config/ietf-netconf-acm:input)
ly ERROR: Failed to resolve augment "/ietf-netconf-acm:get/ietf-netconf-acm:input". (/ietf-netconf-with-defaults:/ietf-netconf-acm:get/ietf-netconf-acm:input)
ly ERROR: Failed to resolve augment "/ietf-netconf-acm:copy-config/ietf-netconf-acm:input". (/ietf-netconf-with-defaults:/ietf-netconf-acm:copy-config/ietf-netconf-acm:input)
ly ERROR: Module "ietf-netconf-with-defaults" parsing failed.
ly ERROR: Importing "ietf-netconf-acm" module into "ietf-system" failed.
ly ERROR: Module "ietf-system" parsing failed.
> get-config --defaults report-all --source running

Program received signal SIGSEGV, Segmentation fault.
0x00007ffff7890715 in lyd_insert_common (parent=0x606000007b80, sibling=0x0, node=0x60700004cfb0) at ../src/tree_data.c:3076
3076                    for (par1 = ins->schema->parent; !(par1->nodetype & (LYS_INPUT | LYS_OUTPUT)); par1 = par1->parent);
(gdb) print ins
$1 = (struct lyd_node *) 0x60700004cfb0
(gdb) print ins->schema
$2 = (struct lys_node *) 0x61000000d040
(gdb) set print pretty on
(gdb) set print object on
(gdb) print ins->schema->parent
$3 = (struct lys_node *) 0x60d000006ec0
(gdb) print par1
$4 = (struct lys_node *) 0x0

typedef with type decimal64 will not success when edit-config.

Hi,
I got failed when I do edit-config with below module and xml:

module a {
  namespace "aaa:1";
  prefix a;

  typedef typeA{
    type decimal64{
      fraction-digits 1;
      range "-10..-1";
    }
  }

  container aa
  {
    leaf f1{
      type typeA;
    }
  }
}
<aa xmlns="aaa:1">
<f1>-3.0</f1>
</aa>

And I found that this bugs may be caused in function op_set_srval, when type is derived from decimal64, ((struct lys_node_leaf *) leaf->schema)->type.info.dec64.dig is zero, and the fraction-digits is defined in the base type.
when I fix it like above, edit-config is ok, but get-config still fail, the log has this:

netopeer2-server[1561]: Value "-30" does not satisfy a constraint (range, length, or pattern). (/a:aa/f1)
netopeer2-server[1561]: Failed to create node "f1" as a child of "aa". (/a:aa/f1)

It seems that sysrepo return -30 as the value.

Call Home

any update on call home support ?
do we have this functionality getting merge with master branch

if not when is this planned and can be expected .

Invalid processing of a get request

This behavior can be seen in the devel branch code, I've not tried the master branch.

The following NETCONF request:

#198
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<get>
    <filter>
        <interfaces-state xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces" />
    </filter>
</get>
</rpc>
##

Renders to incorrect request in sysrepo:

[INF] (rp_dt_get_values_wrapper:911) Get items request running datastore, xpath: /ietf-interfaces:interfaces-state

and therefore returns no data:

#143
<rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"/></rpc-reply>
##

The correct xpath is supposed to be /ietf-interfaces:interfaces-state//* instead of /ietf-interfaces:interfaces-state

if more than two leafs in the container of modify data, the edit-config operation will failed.

if more than two leafs in the container of modify data, the edit-config operation will failed.
i found the xpath that constructed in the function is wrong when edit the third leaf in the container.
for example:
my model define is like this:

module ME {
  namespace "urn:ietf:params:xml:ns:yang:z";
  prefix ME;
  revision 2016-05-10;

  container ME{
    leaf MEId{
      type uint32{
        range "1";
      }
      mandatory true;
      config true;
      description "Object ID of managed NE";
    }

    leaf vName{
      type string{
        length "1..128";
      }
      mandatory true;
      config true;
      description "NE provider";
    }

    leaf rMode{
      type int32{
        range "1..65535";
      }
      mandatory true;
      config true;
      description "Radio Standard";
    }
  }
}

the xpath of rMode construct in the function is like
/ME:ME/vName/rMode
as we see the xpath is not right,and the right xpath is "/ME:ME/rMode"

i check the code ,wonder is there any thing wrong with "op_editconfig" function in operations.c when deal leaf node?
and i wonder :if the local parameter "missing_keys" and "lastkey" in function op_editconfig is used to judge the current leaf is list or is single leaf node? when the leaf is only leaf node ,the lastkey need reinitialize to zero,as the "dfs_nextsibling" will "--" operation on the lastkey

there is some thing wrong with the xpath when delete all leaf list elements master branch

there is some thing wrong with the xpath when delete all leaf list elements
as an example ,when use the follow xml to delete the data,the xpath is like
/TestDelLeafList:RootContainer/secondLevelLeafList[.='']
when use this xpath to operator sysrepo data ,it report Error!
<RootContainer xmlns="urn:ietf:params:xml:ns:yang:fox" xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"> <secondLevelLeafList xc:operation="delete"></secondLevelLeafList> </RootContainer>

edit-config failed for leaf-list

module

module t{
  namespace "ttt:1";
  prefix t;

  container c1{
    leaf-list lf1{
      type int8;
    }
  }
}

data:

<c1 xmlns="ttt:1">
<lf1>10</lf1>
</c1>

result:

> edit-config --target running --config=/root/z-conf/mymodules/e5g/d.xml
OK
> 
> 
> edit-config --target running --config=/root/z-conf/mymodules/e5g/d.xml
ERROR
        type:     application
        tag:      operation-failed
        severity: error
        message:  Invalid argument
> 

notice that it only failed in the second time.
sysrepod print some error:

[INF] (rp_dt_set_item_wrapper:559) Set item request running datastore, xpath: /t:c1/lf1[.='10']
[DBG] (dm_get_data_info:1701) Module t already loaded
[DBG] (dm_ly_log_cb:815) libyang error: Unexpected character(s) '[' ([.='10']).
[ERR] (rp_dt_set_item:423) Setting of item failed /t:c1/lf1[.='10'] 65
[ERR] (rp_dt_set_item_wrapper:574) Set item failed
[ERR] (rp_set_item_req_process:919) Set item failed for '/t:c1/lf1[.='10']', session id=2024596807.

Keyboard-interactive authentication problem from netopeer2-cli to netopeer2-server

Hi all
I'm trying to connect netopeer2-cli to netopeer2-server running on my embedded board.
The connection procedure fails with the following messages

nc VERBOSE: Keyboard-interactive authentication.
[2016/09/26 15:09:06.430743, 3] ssh_userauth_kbdint_init:  Sending keyboard-interactive init request
[2016/09/26 15:09:06.430825, 3] ssh_socket_unbuffered_write:  Enabling POLLOUT for socket
[2016/09/26 15:09:06.430863, 3] packet_send2:  packet: wrote [len=76,padding=16,comp=59,payload=59]
[2016/09/26 15:09:06.440419, 3] ssh_packet_socket_callback:  packet: read type 60 [len=92,padding=10,comp=81,payload=81]
[2016/09/26 15:09:06.440469, 3] ssh_packet_process:  Dispatching handler for packet type 60
[2016/09/26 15:09:06.440488, 3] ssh_packet_userauth_info_request:  1 keyboard-interactive prompts
Interactive SSH Authentication
Type your password:
Password: 
[2016/09/26 15:09:09.029184, 3] ssh_userauth_kbdint_send:  Sending keyboard-interactive response packet
[2016/09/26 15:09:09.029282, 3] ssh_socket_unbuffered_write:  Enabling POLLOUT for socket
[2016/09/26 15:09:09.029299, 3] packet_send2:  packet: wrote [len=28,padding=9,comp=18,payload=18]
[2016/09/26 15:09:09.038973, 3] ssh_packet_socket_callback:  packet: read type 52 [len=12,padding=10,comp=1,payload=1]
[2016/09/26 15:09:09.039003, 3] ssh_packet_process:  Dispatching handler for packet type 52
[2016/09/26 15:09:09.039022, 3] ssh_packet_userauth_success:  Authentication successful
nc VERBOSE: Authentication successful.
[2016/09/26 15:09:09.039047, 2] channel_open:  Creating a channel 43 with 64000 window and 32768 max packet
[2016/09/26 15:09:09.039086, 3] ssh_socket_unbuffered_write:  Enabling POLLOUT for socket
[2016/09/26 15:09:09.039105, 3] packet_send2:  packet: wrote [len=44,padding=19,comp=24,payload=24]
[2016/09/26 15:09:09.039116, 3] channel_open:  Sent a SSH_MSG_CHANNEL_OPEN type session for channel 43
[2016/09/26 15:09:09.040361, 1] ssh_socket_exception_callback:  Socket exception callback: 2 (104)
[2016/09/26 15:09:09.040391, 1] ssh_socket_exception_callback:  Socket error: Connection reset by peer
nc ERROR: Opening an SSH channel failed (Socket error: Connection reset by peer).
cmd_connect: Connecting to the 192.168.1.117:6001 as user "root" failed.

The authentication step seems to be passed but something else happens.
Do you have any idea or suggestion about this problem?
Of course on a X86 the authentication procedure works as a charm.
Any help will be greatly appreciated
fabio

copy-config always failed

I get this error message when I execute copy-config --target running --src-config=/root/d.xml in netopeer2-cli.

ERROR
        type:     application
        tag:      operation-failed
        severity: error
        path:     /ietf-netconf-acm:nacm/enable-nacm
        message:  Requested schema model is not known

module:

module t{
  namespace "ttt:1";
  prefix t;

  container c1{
    leaf f1{
      type int8;
    }
  }
}

d.xml

<c1 xmlns="ttt:1">
<f1>10</f1>
</c1>

DOS by not using netconf subsystem

SSH to the netconf port normally:
{code}
ssh -p 6001 localhost
{code}

Authenticate and then the server will disconnect you.
Attempt to connect again, and observe that the connection will hang until the first connection times out (even though it was already closed by the server).

Getting error for flag NC_ENABLED_SSH

I am getting below error even though i have nc_client.h & nc_server.h which defines NC_ENABLED_SSH in libnetconf2 directory.

I tried setting env NC_ENABLED_SSH to nc_client.h & nc_server.h location but still error appears

-- Looking for NC_ENABLED_SSH
-- Looking for NC_ENABLED_SSH - not found
-- Looking for NC_ENABLED_TLS
-- Looking for NC_ENABLED_TLS - not found
CMake Error at CMakeLists.txt:71 (message):
Missing SSH support in libnetconf2, server requires SSH to be supported.

Please suggest

Edit-config for union sr_val_t type not filled

There is reported issue sysrepo/sysrepo#354

The problem is that sysrepo receives set request with SR_UNKNOWN_T
netopeer2-server[30879]: (sr_set_val_t_type_in_gpb:901) Type can not be mapped to gpb type '(null)' type 0

According to the log, this was reported for master branch. It might be already fix, could you check it?

thanks,
Lukas

Netopeer accepts invalid requests and responds with OK

After sending an invalid request to the server (wrong namespace - missing colon in <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietfinterfaces">), the server responds with status OK, but nothing is actually saved into the datastore:

#735
     <rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
       <edit-config>
         <target>
           <running/>
         </target>
         <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
           <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietfinterfaces">
             <interface xc:operation="replace">
               <name>GigabitEthernet0/8/0</name>
               <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
                 <address>
                   <ip>192.0.2.4</ip>
                   <prefix-length>24</prefix-length>
                 </address>
               </ipv4>
             </interface>
           </interfaces>
         </config>
       </edit-config>
     </rpc>
##

#93
<rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><ok/></rpc-reply>
##

Server logs:

[2016/11/02 15:21:39.821156, 3] ssh_packet_socket_callback:  packet: read type 94 [len=28,padding=15,comp=12,payload=12]
[2016/11/02 15:21:39.821163, 3] ssh_packet_process:  Dispatching handler for packet type 94
[2016/11/02 15:21:39.821168, 3] channel_rcv_data:  Channel receiving 3 bytes data in 0 (local win=1277297 remote win=2094003)
[2016/11/02 15:21:39.821171, 3] channel_default_bufferize:  placing 3 bytes into channel buffer (stderr=0)
[2016/11/02 15:21:39.821177, 3] channel_rcv_data:  Channel windows are now (local win=1277294 remote win=2094003)
[2016/11/02 15:21:39.821182, 3] ssh_channel_read_timeout:  Read (1) buffered : 2 bytes. Window: 1277294
[2016/11/02 15:21:39.821185, 3] ssh_channel_read_timeout:  Read (1) buffered : 1 bytes. Window: 1277294
netopeer2-server[25700]: Session 1: received message:
     <rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
       <edit-config>
         <target>
           <running/>
         </target>
         <config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
           <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietfinterfaces">
             <interface xc:operation="replace">
               <name>GigabitEthernet0/8/0</name>
               <ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip">
                 <address>
                   <ip>192.0.2.4</ip>
                   <prefix-length>24</prefix-length>
                 </address>
               </ipv4>
             </interface>
           </interfaces>
         </config>
       </edit-config>
     </rpc>
netopeer2-server[25700]: DICT: inserting "rpc" with collision 
netopeer2-server[25700]: DICT: inserting "message-id" with collision 
netopeer2-server[25700]: DICT: inserting "101" with collision 
netopeer2-server[25700]: DICT: inserting (refcount) "urn:ietf:params:xml:ns:netconf:base:1.0"
netopeer2-server[25700]: DICT: inserting (refcount) "edit-config"
netopeer2-server[25700]: DICT: inserting (refcount) "target"
netopeer2-server[25700]: DICT: inserting (refcount) "running"
netopeer2-server[25700]: DICT: inserting (refcount) ""
netopeer2-server[25700]: DICT: inserting (refcount) ""
netopeer2-server[25700]: DICT: inserting (refcount) "config"
netopeer2-server[25700]: DICT: inserting "xc" with collision 
netopeer2-server[25700]: DICT: inserting (refcount) "urn:ietf:params:xml:ns:netconf:base:1.0"
netopeer2-server[25700]: DICT: inserting (refcount) "interfaces"
netopeer2-server[25700]: DICT: inserting "urn:ietf:params:xml:ns:yang:ietfinterfaces" with collision 
netopeer2-server[25700]: DICT: inserting (refcount) "interface"
netopeer2-server[25700]: DICT: inserting "operation" with collision 
netopeer2-server[25700]: DICT: inserting (refcount) "replace"
netopeer2-server[25700]: DICT: inserting (refcount) "name"
netopeer2-server[25700]: DICT: inserting "GigabitEthernet0/8/0" with collision 
netopeer2-server[25700]: DICT: inserting (refcount) "ipv4"
netopeer2-server[25700]: DICT: inserting (refcount) "urn:ietf:params:xml:ns:yang:ietf-ip"
netopeer2-server[25700]: DICT: inserting (refcount) "address"
netopeer2-server[25700]: DICT: inserting (refcount) "ip"
netopeer2-server[25700]: DICT: inserting "192.0.2.4" with collision 
netopeer2-server[25700]: DICT: inserting (refcount) "prefix-length"
netopeer2-server[25700]: DICT: inserting "24" with collision 
netopeer2-server[25700]: DICT: inserting (refcount) ""
netopeer2-server[25700]: DICT: inserting (refcount) ""
netopeer2-server[25700]: DICT: inserting (refcount) ""
netopeer2-server[25700]: DICT: inserting (refcount) ""
netopeer2-server[25700]: DICT: inserting (refcount) ""
netopeer2-server[25700]: DICT: inserting (refcount) ""
netopeer2-server[25700]: DICT: inserting (refcount) ""
netopeer2-server[25700]: DICT: inserting (refcount) "urn:ietf:params:xml:ns:netconf:base:1.0"
netopeer2-server[25700]: DICT: inserting (refcount) "xc"
netopeer2-server[25700]: DICT: inserting (refcount) "merge"
netopeer2-server[25700]: DICT: inserting (refcount) "test-then-set"
netopeer2-server[25700]: DICT: inserting (refcount) "stop-on-error"
netopeer2-server[25700]: Resolving unresolved data nodes and their constraints...
netopeer2-server[25700]: All data nodes and constraints resolved.
netopeer2-server[25700]: XPATH: expression "/ietf-netconf:edit-config/target/*":
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "target"
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "*"
netopeer2-server[25700]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[25700]: DICT: inserting (refcount) "edit-config"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[25700]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[25700]: DICT: inserting (refcount) "target"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[25700]: XPATH: eval_relative_location_path parsed Operator(Path)[32]
netopeer2-server[25700]: DICT: inserting "*" with collision 
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[33]
netopeer2-server[25700]: XPATH: expression "/ietf-netconf:edit-config/default-operation":
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "default-operation"
netopeer2-server[25700]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[25700]: DICT: inserting (refcount) "edit-config"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[25700]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[25700]: DICT: inserting (refcount) "default-operation"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[25700]: XPATH: expression "/ietf-netconf:edit-config/test-option":
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "test-option"
netopeer2-server[25700]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[25700]: DICT: inserting (refcount) "edit-config"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[25700]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[25700]: DICT: inserting (refcount) "test-option"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[25700]: XPATH: expression "/ietf-netconf:edit-config/error-option":
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "error-option"
netopeer2-server[25700]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[25700]: DICT: inserting (refcount) "edit-config"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[25700]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[25700]: DICT: inserting (refcount) "error-option"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[25700]: XPATH: expression "/ietf-netconf:edit-config/config":
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "ietf-netconf:edit-config"
netopeer2-server[25700]: XPATH:	Token Operator(Path), in expression "/"
netopeer2-server[25700]: XPATH:	Token NameTest, in expression "config"
netopeer2-server[25700]: XPATH: eval_absolute_location_path parsed Operator(Path)[0]
netopeer2-server[25700]: DICT: inserting (refcount) "edit-config"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[1]
netopeer2-server[25700]: XPATH: eval_relative_location_path parsed Operator(Path)[25]
netopeer2-server[25700]: DICT: inserting (refcount) "config"
netopeer2-server[25700]: XPATH: eval_node_test              parsed NameTest[26]
netopeer2-server[25700]: Session 1: sending message:

#93

[2016/11/02 15:21:39.822517, 3] ssh_socket_unbuffered_write:  Enabling POLLOUT for socket
[2016/11/02 15:21:39.822561, 3] packet_send2:  packet: wrote [len=28,padding=13,comp=14,payload=14]
[2016/11/02 15:21:39.822573, 3] channel_write_common:  channel_write wrote 5 bytes
netopeer2-server[25700]: Session 1: sending message:
<rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><ok/></rpc-reply>
[2016/11/02 15:21:39.822609, 3] packet_send2:  packet: wrote [len=108,padding=5,comp=102,payload=102]
[2016/11/02 15:21:39.822622, 3] channel_write_common:  channel_write wrote 93 bytes
[2016/11/02 15:21:39.822645, 3] ssh_socket_unbuffered_write:  Enabling POLLOUT for socket
netopeer2-server[25700]: Session 1: sending message:

##

[2016/11/02 15:21:39.822704, 3] packet_send2:  packet: wrote [len=28,padding=14,comp=13,payload=13]
[2016/11/02 15:21:39.822717, 3] channel_write_common:  channel_write wrote 4 bytes
[2016/11/02 15:21:39.822740, 3] ssh_socket_unbuffered_write:  Enabling POLLOUT for socket

Multiple netconf client session nt working

I already have an ongoing session, when i try to connect via other netconf client to Netopeer2-server it gives it does not connect.

netopeer2-server[15736]: (cl_request_process:423) session-start request sent, waiting for response.
netopeer2-server[15736]: (cl_request_process:445) session-start response received, processing.
netopeer2-server[15736]: nc_ps_add_session: failed to wait for a pollsession condition (Connection timed out).
netopeer2-server[15736]: nc_ps_add_session: failed to wait for a pollsession condition (Connection timed out).
netopeer2-server[15736]: nc_ps_add_session: failed to wait for a pollsession condition (Connection timed out).
netopeer2-server[15736]: Internal error (/root/Netopeer2/server/main.c:591)
netopeer2-server[15736]: (cl_request_process:401) Sending session-stop request.

Netopeer2 returns state data for get-config

It seems that we need a sr_session_set_options call somewhere here? https://github.com/CESNET/Netopeer2/blob/devel-server/server/op_get_config.c#L615

Example:

#151
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<get-config>
    <source>
        <running />
    </source>
</get-config>
</rpc>
##

#1022
<rpc-reply message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><data xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"><interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"><interface><name>GigabitEthernet0/8/0</name><type>ethernetCsmacd</type><enabled>true</enabled><ipv4 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip"><address><ip>172.16.0.9</ip><prefix-length>24</prefix-length></address></ipv4><ipv6 xmlns="urn:ietf:params:xml:ns:yang:ietf-ip"><address><ip>2001:db8::10</ip><prefix-length>24</prefix-length></address><autoconf></autoconf></ipv6></interface></interfaces><interfaces-state xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"><interface><name>local0</name><type>propVirtual</type><admin-status>down</admin-status><oper-status>down</oper-status><speed>0</speed></interface><interface><name>GigabitEthernet0/8/0</name><type>ethernetCsmacd</type><admin-status>up</admin-status><oper-status>up</oper-status><phys-address>08:00:27:23:b0:76</phys-address><speed>1000000000</speed></interface>
#38
</interfaces-state></data></rpc-reply>
##

about op_copyconfig reFree configData cause netopeer server crash in master branch

In our code we use lyd_free_withsiblings(config) to free the lyd config node after we set all items success.
and we also free lyd config node when sr_commit return error, the double free will cause netopeer server crash
=======part code of op_copyconfig in master branch=====

        }
        /* cleanup */
        lyd_free_withsiblings(config);  // first free at line 269

        /* commit the result */
        if (sessions->ds != SR_DS_CANDIDATE) {
            /* commit in candidate causes copy to running,
             * so do it here only on non-candidate datastores */
            rc = sr_commit(sessions->srs);
        }
    } else {
        rc = sr_copy_config(sessions->srs, NULL, source, target);
        /* commit is done implicitely by sr_copy_config() */
    }

    if (rc != SR_ERR_OK) {
srerror:
        /* cleanup */
        lyd_free_withsiblings(config); // if sr_commit return error,we free again at line 285

        /* handle error */
        if (!e) {
            return op_build_err_sr(NULL, sessions->srs);
        } else {
            return nc_server_reply_err(e);
        }
    }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.