Search in sources :

Example 66 with Ipv6Prefix

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix in project openflowplugin by opendaylight.

the class Ipv6SourceEntrySerializerTest method testSerializeWithoutMask.

@Test
public void testSerializeWithoutMask() throws Exception {
    final Ipv6Prefix ipv6Address = new Ipv6Prefix("2001:db8::123/128");
    final Match ipv6abmMatch = new MatchBuilder().setLayer3Match(new Ipv6MatchBuilder().setIpv6Source(ipv6Address).build()).build();
    assertMatch(ipv6abmMatch, false, (out) -> {
        byte[] address = new byte[16];
        out.readBytes(address);
        assertArrayEquals(address, IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(ipv6Address)));
    });
}
Also used : MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder) Ipv6Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match) Test(org.junit.Test)

Example 67 with Ipv6Prefix

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix in project openflowplugin by opendaylight.

the class AddressNormalizationUtilTest method normalizeIpv6Arbitrary.

@Test
public void normalizeIpv6Arbitrary() throws Exception {
    final Ipv6Address leftAddress = new Ipv6Address("1E3D:5678:9ABC::");
    final Ipv6ArbitraryMask leftMask = new Ipv6ArbitraryMask("FFFF:FF00::");
    final Ipv6Prefix right = new Ipv6Prefix("1e3d:5600:0:0:0:0:0:0/24");
    assertEquals(right, AddressNormalizationUtil.normalizeIpv6Arbitrary(leftAddress, leftMask));
}
Also used : Ipv6ArbitraryMask(org.opendaylight.yang.gen.v1.urn.opendaylight.opendaylight.ipv6.arbitrary.bitmask.fields.rev160224.Ipv6ArbitraryMask) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address) Ipv6Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix) Test(org.junit.Test)

Example 68 with Ipv6Prefix

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix in project openflowplugin by opendaylight.

the class AddressNormalizationUtilTest method normalizeIpv6Prefix.

@Test
public void normalizeIpv6Prefix() throws Exception {
    final Ipv6Prefix left = new Ipv6Prefix("1E3D:5678:9ABC::/24");
    final Ipv6Prefix right = new Ipv6Prefix("1e3d:5600:0:0:0:0:0:0/24");
    assertEquals(right, AddressNormalizationUtil.normalizeIpv6Prefix(left));
}
Also used : Ipv6Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix) Test(org.junit.Test)

Example 69 with Ipv6Prefix

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix in project openflowplugin by opendaylight.

the class MatchNormalizationUtilTest method normalizeIpv6MatchArbitraryBitMask.

@Test
public void normalizeIpv6MatchArbitraryBitMask() {
    final Ipv6Address leftAddress = new Ipv6Address("1E3D:5678:9ABC::");
    final Ipv6ArbitraryMask leftMask = new Ipv6ArbitraryMask("FFFF:FF00::");
    final Ipv6Prefix right = new Ipv6Prefix("1e3d:5600:0:0:0:0:0:0/24");
    final MatchBuilder matchBuilder = MatchNormalizationUtil.normalizeIpv6MatchArbitraryBitMask(new MatchBuilder().setLayer3Match(new Ipv6MatchArbitraryBitMaskBuilder().setIpv6SourceAddressNoMask(leftAddress).setIpv6SourceArbitraryBitmask(leftMask).setIpv6DestinationAddressNoMask(leftAddress).setIpv6DestinationArbitraryBitmask(leftMask).build()));
    assertEquals(right, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6Source());
    assertEquals(right, Ipv6Match.class.cast(matchBuilder.getLayer3Match()).getIpv6Destination());
}
Also used : Ipv6ArbitraryMask(org.opendaylight.yang.gen.v1.urn.opendaylight.opendaylight.ipv6.arbitrary.bitmask.fields.rev160224.Ipv6ArbitraryMask) Ipv6MatchArbitraryBitMaskBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchArbitraryBitMaskBuilder) ArpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder) TunnelIpv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder) Ipv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder) Ipv6Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address) Ipv6Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix) Test(org.junit.Test)

Example 70 with Ipv6Prefix

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix in project openflowplugin by opendaylight.

the class Ipv6DestinationEntryDeserializerTest method deserializeEntry.

@Test
public void deserializeEntry() throws Exception {
    final ByteBuf in = UnpooledByteBufAllocator.DEFAULT.buffer();
    final Ipv6Prefix address = new Ipv6Prefix("fe80::200:f8ff:fe21:67cf/30");
    writeHeader(in, true);
    in.writeBytes(IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(address)));
    in.writeBytes(IpConversionUtil.convertIpv6PrefixToByteArray(IpConversionUtil.extractIpv6Prefix(address)));
    final Ipv6Match match = Ipv6Match.class.cast(deserialize(in).getLayer3Match());
    assertEquals(address.getValue(), match.getIpv6Destination().getValue());
    assertEquals(0, in.readableBytes());
}
Also used : Ipv6Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match) ByteBuf(io.netty.buffer.ByteBuf) Ipv6Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix) Test(org.junit.Test)

Aggregations

Ipv6Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix)63 Test (org.junit.Test)42 ArrayList (java.util.ArrayList)20 ByteBuf (io.netty.buffer.ByteBuf)16 IpPrefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix)13 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)13 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)12 Ipv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder)11 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)10 Flowspec (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.Flowspec)8 FlowspecBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.FlowspecBuilder)8 InetAddress (java.net.InetAddress)6 AceIpv6Builder (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.access.control.list.rev160218.access.lists.acl.access.list.entries.ace.matches.ace.type.ace.ip.ace.ip.version.AceIpv6Builder)6 SourceIpv6PrefixCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.group.ipv6.flowspec.flowspec.type.SourceIpv6PrefixCaseBuilder)6 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder)6 Attributes1Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.Attributes1Builder)6 MpReachNlriBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.MpReachNlriBuilder)6 AdvertizedRoutesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder)6 IpPrefixSubobject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.IpPrefixSubobject)6 SimpleAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.lisp.address.types.rev151105.SimpleAddress)5