netopeer icon indicating copy to clipboard operation
netopeer copied to clipboard

unknown element

Open zhangk90 opened this issue 6 years ago • 9 comments

hi sir, netopeer-server always show this when edit-config xml image

rng and xsl has been deleted

Thanks!

zhangk90 avatar Apr 13 '18 06:04 zhangk90

can you provide the server's <hello> message?

rkrejci avatar Apr 13 '18 08:04 rkrejci

this? image

zhangk90 avatar Apr 13 '18 08:04 zhangk90

sorry, lost in formatting. No, I need to see the netopeer-server's hello message sent to client. If you are using netopeer-cli, the output of status command should be fine.

rkrejci avatar Apr 13 '18 09:04 rkrejci

image thanks!

zhangk90 avatar Apr 13 '18 09:04 zhangk90

can you provide the rest of the log from your original post? Does it end with an error returned to client or by not doing what is expected? And please avoid posting images, instead just copy paste the text and add formatting.

rkrejci avatar Apr 13 '18 09:04 rkrejci

yin:

<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:ietf:params:xml:ns:yang:yin:1" xmlns:xy="http://www.raisecom.com/vcpe" xmlns:inet="urn:ietf:params:xml:ns:yang:ietf-inet-types" name="vcpe">
  <namespace uri="http://www.raisecom.com/vcpe"/>
  <prefix value="xy"/>
  <import module="ietf-inet-types">
    <prefix value="inet"/>
    <revision-date date="2013-07-15"/>
  </import>
  <organization>
    <text>raisecom</text>
  </organization>
  <contact>
    <text>[email protected]</text>
  </contact>
  <description>
    <text>This module contains a collection of YANG definitions for
 managing vCPE device.</text>
  </description>
  <revision date="2018-01-24">
    <description>
      <text>Initial revision.</text>
    </description>
    <reference>
      <text>RFC 6020</text>
    </reference>
  </revision>
  <container name="interfaces">
    <description>
      <text>interface info</text>
    </description>
    <list name="interface">
      <key value="name"/>
      <description>
        <text>interface</text>
      </description>
      <leaf name="name">
        <type name="string"/>
        <description>
          <text>interface name</text>
        </description>
      </leaf>
      <leaf name="ipv4-address">
        <type name="inet:ipv4-address"/>
        <description>
          <text>interface ip</text>
        </description>
      </leaf>
      <leaf name="mask">
        <type name="uint8"/>
        <description>
          <text>interface mask</text>
        </description>
      </leaf>
    </list>
  </container>
</module>

server init:

