From 3541aebb03ba234b9b4b64d37e8747a31f9607d3 Mon Sep 17 00:00:00 2001 From: Abdelilah Essiari Date: Fri, 2 Feb 2024 12:46:00 -0800 Subject: [PATCH] minor fixes for adding/removing interfaces --- fabrictestbed_extensions/fablib/network_service.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fabrictestbed_extensions/fablib/network_service.py b/fabrictestbed_extensions/fablib/network_service.py index 442df7e6..fd8994a5 100644 --- a/fabrictestbed_extensions/fablib/network_service.py +++ b/fabrictestbed_extensions/fablib/network_service.py @@ -988,9 +988,13 @@ def get_interfaces(self) -> List[Interface]: self.interfaces = [] for interface in self.get_fim_network_service().interface_list: logging.debug(f"interface: {interface}") - self.interfaces.append( - self.get_slice().get_interface(name=interface.name) - ) + + try: + self.interfaces.append( + self.get_slice().get_interface(name=interface.name) + ) + except: + logging.warning(f"interface not found: {interface.name}") return self.interfaces @@ -1190,6 +1194,9 @@ def set_allocated_ips(self, allocated_ips: dict[IPv4Address or IPv6Address]): for ip in allocated_ips: allocated_ips_strs.append(str(ip)) + if "subnet" not in fablib_data: + fablib_data["subnet"] = {} + fablib_data["subnet"]["allocated_ips"] = allocated_ips_strs self.set_fablib_data(fablib_data)