Bump upstreams for 2022.09 Chlorine
[openflowplugin.git] / openflowjava / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / deserialization / match / OxmIpv6FlabelDeserializer.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 static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
11
12 import io.netty.buffer.ByteBuf;
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6FlowLabel;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Ipv6Flabel;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Ipv6FlabelCaseBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.ipv6.flabel._case.Ipv6FlabelBuilder;
18
19 /**
20  * Translates Ipv6Flabel messages.
21  *
22  * @author michal.polkorab
23  */
24 public class OxmIpv6FlabelDeserializer extends AbstractOxmMatchEntryDeserializer {
25     public OxmIpv6FlabelDeserializer() {
26         super(Ipv6Flabel.VALUE);
27     }
28
29     @Override
30     protected void deserialize(final ByteBuf input, final MatchEntryBuilder builder) {
31         final Ipv6FlabelBuilder labelBuilder = new Ipv6FlabelBuilder()
32                 .setIpv6Flabel(new Ipv6FlowLabel(readUint32(input)));
33         if (builder.getHasMask()) {
34             labelBuilder.setMask(OxmDeserializerHelper.convertMask(input, Integer.BYTES));
35         }
36         builder.setMatchEntryValue(new Ipv6FlabelCaseBuilder().setIpv6Flabel(labelBuilder.build()).build());
37     }
38 }