From a39a5b671e7b770900e844984e5564a47d246124 Mon Sep 17 00:00:00 2001 From: Patryk Wrobel Date: Fri, 23 Feb 2024 12:44:04 +0100 Subject: [PATCH] pylib/rest_client.py: add ownership API to ScyllaRESTAPIClient This change adds a member function that can be used to access 'storage_service/ownership' API. It will be used by tests that need to access this API. Refs: scylladb#17342 Signed-off-by: Patryk Wrobel --- test/pylib/rest_client.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/pylib/rest_client.py b/test/pylib/rest_client.py index 64e7a288bd..5125d974f4 100644 --- a/test/pylib/rest_client.py +++ b/test/pylib/rest_client.py @@ -162,6 +162,17 @@ class ScyllaRESTAPIClient(): assert(type(data) == list) return data + async def get_ownership(self, dst_server_ip: IPAddress, keyspace: str = None, table: str = None) -> list: + """Retrieve the ownership""" + if keyspace is None and table is None: + api_path = f"/storage_service/ownership/" + elif table is None: + api_path = f"/storage_service/ownership/{keyspace}" + else: + api_path = f"/storage_service/ownership/{keyspace}?cf={table}" + data = await self.client.get_json(api_path, dst_server_ip) + return data + async def get_down_endpoints(self, node_ip: IPAddress) -> list[IPAddress]: """Retrieve down endpoints from gossiper's point of view """ data = await self.client.get_json("/gossiper/endpoint/down/", node_ip)