Examples of Ethernet


Examples of net.floodlightcontroller.packet.Ethernet

                    controller.injectOfMessage(sw, pi, cntx));
        verify(test1);
        verify(test2);
        verify(sw);

        Ethernet eth = IFloodlightProviderService.bcStore.get(cntx,
                IFloodlightProviderService.CONTEXT_PI_PAYLOAD);
        assertArrayEquals(testPacket.serialize(), eth.serialize());
    }
View Full Code Here

Examples of net.floodlightcontroller.packet.Ethernet

        // Creating mock switch to which we will send packet out and
        IOFSwitch sw = createMock(IOFSwitch.class);
        expect(sw.getId()).andReturn(new Long(0));

        // Mock Packet-in
        IPacket testPacket = new Ethernet()
        .setSourceMACAddress("00:44:33:22:11:00")
        .setDestinationMACAddress("00:11:22:33:44:55")
        .setEtherType(Ethernet.TYPE_ARP)
        .setPayload(
                new ARP()
View Full Code Here

Examples of net.floodlightcontroller.packet.Ethernet

        mockFloodlightProvider.setSwitches(switches);

        replay(mockSwitch1, mockSwitch5, mockSwitch10, mockSwitch50);

        // Build our test packet
        this.testARPReplyPacket_1 = new Ethernet()
        .setSourceMACAddress("00:44:33:22:11:01")
        .setDestinationMACAddress("00:11:22:33:44:55")
        .setEtherType(Ethernet.TYPE_ARP)
        .setVlanID((short)5)
        .setPayload(
                    new ARP()
                    .setHardwareType(ARP.HW_TYPE_ETHERNET)
                    .setProtocolType(ARP.PROTO_TYPE_IP)
                    .setHardwareAddressLength((byte) 6)
                    .setProtocolAddressLength((byte) 4)
                    .setOpCode(ARP.OP_REPLY)
                    .setSenderHardwareAddress(Ethernet.toMACAddress("00:44:33:22:11:01"))
                    .setSenderProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.1"))
                    .setTargetHardwareAddress(Ethernet.toMACAddress("00:11:22:33:44:55"))
                    .setTargetProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.2")));
        this.testARPReplyPacket_1_Srld = testARPReplyPacket_1.serialize();

        // Another test packet with the same ARP payload as packet 1 but with
        // a different source MAC. (i.e., sender MAC and source MAC differ)
        this.testARPReplyPacket_2 = new Ethernet()
        .setSourceMACAddress("00:99:88:77:66:55")
        .setDestinationMACAddress("00:11:22:33:44:55")
        .setEtherType(Ethernet.TYPE_ARP)
        .setVlanID((short)5)
        .setPayload(
                    new ARP()
                    .setHardwareType(ARP.HW_TYPE_ETHERNET)
                    .setProtocolType(ARP.PROTO_TYPE_IP)
                    .setHardwareAddressLength((byte) 6)
                    .setProtocolAddressLength((byte) 4)
                    .setOpCode(ARP.OP_REPLY)
                    .setSenderHardwareAddress(Ethernet.toMACAddress("00:44:33:22:11:01"))
                    .setSenderProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.1"))
                    .setTargetHardwareAddress(Ethernet.toMACAddress("00:11:22:33:44:55"))
                    .setTargetProtocolAddress(IPv4.toIPv4AddressBytes("192.168.1.2")));
        this.testARPReplyPacket_2_Srld = testARPReplyPacket_2.serialize();

        // This packet reverses the MACs and IP from testARPReplyPacket_1
        this.testUDPPacket = (Ethernet) new Ethernet()
        .setSourceMACAddress("00:11:22:33:44:55")
        .setDestinationMACAddress("00:44:33:22:11:01")
        .setEtherType(Ethernet.TYPE_IPv4)
        .setVlanID((short)5)
        .setPayload(
View Full Code Here

Examples of net.floodlightcontroller.packet.Ethernet

    }

    private Command dispatchPacketIn(long swId, OFPacketIn pi,
                                     FloodlightContext cntx) {
        IOFSwitch sw = mockFloodlightProvider.getSwitch(swId);
        Ethernet eth = new Ethernet();
        eth.deserialize(pi.getPacketData(), 0, pi.getPacketData().length);
        IFloodlightProviderService.bcStore.put(cntx,
                IFloodlightProviderService.CONTEXT_PI_PAYLOAD,
                eth);
        return deviceManager.receive(sw, pi, cntx);
    }
View Full Code Here

Examples of org.jnetpcap.protocol.lan.Ethernet

    packet.setUByte(14 + 0, 0x45);
    System.out.println(packet.toHexdump());
    packet.setUByte(14 + 9, 0x11); //UDP
    System.out.println(packet.toHexdump());
    packet.scan(JProtocol.ETHERNET_ID);
    Ethernet eth = packet.getHeader(new Ethernet());
    Ip4 ip = packet.getHeader(new Ip4());
    Udp udp = packet.getHeader(new Udp());
//    udp.transferFrom(getFakeData(1460)); //Generate Random bytes
    eth.destination(new byte[] {(byte) 0xaa, 0x0c, 0x08, 11, 22, 33});
    eth.source(new byte[] {(byte) 0xaa, 0x0c, 0x08, 11, 22, 34});
    ip.flags(0);
    ip.tos(0);
    ip.source(new byte[] {(byte) 192, (byte) 168, 18, (byte) 218});
    ip.setByteArray(16, new byte[] {(byte) 192,(byte) 168, 18, (byte) 219});
   
View Full Code Here

Examples of org.jnetpcap.protocol.lan.Ethernet

  /**
   * Test ip4 fragment flag directly.
   */
  public void testIp4FragmentFlagDirectly() {
    JPacket packet = TestUtils.getPcapPacket(TestUtils.REASEMBLY, 1 - 1);
    Ethernet eth = new Ethernet();

    if (packet.hasHeader(eth)) {
      // System.out.println(eth);
      // System.out.printf("flags=%x\n", eth.getState().getFlags());
      assertNotSame(JHeader.State.FLAG_HEADER_FRAGMENTED, (eth.getState()
          .getFlags() & JHeader.State.FLAG_HEADER_FRAGMENTED));
    }

    Ip4 ip = new Ip4();
    if (packet.hasHeader(ip)) {
View Full Code Here

Examples of org.jnetpcap.protocol.lan.Ethernet

  /**
   * Test j header is fragmented.
   */
  public void testJHeaderIsFragmented() {
    JPacket packet = TestUtils.getPcapPacket(TestUtils.REASEMBLY, 1 - 1);
    Ethernet eth = new Ethernet();

    if (packet.hasHeader(eth)) {
      assertFalse(eth.isFragmented());
    }

    Ip4 ip = new Ip4();
    if (packet.hasHeader(ip)) {
      assertTrue(ip.isFragmented());
View Full Code Here

Examples of org.jnetpcap.protocol.lan.Ethernet

    // TEMP_CAP_FILE.delete();
    // }
    // FormatUtils.createPcapFile(TEMP_CAP, data);

    // System.out.println(packet);
    System.out.println(packet.getHeader(new Ethernet()));
    System.out.println(packet.getHeader(new Ip4()));
    System.out.println(packet.getHeader(new Udp()));
    System.out.println(packet.getState().toDebugString());

  }
View Full Code Here

Examples of org.jnetpcap.protocol.lan.Ethernet

  public void testScanIpv6File() throws IOException {
    TextFormatter out = new TextFormatter(OUT);
    out.setResolveAddresses(false);

    int i = 0;
    Ethernet eth = new Ethernet();
    for (PcapPacket packet : TestUtils.getIterable("tests/test-ipv6.pcap")) {

      System.out.println(packet.toDebugString());
      if (packet.hasHeader(eth)) {
        out.format(eth);
View Full Code Here

Examples of org.jnetpcap.protocol.lan.Ethernet

    out.setResolveAddresses(false);

    PcapPacket packet = TestUtils.getPcapPacket("tests/test-http-jpeg.pcap", 5);

    Ip4 ip = new Ip4();
    Ethernet eth = new Ethernet();
    if (packet.hasHeader(eth)) {
      out.format(eth);
    }
    if (packet.hasHeader(ip)) {
      out.format(ip);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.