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.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
17 * @author michal.polkorab
20 public final class OxmMaskDeserializer {
22 private OxmMaskDeserializer() {
23 throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
27 * Appends mask to match entry (match entry builder)
28 * @param builder builder which the mask will append to
29 * @param input input ByteBuf
30 * @param matchEntryLength mask length
32 public static void addMaskAugmentation(MatchEntriesBuilder builder, ByteBuf input,
33 int matchEntryLength) {
34 MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
35 byte[] mask = new byte[matchEntryLength];
36 input.readBytes(mask);
37 maskBuilder.setMask(mask);
38 builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());