Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
OpenConfig implementation in IOS-XRv is order-specific when sending JSON over gRPC #4
NB: This is the gRPC client "grpc_cfg.py" I am using based off of the public Cisco example: https://gist.github.com/jwbensley/cd2f5bfacee321328ca638b5b5523bd9
NB: This is using the IOS-XRv 6.2.1 stable vagrant image from https://devhub.cisco.com/artifactory/appdevci-release/XRv64/6.2.1/ dated 17th Oct 2016
OpenConfig with Pyangbind (v0.5.8) is producing configuration when serialized to JSON in the below order; the key point here is that in the IPv4 config
The below works (but I have to manually re-order the statements (also note the case sensitive issue must be corrected):
I am filling the OpenConfig object "in order" however this might just come down to the PyangBind serialization into an unordered dict; so I have to manually reorder the items so the the JSON is in the correct order:
This is the error message I get because the "config" section is before the "afi-safi-name" section:
Are the OpenConfig YANG modules defining a strict order that the data should be sent in via JSON? I would expect all data to be sent to the gRPC server and for it evaluate it once it has received it all. It seems like it is receiving the "config" section and then generating the error, even though the "afi-safi-name" section is coming.
The JSON parsing logic in current releases of XR is following NETCONF XML parsing rules, which specifies that the keys must come first and in the correct order. This behavior will need to change to reflect the non-ordered nature of attributes in JSON objects. I don't have a target release date for that as yet.