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.group.service.rev130918.AddGroupInput;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupInputBuilder;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.AddGroupOutput;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupMessage;
20 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupModCommand;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
23 public class SingleLayerGroupServiceTest extends ServiceMocking {
24 private static final long GROUP_ID = 42;
25 private SingleLayerGroupService<AddGroupOutput> service;
28 protected void setup() throws Exception {
29 service = new SingleLayerGroupService<>(mockedRequestContextStack,
30 mockedDeviceContext, AddGroupOutput.class);
34 public void buildRequest() throws Exception {
35 final AddGroupInput input = new AddGroupInputBuilder()
36 .setGroupId(new GroupId(GROUP_ID))
39 final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
40 assertEquals(GroupMessage.class, ofHeader.getImplementedInterface());
42 final GroupMessage result = (GroupMessage) ofHeader;
44 assertEquals(GroupModCommand.OFPGCADD, result.getCommand());
45 assertEquals(GROUP_ID, result.getGroupId().getValue().longValue());