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
9 package org.opendaylight.openflowplugin.impl.services.singlelayer;
11 import static org.junit.Assert.assertEquals;
13 import org.junit.Test;
14 import org.opendaylight.openflowplugin.impl.services.ServiceMocking;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortMessage;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.PortBuilder;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortOutput;
22 public class SingleLayerPortServiceTest extends ServiceMocking {
23 private static final long PORT_ID = 42;
24 private SingleLayerPortService<UpdatePortOutput> service;
27 protected void setup() throws Exception {
28 service = new SingleLayerPortService<>(mockedRequestContextStack,
29 mockedDeviceContext, UpdatePortOutput.class);
33 public void buildRequest() throws Exception {
34 final Port input = new PortBuilder()
35 .setPortNumber(new PortNumberUni(PORT_ID))
38 final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
39 assertEquals(PortMessage.class, ofHeader.getImplementedInterface());
41 final PortMessage result = PortMessage.class.cast(ofHeader);
43 assertEquals(PORT_ID, result.getPortNumber().getUint32().longValue());