def set_PHV(self, pkt, payload=None): """ set PHV for deparser """ scap_to_PHV(self.dut, pkt, self.name_to_VHDL) full_hdr = scapy_to_BinaryValue(pkt) print("emitted {} bytes : \n {}".format(len(raw(pkt)), raw(pkt))) self.dut._log.info("send {}B : {}".format(len(full_hdr.buff), full_hdr.binstr)) new_output = PHVDeparser(len(self.dut.packet_out_tdata), full_hdr) self.expected_output.extend(new_output)
def send(self, pkt): if isinstance(pkt, scapy_pkt): self.overrideModel = True self.expected_output.append(scapy_to_BinaryValue(pkt)) self.stream_in.append(pkt) self.overrideModel = False