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 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 start_message(self): self._tire_packet = packet_common.make_tire_packet()