From ae6bc78ba45f5a5fdc2bf1e559cbb785644df582 Mon Sep 17 00:00:00 2001 From: Lluis Gifre <lluis.gifre@cttc.es> Date: Tue, 5 Jul 2022 10:58:29 +0200 Subject: [PATCH] PathComp: - Added definition of algorithm in proto file - Minor code comments and TODOs added --- proto/pathcomp.proto | 11 +++++++++++ src/pathcomp/service/PathCompServiceServicerImpl.py | 2 ++ src/pathcomp/tests/Objects.py | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/proto/pathcomp.proto b/proto/pathcomp.proto index 2570456bb..9eb650fb9 100644 --- a/proto/pathcomp.proto +++ b/proto/pathcomp.proto @@ -21,8 +21,19 @@ service PathCompService { rpc Compute(PathCompRequest) returns (PathCompReply) {} } +message Algorithm_ShortestPath {} + +message Algorithm_KShortestPath { + uint32 k_inspection = 1; + uint32 k_return = 2; +} + message PathCompRequest { repeated context.Service services = 1; + oneof algorithm { + Algorithm_ShortestPath shortest_path = 10; + Algorithm_KShortestPath k_shortest_path = 11; + } } message PathCompReply { diff --git a/src/pathcomp/service/PathCompServiceServicerImpl.py b/src/pathcomp/service/PathCompServiceServicerImpl.py index 1bb4470b1..e1c725150 100644 --- a/src/pathcomp/service/PathCompServiceServicerImpl.py +++ b/src/pathcomp/service/PathCompServiceServicerImpl.py @@ -38,6 +38,8 @@ class PathCompServiceServicerImpl(PathCompServiceServicer): context_client = ContextClient() + # TODO: consider filtering resources + grpc_contexts = context_client.ListContexts(Empty()) grpc_devices = context_client.ListDevices(Empty()) grpc_links = context_client.ListLinks(Empty()) diff --git a/src/pathcomp/tests/Objects.py b/src/pathcomp/tests/Objects.py index a3cf10b78..f4785d7ae 100644 --- a/src/pathcomp/tests/Objects.py +++ b/src/pathcomp/tests/Objects.py @@ -93,8 +93,8 @@ LINK_C2_C3_ID, LINK_C2_C3 = compose_link(DEVICE_C2_ENDPOINTS[1], DEVICE_C3_ENDPO # ----- Service -------------------------------------------------------------------------------------------------------- SERVICE_A1_B1 = compose_service(DEVICE_A1_ENDPOINTS[2], DEVICE_B1_ENDPOINTS[2], constraints=[ - json_constraint('bandwidth', 10.0), - json_constraint('latency_ms', 5.0) + json_constraint('bandwidth[gbps]', 10.0), + json_constraint('latency[ms]', 5.0), ]) # ----- Containers ----------------------------------------------------------------------------------------------------- -- GitLab