2 * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved.
\r
4 * This program and the accompanying materials are made available under the
\r
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
\r
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
\r
8 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
\r
10 import io.netty.buffer.ByteBuf;
\r
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
\r
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntryBuilder;
\r
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
\r
17 * @author michal.polkorab
\r
20 public final class OxmMaskDeserializer {
\r
22 private OxmMaskDeserializer() {
\r
23 throw new UnsupportedOperationException("Utility class shouldn't be instantiated");
\r
27 * Appends mask to match entry (match entry builder)
\r
28 * @param builder builder which the mask will append to
\r
29 * @param input input ByteBuf
\r
30 * @param matchEntryLength mask length
\r
32 public static void addMaskAugmentation(MatchEntriesBuilder builder, ByteBuf input,
\r
33 int matchEntryLength) {
\r
34 MaskMatchEntryBuilder maskBuilder = new MaskMatchEntryBuilder();
\r
35 byte[] mask = new byte[matchEntryLength];
\r
36 input.readBytes(mask);
\r
37 maskBuilder.setMask(mask);
\r
38 builder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
\r