Search in sources :

Example 41 with IPv6

use of org.onlab.packet.IPv6 in project trellis-control by opennetworkinglab.

the class IcmpHandlerTest method testPing6RemoteGatewayLeaf2Down.

// Ping6 to a gateway but one of the destination leaf is down
@Test
public void testPing6RemoteGatewayLeaf2Down() {
    // Expected behavior
    expect(segmentRoutingManager.deviceService.isAvailable(LOCAL_LEAF1)).andReturn(true).times(1);
    expect(segmentRoutingManager.deviceService.isAvailable(LOCAL_LEAF2)).andReturn(false).times(1);
    replay(segmentRoutingManager.deviceService);
    // Process
    icmpHandler.processIcmpv6(ETH_REQ_IPV61, CP11);
    // Verify packet-out
    Ethernet ethernet = packetService.getEthernetPacket(ETH_REQ_IPV61.getSourceMAC());
    assertNotNull(ethernet);
    assertThat(ethernet.getSourceMAC(), is(ETH_REQ_IPV61.getDestinationMAC()));
    assertThat(ethernet.getDestinationMAC(), is(ETH_REQ_IPV61.getSourceMAC()));
    assertThat(ethernet.getEtherType(), is(Ethernet.MPLS_UNICAST));
    assertTrue(ethernet.getPayload() instanceof MPLS);
    MPLS mpls = (MPLS) ethernet.getPayload();
    assertThat(mpls.getLabel(), is(LOCAL_LEAF1_SID6));
    assertTrue(mpls.getPayload() instanceof IPv6);
    IPv6 ip = (IPv6) mpls.getPayload();
    assertThat(ip.getSourceAddress(), is(DST_IPV6.toOctets()));
    assertThat(ip.getDestinationAddress(), is(SRC_IPV61.toOctets()));
    assertTrue(ip.getPayload() instanceof ICMP6);
    ICMP6 icmp = (ICMP6) ip.getPayload();
    assertThat(icmp.getIcmpType(), is(ECHO_REPLY));
    // Verify behavior
    verify(segmentRoutingManager.deviceService);
}
Also used : IPv6(org.onlab.packet.IPv6) Ethernet(org.onlab.packet.Ethernet) ICMP6(org.onlab.packet.ICMP6) MPLS(org.onlab.packet.MPLS) Test(org.junit.Test)

Example 42 with IPv6

use of org.onlab.packet.IPv6 in project trellis-control by opennetworkinglab.

the class IcmpHandlerTest method testPing6GatewayPair.

// Ping6 to a dh gateway
@Test
public void testPing6GatewayPair() {
    // Expected behavior
    expect(segmentRoutingManager.deviceService.isAvailable(LOCAL_LEAF1)).andReturn(true).times(1);
    expect(segmentRoutingManager.deviceService.isAvailable(LOCAL_LEAF2)).andReturn(true).times(1);
    replay(segmentRoutingManager.deviceService);
    // Process
    icmpHandler.processIcmpv6(ETH_REQ_IPV6_GATEWAY_PAIR, CP2021);
    // Verify packet-out
    Ethernet ethernet = packetService.getEthernetPacket(ETH_REQ_IPV6_GATEWAY_PAIR.getSourceMAC());
    assertNotNull(ethernet);
    assertThat(ethernet.getSourceMAC(), is(ETH_REQ_IPV6_GATEWAY_PAIR.getDestinationMAC()));
    assertThat(ethernet.getDestinationMAC(), is(ETH_REQ_IPV6_GATEWAY_PAIR.getSourceMAC()));
    assertTrue(ethernet.getPayload() instanceof IPv6);
    IPv6 ip = (IPv6) ethernet.getPayload();
    assertThat(ip.getSourceAddress(), is(DST_IPV6_GATEWAY_PAIR.toOctets()));
    assertThat(ip.getDestinationAddress(), is(SRC_IPV61.toOctets()));
    assertTrue(ip.getPayload() instanceof ICMP6);
    ICMP6 icmp = (ICMP6) ip.getPayload();
    assertThat(icmp.getIcmpType(), is(ECHO_REPLY));
    // Verify behavior
    verify(segmentRoutingManager.deviceService);
}
Also used : IPv6(org.onlab.packet.IPv6) Ethernet(org.onlab.packet.Ethernet) ICMP6(org.onlab.packet.ICMP6) Test(org.junit.Test)

