Exemple #1
0
 def _add_row_to_cli_table(self, tab, delay_ticks, tie_header_lifetime):
     header = tie_header_lifetime.header
     lifetime = tie_header_lifetime.remaining_lifetime
     row = [
         packet_common.direction_str(header.tieid.direction),
         header.tieid.originator,
         packet_common.tietype_str(header.tieid.tietype),
         header.tieid.tie_nr, header.seq_nr
     ]
     if self._with_lifetime:
         row.append(lifetime)
     row.append("{:.2f}".format(delay_ticks * _TICK_INTERVAL))
     tab.add_row(row)
Exemple #2
0
 def tie_headers_table_common(self, tie_headers):
     tab = table.Table()
     tab.add_row([
         "Direction",
         "Originator",
         "Type",
         "TIE Nr",
         "Seq Nr",
         ["Remaining", "Lifetime"],
         ["Origination", "Time"]])
     for tie_header in tie_headers.values():
         # TODO: Move direction_str etc. to packet_common
         tab.add_row([packet_common.direction_str(tie_header.tieid.direction),
                      tie_header.tieid.originator,
                      packet_common.tietype_str(tie_header.tieid.tietype),
                      tie_header.tieid.tie_nr,
                      tie_header.seq_nr,
                      tie_header.remaining_lifetime,
                      "-"])   # TODO: Report origination_time
     return tab
Exemple #3
0
def test_direction_str():
    assert packet_common.direction_str(common.ttypes.TieDirectionType.South) == "South"
    assert packet_common.direction_str(common.ttypes.TieDirectionType.North) == "North"
    assert packet_common.direction_str(999) == "999"