diff --git a/pkgs/clan-cli/clan_cli/config.py b/pkgs/clan-cli/clan_cli/config.py index 1891573..f50cd8b 100644 --- a/pkgs/clan-cli/clan_cli/config.py +++ b/pkgs/clan-cli/clan_cli/config.py @@ -1,8 +1,10 @@ host = "127.0.0.1" port_dlg = 7000 port_ap = 7500 -port_client_base = 8000 +_port_client_base = 8000 +c1_port = _port_client_base + 1 +c2_port = _port_client_base + 2 dlg_url = f"http://{host}:{port_dlg}/docs" ap_url = f"http://{host}:{port_ap}/docs" -c1_url = f"http://{host}:{port_client_base}/docs" -c2_url = f"http://{host}:{port_client_base + 1}/docs" +c1_url = f"http://{host}:{c1_port}/docs" +c2_url = f"http://{host}:{c2_port}/docs" diff --git a/pkgs/clan-cli/clan_cli/emulate_fastapi.py b/pkgs/clan-cli/clan_cli/emulate_fastapi.py index 982a1fb..6991680 100644 --- a/pkgs/clan-cli/clan_cli/emulate_fastapi.py +++ b/pkgs/clan-cli/clan_cli/emulate_fastapi.py @@ -17,8 +17,8 @@ app_c2 = FastAPI(swagger_ui_parameters={"tryItOutEnabled": True}) apps = [ (app_dlg, config.port_dlg), (app_ap, config.port_ap), - (app_c1, config.port_client_base), - (app_c2, config.port_client_base + 1), + (app_c1, config.c1_port), + (app_c2, config.c2_port), ] @@ -79,7 +79,7 @@ def get_health(*, url: str, max_retries: int = 20, delay: float = 0.2) -> str | # TODO send_msg??? -@app_c1.get("/consume_service_from_other_entity", response_class=HTMLResponse) +@app_c1.get("/v1/print_daemon1", response_class=HTMLResponse) async def consume_service_from_other_entity_c1() -> HTMLResponse: html_content = """ @@ -92,7 +92,17 @@ async def consume_service_from_other_entity_c1() -> HTMLResponse: return HTMLResponse(content=html_content, status_code=200) -@app_c2.get("/consume_service_from_other_entity", response_class=HTMLResponse) +@app_c1.get("/v1/print_daemon1/register", response_class=JSONResponse) +async def register_c1() -> JSONResponse: + return JSONResponse(content={"status": "registered"}, status_code=200) + + +@app_c1.get("/v1/print_daemon1/deregister", response_class=JSONResponse) +async def deregister_c1() -> JSONResponse: + return JSONResponse(content={"status": "deregistered"}, status_code=200) + + +@app_c2.get("/v1/print_daemon2", response_class=HTMLResponse) async def consume_service_from_other_entity_c2() -> HTMLResponse: html_content = """ @@ -105,6 +115,16 @@ async def consume_service_from_other_entity_c2() -> HTMLResponse: return HTMLResponse(content=html_content, status_code=200) +@app_c2.get("/v1/print_daemon1/register", response_class=JSONResponse) +async def register_c2() -> JSONResponse: + return JSONResponse(content={"status": "registered"}, status_code=200) + + +@app_c2.get("/v1/print_daemon1/deregister", response_class=JSONResponse) +async def deregister_c2() -> JSONResponse: + return JSONResponse(content={"status": "deregistered"}, status_code=200) + + @app_ap.get("/ap_list_of_services", response_class=JSONResponse) async def ap_list_of_services() -> JSONResponse: res = [ diff --git a/pkgs/clan-cli/tests/test_db_api.py b/pkgs/clan-cli/tests/test_db_api.py index 14694cf..f17d7bd 100644 --- a/pkgs/clan-cli/tests/test_db_api.py +++ b/pkgs/clan-cli/tests/test_db_api.py @@ -26,7 +26,7 @@ random.seed(42) host = config.host port_dlg = config.port_dlg port_ap = config.port_ap -port_client_base = config.port_client_base +port_client_base = config._port_client_base num_uuids = 100 uuids = [str(uuid.UUID(int=random.getrandbits(128))) for i in range(num_uuids)] @@ -38,7 +38,7 @@ def test_health(api_client: ApiClient) -> None: assert res.status == Status.ONLINE -def create_entities(num: int = 10, role: str = "entity") -> list[EntityCreate]: +def create_entities(num: int = 5, role: str = "entity") -> list[EntityCreate]: res = [] for i in range(num): en = EntityCreate( @@ -108,10 +108,9 @@ def test_create_services(api_client: ApiClient) -> None: sapi = ServicesApi(api_client=api_client) eapi = EntitiesApi(api_client=api_client) for midx, entity in enumerate(eapi.get_all_entities()): - for idx in range(4): - service_obj = create_service(idx + 4 * midx, entity) - service = sapi.create_service(service_obj) - assert service.uuid == service_obj.uuid + service_obj = create_service(midx, entity) + service = sapi.create_service(service_obj) + assert service.uuid == service_obj.uuid random.seed(77) diff --git a/pkgs/ui/src/components/sidebar/index.tsx b/pkgs/ui/src/components/sidebar/index.tsx index b56c213..c2519ff 100644 --- a/pkgs/ui/src/components/sidebar/index.tsx +++ b/pkgs/ui/src/components/sidebar/index.tsx @@ -45,6 +45,18 @@ const menuEntityEntries: MenuEntry[] = [ to: "/client/C2", disabled: false, }, + { + icon: , + label: "C3", + to: "/client/C3", + disabled: false, + }, + { + icon: , + label: "C4", + to: "/client/C4", + disabled: false, + }, ]; const menuEntries: MenuEntry[] = [