-
Notifications
You must be signed in to change notification settings - Fork 247
Description
I found a problem where installing a module that includes a submodule that imports another module breaks sysrepo internal state. I modified the existing tests/files/sub-mod.yang
in this repository to import another module sub-mod-types.yang
. The parent module tests/files/main-mod.yang
remains unchanged.
submodule sub-mod {
belongs-to main-mod {
prefix mm;
}
import sub-mod-types {
prefix smt;
}
feature feat;
leaf sub-leaf {
type smt:sub-type;
}
}
module sub-mod-types {
namespace "urn:sub-mod-types";
prefix smt;
typedef sub-type {
type string;
}
}
I then install main-mod.yang
in a clean sysrepo and expect the dependencies to be resolved. I intentionally did not install sub-mod-types.yang
because imported modules are installed automatically. sysrepo is left in a broken state - other sysrepoctl
operations fail:
root@779ce0db8fc7:/src/sysrepo/tests/files# sysrepoctl --install main-mod.yang --search-dirs . -v4
[INF] Connection 2 created.
[INF] Module "main-mod" was installed.
[INF] File "main-mod.yang" was installed.
[INF] File "sub-mod.yang" was installed.
[INF] No datastore changes to apply.
root@779ce0db8fc7:/src/sysrepo/tests/files# sysrepoctl -l
[ERR] Data model "sub-mod-types" not found in local searchdirs.
[ERR] Loading "sub-mod-types" module failed.
[ERR] Parsing submodule "sub-mod" failed.
[ERR] Including "sub-mod" submodule into "main-mod" failed.
[ERR] Parsing module "main-mod" failed.
[ERR] Loading "main-mod" module failed.
sysrepoctl error: Failed to connect (libyang error)
For more details you may try to increase the verbosity up to "-v3".
I built libyang and sysrepo using the latest devel branches. I extended the existing tests/test_module.c
module load test in my own branch: https://github.com/mzagozen/sysrepo/tree/test-submodule-import