root@ubuntu:/usr/local/etc/netopeer/vcpe# netopeer-server -v 3
netopeer-server[14584]: Shared memory location: /dev/shm/libnetconfshm
netopeer-server[14584]: Shared memory file libnetconfshm already exists - opening
netopeer-server[14584]: POSIX SHM File Descriptor: 5 (600B).
netopeer-server[14584]: ncds_features_parse: no feature definitions found in data model ietf-inet-types.
netopeer-server[14584]: ncds_features_parse: no feature definitions found in data model ietf-yang-types.
netopeer-server[14584]: ncds_features_parse: no feature definitions found in data model ietf-netconf-monitoring.
netopeer-server[14584]: ncds_features_parse: no feature definitions found in data model ietf-netconf-notifications.
netopeer-server[14584]: ncds_features_parse: no feature definitions found in data model nc-notifications.
netopeer-server[14584]: ncds_features_parse: no feature definitions found in data model notifications.
netopeer-server[14584]: ncds_features_parse: no feature definitions found in data model libnetconf-notifications.
netopeer-server[14584]: ncds_features_parse: no feature definitions found in data model ietf-netconf-with-defaults.
netopeer-server[14584]: ncds_features_parse: no feature definitions found in data model ietf-netconf-acm.
netopeer-server[14584]: ncds_set_validation: Relax NG validator set (//var/lib/libnetconf//ietf-netconf-acm-config.rng)
netopeer-server[14584]: ncds_set_validation: Schematron validator set (//var/lib/libnetconf//ietf-netconf-acm-schematron.xsl)
netopeer-server[14584]: Datastore ietf-netconf-acm initiated with ID 9.
netopeer-server[14584]: Checking the default Events stream path //var/lib/libnetconf//streams/.
netopeer-server[14584]: Adding augment model "/usr/local/etc/netopeer/cfgnetopeer/ietf-x509-cert-to-name.yin"
netopeer-server[14584]: ncds_features_parse: no feature definitions found in data model ietf-x509-cert-to-name.
netopeer-server[14584]: Adding static transapi "/usr/local/etc/netopeer/cfgnetopeer/ietf-netconf-server.yin"
netopeer-server[14584]: ncds_new_internal: Relax NG validator set (/usr/local/etc/netopeer/cfgnetopeer/ietf-netconf-server-config.rng)
netopeer-server[14584]: ncds_new_internal: Schematron validator set (/usr/local/etc/netopeer/cfgnetopeer/ietf-netconf-server-schematron.xsl)
netopeer-server[14584]: "ssh" features in "ietf-netconf-server" module enabled.
netopeer-server[14584]: "inbound-ssh" features in "ietf-netconf-server" module enabled.
netopeer-server[14584]: "outbound-ssh" features in "ietf-netconf-server" module enabled.
netopeer-server[14584]: Datastore ietf-netconf-server initiated with ID 1804289384.
netopeer-server[14584]: Setting the default SSH configuration for the ietf-netconf-server module...
netopeer-server[14584]: callback_srv_netconf_srv_listen_srv_port: SSH listening on the port 830
netopeer-server[14584]: Adding static transapi "/usr/local/etc/netopeer/cfgnetopeer/netopeer-cfgnetopeer.yin"
netopeer-server[14584]: ncds_new_internal: Relax NG validator set (/usr/local/etc/netopeer/cfgnetopeer/netopeer-cfgnetopeer-config.rng)
netopeer-server[14584]: ncds_new_internal: Schematron validator set (/usr/local/etc/netopeer/cfgnetopeer/netopeer-cfgnetopeer-schematron.xsl)
netopeer-server[14584]: "dynamic-modules" features in "netopeer-cfgnetopeer" module enabled.
netopeer-server[14584]: "ssh" features in "netopeer-cfgnetopeer" module enabled.
netopeer-server[14584]: Datastore netopeer-cfgnetopeer initiated with ID 846930887.
netopeer-server[14584]: Setting the default configuration for the cfgnetopeer module...
netopeer-server[14584]: Setting the default configuration for the cfgnetopeer module SSH...
netopeer-server[14584]: Transapi calling callback /A:netopeer/A:modules/A:module/A:enabled with op ADD.
netopeer-server[14584]: Adding transapi "/usr/local/etc/netopeer/vcpe/vcpe.yin"
netopeer-server[14584]: ncds_features_parse: no feature definitions found in data model vcpe.
netopeer-server[14584]: Missing RelaxNG schema for validation (/usr/local/etc/netopeer/vcpe/vcpe-config.rng - No such file or directory).
netopeer-server[14584]: Missing Schematron stylesheet for validation (/usr/local/etc/netopeer/vcpe/vcpe-schematron.xsl - No such file or directory).
netopeer-server[14584]: Datastore vcpe initiated with ID 1681692778.
netopeer-server[14584]: Netopeer server successfully initialized.

edit-config:

root@ubuntu:~# netopeer-cli
netconf> connect localhost
root@localhost password: 
netconf> edit-config 

  Select target datastore (running|startup|candidate|url:<dsturl>): candidate
<?xml version="1.0" encoding="UTF-8"?>
<vcpe xmlns="http://www.raisecom.com/vcpe">
    <interfaces xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
        <interface xc:operation="merge">
            <name>eth0</name>
        </interface>
    </interfaces>
</vcpe>
<!--#
Type the edit configuration data.
-->
                                                                         

  Result OK
netconf> commit
NETCONF error: operation-failed (application) - Failed to apply configuration changes to device.
netconf>`

server print:
`netopeer-server[14584]: SSH log: ssh_socket_pollcallback: Received POLLOUT in connecting state
netopeer-server[14584]: SSH log: callback_receive_banner: Received banner: SSH-2.0-libssh_0.7.5
netopeer-server[14584]: SSH log: ssh_server_connection_callback: SSH client banner: SSH-2.0-libssh_0.7.5
netopeer-server[14584]: SSH log: ssh_analyze_banner: Analyzing banner: SSH-2.0-libssh_0.7.5
netopeer-server[14584]: SSH log: packet_send2: packet: wrote [len=508,padding=10,comp=497,payload=497]
netopeer-server[14584]: SSH log: ssh_socket_unbuffered_write: Enabling POLLOUT for socket
netopeer-server[14584]: SSH log: ssh_packet_socket_callback: packet: read type 20 [len=524,padding=7,comp=516,payload=516]
netopeer-server[14584]: SSH log: ssh_packet_process: Dispatching handler for packet type 20
netopeer-server[14584]: SSH log: crypt_set_algorithms_server: Set output algorithm aes256-ctr
netopeer-server[14584]: SSH log: crypt_set_algorithms_server: Set input algorithm aes256-ctr
netopeer-server[14584]: SSH log: crypt_set_algorithms_server: Set HMAC output algorithm to hmac-sha2-256
netopeer-server[14584]: SSH log: crypt_set_algorithms_server: Set HMAC input algorithm to hmac-sha2-256
netopeer-server[14584]: SSH log: ssh_packet_socket_callback: packet: read type 30 [len=44,padding=6,comp=37,payload=37]
netopeer-server[14584]: SSH log: ssh_packet_process: Dispatching handler for packet type 30
netopeer-server[14584]: SSH log: ssh_packet_kexdh_init: Received SSH_MSG_KEXDH_INIT
netopeer-server[14584]: SSH log: ssh_server_curve25519_init: SSH_MSG_KEX_ECDH_REPLY sent
netopeer-server[14584]: SSH log: ssh_socket_unbuffered_write: Enabling POLLOUT for socket
netopeer-server[14584]: SSH log: packet_send2: packet: wrote [len=604,padding=8,comp=595,payload=595]
netopeer-server[14584]: SSH log: packet_send2: packet: wrote [len=12,padding=10,comp=1,payload=1]
netopeer-server[14584]: SSH log: ssh_server_curve25519_init: SSH_MSG_NEWKEYS sent
netopeer-server[14584]: SSH log: ssh_socket_unbuffered_write: Enabling POLLOUT for socket
netopeer-server[14584]: SSH log: ssh_packet_socket_callback: packet: read type 21 [len=12,padding=10,comp=1,payload=1]
netopeer-server[14584]: SSH log: ssh_packet_process: Dispatching handler for packet type 21
netopeer-server[14584]: SSH log: ssh_packet_newkeys: Received SSH_MSG_NEWKEYS
netopeer-server[14584]: SSH log: ssh_handle_key_exchange: ssh_handle_key_exchange: current state : 7
netopeer-server[14584]: Received an SSH message "request-service" of subtype "ssh-userauth".
netopeer-server[14584]: Received an SSH message "request-auth" of subtype "none".
netopeer-server[14584]: Received an SSH message "request-auth" of subtype "password".
netopeer-server[14584]: User 'root' authenticated.
netopeer-server[14584]: Received an SSH message "request-channel-open" of subtype "session".
netopeer-server[14584]: Received an SSH message "request-channel" of subtype "subsystem".
netopeer-server[14584]: Writing message (session 2): <?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:netconf:capability:candidate:1.0</capability>
    <capability>urn:ietf:params:netconf:capability:startup:1.0</capability>
    <capability>urn:ietf:params:netconf:capability:rollback-on-error:1.0</capability>
    <capability>urn:ietf:params:netconf:capability:interleave:1.0</capability>
    <capability>urn:ietf:params:netconf:capability:notification:1.0</capability>
    <capability>urn:ietf:params:netconf:capability:validate:1.0</capability>
    <capability>urn:ietf:params:netconf:capability:validate:1.1</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:netconf:capability:url:1.0?scheme=scp,file</capability>
    <capability>http://www.raisecom.com/vcpe?module=vcpe&amp;revision=2018-01-24</capability>
    <capability>urn:cesnet:tmc:netopeer:1.0?module=netopeer-cfgnetopeer&amp;revision=2015-05-19&amp;features=ssh,dynamic-modules</capability>
    <capability>urn:ietf:params:xml:ns:yang:ietf-netconf-server?module=ietf-netconf-server&amp;revision=2014-01-24&amp;features=ssh,inbound-ssh,outbound-ssh</capability>
    <capability>urn:ietf:params:xml:ns:yang:ietf-x509-cert-to-name?module=ietf-x509-cert-to-name&amp;revision=2013-03-26</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:ietf-netconf-with-defaults?module=ietf-netconf-with-defaults&amp;revision=2010-06-09</capability>
    <capability>urn:cesnet:params:xml:ns:libnetconf:notifications?module=libnetconf-notifications&amp;revision=2016-07-21</capability>
    <capability>urn:ietf:params:xml:ns:netconf:notification:1.0?module=notifications&amp;revision=2008-07-14</capability>
    <capability>urn:ietf:params:xml:ns:netmod:notification?module=nc-notifications&amp;revision=2008-07-14</capability>
    <capability>urn:ietf:params:xml:ns:yang:ietf-netconf-notifications?module=ietf-netconf-notifications&amp;revision=2012-02-06</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:netconf:base:1.0?module=ietf-netconf&amp;revision=2011-06-01&amp;features=writable-running,candidate,rollback-on-error,validate,startup,url</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-inet-types?module=ietf-inet-types&amp;revision=2013-07-15</capability>
  </capabilities>
  <session-id>2</session-id>
</hello>
netopeer-server[14584]: Received message (session 2): <?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:netconf:capability:candidate:1.0</capability>
    <capability>urn:ietf:params:netconf:capability:startup:1.0</capability>
    <capability>urn:ietf:params:netconf:capability:rollback-on-error:1.0</capability>
  </capabilities>
</hello>
netopeer-server[14584]: Adding new event (5)
netopeer-server[14584]: Created session 2 for user 'root' (UID 0) (recovery)
netopeer-server[14584]: New server session for 'root' with ID 2
netopeer-server[14584]: Received message (session 2): <?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <edit-config>
    <target>
      <candidate/>
    </target>
    <config>
      <vcpe xmlns="http://www.raisecom.com/vcpe">
        <interfaces xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
          <interface xc:operation="merge">
            <name>eth0</name>
          </interface>
        </interfaces>
      </vcpe>
    </config>
  </edit-config>
</rpc>
netopeer-server[14584]: unknown element vcpe!
netopeer-server[14584]: unknown element interfaces!
netopeer-server[14584]: unknown element interface!
netopeer-server[14584]: unknown element name!
netopeer-server[14584]: Merging the node vcpe (src/datastore/edit_config.c:2330)
netopeer-server[14584]: Creating the node vcpe (src/datastore/edit_config.c:1492)
netopeer-server[14584]: Deleting the node vcpe (src/datastore/edit_config.c:1008)
netopeer-server[14584]: Writing message (session 2): <?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <ok/>
</rpc-reply>
netopeer-server[14584]: Received message (session 2): <?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">
  <commit/>
</rpc>
netopeer-server[14584]: Model "vcpe" transAPI: nothing changed.
netopeer-server[14584]: Transapi calling callback /A:netopeer/A:modules/A:module/A:enabled with op REM.
netopeer-server[14584]: Transapi calling callback /A:netopeer/A:modules/A:module/A:enabled with op ADD.
netopeer-server[14584]: Reading configuration for bus module failed
netopeer-server[14584]: Callback for path /A:netopeer/A:modules/A:module/A:enabled failed (1).
netopeer-server[14584]: Transapi calling callback /A:netopeer/A:modules/A:module/A:enabled with op ADD.
netopeer-server[14584]: Adding transapi "/usr/local/etc/netopeer/vcpe/vcpe.yin"
netopeer-server[14584]: ncds_features_parse: no feature definitions found in data model vcpe.
netopeer-server[14584]: Missing RelaxNG schema for validation (/usr/local/etc/netopeer/vcpe/vcpe-config.rng - No such file or directory).
netopeer-server[14584]: Missing Schematron stylesheet for validation (/usr/local/etc/netopeer/vcpe/vcpe-schematron.xsl - No such file or directory).
netopeer-server[14584]: Datastore vcpe initiated with ID 1714636916.
netopeer-server[14584]: Transapi calling callback /A:netopeer/A:modules/A:module/A:enabled with op REM.
netopeer-server[14584]: Updating XML tree after TransAPI callbacks
netopeer-server[14584]: Writing message (session 2): <?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">
  <rpc-error>
    <error-type>application</error-type>
    <error-tag>operation-failed</error-tag>
    <error-severity>error</error-severity>
    <error-message>Failed to apply configuration changes to device.</error-message>
  </rpc-error>
</rpc-reply>`

zhangk90 avatar Apr 13 '18 09:04 zhangk90

hmm, I don't know. Try discard-changes operation before edit-config the candidate or edit-config directly the running. Before the commit, check the content of the candidate via get-config to know what is actually happenning (before any operation, candidate should be the same as running and I'm afraid that in this case it is not).

And if possible, move to Netopeer2, this old version is no more supported, so I cannot spent time by checking what is going on. Sorry.

rkrejci avatar Apr 13 '18 09:04 rkrejci

maybe the path defined error .path = "/xy:vcpe/xy:interfaces/xy:interface/xy:name", .func =callback_xy_vcpe_xy_interfaces_xy_interface_xy_name

anyway,thank you very much

zhangk90 avatar Apr 13 '18 09:04 zhangk90

Hi, you are incorrectly including non-existing container vcpe in the edit-config. It should work with your model with XML:

<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <edit-config>
    <target>
      <candidate/>
    </target>
    <config>
      <interfaces xmlns="http://www.raisecom.com/vcpe" xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
        <interface xc:operation="merge">
          <name>eth0</name>
        </interface>
      </interfaces>
    </config>
  </edit-config>
</rpc>

Regards, Michal

michalvasko avatar Apr 23 '18 12:04 michalvasko