From 559cac18e8f2f9fec6a73f4a0742a2338fc489ca Mon Sep 17 00:00:00 2001 From: Blake Harnden <32446120+bharnden@users.noreply.github.com> Date: Fri, 1 Apr 2022 21:23:58 -0700 Subject: [PATCH] grpc: fixed wireless config client/server --- daemon/core/api/grpc/client.py | 2 ++ daemon/core/api/grpc/grpcutils.py | 16 ++++++++++++++++ daemon/core/api/grpc/server.py | 2 ++ 3 files changed, 20 insertions(+) diff --git a/daemon/core/api/grpc/client.py b/daemon/core/api/grpc/client.py index 45af5728..a8cb324a 100644 --- a/daemon/core/api/grpc/client.py +++ b/daemon/core/api/grpc/client.py @@ -1112,6 +1112,8 @@ class CoreGrpcClient: options1: LinkOptions, options2: LinkOptions = None, ) -> None: + if options2 is None: + options2 = options1 request = WirelessConfigRequest( session_id=session_id, wireless_id=wireless_id, diff --git a/daemon/core/api/grpc/grpcutils.py b/daemon/core/api/grpc/grpcutils.py index e2cba7e9..1080f9ff 100644 --- a/daemon/core/api/grpc/grpcutils.py +++ b/daemon/core/api/grpc/grpcutils.py @@ -476,6 +476,22 @@ def convert_link_options(options: LinkOptions) -> core_pb2.LinkOptions: ) +def convert_options_proto(options: core_pb2.LinkOptions) -> LinkOptions: + return LinkOptions( + delay=options.delay, + bandwidth=options.bandwidth, + loss=options.loss, + dup=options.dup, + jitter=options.jitter, + mer=options.mer, + burst=options.burst, + mburst=options.mburst, + buffer=options.buffer, + unidirectional=options.unidirectional, + key=options.key, + ) + + def convert_link( node1: NodeBase, iface1: Optional[CoreInterface], diff --git a/daemon/core/api/grpc/server.py b/daemon/core/api/grpc/server.py index 4bc5aab1..9754740d 100644 --- a/daemon/core/api/grpc/server.py +++ b/daemon/core/api/grpc/server.py @@ -1355,5 +1355,7 @@ class CoreGrpcServer(core_pb2_grpc.CoreApiServicer): options2 = options1 if request.HasField("options2"): options2 = request.options2 + options1 = grpcutils.convert_options_proto(options1) + options2 = grpcutils.convert_options_proto(options2) wireless.link_config(request.node1_id, request.node2_id, options1, options2) return WirelessConfigResponse()