Search in sources :

Example 1 with Ipv6NdSll

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdSll in project openflowplugin by opendaylight.

the class OfToSalIpv6NdSllCase method process.

@Override
public Optional<MatchBuilder> process(@Nonnull Ipv6NdSllCase source, MatchResponseConvertorData data, ConvertorExecutor convertorExecutor) {
    final MatchBuilder matchBuilder = data.getMatchBuilder();
    final Ipv6MatchBuilder ipv6MatchBuilder = data.getIpv6MatchBuilder();
    Ipv6NdSll ipv6NdSll = source.getIpv6NdSll();
    if (ipv6NdSll != null) {
        ipv6MatchBuilder.setIpv6NdSll(ipv6NdSll.getMacAddress());
        matchBuilder.setLayer3Match(ipv6MatchBuilder.build());
    }
    return Optional.of(matchBuilder);
}
Also used : Ipv6NdSll(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.nd.sll._case.Ipv6NdSll) 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 2 with Ipv6NdSll

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdSll in project openflowplugin by opendaylight.

the class Ipv6NdSllEntrySerializerTest method testSerialize.

@Test
public void testSerialize() throws Exception {
    final MacAddress ipv6NdSll = new MacAddress("00:01:02:03:04:05");
    final Match ipv6NdSllMatch = new MatchBuilder().setLayer3Match(new Ipv6MatchBuilder().setIpv6NdSll(ipv6NdSll).build()).build();
    assertMatch(ipv6NdSllMatch, false, (out) -> {
        byte[] addressBytes = new byte[6];
        out.readBytes(addressBytes);
        assertEquals(new MacAddress(ByteBufUtils.macAddressToString(addressBytes)).getValue(), ipv6NdSll.getValue());
    });
}
Also used : MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) 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) Match(org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match) Test(org.junit.Test)

Example 3 with Ipv6NdSll

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdSll in project openflowplugin by opendaylight.

the class SalToOfIpv6MatchCase method process.

