From 2987c805b834489689d6cbe263ca7d183729e278 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20B=C3=BCchse?= Date: Fri, 12 Jan 2024 15:41:58 +0100 Subject: [PATCH] Automatically find external network MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Matthias Büchse --- Tests/iaas/entropy/entropy-check.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Tests/iaas/entropy/entropy-check.py b/Tests/iaas/entropy/entropy-check.py index 52968806a..9ae36de22 100755 --- a/Tests/iaas/entropy/entropy-check.py +++ b/Tests/iaas/entropy/entropy-check.py @@ -188,9 +188,16 @@ def prepare(self): }], dns_nameservers=["9.9.9.9"], ) - external_gateway_net_id = \ - "585ec5ec-5993-4042-93b9-264b0d82ac8e" - # "ebfe5546-f09f-4f42-ab54-094e457d42ec" + external_networks = list(self.conn.network.networks(is_router_external=True)) + if not external_networks: + raise RuntimeError("No external network found!") + if len(external_networks) > 1: + logger.debug( + "More than one external network found: " + + ', '.join([n.id for n in external_networks]) # noqa: W503 + ) + external_gateway_net_id = external_networks[0].id + logger.debug(f"Using external network {external_gateway_net_id}.") self.router = self.conn.create_router( ROUTER_NAME, ext_gateway_net_id=external_gateway_net_id, )