diff --git a/pacman/model/resources/iptag_resource.py b/pacman/model/resources/iptag_resource.py index 72a5d2ead..4e6ea3206 100644 --- a/pacman/model/resources/iptag_resource.py +++ b/pacman/model/resources/iptag_resource.py @@ -36,7 +36,7 @@ class IPtagResource(object): "_traffic_identifier") def __init__( - self, ip_address: Optional[str], port: Optional[int], + self, ip_address: str, port: int, strip_sdp: bool, tag: Optional[int] = None, traffic_identifier: str = "DEFAULT"): """ @@ -60,7 +60,7 @@ def __init__( self._traffic_identifier = traffic_identifier @property - def ip_address(self) -> Optional[str]: + def ip_address(self) -> str: """ The IP address to assign to the tag. @@ -69,7 +69,7 @@ def ip_address(self) -> Optional[str]: return self._ip_address @property - def port(self) -> Optional[int]: + def port(self) -> int: """ The port of the tag. diff --git a/pacman/model/tags/tags.py b/pacman/model/tags/tags.py index 83c11537d..577fdb3f8 100644 --- a/pacman/model/tags/tags.py +++ b/pacman/model/tags/tags.py @@ -133,13 +133,12 @@ def add_reverse_ip_tag( "reverse_ip_tag", reverse_ip_tag, "The port has already been assigned on the given board") + board_address = reverse_ip_tag.board_address self._reverse_ip_tags[ - (reverse_ip_tag.board_address, - reverse_ip_tag.tag)] = reverse_ip_tag + (board_address, reverse_ip_tag.tag)] = reverse_ip_tag self._reverse_ip_tags_by_vertex[vertex].append(reverse_ip_tag) if reverse_ip_tag.port is not None: - self._ports_assigned.add( - (reverse_ip_tag.board_address, reverse_ip_tag.port)) + self._ports_assigned.add((board_address, reverse_ip_tag.port)) @property def ip_tags_vertices(self) -> Iterable[Tuple[IPTag, MachineVertex]]: diff --git a/pacman/operations/tag_allocator_algorithms/basic_tag_allocator.py b/pacman/operations/tag_allocator_algorithms/basic_tag_allocator.py index 5120515ff..39a62065a 100644 --- a/pacman/operations/tag_allocator_algorithms/basic_tag_allocator.py +++ b/pacman/operations/tag_allocator_algorithms/basic_tag_allocator.py @@ -125,8 +125,10 @@ def __find_free_tag( def __create_tag( eth_chip: Chip, placement: Placement, iptag: IPtagResource, tag: int) -> IPTag: + ethernet_ip = eth_chip.ip_address + assert ethernet_ip is not None return IPTag( - eth_chip.ip_address, placement.x, placement.y, + ethernet_ip, placement.x, placement.y, tag, iptag.ip_address, iptag.port, iptag.strip_sdp, iptag.traffic_identifier) @@ -135,8 +137,10 @@ def __create_reverse_tag( eth_chip: Chip, placement: Placement, reverse_iptag: ReverseIPtagResource, tag: int, port: int) -> ReverseIPTag: + ethernet_ip_address = eth_chip.ip_address + assert ethernet_ip_address is not None return ReverseIPTag( - eth_chip.ip_address, tag, port, placement.x, placement.y, placement.p, + ethernet_ip_address, tag, port, placement.x, placement.y, placement.p, reverse_iptag.sdp_port)