Bump upstreams for 2022.09 Chlorine
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / protocol / serialization / multipart / tablefeatures / NextTableTablePropertySerializerTest.java
1 /*
2  * Copyright (c) 2017 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.openflowplugin.impl.protocol.serialization.multipart.tablefeatures;
10
11 import static org.junit.Assert.assertEquals;
12
13 import java.util.Collections;
14 import org.junit.Test;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.TableFeaturesPropType;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.TableFeaturePropType;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTable;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.NextTableBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop.type.next.table.TablesBuilder;
20 import org.opendaylight.yangtools.yang.common.Uint8;
21
22 public class NextTableTablePropertySerializerTest extends AbstractTablePropertySerializerTest {
23
24     @Test
25     public void testSerialize() {
26         final short tableId = 42;
27         final NextTable property = new NextTableBuilder()
28                 .setTables(new TablesBuilder()
29                         .setTableIds(Collections.singletonList(Uint8.valueOf(tableId)))
30                         .build())
31                 .build();
32
33         assertProperty(property, out -> assertEquals(out.readUnsignedByte(), tableId));
34     }
35
36     @Override
37     protected Class<? extends TableFeaturePropType> getClazz() {
38         return NextTable.class;
39     }
40
41     @Override
42     protected int getType() {
43         return TableFeaturesPropType.OFPTFPTNEXTTABLES.getIntValue();
44     }
45
46 }