def pkt_verify(parent, rcv_pkt, exp_pkt):
if str(exp_pkt) != str(rcv_pkt):
logging.error("ERROR: Packet match failed.")
logging.debug("Expected (" + str(len(exp_pkt)) + ")")
logging.debug(str(exp_pkt).encode('hex'))
sys.stdout = tmpout = StringIO()
exp_pkt.show()
sys.stdout = sys.__stdout__
logging.debug(tmpout.getvalue())
logging.debug("Received (" + str(len(rcv_pkt)) + ")")
logging.debug(str(rcv_pkt).encode('hex'))
sys.stdout = tmpout = StringIO()
Ether(rcv_pkt).show()
sys.stdout = sys.__stdout__
logging.debug(tmpout.getvalue())
parent.assertEqual(str(exp_pkt), str(rcv_pkt),
"Packet match error")
return rcv_pkt
评论列表
文章目录