示例#1
0
 @Override
 public InboundPacket inPacket() {
   IPv6 ipv6 = new IPv6();
   ipv6.setDestinationAddress(Ip6Address.valueOf("1000::1").toOctets());
   ipv6.setSourceAddress(IP2);
   Ethernet eth = new Ethernet();
   eth.setEtherType(Ethernet.TYPE_IPV6)
       .setVlanID(VLAN.toShort())
       .setSourceMACAddress(MAC2)
       .setDestinationMACAddress(MacAddress.valueOf("00:00:00:00:00:01"))
       .setPayload(ipv6);
   ConnectPoint receivedFrom = new ConnectPoint(deviceId(deviceId), portNumber(INPORT));
   return new DefaultInboundPacket(receivedFrom, eth, ByteBuffer.wrap(eth.serialize()));
 }
示例#2
0
 @Override
 public InboundPacket inPacket() {
   IPv4 ipv4 = new IPv4();
   ipv4.setDestinationAddress("10.0.0.1");
   ipv4.setSourceAddress(IP_ADDRESS.toString());
   Ethernet eth = new Ethernet();
   eth.setEtherType(Ethernet.TYPE_IPV4)
       .setVlanID(VLAN.toShort())
       .setSourceMACAddress(MAC)
       .setDestinationMACAddress(MacAddress.valueOf("00:00:00:00:00:01"))
       .setPayload(ipv4);
   ConnectPoint receivedFrom = new ConnectPoint(deviceId(deviceId), portNumber(INPORT));
   return new DefaultInboundPacket(receivedFrom, eth, ByteBuffer.wrap(eth.serialize()));
 }
示例#3
0
    @Override
    public InboundPacket inPacket() {
      ARP arp = new ARP();
      arp.setSenderProtocolAddress(IP)
          .setSenderHardwareAddress(MAC.toBytes())
          .setTargetHardwareAddress(BCMAC.toBytes())
          .setTargetProtocolAddress(IP);

      Ethernet eth = new Ethernet();
      eth.setEtherType(Ethernet.TYPE_ARP)
          .setVlanID(VLAN.toShort())
          .setSourceMACAddress(MAC.toBytes())
          .setDestinationMACAddress(BCMAC)
          .setPayload(arp);
      ConnectPoint receivedFrom = new ConnectPoint(deviceId(deviceId), portNumber(INPORT));
      return new DefaultInboundPacket(receivedFrom, eth, ByteBuffer.wrap(eth.serialize()));
    }
示例#4
0
 @Override
 public InboundPacket inPacket() {
   RouterSolicitation ns = new RouterSolicitation();
   ICMP6 icmp6 = new ICMP6();
   icmp6.setPayload(ns);
   IPv6 ipv6 = new IPv6();
   ipv6.setPayload(icmp6);
   ipv6.setDestinationAddress(Ip6Address.valueOf("ff02::2").toOctets());
   ipv6.setSourceAddress(Ip6Address.valueOf("::").toOctets());
   Ethernet eth = new Ethernet();
   eth.setEtherType(Ethernet.TYPE_IPV6)
       .setVlanID(VLAN.toShort())
       .setSourceMACAddress(MAC2.toBytes())
       .setDestinationMACAddress(MacAddress.valueOf("33:33:00:00:00:02"))
       .setPayload(ipv6);
   ConnectPoint receivedFrom = new ConnectPoint(deviceId(deviceId), portNumber(INPORT));
   return new DefaultInboundPacket(receivedFrom, eth, ByteBuffer.wrap(eth.serialize()));
 }
示例#5
0
 @Override
 public InboundPacket inPacket() {
   NeighborAdvertisement na = new NeighborAdvertisement();
   ICMP6 icmp6 = new ICMP6();
   icmp6.setPayload(na);
   IPv6 ipv6 = new IPv6();
   ipv6.setPayload(icmp6);
   ipv6.setDestinationAddress(Ip6Address.valueOf("ff02::1").toOctets());
   ipv6.setSourceAddress(IP2);
   Ethernet eth = new Ethernet();
   eth.setEtherType(Ethernet.TYPE_IPV6)
       .setVlanID(VLAN.toShort())
       .setSourceMACAddress(MAC2.toBytes())
       .setDestinationMACAddress(BCMAC2)
       .setPayload(ipv6);
   ConnectPoint receivedFrom = new ConnectPoint(deviceId(deviceId), portNumber(INPORT));
   return new DefaultInboundPacket(receivedFrom, eth, ByteBuffer.wrap(eth.serialize()));
 }