Search in sources :

Example 1 with MultipartRequestGroup

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroup in project openflowplugin by opendaylight.

the class GroupDirectStatisticsServiceTest method testBuildRequestBody.

@Override
public void testBuildRequestBody() throws Exception {
    final GetGroupStatisticsInput input = mock(GetGroupStatisticsInput.class);
    when(input.getNode()).thenReturn(createNodeRef(NODE_ID));
    when(input.getGroupId()).thenReturn(new GroupId(GROUP_NO));
    final MultipartRequestGroupCase body = (MultipartRequestGroupCase) ((MultipartRequestInput) service.buildRequest(new Xid(42L), input)).getMultipartRequestBody();
    final MultipartRequestGroup group = body.getMultipartRequestGroup();
    assertEquals(GROUP_NO, group.getGroupId().getValue());
}
Also used : MultipartRequestGroupCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupCase) Xid(org.opendaylight.openflowplugin.api.openflow.device.Xid) MultipartRequestGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroup) GetGroupStatisticsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetGroupStatisticsInput) GroupId(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId)

Example 2 with MultipartRequestGroup

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroup in project openflowplugin by opendaylight.

the class MultipartRequestInputFactoryTest method testMakeMultipartRequestInputGroup.

@Test
public void testMakeMultipartRequestInputGroup() throws Exception {
    final MultipartType mpType = MultipartType.OFPMPGROUP;
    final MultipartRequestInput mpRqInput = (MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
    checkHeader(mpRqInput, mpType);
    final MultipartRequestBody mpRqBody = mpRqInput.getMultipartRequestBody();
    Assert.assertTrue(mpRqBody instanceof MultipartRequestGroupCase);
    MultipartRequestGroup mpRq = ((MultipartRequestGroupCase) mpRqBody).getMultipartRequestGroup();
    Assert.assertEquals(OFConstants.OFPG_ALL, mpRq.getGroupId().getValue());
}
Also used : MultipartRequestGroupCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupCase) MultipartRequestGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroup) MultipartType(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType) MultipartRequestBody(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.MultipartRequestBody) MultipartRequestInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput) Test(org.junit.Test)

Example 3 with MultipartRequestGroup

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroup in project openflowplugin by opendaylight.

the class MultipartRequestInputFactory method serializeeGroupStatsBody.

private static void serializeeGroupStatsBody(final MultipartRequestBody multipartRequestBody, final ByteBuf output) {
    MultipartRequestGroupCase groupStatsCase = (MultipartRequestGroupCase) multipartRequestBody;
    MultipartRequestGroup groupStats = groupStatsCase.getMultipartRequestGroup();
    output.writeInt(groupStats.getGroupId().getValue().intValue());
    output.writeZero(PADDING_IN_MULTIPART_REQUEST_GROUP_BODY);
}
Also used : MultipartRequestGroupCase(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupCase) MultipartRequestGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroup)

Aggregations

MultipartRequestGroupCase (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupCase)3 MultipartRequestGroup (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroup)3 Test (org.junit.Test)1 Xid (org.opendaylight.openflowplugin.api.openflow.device.Xid)1 GetGroupStatisticsInput (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetGroupStatisticsInput)1 GroupId (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId)1 MultipartType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType)1 MultipartRequestInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput)1 MultipartRequestBody (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.MultipartRequestBody)1