2 * Copyright (c) 2017 Pantheon Technologies s.r.o. and others. All rights reserved.
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
8 package org.opendaylight.openflowplugin.impl.services.singlelayer;
10 import static org.junit.Assert.assertEquals;
12 import org.junit.Test;
13 import org.opendaylight.openflowplugin.impl.services.ServiceMocking;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortMessage;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortBuilder;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutput;
20 import org.opendaylight.yangtools.yang.common.Uint32;
22 public class SingleLayerPortServiceTest extends ServiceMocking {
23 private static final Uint32 PORT_ID = Uint32.valueOf(42);
24 private SingleLayerPortService<UpdatePortOutput> service;
27 protected void setup() {
28 service = new SingleLayerPortService<>(mockedRequestContextStack, mockedDeviceContext, UpdatePortOutput.class);
32 public void buildRequest() {
33 final Port input = new PortBuilder()
34 .setPortNumber(new PortNumberUni(PORT_ID))
35 .setPortModOrder(Uint32.ZERO)
38 final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
39 assertEquals(PortMessage.class, ofHeader.implementedInterface());
41 final PortMessage result = (PortMessage) ofHeader;
43 assertEquals(PORT_ID, result.getPortNumber().getUint32());