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.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.TunnelId;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.TunnelIdCaseBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.tunnel.id._case.TunnelIdBuilder;
17 * Translates OxmTunnelId messages.
19 * @author michal.polkorab
21 public class OxmTunnelIdDeserializer extends AbstractOxmMatchEntryDeserializer {
22 public OxmTunnelIdDeserializer() {
23 super(TunnelId.class);
27 protected void deserialize(final ByteBuf input, final MatchEntryBuilder builder) {
28 final byte[] metadataBytes = new byte[Long.BYTES];
29 input.readBytes(metadataBytes);
30 final TunnelIdBuilder tunnelIdBuilder = new TunnelIdBuilder()
31 .setTunnelId(metadataBytes);
32 if (builder.isHasMask()) {
33 tunnelIdBuilder.setMask(OxmDeserializerHelper.convertMask(input, Long.BYTES));
35 builder.setMatchEntryValue(new TunnelIdCaseBuilder().setTunnelId(tunnelIdBuilder.build()).build());