diff --git a/CHANGELOG.md b/CHANGELOG.md index d70a2af5..1f034e91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 # Unreleased ### Fixed +- ERO Support (Issue [#338](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/338)) - List hosts (Issue [#331](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/331)) - AL2S Support (Issue [#325](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/325)) - Deny infeasible slices (Issue [#326](https://github.com/fabric-testbed/fabrictestbed-extensions/issues/326)) diff --git a/fabrictestbed_extensions/fablib/network_service.py b/fabrictestbed_extensions/fablib/network_service.py index 082301bc..da1f2bc2 100644 --- a/fabrictestbed_extensions/fablib/network_service.py +++ b/fabrictestbed_extensions/fablib/network_service.py @@ -126,7 +126,9 @@ def get_fim_network_service_types() -> List[str]: ) @staticmethod - def __calculate_l2_nstype(interfaces: List[Interface] = None, ero_enabled: bool = False) -> ServiceType: + def __calculate_l2_nstype( + interfaces: List[Interface] = None, ero_enabled: bool = False + ) -> ServiceType: """ Not inteded for API use @@ -170,9 +172,9 @@ def __calculate_l2_nstype(interfaces: List[Interface] = None, ero_enabled: bool # L2PTP limitation for Facility Ports: # basically the layer-2 point-to-point server template applied is not popping # vlan tags over the MPLS tunnel between two facility ports. - if (((includes_facility_port and facility_port_interfaces < 2) or ero_enabled) - and not basic_nic_count - ): + if ( + (includes_facility_port and facility_port_interfaces < 2) or ero_enabled + ) and not basic_nic_count: # For now WAN FacilityPorts require L2PTP rtn_nstype = NetworkService.network_service_map["L2PTP"] elif len(interfaces) >= 2: @@ -431,7 +433,9 @@ def new_l2network( NetworkService.__validate_nstype(nstype, interfaces) # Set default VLANs for P2P networks that did not pass in VLANs - if nstype == ServiceType.L2PTP and len(interfaces): # or nstype == ServiceType.L2STS: + if nstype == ServiceType.L2PTP and len( + interfaces + ): # or nstype == ServiceType.L2STS: vlan1 = interfaces[0].get_vlan() vlan2 = interfaces[1].get_vlan() @@ -1136,7 +1140,9 @@ def add_interface(self, interface: Interface): curr_nstype = self.get_type() if self.get_layer() == NSLayer.L2: ero_enabled = True if self.get_fim().ero else False - new_nstype = NetworkService.__calculate_l2_nstype(interfaces=new_interfaces, ero_enabled=ero_enabled) + new_nstype = NetworkService.__calculate_l2_nstype( + interfaces=new_interfaces, ero_enabled=ero_enabled + ) if curr_nstype != new_nstype: self.__replace_network_service(new_nstype) else: @@ -1179,7 +1185,9 @@ def remove_interface(self, interface: Interface): curr_nstype = self.get_type() if self.get_layer() == NSLayer.L2: ero_enabled = True if self.get_fim().ero else False - new_nstype = NetworkService.__calculate_l2_nstype(interfaces=interfaces, ero_enabled=ero_enabled) + new_nstype = NetworkService.__calculate_l2_nstype( + interfaces=interfaces, ero_enabled=ero_enabled + ) if curr_nstype != new_nstype: self.__replace_network_service(new_nstype) @@ -1383,17 +1391,22 @@ def set_l2_route_hops(self, hops: List[str]): interfaces = self.get_interfaces() - if len(interfaces) != 2 or self.get_type() not in [ServiceType.L2STS, ServiceType.L2PTP]: - raise Exception("Network path can only be specified for a Point to Point Layer2 connection!") + if len(interfaces) != 2 or self.get_type() not in [ + ServiceType.L2STS, + ServiceType.L2PTP, + ]: + raise Exception( + "Network path can only be specified for a Point to Point Layer2 connection!" + ) ifs_sites = [] for ifs in interfaces: ifs_sites.append(ifs.get_site()) resources = self.get_fablib_manager().get_resources() - resources.validate_requested_ero_path(source=ifs_sites[0], - end=ifs_sites[1], - hops=hops) + resources.validate_requested_ero_path( + source=ifs_sites[0], end=ifs_sites[1], hops=hops + ) p = Path() p.set_symmetric(hops) e = ERO() diff --git a/fabrictestbed_extensions/fablib/resources.py b/fabrictestbed_extensions/fablib/resources.py index c9b9d7f6..9f8f90e7 100644 --- a/fabrictestbed_extensions/fablib/resources.py +++ b/fabrictestbed_extensions/fablib/resources.py @@ -836,11 +836,13 @@ def validate_requested_ero_path(self, source: str, end: str, hops: List[str]): if not source_site or not end_site: raise Exception(f"Source {source} or End: {end} is not found!") - path = self.get_fim().graph_model.get_nodes_on_path_with_hops(node_a=source_site.node_id, - node_z=end_site.node_id, - hops=hop_sites_node_ids) + path = self.get_fim().graph_model.get_nodes_on_path_with_hops( + node_a=source_site.node_id, node_z=end_site.node_id, hops=hop_sites_node_ids + ) if not path or not len(path): - raise Exception(f"Requested path via {hops} between {source} and {end} is invalid!") + raise Exception( + f"Requested path via {hops} between {source} and {end} is invalid!" + ) class Links(Resources): diff --git a/fabrictestbed_extensions/fablib/site.py b/fabrictestbed_extensions/fablib/site.py index 18b69186..b3943581 100644 --- a/fabrictestbed_extensions/fablib/site.py +++ b/fabrictestbed_extensions/fablib/site.py @@ -699,6 +699,7 @@ def __load_hosts(self): """ try: from fim.user import NodeType + for c_name, child in self.site.children.items(): if child.type == NodeType.Server: self.hosts[child.name] = Host(