def test_ptp_header(self): # create one header, copy its bytes, then compare their fields ptp = Common() assert (ptp != None) ptp.versionPTP = 2 ptp.messageLength = 44 ptp.flags = 0x0200 ptp.sourcePortIdentity = 0x000cecfffe08030f ptp.sequenceId = 6630 ptp.controlField = 0 # Create a packet to compare against ptpnew = Common() ptpnew.decode(ptp.bytes) self.assertEqual(ptp.bytes, ptpnew.bytes, "bytes not equal") for field in ptp._fieldnames: self.assertEqual(getattr(ptp, field), getattr(ptpnew, field), ("%s not equal" % field))
def test_ptp_header(self): # create one header, copy its bytes, then compare their fields ptp = CommonV1() assert (ptp != None) ptp.versionPTP = 1 ptp.versionNetwork = 1 ptp.subdomain = "_DFLT " ptp.messageType = 1 ptp.sourceCommunicationTechnology = 1 ptp.sourceUuid = "\x00\x0e\xfe\x00\x0f\xa2" ptp.sourcePortId = 1 ptp.sequenceId = 40828 ptp.control = 0 # Create a packet to compare against ptpnew = Common() ptpnew.decode(ptp.bytes) self.assertEqual(ptp.bytes, ptpnew.bytes, "bytes not equal") for field in ptp._fieldnames: self.assertEqual(getattr(ptp, field), getattr(ptpnew, field), ("%s not equal" % field))