telekom / sysrepo-plugin-interfaces

BSD 3-Clause "New" or "Revised" License
10 stars 18 forks source link

[Error] No data found for interface/description #3

Closed minhix closed 2 years ago

minhix commented 2 years ago

I have a problem starting sysrepo-plugin-interfaces. Please help!

pi@raspberrypi:~ $ sudo sysrepo-plugin-interfaces 
[INF] Applying scheduled changes.
[INF] No scheduled changes.
[INF] Datastore copied from <startup> to <running>.
[INF] Connection 1 created.
[INF] Session 1 (user "root", CID 1) created.
[ERR] No data found for "/ietf-interfaces:interfaces/interface[name="lo"]/description".
[ERR] PLG: sr_get_item error (5): Item not found
[ERR] PLG: get_interface_description error
[ERR] No data found for "/ietf-interfaces:interfaces/interface[name="eth0"]/description".
[ERR] PLG: sr_get_item error (5): Item not found
[ERR] PLG: get_interface_description error
[ERR] No data found for "/ietf-interfaces:interfaces/interface[name="wlan0"]/description".
[ERR] PLG: sr_get_item error (5): Item not found
[ERR] PLG: get_interface_description error
[INF] PLG: start session to startup datastore
[INF] Session 2 (user "root", CID 1) created.
[INF] PLG: running DS is empty, loading data
[ERR] Invalid identityref "iana-if-type:softwareLoopback" value - unable to map prefix to YANG schema.
[ERR] Invalid datastore edit.
[ERR] PLG: sr_set_item_str error (1): Invalid argument
[ERR] PLG: load_data error
[ERR] PLG: sr_plugin_init_cb error
[INF] PLG: plugin cleanup finished
[INF] No datastore changes to apply.

Interfaces on the device:

pi@raspberrypi:~ $ ifconfig 
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.10.1.212  netmask 255.255.0.0  broadcast 10.10.255.255
        inet6 fe80::ad51:4729:d493:e0d6  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:55:6a:f9  txqueuelen 1000  (Ethernet)
        RX packets 232  bytes 19601 (19.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 67  bytes 10510 (10.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 14  bytes 1800 (1.7 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 14  bytes 1800 (1.7 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether b8:27:eb:00:3f:ac  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
iffy50 commented 2 years ago

Is the loopback feature enabled? sudo sysrepoctl -c ietf-if-extensions -e loopback

You can check: `sudo sysrepoctl -l Sysrepo repository: /etc/sysrepo

Module Name | Revision | Flags | Owner | Permissions | Submodules | Features ietf-if-extensions | 2020-07-29 | I | root:root | 600 | | loopback sub-interfaces`

feelqah commented 2 years ago

Hi, you didn't install the iana-if-type YANG module, that is why you are getting the error: [ERR] Invalid identityref "iana-if-type:softwareLoopback" value - unable to map prefix to YANG schema.

You can install it with: sudo sysrepoctl -i ./yang/iana-if-type@2017-01-19.yang

You will also have to install the ietf-ip module for the plugin to work: sudo sysrepoctl -i ./yang/ietf-ip@2018-02-22.yang

It would be best to install all the necessary modules first as stated in the README doc.

In addition, if you are going to use the parent-interface node from the ietf-if-extensions module you will have to enable the sub-interfaces feature: sudo sysrepoctl --change ietf-if-extensions --enable-feature sub-interfaces

minhix commented 2 years ago

Thank iffy50 and feelqah for the hints!

Unfortunately, after trying to enable the loopback feature, now I get a new error.

pi@raspberrypi:~/Dev $ sudo sysrepoctl -l -v3
[INF] Applying scheduled changes.
[ERR] Internal error (/home/pi/Dev/sysrepo/src/lyd_mods.c:1239).
[ERR] Failed to update data for the new context.
sysrepoctl error: Failed to connect (Operation failed)

Here is what I found in lyd_mods.c:1239

        /* get SHM mod */
        shm_mod = sr_shmmain_find_module(SR_CONN_MAIN_SHM(conn), ly_mod->name);
        SR_CHECK_INT_RET(!shm_mod, err_info);
minhix commented 2 years ago

OK! I can fix the aforementioned problem by running sudo make sr_clean in sysrepo/build

I also figured out what was the problem with my node.

The problem is that I blindly add yang models following the README from https://github.com/telekom/sysrepo-plugin-interfaces. So I added ietf-if-type before ietf-interface

That seems to be wrong. After checking the error message, I added the ietf-interface and then ietf-if-type. Then now it works for me

minhix commented 2 years ago

So please double-check and update the README if needed

feelqah commented 2 years ago

Great :) Thanks for noticing this. I'll update the README. You should have gotten an error though, because iana-if-type depends on ietf-interfaces module:

sudo sysrepoctl -i  yang/iana-if-type@2017-01-19.yang

[ERR] Data model "ietf-interfaces" not found in local searchdirs.
[ERR] Loading "ietf-interfaces" module failed.
[ERR] Parsing module "iana-if-type" failed.
sysrepoctl error: Failed to install module "yang/iana-if-type@2017-01-19.yang" (libyang error)
For more details you may try to increase the verbosity up to "-v3".