RootNode.validate() fails when node represents an `action`
Closed this issue · 3 comments
kwatsen commented
In the xml-improved
fork, there are two nearly identical tests:
- test_xml_rpc()
- test_xml_action()
test_xml_rpc()
passes, but test_xml_action()
with the message:
yangson.exceptions.SchemaError: [/] member-not-allowed: test:output
Why does the identical code work for an rpc
but not an action
? They are both instances of the same RpcActionNode
class...
kwatsen commented
I should add that this issue is NOT XML-specific.
The relevant code is:
output_obj = {
"test:output" : {
"leafL" : True
}
}
# get the schema node for the 'action'
sn_action = data_model.get_schema_node("/test:contA/listA/contD/acA")
assert(type(sn_action) == RpcActionNode)
# convert raw object to an InstanceValue
output_inst_val = sn_action.from_raw(output_obj, allow_nodata=True)
assert(str(output_inst_val) == str(output_obj))
# convert InstanceValue to an Instance (a RootNode)
output_inst = RootNode(output_inst_val, sn_action, data_model.schema_data, output_inst_val.timestamp)
#output_inst.validate(ctype=ContentType.all) # fails, see Issue #88
Again, identical code validating an RPC's output
works fine.
llhotka commented
Fixed in version 1.3.65.
llhotka commented
Kent Watsen <notifications@github.com> writes:
In the `xml-improved` fork, there are two nearly identical tests:
1. test_xml_rpc()
2. test_xml_action()
`test_xml_rpc()` passes, but `test_xml_action()` with the message:
```
yangson.exceptions.SchemaError: [/] member-not-allowed: test:output
```
Why does the identical code work for an `rpc` but not an `action`? They are both instances of the same `RpcActionNode` class...
Because action schema node has a data node ancestor whereas rpc schema node doesn't.
It's now fixed in version PyPI 1.3.65.
Cheers, Lada
…
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
#88
--
Ladislav Lhotka
Head, CZ.NIC Labs
PGP Key ID: 0xB8F92B08A9F76C67