2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
\r
10 import io.netty.buffer.ByteBuf;
\r
12 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
\r
13 import org.opendaylight.openflowjava.protocol.impl.util.ByteBufUtils;
\r
14 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
\r
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Address;
\r
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntry;
\r
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Ipv6AddressMatchEntryBuilder;
\r
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
\r
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
\r
22 * @author michal.polkorab
\r
25 public abstract class AbstractOxmIpv6AddressDeserializer extends AbstractOxmMatchEntryDeserializer
\r
26 implements OFDeserializer<MatchEntries> {
\r
29 public MatchEntries deserialize(final ByteBuf input) {
\r
30 MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
\r
31 addIpv6AddressAugmentation(builder, input);
\r
32 if (builder.isHasMask()) {
\r
33 OxmMaskDeserializer.addMaskAugmentation(builder, input,
\r
34 EncodeConstants.SIZE_OF_IPV6_ADDRESS_IN_BYTES);
\r
36 return builder.build();
\r
39 private static void addIpv6AddressAugmentation(final MatchEntriesBuilder builder, final ByteBuf input) {
\r
40 Ipv6AddressMatchEntryBuilder ipv6AddressBuilder = new Ipv6AddressMatchEntryBuilder();
\r
41 ipv6AddressBuilder.setIpv6Address(new Ipv6Address(ByteBufUtils.readIpv6Address(input)));
\r
42 builder.addAugmentation(Ipv6AddressMatchEntry.class, ipv6AddressBuilder.build());
\r