pyangbind
pyangbind copied to clipboard
Problem with `_is_config`
Hello, I have noticed the following. For a model like the following one (excerpt from the openconfig-mpls-sr model):
module test_model {
yang-version "1";
// namespace
namespace "http://openconfig.net/yang/sr";
prefix "oc-sr";
// meta
grouping sr-mpls-top {
container segment-routing {
container aggregate-sid-counters {
list aggregate-sid-counter {
key "mpls-label";
config false;
leaf mpls-label {
type string;
}
}
}
}
}
uses sr-mpls-top;
}
When compiling that model with pyangbind aggregate-sid-counter
will have is_config=True
.
(pyangbind) ➜ pyangbind git:(dbarrosop/is_config_lists) ✗ pyang --plugindir $PYBINDPLUGIN -f pybind test_model.yang | grep aggregate-sid-counter\"
self.__aggregate_sid_counter = YANGDynClass(base=YANGListType("mpls_label",yc_aggregate_sid_counter_test_model__segment_routing_aggregate_sid_counters_aggregate_sid_counter, yang_name="aggregate-sid-counter", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='mpls-label', extensions=None), is_container='list', yang_name="aggregate-sid-counter", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/sr', defining_module='test_model', yang_type='list', is_config=True)
t = YANGDynClass(v,base=YANGListType("mpls_label",yc_aggregate_sid_counter_test_model__segment_routing_aggregate_sid_counters_aggregate_sid_counter, yang_name="aggregate-sid-counter", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='mpls-label', extensions=None), is_container='list', yang_name="aggregate-sid-counter", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/sr', defining_module='test_model', yang_type='list', is_config=True)
'generated-type': """YANGDynClass(base=YANGListType("mpls_label",yc_aggregate_sid_counter_test_model__segment_routing_aggregate_sid_counters_aggregate_sid_counter, yang_name="aggregate-sid-counter", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='mpls-label', extensions=None), is_container='list', yang_name="aggregate-sid-counter", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/sr', defining_module='test_model', yang_type='list', is_config=True)""",
self.__aggregate_sid_counter = YANGDynClass(base=YANGListType("mpls_label",yc_aggregate_sid_counter_test_model__segment_routing_aggregate_sid_counters_aggregate_sid_counter, yang_name="aggregate-sid-counter", parent=self, is_container='list', user_ordered=False, path_helper=self._path_helper, yang_keys='mpls-label', extensions=None), is_container='list', yang_name="aggregate-sid-counter", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions=None, namespace='http://openconfig.net/yang/sr', defining_module='test_model', yang_type='list', is_config=True)
I would expect aggregate-sid-counter
to have is_config=False
as the configuration is explicitly set to false
. I can probably try to patch this, I just wanted to ask if this is a bug or if I am missing something.
Hi David,
This looks like an issue for sure -- let me look at what's going on here and get back to you.
Cheers, r.
I believe this is fixed by https://github.com/robshakir/pyangbind/pull/323 as well
Closing as https://github.com/robshakir/pyangbind/pull/323/ seems to have fixed this. The Commit includes UnitTests that validate the reported issue condition is fixed.