Fix openflow-protocol-impl deprecation warnings
[openflowplugin.git] / openflowjava / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / deserialization / match / OxmPbbIsidDeserializer.java
1 /*
2  * Copyright (c) 2013 Pantheon Technologies s.r.o. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
9
10 import io.netty.buffer.ByteBuf;
11 import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.PbbIsid;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.PbbIsidCaseBuilder;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.pbb.isid._case.PbbIsidBuilder;
16 import org.opendaylight.yangtools.yang.common.Uint32;
17
18 /**
19  * Translates OxmPbbIsid messages.
20  *
21  * @author michal.polkorab
22  */
23 public class OxmPbbIsidDeserializer extends AbstractOxmMatchEntryDeserializer {
24     public OxmPbbIsidDeserializer() {
25         super(PbbIsid.class);
26     }
27
28     @Override
29     protected void deserialize(final ByteBuf input, final MatchEntryBuilder builder) {
30         final int isid = input.readUnsignedMedium();
31         final PbbIsidBuilder isidBuilder = new PbbIsidBuilder()
32                 .setIsid(Uint32.valueOf(isid));
33         if (builder.isHasMask()) {
34             isidBuilder.setMask(OxmDeserializerHelper.convertMask(input, EncodeConstants.SIZE_OF_3_BYTES));
35         }
36         builder.setMatchEntryValue(new PbbIsidCaseBuilder().setPbbIsid(isidBuilder.build()).build());
37     }
38 }