Hey!
I've been playing around with FreeCONF for some days. In general I like it, and it really helps me to get a better understanding of YANG and RESTCONF. Today I tried to patch/put/post data to a binary leaf, without success. Perhaps you could point me to a solution?
Approach: I follow the "Getting started" tutorial and change the type of message into type binary;. If I start the server, I get the following error:
Starting server...
Traceback (most recent call last):
File ".../freeconf/server.py", line 62, in <module>
browser = main()
File ".../freeconf/server.py", line 55, in main
dev.apply_startup_config_file("./startup.json")
File ".../freeconf/.venv/lib/python3.10/site-packages/freeconf/device.py", line 26, in apply_startup_config_file
self.__apply_startup_config_stream(self.driver.fs.new_rdr_file(configFile))
File ".../freeconf/.venv/lib/python3.10/site-packages/freeconf/device.py", line 36, in __apply_startup_config_stream
self.driver.g_device.ApplyStartupConfig(req)
File ".../freeconf/.venv/lib/python3.10/site-packages/grpc/_channel.py", line 1176, in __call__
return _end_unary_response_blocking(state, call, False, None)
File ".../freeconf/.venv/lib/python3.10/site-packages/grpc/_channel.py", line 1005, in _end_unary_response_blocking
raise _InactiveRpcError(state) # pytype: disable=not-instantiable
grpc._channel._InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
status = StatusCode.UNKNOWN
details = "cannot coerse 'string' to binary value"
debug_error_string = "UNKNOWN:Error received from peer {created_time:"2024-04-09T14:41:51.964747905+02:00", grpc_status:2, grpc_message:"cannot coerse \'string\' to binary value"}"
>
So that didn't go very well. For now, I can remove the "message" key from ./startup.json (so "hello: {}") and start the server again without issues. Then, I try to POST a base64-encoded string as described in RFC7950 as follows:
# base64 encoding of "Hello, world!"
curl -X POST -d '{"message": "SGVsbG8sIHdvcmxkIQ=="}' http://localhost:8080/restconf/data/hello
which returns
cannot coerse 'string' to binary value
Is base64 decoding of JSON strings for binary types not implemented? If it is, what am I doing wrong?
Looking forward to your help.
Hey!
I've been playing around with FreeCONF for some days. In general I like it, and it really helps me to get a better understanding of YANG and RESTCONF. Today I tried to patch/put/post data to a binary leaf, without success. Perhaps you could point me to a solution?
Approach: I follow the "Getting started" tutorial and change the type of
messageintotype binary;. If I start the server, I get the following error:So that didn't go very well. For now, I can remove the
"message"key from./startup.json(so"hello: {}") and start the server again without issues. Then, I try to POST a base64-encoded string as described in RFC7950 as follows:which returns
cannot coerse 'string' to binary valueIs base64 decoding of JSON strings for binary types not implemented? If it is, what am I doing wrong?
Looking forward to your help.