use of com.exalttech.trex.packets.TrexEthernetPacket in project trex-stateless-gui by cisco-system-traffic-generator.
the class EthernetTest method testEthernetProfile.
@Test(dataProvider = "packetData", dependsOnGroups = { "init" })
public void testEthernetProfile(PacketData packetData) throws IOException, InterruptedException, PcapNativeException, NotOpenException, URISyntaxException {
// create profile
LOG.info("create ethernet packet");
int packetLength = PacketBuilderHelper.getPacketLength(packetData.getPacketLength().getLengthType(), packetData.getPacketLength().getFrameLength(), packetData.getPacketLength().getMaxLength());
Payload payload = packetUtil.getPayload(packetData.getPayload());
TrexEthernetPacket ethernetPacket = packetUtil.prepareEthernetPacket(packetData, packetLength, payload);
if (!packetData.isTaggedVlan()) {
ethernetPacket.buildPacket(null);
} else {
packetUtil.addVlanToPacket(ethernetPacket, null);
}
// prepare and save yaml data
LOG.info("Prepare and save Yaml file");
packetUtil.prepareAndSaveYamlFile(ethernetPacket.getPacket().getRawData(), packetData);
//Generate pcap files
LOG.info("Generate Pcap file for " + packetData.getTestFileName() + ".yaml");
packetUtil.generatePcapFile(packetData.getTestFileName());
// compare pcaps
boolean result = packetUtil.comparePcaps(packetData.getTestFileName(), "generated_" + packetData.getTestFileName());
Assert.assertEquals(result, true, "Invalid generated " + packetData.getTestFileName() + " pcap. ");
}
use of com.exalttech.trex.packets.TrexEthernetPacket in project trex-stateless-gui by cisco-system-traffic-generator.
the class IPV4Test method testIPV4Profile.
@Test(dataProvider = "packetData", dependsOnGroups = { "init" })
public void testIPV4Profile(PacketData packetData) throws IOException, InterruptedException, PcapNativeException, NotOpenException, URISyntaxException {
TrexEthernetPacket ethernetPacket = buildIPV4Packet(packetData);
// prepare and save yaml data
LOG.info("Prepare and save Yaml file");
packetUtil.prepareAndSaveYamlFile(ethernetPacket.getPacket().getRawData(), packetData);
//Generate pcap files
LOG.info("Generate Pcap file for " + packetData.getTestFileName() + ".yaml");
packetUtil.generatePcapFile(packetData.getTestFileName());
// compare pcaps
boolean result = packetUtil.comparePcaps(packetData.getTestFileName(), "generated_" + packetData.getTestFileName());
Assert.assertEquals(result, true, "Invalid generated " + packetData.getTestFileName() + " pcap. ");
}
use of com.exalttech.trex.packets.TrexEthernetPacket in project trex-stateless-gui by cisco-system-traffic-generator.
the class TCPTest method testTCPProfile.
@Test(dataProvider = "packetData", dependsOnGroups = { "init" })
public void testTCPProfile(PacketData packetData) throws IOException, InterruptedException, PcapNativeException, NotOpenException, URISyntaxException {
TrexEthernetPacket ethernetPacket = buildIPV4Packet(packetData);
// prepare and save yaml data
LOG.info("Prepare and save Yaml file");
packetUtil.prepareAndSaveYamlFile(ethernetPacket.getPacket().getRawData(), packetData);
//Generate pcap files
LOG.info("Generate Pcap file for " + packetData.getTestFileName() + ".yaml");
packetUtil.generatePcapFile(packetData.getTestFileName());
// compare pcaps
boolean result = packetUtil.comparePcaps(packetData.getTestFileName(), "generated_" + packetData.getTestFileName());
Assert.assertEquals(result, true, "Invalid generated " + packetData.getTestFileName() + " pcap. ");
}
Aggregations