def test_full_ti(self): p = lldptool.parse_into_list(lldptool_ti) self.assertEquals(p[0][0], 'Chassis ID TLV') self.assertEquals(p[1][0], 'Port ID TLV') self.assertEquals(p[2][0], 'Time to Live TLV') self.assertEquals(p[3][0], 'CEE DCBX TLV') self.assertEquals(p[4][0], 'End of LLDPDU TLV')
def test_ieee_full_tni(self): p = lldptool.parse_into_list(ieee_lldptool_tni) self.assertEquals(p[0][0], 'Chassis ID TLV') self.assertEquals(p[1][0], 'Port ID TLV') self.assertEquals(p[2][0], 'Time to Live TLV') self.assertEquals(p[3][0], 'IEEE 8021QAZ ETS Configuration TLV') self.assertEquals(p[4][0], 'IEEE 8021QAZ PFC TLV') self.assertEquals(p[5][0], 'IEEE 8021QAZ APP TLV') self.assertEquals(p[6][0], 'End of LLDPDU TLV')
def test_tlv_data(self): p = lldptool.parse_into_list("""Chassis ID TLV \tIPv4: 10.0.0.150 End of LLDPDU TLV """) self.assertEquals(p[0][0], 'Chassis ID TLV') self.assertEquals(p[0][1], [['IPv4', '10.0.0.150']]) self.assertEquals(p[1][0], 'End of LLDPDU TLV')
def test_full_tni(self): p = lldptool.parse_into_list(lldptool_tni) self.assertEquals(p[0][0], 'Chassis ID TLV') self.assertEquals(p[1][0], 'Port ID TLV') self.assertEquals(p[2][0], 'Time to Live TLV') self.assertEquals(p[3][0], 'Port Description TLV') self.assertEquals(p[4][0], 'System Name TLV') self.assertEquals(p[5][0], 'System Description TLV') self.assertEquals(p[6][0], 'System Capabilities TLV') self.assertEquals(p[7][0], 'Management Address TLV') self.assertEquals(p[8][0], 'Unknown interface subtype: 0') self.assertEquals(p[9][0], 'CEE DCBX TLV') self.assertEquals(p[10][0], 'End of LLDPDU TLV')
def test_only_errors(self): p = lldptool.parse_into_list("""Unknown interface subtype: 0 Unknown interface subtype: 0 Unknown interface subtype: 0 Unknown interface subtype: 0 Unknown interface subtype: 0 End of LLDPDU TLV """) self.assertEquals(p[0][0], 'Unknown interface subtype: 0') self.assertEquals(p[1][0], 'Unknown interface subtype: 0') self.assertEquals(p[2][0], 'Unknown interface subtype: 0') self.assertEquals(p[3][0], 'Unknown interface subtype: 0') self.assertEquals(p[4][0], 'Unknown interface subtype: 0') self.assertEquals(p[5][0], 'End of LLDPDU TLV')