grpc: updated client methods to allow passing source for add_link/delete_link, None by default
This commit is contained in:
parent
aebbff8c22
commit
f921fa45c5
2 changed files with 9 additions and 3 deletions
|
@ -614,6 +614,7 @@ class CoreGrpcClient:
|
|||
iface1: core_pb2.Interface = None,
|
||||
iface2: core_pb2.Interface = None,
|
||||
options: core_pb2.LinkOptions = None,
|
||||
source: str = None,
|
||||
) -> core_pb2.AddLinkResponse:
|
||||
"""
|
||||
Add a link between nodes.
|
||||
|
@ -624,6 +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
|
||||
:return: response with result of success or failure
|
||||
:raises grpc.RpcError: when session or one of the nodes don't exist
|
||||
"""
|
||||
|
@ -635,7 +637,9 @@ class CoreGrpcClient:
|
|||
iface2=iface2,
|
||||
options=options,
|
||||
)
|
||||
request = core_pb2.AddLinkRequest(session_id=session_id, link=link)
|
||||
request = core_pb2.AddLinkRequest(
|
||||
session_id=session_id, link=link, source=source
|
||||
)
|
||||
return self.stub.AddLink(request)
|
||||
|
||||
def edit_link(
|
||||
|
@ -676,6 +680,7 @@ class CoreGrpcClient:
|
|||
node2_id: int,
|
||||
iface1_id: int = None,
|
||||
iface2_id: int = None,
|
||||
source: str = None,
|
||||
) -> core_pb2.DeleteLinkResponse:
|
||||
"""
|
||||
Delete a link between nodes.
|
||||
|
@ -685,6 +690,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
|
||||
:return: response with result of success or failure
|
||||
:raises grpc.RpcError: when session doesn't exist
|
||||
"""
|
||||
|
@ -694,6 +700,7 @@ class CoreGrpcClient:
|
|||
node2_id=node2_id,
|
||||
iface1_id=iface1_id,
|
||||
iface2_id=iface2_id,
|
||||
source=source,
|
||||
)
|
||||
return self.stub.DeleteLink(request)
|
||||
|
||||
|
|
|
@ -833,12 +833,11 @@ class Session:
|
|||
for handler in self.config_handlers:
|
||||
handler(config_data)
|
||||
|
||||
def broadcast_link(self, link_data: LinkData, source: str = None) -> None:
|
||||
def broadcast_link(self, link_data: LinkData) -> None:
|
||||
"""
|
||||
Handle link data that should be provided to link handlers.
|
||||
|
||||
:param link_data: link data to send out
|
||||
:param source: source of broadcast, None by default
|
||||
:return: nothing
|
||||
"""
|
||||
for handler in self.link_handlers:
|
||||
|
|
Loading…
Reference in a new issue