Use ByteBuf.readRetainedSlice()
[openflowplugin.git] / openflowplugin-impl / src / test / java / org / opendaylight / openflowplugin / impl / services / util / RequestInputUtilsTest.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 package org.opendaylight.openflowplugin.impl.services.util;
9
10 import static org.junit.Assert.assertEquals;
11 import static org.junit.Assert.assertFalse;
12
13 import org.junit.Test;
14 import org.opendaylight.openflowplugin.api.OFConstants;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput;
17 import org.opendaylight.yangtools.yang.common.Uint32;
18 import org.opendaylight.yangtools.yang.common.Uint8;
19
20 public class RequestInputUtilsTest {
21     @Test
22     public void createMultipartHeader() {
23         final Uint8 version = OFConstants.OFP_VERSION_1_3;
24         final Uint32 xid = Uint32.valueOf(42L);
25         final MultipartType type = MultipartType.OFPMPDESC;
26
27         final MultipartRequestInput input = RequestInputUtils
28                 .createMultipartHeader(type, xid, version)
29                 .build();
30
31         assertEquals(version, input.getVersion());
32         assertEquals(xid, input.getXid());
33         assertEquals(type, input.getType());
34         assertFalse(input.getFlags().getOFPMPFREQMORE());
35     }
36 }