@Override
public Optional<List<MatchEntry>> process(@Nonnull Ipv6Match source, VersionConvertorData data, ConvertorExecutor convertorExecutor) {
    List<MatchEntry> result = new ArrayList<>();
    if (source.getIpv6Source() != null) {
        Ipv6Prefix ipv6Prefix = source.getIpv6Source();
        MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
        matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
        matchEntryBuilder.setOxmMatchField(Ipv6Src.class);
        Ipv6SrcCaseBuilder ipv6SrcCaseBuilder = new Ipv6SrcCaseBuilder();
        Ipv6SrcBuilder ipv6SrcBuilder = new Ipv6SrcBuilder();
        final Integer prefix = IpConversionUtil.extractIpv6Prefix(ipv6Prefix);
        boolean hasMask = false;
        if (null != prefix) {
            ipv6SrcBuilder.setMask(IpConversionUtil.convertIpv6PrefixToByteArray(prefix));
            hasMask = true;
        }
        ipv6SrcBuilder.setIpv6Address(IpConversionUtil.extractIpv6Address(ipv6Prefix));
        ipv6SrcCaseBuilder.setIpv6Src(ipv6SrcBuilder.build());
        matchEntryBuilder.setHasMask(hasMask);
        matchEntryBuilder.setMatchEntryValue(ipv6SrcCaseBuilder.build());
        result.add(matchEntryBuilder.build());
    }
    if (source.getIpv6Destination() != null) {
        Ipv6Prefix ipv6Prefix = source.getIpv6Destination();
        MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
        matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
        matchEntryBuilder.setOxmMatchField(Ipv6Dst.class);
        Ipv6DstCaseBuilder ipv6DstCaseBuilder = new Ipv6DstCaseBuilder();
        Ipv6DstBuilder ipv6DstBuilder = new Ipv6DstBuilder();
        final Integer prefix = IpConversionUtil.extractIpv6Prefix(ipv6Prefix);
        boolean hasMask = false;
        if (null != prefix) {
            ipv6DstBuilder.setMask(IpConversionUtil.convertIpv6PrefixToByteArray(prefix));
            hasMask = true;
        }
        ipv6DstBuilder.setIpv6Address(IpConversionUtil.extractIpv6Address(ipv6Prefix));
        ipv6DstCaseBuilder.setIpv6Dst(ipv6DstBuilder.build());
        matchEntryBuilder.setHasMask(hasMask);
        matchEntryBuilder.setMatchEntryValue(ipv6DstCaseBuilder.build());
        result.add(matchEntryBuilder.build());
    }
    if (source.getIpv6Label() != null) {
        MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
        boolean hasmask = false;
        matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
        matchEntryBuilder.setOxmMatchField(Ipv6Flabel.class);
        Ipv6FlabelCaseBuilder ipv6FlabelCaseBuilder = new Ipv6FlabelCaseBuilder();
        Ipv6FlabelBuilder ipv6FlabelBuilder = new Ipv6FlabelBuilder();
        ipv6FlabelBuilder.setIpv6Flabel(source.getIpv6Label().getIpv6Flabel());
        if (source.getIpv6Label().getFlabelMask() != null) {
            hasmask = true;
            ipv6FlabelBuilder.setMask(ByteUtil.unsignedIntToBytes(source.getIpv6Label().getFlabelMask().getValue()));
        }
        ipv6FlabelCaseBuilder.setIpv6Flabel(ipv6FlabelBuilder.build());
        matchEntryBuilder.setMatchEntryValue(ipv6FlabelCaseBuilder.build());
        matchEntryBuilder.setHasMask(hasmask);
        result.add(matchEntryBuilder.build());
    }
    if (source.getIpv6NdTarget() != null) {
        MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
        matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
        matchEntryBuilder.setHasMask(false);
        matchEntryBuilder.setOxmMatchField(Ipv6NdTarget.class);
        Ipv6NdTargetCaseBuilder ipv6NdTargetCaseBuilder = new Ipv6NdTargetCaseBuilder();
        Ipv6NdTargetBuilder ipv6NdTargetBuilder = new Ipv6NdTargetBuilder();
        ipv6NdTargetBuilder.setIpv6Address(source.getIpv6NdTarget());
        ipv6NdTargetCaseBuilder.setIpv6NdTarget(ipv6NdTargetBuilder.build());
        matchEntryBuilder.setMatchEntryValue(ipv6NdTargetCaseBuilder.build());
        result.add(matchEntryBuilder.build());
    }
    if (source.getIpv6NdSll() != null) {
        MacAddress ipv6NdSll = source.getIpv6NdSll();
        MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
        matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
        matchEntryBuilder.setOxmMatchField(Ipv6NdSll.class);
        Ipv6NdSllCaseBuilder ipv6NdSllCaseBuilder = new Ipv6NdSllCaseBuilder();
        Ipv6NdSllBuilder ipv6NdSllBuilder = new Ipv6NdSllBuilder();
        ipv6NdSllBuilder.setMacAddress(ipv6NdSll);
        ipv6NdSllCaseBuilder.setIpv6NdSll(ipv6NdSllBuilder.build());
        matchEntryBuilder.setMatchEntryValue(ipv6NdSllCaseBuilder.build());
        matchEntryBuilder.setHasMask(false);
        result.add(matchEntryBuilder.build());
    }
    if (source.getIpv6NdTll() != null) {
        MacAddress ipv6NdSll = source.getIpv6NdTll();
        MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
        matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
        matchEntryBuilder.setOxmMatchField(Ipv6NdTll.class);
        Ipv6NdTllCaseBuilder ipv6NdTllCaseBuilder = new Ipv6NdTllCaseBuilder();
        Ipv6NdTllBuilder ipv6NdTllBuilder = new Ipv6NdTllBuilder();
        ipv6NdTllBuilder.setMacAddress(ipv6NdSll);
        ipv6NdTllCaseBuilder.setIpv6NdTll(ipv6NdTllBuilder.build());
        matchEntryBuilder.setMatchEntryValue(ipv6NdTllCaseBuilder.build());
        matchEntryBuilder.setHasMask(false);
        result.add(matchEntryBuilder.build());
    }
    if (source.getIpv6ExtHeader() != null) {
        MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder();
        boolean hasmask = false;
        matchEntryBuilder.setOxmClass(OpenflowBasicClass.class);
        matchEntryBuilder.setOxmMatchField(Ipv6Exthdr.class);
        Ipv6ExthdrCaseBuilder ipv6ExthdrCaseBuilder = new Ipv6ExthdrCaseBuilder();
        Ipv6ExthdrBuilder ipv6ExthdrBuilder = new Ipv6ExthdrBuilder();
        int bitmap = source.getIpv6ExtHeader().getIpv6Exthdr();
        ipv6ExthdrBuilder.setPseudoField(makeIpv6ExthdrFlags(bitmap));
        if (source.getIpv6ExtHeader().getIpv6ExthdrMask() != null) {
            hasmask = true;
            ipv6ExthdrBuilder.setMask(ByteUtil.unsignedShortToBytes(source.getIpv6ExtHeader().getIpv6ExthdrMask()));
        }
        ipv6ExthdrCaseBuilder.setIpv6Exthdr(ipv6ExthdrBuilder.build());
        matchEntryBuilder.setMatchEntryValue(ipv6ExthdrCaseBuilder.build());
        matchEntryBuilder.setHasMask(hasmask);
        result.add(matchEntryBuilder.build());
    }
    return Optional.of(result);
}
Also used : Ipv6NdTargetBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.nd.target._case.Ipv6NdTargetBuilder) MatchEntry(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry) ArrayList(java.util.ArrayList) Ipv6ExthdrBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.exthdr._case.Ipv6ExthdrBuilder) Ipv6NdTargetCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6NdTargetCaseBuilder) Ipv6DstBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.dst._case.Ipv6DstBuilder) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) Ipv6SrcCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6SrcCaseBuilder) Ipv6Prefix(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix) Ipv6NdSllBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.nd.sll._case.Ipv6NdSllBuilder) Ipv6FlabelCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6FlabelCaseBuilder) MatchEntryBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder) Ipv6FlabelBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.flabel._case.Ipv6FlabelBuilder) Ipv6SrcBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.src._case.Ipv6SrcBuilder) Ipv6NdTllBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.nd.tll._case.Ipv6NdTllBuilder) Ipv6ExthdrCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6ExthdrCaseBuilder) Ipv6NdTllCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6NdTllCaseBuilder) Ipv6DstCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6DstCaseBuilder) Ipv6NdSllCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6NdSllCaseBuilder)

Example 4 with Ipv6NdSll

use of org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.Ipv6NdSll 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)

Aggregations

MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)3 Ipv6MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder)3 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)2 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 Ipv6Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix)1 Match (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match)1 Ipv6Match (org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6Match)1 MatchEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry)1 MatchEntryBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder)1 Ipv6DstCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6DstCaseBuilder)1 Ipv6ExthdrCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6ExthdrCaseBuilder)1 Ipv6FlabelCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6FlabelCaseBuilder)1 Ipv6NdSllCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6NdSllCaseBuilder)1 Ipv6NdTargetCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6NdTargetCaseBuilder)1 Ipv6NdTllCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6NdTllCaseBuilder)1 Ipv6SrcCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6SrcCaseBuilder)1 Ipv6DstBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.dst._case.Ipv6DstBuilder)1 Ipv6ExthdrBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.exthdr._case.Ipv6ExthdrBuilder)1 Ipv6FlabelBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.flabel._case.Ipv6FlabelBuilder)1