Example 43 with IPv6

use of org.onlab.packet.IPv6 in project trellis-control by opennetworkinglab.

the class IcmpHandlerTest method testPing6RemoteGatewaySamePair.

// Ping6 to a gateway attached only to the pair leaf (routing through spine)
@Test
public void testPing6RemoteGatewaySamePair() {
    // Expected behavior
    expect(segmentRoutingManager.deviceService.isAvailable(LOCAL_LEAF1)).andReturn(true).times(1);
    expect(segmentRoutingManager.deviceService.isAvailable(LOCAL_LEAF2)).andReturn(true).times(1);
    replay(segmentRoutingManager.deviceService);
    // Process
    icmpHandler.processIcmpv6(ETH_REQ_IPV6_SAME, CP2025);
    // Verify packet-out
    Ethernet ethernet = packetService.getEthernetPacket(ETH_REQ_IPV6_SAME.getSourceMAC());
    assertNotNull(ethernet);
    assertThat(ethernet.getSourceMAC(), is(ETH_REQ_IPV6_SAME.getDestinationMAC()));
    assertThat(ethernet.getDestinationMAC(), is(ETH_REQ_IPV6_SAME.getSourceMAC()));
    assertTrue(ethernet.getPayload() instanceof MPLS);
    MPLS mpls = (MPLS) ethernet.getPayload();
    assertThat(mpls.getLabel(), is(LOCAL_LEAF1_SID6));
    assertTrue(mpls.getPayload() instanceof IPv6);
    IPv6 ip = (IPv6) mpls.getPayload();
    assertThat(ip.getSourceAddress(), is(DST_IPV6_SAME.toOctets()));
    assertThat(ip.getDestinationAddress(), is(SRC_IPV61.toOctets()));
    assertTrue(ip.getPayload() instanceof ICMP6);
    ICMP6 icmp = (ICMP6) ip.getPayload();
    assertThat(icmp.getIcmpType(), is(ECHO_REPLY));
    // Verify behavior
    verify(segmentRoutingManager.deviceService);
}
Also used : IPv6(org.onlab.packet.IPv6) Ethernet(org.onlab.packet.Ethernet) ICMP6(org.onlab.packet.ICMP6) MPLS(org.onlab.packet.MPLS) Test(org.junit.Test)

Example 44 with IPv6

use of org.onlab.packet.IPv6 in project trellis-control by opennetworkinglab.

the class IcmpHandlerTest method testPing6LoopbackPairDifferentLeaf.

