pyang gives a warning imported module "b" not used when the only use of the b module is in a somewhat complex must expression such as: must "not(deref(.)/a:gizmo-attrs/b:b-attributes)". If I add to the same module an expression such as must "not(/a:gizmos/a:gizmo-attrs/b:b-attribute)", then I no longer get that warning.
module a {
namespace "urn:a";
prefix a;
list gizmos {
key "gizmo-name";
leaf gizmo-name {
type string;
}
container gizmo-attrs {
// to be augmented by other modules
}
}
}
b.yang
module b {
namespace "urn:b";
prefix b;
import a {
prefix a;
}
augment /a:gizmos/a:gizmo-attrs {
leaf b-attribute {
type boolean;
}
}
}
c.yang
module c {
namespace "urn:c";
prefix c;
import a {
prefix a;
}
import b {
prefix b;
}
list c-widget {
key "widget-name";
leaf widget-name {
type string;
}
// to define a C widget, we need an A gizmo, but those with b-attributes are not usable
leaf a-gizmo {
type leafref {
path "/a:gizmos/a:gizmo-name";
}
must "not(deref(.)/a:gizmo-attrs/b:b-attributes)" {
error-message "Cannot use a gizmo that has b-attributes";
}
}
}
}
Hi,
pyang gives a warning
imported module "b" not used
when the only use of theb
module is in a somewhat complex must expression such as:must "not(deref(.)/a:gizmo-attrs/b:b-attributes)"
. If I add to the same module an expression such asmust "not(/a:gizmos/a:gizmo-attrs/b:b-attribute)"
, then I no longer get that warning.I added a testcase to github.com/fperrin/pyang branch fred-pyang-unused-module-warning, that is: https://github.com/fperrin/pyang/tree/fred-pyang-unused-module-warning/test/test_issues/test_unused_prefix
Or if that's easier:
a.yang
b.yang
c.yang