2 * Copyright (c) 2016 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
9 package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
11 import io.netty.buffer.ByteBuf;
12 import java.util.Objects;
13 import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmDeserializerHelper;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetDestinationBuilder;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatch;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
19 public class EthernetDestinationEntryDeserializer extends AbstractMatchEntryDeserializer {
22 public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
23 final boolean hasMask = processHeader(message);
24 final EthernetMatch ethernetMatch = builder.getEthernetMatch();
25 final EthernetDestinationBuilder ethernetDestinationBuilder = new EthernetDestinationBuilder();
26 ethernetDestinationBuilder.setAddress(OxmDeserializerHelper.convertMacAddress(message));
29 ethernetDestinationBuilder.setMask(OxmDeserializerHelper.convertMacAddress(message));
32 if (Objects.isNull(ethernetMatch)) {
33 builder.setEthernetMatch(new EthernetMatchBuilder()
34 .setEthernetDestination(ethernetDestinationBuilder.build())
36 } else if (Objects.isNull(ethernetMatch.getEthernetDestination())) {
37 builder.setEthernetMatch(new EthernetMatchBuilder(ethernetMatch)
38 .setEthernetDestination(ethernetDestinationBuilder.build())
41 throwErrorOnMalformed(builder, "ethernetMatch", "ethernetDestination");