X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflow-protocol-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowjava%2Fprotocol%2Fimpl%2Fdeserialization%2Fmatch%2FOxmMplsTcDeserializer.java;h=ed77c9025f616e0f6876916d5e59ee5559e35796;hb=29a2a074c78708f6d18583779ece96bb6573f0c6;hp=f7a063393bfb2e8d084d5bf5c074b5e05e393dde;hpb=138faab735adbfe386941d9302853dd6b20c31be;p=openflowjava.git diff --git a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmMplsTcDeserializer.java b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmMplsTcDeserializer.java index f7a06339..ed77c902 100644 --- a/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmMplsTcDeserializer.java +++ b/openflow-protocol-impl/src/main/java/org/opendaylight/openflowjava/protocol/impl/deserialization/match/OxmMplsTcDeserializer.java @@ -1,52 +1,53 @@ -/* - * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - */ -package org.opendaylight.openflowjava.protocol.impl.deserialization.match; - -import io.netty.buffer.ByteBuf; - -import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntry; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.TcMatchEntryBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MatchField; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.MplsTc; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OxmClassBase; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries; -import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder; - -/** - * @author michal.polkorab - * - */ -public class OxmMplsTcDeserializer extends AbstractOxmMatchEntryDeserializer - implements OFDeserializer { - - @Override - public MatchEntries deserialize(ByteBuf input) { - MatchEntriesBuilder builder = processHeader(getOxmClass(), getOxmField(), input); - addMplsTcAugmentation(input, builder); - return builder.build(); - } - - private static void addMplsTcAugmentation(ByteBuf input, - MatchEntriesBuilder builder) { - TcMatchEntryBuilder tcBuilder = new TcMatchEntryBuilder(); - tcBuilder.setTc(input.readUnsignedByte()); - builder.addAugmentation(TcMatchEntry.class, tcBuilder.build()); - } - - @Override - protected Class getOxmField() { - return MplsTc.class; - } - - @Override - protected Class getOxmClass() { - return OpenflowBasicClass.class; - } +/* + * Copyright (c) 2013 Pantheon Technologies s.r.o. and others. All rights reserved. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License v1.0 which accompanies this distribution, + * and is available at http://www.eclipse.org/legal/epl-v10.html + */ +package org.opendaylight.openflowjava.protocol.impl.deserialization.match; + +import io.netty.buffer.ByteBuf; + +import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MatchField; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.MplsTc; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OxmClassBase; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntry; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.MplsTcCaseBuilder; +import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.mpls.tc._case.MplsTcBuilder; + +/** + * @author michal.polkorab + * + */ +public class OxmMplsTcDeserializer extends AbstractOxmMatchEntryDeserializer + implements OFDeserializer { + + @Override + public MatchEntry deserialize(ByteBuf input) { + MatchEntryBuilder builder = processHeader(getOxmClass(), getOxmField(), input); + addMplsTcValue(input, builder); + return builder.build(); + } + + private static void addMplsTcValue(ByteBuf input, MatchEntryBuilder builder) { + MplsTcCaseBuilder caseBuilder = new MplsTcCaseBuilder(); + MplsTcBuilder tcBuilder = new MplsTcBuilder(); + tcBuilder.setTc(input.readUnsignedByte()); + caseBuilder.setMplsTc(tcBuilder.build()); + builder.setMatchEntryValue(caseBuilder.build()); + } + + @Override + protected Class getOxmField() { + return MplsTc.class; + } + + @Override + protected Class getOxmClass() { + return OpenflowBasicClass.class; + } } \ No newline at end of file