def check_process_tire_common(test_node, header_info_list): # Prepare the TIRE packet tire = packet_common.make_tire_packet() for header_info in header_info_list: (direction, originator, _prefixtype, tie_nr, seq_nr, lifetime, _disposition) = header_info tie_header = packet_common.make_tie_header_with_lifetime( direction, originator, PREFIX, tie_nr, seq_nr, lifetime) packet_common.add_tie_header_to_tire(tire, tie_header) # Process the TIRE packet result = test_node.process_rx_tire_packet(tire) (request_tie_headers, start_sending_tie_headers, acked_tie_headers) = result # Check results compare_header_lists( tie_headers_with_disposition(test_node, header_info_list, [REQUEST_OLDER]), request_tie_headers) disposition = [ e.header for e in tie_headers_with_disposition( test_node, header_info_list, [START_NEWER]) ] compare_header_lists(disposition, start_sending_tie_headers) disposition = [ e.header for e in tie_headers_with_disposition(test_node, header_info_list, [ACK]) ] compare_header_lists(disposition, acked_tie_headers)
def service_ties_req(self): tire_packet = packet_common.make_tire_packet() for tie_header in self._ties_req.values(): # We don't request a TIE from our neighbor if the flooding scope rules say that the # neighbor is not allowed to flood the TIE to us. Why? Because the neighbor is allowed # to advertise extra TIEs in the TIDE, and if we request them we will get an # oscillation. (allowed, _reason) = self._node.flood_allowed_from_nbr_to_node( tie_header, self.neighbor_direction(), self.neighbor.system_id, self.neighbor.level, self.neighbor.top_of_fabric(), self._node.system_id) if allowed: packet_common.add_tie_header_to_tire(tire_packet, tie_header) else: # TODO: log message pass packet_content = encoding.ttypes.PacketContent(tire=tire_packet) packet_header = encoding.ttypes.PacketHeader( sender=self._node.system_id, level=self._node.level_value()) protocol_packet = encoding.ttypes.ProtocolPacket( header=packet_header, content=packet_content) self.send_protocol_packet(protocol_packet, flood=True)
def add_to_message(self, tie_header_with_lifetime): # We don't request a TIE from our neighbor if the flooding scope rules say that the # neighbor is not allowed to flood the TIE to us. Why? Because the neighbor is allowed # to advertise extra TIEs in the TIDE, and if we request them we will get an # oscillation. tie_header = tie_header_with_lifetime.header tie_id = tie_header.tieid node = self._interface.node (allowed, reason) = node.flood_allowed_from_nbr_to_node( tie_header=tie_header, neighbor_direction=self._interface.neighbor_direction(), neighbor_system_id=self._interface.neighbor_lie.system_id, neighbor_level=self._interface.neighbor_lie.level, neighbor_is_top_of_fabric=self._interface.neighbor_lie. top_of_fabric(), node_system_id=node.system_id) if allowed: # TIE requests in a TIRE must have remaining lifetime zero tie_header_lifetime = packet_common.expand_tie_header_with_lifetime( tie_header, 0) packet_common.add_tie_header_to_tire(self._tire_packet, tie_header_lifetime) return True self._interface.warning( "TIE %s, which was in %s queue, could not be sent because %s", tie_id, self._name, reason) return False
def service_ties_ack(self): tire_packet = packet_common.make_tire_packet() # We always send an ACK for every TIE header on the ACK queue. I.e. we always ACK the TIEs # that we received and accepted. for tie_header in self._ties_ack.values(): packet_common.add_tie_header_to_tire(tire_packet, tie_header) packet_content = encoding.ttypes.PacketContent(tire=tire_packet) packet_header = encoding.ttypes.PacketHeader( sender=self._node.system_id, level=self._node.level_value()) protocol_packet = encoding.ttypes.ProtocolPacket( header=packet_header, content=packet_content) self.send_protocol_packet(protocol_packet, flood=True)
def add_to_message(self, tie_header_lifetime): packet_common.add_tie_header_to_tire(self._tire_packet, tie_header_lifetime) return True