Mass replace CRLF->LF
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / deserialization / match / OxmIpv6ExtHdrDeserializerTest.java
1 /*
2  * Copyright (c) 2014 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
9 package org.opendaylight.openflowjava.protocol.impl.deserialization.match;
10
11 import io.netty.buffer.ByteBuf;
12
13 import org.junit.Assert;
14 import org.junit.Test;
15 import org.opendaylight.openflowjava.protocol.impl.util.BufferHelper;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.MaskMatchEntry;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.PseudoFieldMatchEntry;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Ipv6ExthdrFlags;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Ipv6Exthdr;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntries;
22
23 /**
24  * @author michal.polkorab
25  *
26  */
27 public class OxmIpv6ExtHdrDeserializerTest {
28
29     /**
30      * Tests {@link OxmIpv6ExtHdrDeserializer#deserialize(ByteBuf)}
31      */
32     @Test
33     public void test() {
34         ByteBuf buffer = BufferHelper.buildBuffer("80 00 4E 02 01 FF");
35
36         buffer.skipBytes(4); // skip XID
37         OxmIpv6ExtHdrDeserializer deserializer = new OxmIpv6ExtHdrDeserializer();
38         MatchEntries entry = deserializer.deserialize(buffer);
39
40         Assert.assertEquals("Wrong entry class", OpenflowBasicClass.class, entry.getOxmClass());
41         Assert.assertEquals("Wrong entry field", Ipv6Exthdr.class, entry.getOxmMatchField());
42         Assert.assertEquals("Wrong entry hasMask", false, entry.isHasMask());
43         Assert.assertEquals("Wrong entry value",
44                 new Ipv6ExthdrFlags(true, true, true, true, true, true, true, true, true),
45                 entry.getAugmentation(PseudoFieldMatchEntry.class).getPseudoField());
46         Assert.assertEquals("Wrong entry mask", null, entry.getAugmentation(MaskMatchEntry.class));
47         Assert.assertTrue("Unread data", buffer.readableBytes() == 0);
48     }
49 }