Open tdesh10 opened 4 years ago
This is not a bug. This is the case where you have to supply to _create_rootschema function not only capabilities, but a lookup table as well. These parameters are needed to give YDK mapping of namespaces to YANG module names. In case of JSON encoding the module names are explicitly specified in payload, which allows user create root schema with empty capabilities.
Repository already has all YANG files and can auto-generate such mapping if not specified by the user. There's no reason to ask the user to provide such info if the YANG files have been specified already.
The auto-generation of lookup table is not implemented in YDK. The auto-generation of capabilities list seems not doable, because it requires user knowledge of application of if-features and deviations. The last makes the whole auto-generation idea not reliable. It can be used in first iteration, but not in production applications.
Expected Behavior
ydk.path.Codec.decode(root_schema_node, payload, encoding)
should return the root datanode when root_schema_node uses empty Capabilities list.Current Behavior
ydk.path.Codec.decode(root_schema_node, payload, encoding)
fails with an XML payload and an empty Capabilities list. It does not fail with a JSON payload. Note thatydk.path.Codec.encode(data_node, encoding, pretty)
works correctly when root_schema_node uses empty Capabilities list regardless of the encoding.Steps to Reproduce
Execute the script below in ydk-py docker container.
Your Script
This script produces the following output:
Logs
Output with DEBUG logging
System Information
ydk (0.8.3)
docker run -it ydkdev/ydk-py