use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput in project openflowplugin by opendaylight.
the class OF10StatsRequestInputFactory method deserialize.
@Override
public MultipartRequestInput deserialize(ByteBuf rawMessage) {
Objects.requireNonNull(registry);
MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
builder.setVersion((short) EncodeConstants.OF10_VERSION_ID);
builder.setXid(rawMessage.readUnsignedInt());
int type = rawMessage.readUnsignedShort();
builder.setType(getMultipartType(type));
builder.setFlags(getMultipartRequestFlags(rawMessage.readUnsignedShort()));
switch(getMultipartType(type)) {
case OFPMPDESC:
builder.setMultipartRequestBody(setDesc(rawMessage));
break;
case OFPMPFLOW:
builder.setMultipartRequestBody(setFlow(rawMessage));
break;
case OFPMPAGGREGATE:
builder.setMultipartRequestBody(setAggregate(rawMessage));
break;
case OFPMPTABLE:
builder.setMultipartRequestBody(setTable(rawMessage));
break;
case OFPMPPORTSTATS:
builder.setMultipartRequestBody(setPortStats(rawMessage));
break;
case OFPMPQUEUE:
builder.setMultipartRequestBody(setQueue(rawMessage));
break;
case OFPMPEXPERIMENTER:
builder.setMultipartRequestBody(setExperimenter(rawMessage));
break;
default:
break;
}
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput in project openflowplugin by opendaylight.
the class PortStatsServiceTest method testBuildRequest.
@Test
public void testBuildRequest() throws Exception {
Xid xid = new Xid(42L);
GetNodeConnectorStatisticsInputBuilder input = new GetNodeConnectorStatisticsInputBuilder().setNodeConnectorId(new NodeConnectorId("junitProto:11:12")).setNode(createNodeRef("junitProto:11"));
final OfHeader request = portStatsService.buildRequest(xid, input.build());
Assert.assertTrue(request instanceof MultipartRequestInput);
final MultipartRequestInput mpRequest = (MultipartRequestInput) request;
Assert.assertTrue(mpRequest.getMultipartRequestBody() instanceof MultipartRequestPortStatsCase);
final MultipartRequestPortStatsCase mpRequestBody = (MultipartRequestPortStatsCase) mpRequest.getMultipartRequestBody();
Assert.assertEquals(12L, mpRequestBody.getMultipartRequestPortStats().getPortNo().longValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput 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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput in project openflowplugin by opendaylight.
the class NodeConnectorDirectStatisticsServiceTest method testBuildRequestBody.
@Override
public void testBuildRequestBody() throws Exception {
final GetNodeConnectorStatisticsInput input = mock(GetNodeConnectorStatisticsInput.class);
when(input.getNode()).thenReturn(createNodeRef(NODE_ID));
when(input.getNodeConnectorId()).thenReturn(nodeConnectorId);
final MultipartRequestPortStatsCase body = (MultipartRequestPortStatsCase) ((MultipartRequestInput) service.buildRequest(new Xid(42L), input)).getMultipartRequestBody();
final MultipartRequestPortStats nodeConnector = body.getMultipartRequestPortStats();
assertEquals(PORT_NO, nodeConnector.getPortNo());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput in project openflowplugin by opendaylight.
the class RequestInputUtilsTest method createMultipartHeader.
@Test
public void createMultipartHeader() throws Exception {
final Short version = OFConstants.OFP_VERSION_1_3;
final Long xid = 42L;
final MultipartType type = MultipartType.OFPMPDESC;
final MultipartRequestInput input = RequestInputUtils.createMultipartHeader(type, xid, version).build();
assertEquals(version, input.getVersion());
assertEquals(xid, input.getXid());
assertEquals(type, input.getType());
assertFalse(input.getFlags().isOFPMPFREQMORE());
}
Aggregations