2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
10 import io.netty.buffer.ByteBuf;
12 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
13 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.ArpSha;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ArpShaCaseBuilder;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.arp.sha._case.ArpShaBuilder;
24 * @author michal.polkorab
27 public class OxmArpShaDeserializer extends AbstractOxmMatchEntryDeserializer
28 implements OFDeserializer<MatchEntry> {
31 public MatchEntry deserialize(ByteBuf input) {
32 MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), input);
33 addArpShaValue(input, builder);
34 return builder.build();
37 private static void addArpShaValue(ByteBuf input, MatchEntryBuilder builder) {
38 ArpShaCaseBuilder caseBuilder = new ArpShaCaseBuilder();
39 ArpShaBuilder shaBuilder = new ArpShaBuilder();
40 shaBuilder.setMacAddress(OxmDeserializerHelper.convertMacAddress(input));
41 if (builder.isHasMask()) {
42 shaBuilder.setMask(OxmDeserializerHelper.convertMask(input, EncodeConstants.MAC_ADDRESS_LENGTH));
44 caseBuilder.setArpSha(shaBuilder.build());
45 builder.setMatchEntryValue(caseBuilder.build());
49 protected Class<? extends MatchField> getOxmField() {
54 protected Class<? extends OxmClassBase> getOxmClass() {
55 return OpenflowBasicClass.class;