grpc/pygui: edit_link will now broadcast link changes, pygui now handles receiving this data

This commit is contained in:
Blake Harnden 2020-06-26 15:14:30 -07:00
parent f921fa45c5
commit f4a3fe6b7b
5 changed files with 34 additions and 6 deletions

View file

@ -509,7 +509,7 @@ class CoreGrpcClient:
:param node_id: node id
:param position: position to set node to
:param icon: path to icon for gui to use for node
:param source: application source editing node
:param source: application source
:param geo: lon,lat,alt location for node
:return: response with result of success or failure
:raises grpc.RpcError: when session or node doesn't exist
@ -625,7 +625,7 @@ class CoreGrpcClient:
:param iface1: node one interface data
:param iface2: node two interface data
:param options: options for link (jitter, bandwidth, etc)
:param source: application source adding link
:param source: application source
:return: response with result of success or failure
:raises grpc.RpcError: when session or one of the nodes don't exist
"""
@ -650,6 +650,7 @@ class CoreGrpcClient:
options: core_pb2.LinkOptions,
iface1_id: int = None,
iface2_id: int = None,
source: str = None,
) -> core_pb2.EditLinkResponse:
"""
Edit a link between nodes.
@ -660,6 +661,7 @@ class CoreGrpcClient:
:param options: options for link (jitter, bandwidth, etc)
:param iface1_id: node one interface id
:param iface2_id: node two interface id
:param source: application source
:return: response with result of success or failure
:raises grpc.RpcError: when session or one of the nodes don't exist
"""
@ -670,6 +672,7 @@ class CoreGrpcClient:
options=options,
iface1_id=iface1_id,
iface2_id=iface2_id,
source=source,
)
return self.stub.EditLink(request)
@ -690,7 +693,7 @@ class CoreGrpcClient:
:param node2_id: node two id
:param iface1_id: node one interface id
:param iface2_id: node two interface id
:param source: application source deleting link
:param source: application source
:return: response with result of success or failure
:raises grpc.RpcError: when session doesn't exist
"""

View file

@ -866,6 +866,7 @@ class CoreGrpcServer(core_pb2_grpc.CoreApiServicer):
node2_id=node2_id,
iface1=iface1_data,
iface2=iface2_data,
options=options,
source=source,
)
session.broadcast_link(link_data)
@ -909,6 +910,19 @@ class CoreGrpcServer(core_pb2_grpc.CoreApiServicer):
key=options_proto.key,
)
session.update_link(node1_id, node2_id, iface1_id, iface2_id, options)
iface1 = InterfaceData(id=iface1_id)
iface2 = InterfaceData(id=iface2_id)
source = request.source if request.source else None
link_data = LinkData(
message_type=MessageFlags.NONE,
node1_id=node1_id,
node2_id=node2_id,
iface1=iface1,
iface2=iface2,
options=options,
source=source,
)
session.broadcast_link(link_data)
return core_pb2.EditLinkResponse(result=True)
def DeleteLink(