Search in sources :

Example 21 with Ipv6MatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder in project openflowplugin by opendaylight.

the class OpenflowpluginTestCommandProvider method createL3IPv6Match.

private static MatchBuilder createL3IPv6Match() {
    final MatchBuilder match = new MatchBuilder();
    final EthernetMatchBuilder eth = new EthernetMatchBuilder();
    final EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
    ethTypeBuilder.setType(new EtherType(0x86ddL));
    eth.setEthernetType(ethTypeBuilder.build());
    match.setEthernetMatch(eth.build());
    final MacAddress ndsll = new MacAddress("c2:00:54:f5:00:00");
    final MacAddress ndtll = new MacAddress("00:0c:29:0e:4c:67");
    final Ipv6ExtHeaderBuilder nextheader = new Ipv6ExtHeaderBuilder();
    nextheader.setIpv6Exthdr(58);
    final Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder();
    final Ipv6FlowLabel label = new Ipv6FlowLabel(10028L);
    ipv6label.setIpv6Flabel(label);
    ipv6label.setFlabelMask(new Ipv6FlowLabel(1L));
    // icmpv6
    final Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder();
    // match
    icmpv6match.setIcmpv6Type((short) 135);
    icmpv6match.setIcmpv6Code((short) 0);
    match.setIcmpv6Match(icmpv6match.build());
    final Ipv6MatchBuilder ipv6match = new Ipv6MatchBuilder();
    // ipv6match.setIpv6Source(srcip6);
    // ipv6match.setIpv6Destination(dstip6);
    // ipv6match.setIpv6ExtHeader(nextheader.build());
    ipv6match.setIpv6NdSll(ndsll);
    ipv6match.setIpv6NdTll(ndtll);
    // ipv6match.setIpv6NdTarget(ndtarget);
    ipv6match.setIpv6Label(ipv6label.build());
    match.setLayer3Match(ipv6match.build());
    return match;
}
Also used : EthernetTypeBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder) EtherType(org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Ipv6ExtHeaderBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6ExtHeaderBuilder) Ipv6LabelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6LabelBuilder) Ipv6FlowLabel(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6FlowLabel) ArpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder) Icmpv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder) TunnelIpv4MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder) VlanMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder) TcpFlagsMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.TcpFlagsMatchBuilder) 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) IpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder) Icmpv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder) SctpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder) UdpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.UdpMatchBuilder) TcpMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder) MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder) Icmpv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder) EthernetMatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)

Example 22 with Ipv6MatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder in project openflowplugin by opendaylight.

the class OfToSalIpv6ExthdrCase method process.

@Override
public Optional<MatchBuilder> process(@Nonnull Ipv6ExthdrCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
    final MatchBuilder matchBuilder = data.getMatchBuilder();
    final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
    Ipv6Exthdr ipv6Exthdr = source.getIpv6Exthdr();
    if (ipv6Exthdr != null) {
        Ipv6ExtHeaderBuilder ipv6ExtHeaderBuilder = new Ipv6ExtHeaderBuilder();
        Ipv6ExthdrFlags headerFlags = ipv6Exthdr.getPseudoField();
        Integer bitmap = MatchConvertorUtil.ipv6ExthdrFlagsToInt(headerFlags);
        ipv6ExtHeaderBuilder.setIpv6Exthdr(bitmap);
        byte[] mask = ipv6Exthdr.getMask();
        if (mask != null) {
            ipv6ExtHeaderBuilder.setIpv6ExthdrMask(ByteUtil.bytesToUnsignedShort(mask));
        }
        ipv6MatchBuilder.setIpv6ExtHeader(ipv6ExtHeaderBuilder.build());
        matchBuilder.setLayer3Match(ipv6MatchBuilder.build());
    }
    return Optional.of(matchBuilder);
}
Also used : Ipv6Exthdr(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.exthdr._case.Ipv6Exthdr) Ipv6ExthdrFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags) Ipv6ExtHeaderBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6ExtHeaderBuilder) 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)

Example 23 with Ipv6MatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder in project openflowplugin by opendaylight.

the class Ipv6NdSllEntryDeserializer method deserializeEntry.

@Override
public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
    processHeader(message);
    final MacAddress address = OxmDeserializerHelper.convertMacAddress(message);
    if (Objects.isNull(builder.getLayer3Match())) {
        builder.setLayer3Match(new Ipv6MatchBuilder().setIpv6NdSll(address).build());
    } else if (Ipv6Match.class.isInstance(builder.getLayer3Match()) && Objects.isNull(Ipv6Match.class.cast(builder.getLayer3Match()).getIpv6NdSll())) {
        final Ipv6Match match = Ipv6Match.class.cast(builder.getLayer3Match());
        builder.setLayer3Match(new Ipv6MatchBuilder(match).setIpv6NdSll(address).build());
    } else {
        throwErrorOnMalformed(builder, "layer3Match", "ipv6NdSll");
    }
}
Also used : Ipv6Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Ipv6MatchBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder)

Example 24 with Ipv6MatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder in project openflowplugin by opendaylight.

the class Ipv6DestinationEntrySerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final Ipv6Prefix ipv6Address = new Ipv6Prefix("2001:db8::/32");
    final Match ipv6abmMatch = new MatchBuilder().setLayer3Match(new Ipv6MatchBuilder().setIpv6Destination(ipv6Address).build()).build();
    assertMatch(ipv6abmMatch, true, (out) -> {
        byte[] address = new byte[16];
        out.readBytes(address);
        assertArrayEquals(address, IetfInetUtil.INSTANCE.ipv6AddressBytes(IpConversionUtil.extractIpv6Address(ipv6Address)));
        byte[] mask = new byte[16];
        out.readBytes(mask);
        assertArrayEquals(mask, IpConversionUtil.convertIpv6PrefixToByteArray(IpConversionUtil.extractIpv6Prefix(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 25 with Ipv6MatchBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder in project openflowplugin by opendaylight.

the class Ipv6DestinationEntrySerializerTest 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().setIpv6Destination(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)

Aggregations

Ipv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder)32 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)23 Test (org.junit.Test)13 Ipv6Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix)12 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match)9 Ipv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder)9 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)8 Ipv6ExtHeaderBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6ExtHeaderBuilder)8 Ipv6FlowLabel (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6FlowLabel)7 Ipv6LabelBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ipv6.match.fields.Ipv6LabelBuilder)7 EthernetMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder)7 Ipv6Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address)6 Icmpv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder)6 IpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder)6 ArpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.ArpMatchBuilder)6 TunnelIpv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.TunnelIpv4MatchBuilder)6 Icmpv4MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv4MatchBuilder)5 VlanMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.VlanMatchBuilder)5 SctpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.SctpMatchBuilder)5 TcpMatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._4.match.TcpMatchBuilder)5