// Ping6 to the loopback of the leaf but hashing of the bond interfaces sends to wrong leaf
@Test
public void testPing6LoopbackPairDifferentLeaf() {
    // Expected behavior
    expect(segmentRoutingManager.deviceService.isAvailable(LOCAL_LEAF1)).andReturn(true).times(1);
    expect(segmentRoutingManager.deviceService.isAvailable(LOCAL_LEAF2)).andReturn(true).times(1);
    replay(segmentRoutingManager.deviceService);
    // Process
    icmpHandler.processIcmpv6(ETH_REQ_IPV6_LOOPBACK_PAIR, CP2011);
    // Verify packet-out
    Ethernet ethernet = packetService.getEthernetPacket(ETH_REQ_IPV6_LOOPBACK_PAIR.getSourceMAC());
    assertNotNull(ethernet);
    assertThat(ethernet.getSourceMAC(), is(ETH_REQ_IPV6_LOOPBACK_PAIR.getDestinationMAC()));
    assertThat(ethernet.getDestinationMAC(), is(ETH_REQ_IPV6_LOOPBACK_PAIR.getSourceMAC()));
    assertTrue(ethernet.getPayload() instanceof IPv6);
    IPv6 ip = (IPv6) ethernet.getPayload();
    assertThat(ip.getSourceAddress(), is(DST_IPV6_LOOPBACK_PAIR.toOctets()));
    assertThat(ip.getDestinationAddress(), is(SRC_IPV61.toOctets()));
    assertTrue(ip.getPayload() instanceof ICMP6);
    ICMP6 icmp = (ICMP6) ip.getPayload();
    assertThat(icmp.getIcmpType(), is(ECHO_REPLY));
    // Verify behavior
    verify(segmentRoutingManager.deviceService);
}
Also used : IPv6(org.onlab.packet.IPv6) Ethernet(org.onlab.packet.Ethernet) ICMP6(org.onlab.packet.ICMP6) Test(org.junit.Test)

Example 45 with IPv6

use of org.onlab.packet.IPv6 in project trellis-control by opennetworkinglab.

the class IcmpHandlerTest method testPing6MyGateway.

// Ping6 to our gateway
@Test
public void testPing6MyGateway() {
    // Expected behavior
    expect(segmentRoutingManager.deviceService.isAvailable(REMOTE_LEAF)).andReturn(true).times(1);
    replay(segmentRoutingManager.deviceService);
    // Process
    icmpHandler.processIcmpv6(ETH_REQ_IPV6_MY, CP12);
    // Verify packet-out
    Ethernet ethernet = packetService.getEthernetPacket(ETH_REQ_IPV6_MY.getSourceMAC());
    assertNotNull(ethernet);
    assertThat(ethernet.getSourceMAC(), is(ETH_REQ_IPV6_MY.getDestinationMAC()));
    assertThat(ethernet.getDestinationMAC(), is(ETH_REQ_IPV6_MY.getSourceMAC()));
    assertTrue(ethernet.getPayload() instanceof IPv6);
    IPv6 ip = (IPv6) ethernet.getPayload();
    assertThat(ip.getSourceAddress(), is(DST_IPV6.toOctets()));
    assertThat(ip.getDestinationAddress(), is(SRC_IPV6_MY.toOctets()));
    assertTrue(ip.getPayload() instanceof ICMP6);
    ICMP6 icmp = (ICMP6) ip.getPayload();
    assertThat(icmp.getIcmpType(), is(ECHO_REPLY));
    // Verify behavior
    verify(segmentRoutingManager.deviceService);
}
Also used : IPv6(org.onlab.packet.IPv6) Ethernet(org.onlab.packet.Ethernet) ICMP6(org.onlab.packet.ICMP6) Test(org.junit.Test)

Aggregations

IPv6 (org.onlab.packet.IPv6)48 Ethernet (org.onlab.packet.Ethernet)41 Test (org.junit.Test)27 ICMP6 (org.onlab.packet.ICMP6)22 UDP (org.onlab.packet.UDP)18 DHCP6 (org.onlab.packet.DHCP6)17 ConnectPoint (org.onosproject.net.ConnectPoint)12 Ip6Address (org.onlab.packet.Ip6Address)11 Interface (org.onosproject.net.intf.Interface)11 MacAddress (org.onlab.packet.MacAddress)10 DeviceId (org.onosproject.net.DeviceId)10 OutboundPacket (org.onosproject.net.packet.OutboundPacket)10 IpAddress (org.onlab.packet.IpAddress)9 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)9 VlanId (org.onlab.packet.VlanId)8 Logger (org.slf4j.Logger)8 ByteBuffer (java.nio.ByteBuffer)7 HostService (org.onosproject.net.host.HostService)7 InterfaceService (org.onosproject.net.intf.InterfaceService)7 LoggerFactory (org.slf4j.LoggerFactory)7