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;
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;
16 * Utilities for Oxm deserialization.
18 * @author michal.polkorab
20 public final class OxmDeserializerHelper {
21 private OxmDeserializerHelper() {
26 * Converts binary data into binary mask (for match entries).
28 * @param input input ByteBuf
29 * @param matchEntryLength mask length
32 public static byte[] convertMask(final ByteBuf input, final int matchEntryLength) {
33 byte[] mask = new byte[matchEntryLength];
34 input.readBytes(mask);
39 * Converts binary data into mac address.
41 * @param input input ByteBuf
44 public static MacAddress convertMacAddress(final ByteBuf input) {
45 byte[] address = new byte[EncodeConstants.MAC_ADDRESS_LENGTH];
46 input.readBytes(address);
47 return IetfYangUtil.macAddressFor(address);