Use ByteBuf.readRetainedSlice()
[openflowplugin.git] / openflowplugin-impl / src / main / java / org / opendaylight / openflowplugin / impl / protocol / serialization / match / Icmpv6CodeEntrySerializer.java
1 /*
2  * Copyright (c) 2016 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.openflowplugin.impl.protocol.serialization.match;
9
10 import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.Match;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6Match;
13 import org.opendaylight.yangtools.yang.common.Uint8;
14
15 public class Icmpv6CodeEntrySerializer extends AbstractUint8EntrySerializer {
16     public Icmpv6CodeEntrySerializer() {
17         super(OxmMatchConstants.OPENFLOW_BASIC_CLASS, OxmMatchConstants.ICMPV6_CODE);
18     }
19
20     @Override
21     protected Uint8 extractEntry(final Match match) {
22         final Icmpv6Match icmpMatch = match.getIcmpv6Match();
23         return icmpMatch == null ? null : icmpMatch.getIcmpv6Code();
24     }
25 }