2 * Copyright (c) 2019 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.openflowplugin.impl.protocol.serialization.match;
10 import io.netty.buffer.ByteBuf;
11 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
12 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.IetfYangUtil;
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.MacAddressFilter;
16 public abstract class AbstractMacAddressFilterEntrySerializer<E extends MacAddressFilter>
17 extends AbstractMatchEntrySerializer<E, MacAddress> {
19 protected AbstractMacAddressFilterEntrySerializer(final int oxmClassCode, final int oxmFieldCode) {
20 super(new ConstantHeaderWriter<>(oxmClassCode, oxmFieldCode, EncodeConstants.MAC_ADDRESS_LENGTH));
24 protected final MacAddress extractEntryMask(final E entry) {
25 return entry.getMask();
29 protected final void serializeEntry(final E entry, final MacAddress mask, final ByteBuf outBuffer) {
30 writeMacAddress(entry.getAddress(), outBuffer);
32 writeMask(IetfYangUtil.INSTANCE.macAddressBytes(mask), outBuffer, EncodeConstants.MAC_ADDRESS_LENGTH);