use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput in project openflowplugin by opendaylight.
the class QueueDirectStatisticsServiceTest method testBuildRequestBody.
@Override
public void testBuildRequestBody() throws Exception {
final GetQueueStatisticsInput input = mock(GetQueueStatisticsInput.class);
when(input.getNode()).thenReturn(createNodeRef(NODE_ID));
when(input.getQueueId()).thenReturn(new QueueId(QUEUE_NO));
when(input.getNodeConnectorId()).thenReturn(new NodeConnectorId(NODE_ID + ":" + PORT_NO));
final MultipartRequestQueueCase body = (MultipartRequestQueueCase) ((MultipartRequestInput) service.buildRequest(new Xid(42L), input)).getMultipartRequestBody();
final MultipartRequestQueue queue = body.getMultipartRequestQueue();
assertEquals(PORT_NO, queue.getPortNo());
assertEquals(QUEUE_NO, queue.getQueueId());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput in project openflowplugin by opendaylight.
the class OpendaylightFlowTableStatisticsServiceImplTest method testBuildRequest.
@Test
public void testBuildRequest() throws Exception {
Xid xid = new Xid(42L);
GetFlowTablesStatisticsInputBuilder input = new GetFlowTablesStatisticsInputBuilder().setNode(createNodeRef("unitProt:123"));
final OfHeader request = flowTableStatisticsService.buildRequest(xid, input.build());
Assert.assertTrue(request instanceof MultipartRequestInput);
final MultipartRequestInput mpRequest = (MultipartRequestInput) request;
Assert.assertEquals(MultipartType.OFPMPTABLE, mpRequest.getType());
Assert.assertTrue(mpRequest.getMultipartRequestBody() instanceof MultipartRequestTableCase);
final MultipartRequestTableCase mpRequestBody = (MultipartRequestTableCase) (mpRequest.getMultipartRequestBody());
Assert.assertTrue(mpRequestBody.getMultipartRequestTable().isEmpty());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput in project openflowplugin by opendaylight.
the class MultipartRequestInputMessageFactory method deserialize.
@Override
public MultipartRequestInput deserialize(ByteBuf rawMessage) {
Objects.requireNonNull(registry);
MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
builder.setVersion((short) EncodeConstants.OF13_VERSION_ID);
builder.setXid(rawMessage.readUnsignedInt());
int type = rawMessage.readUnsignedShort();
builder.setType(getMultipartType(type));
builder.setFlags(getMultipartRequestFlags(rawMessage.readUnsignedShort()));
rawMessage.skipBytes(PADDING);
switch(MultipartType.forValue(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 OFPMPTABLEFEATURES:
builder.setMultipartRequestBody(setTableFeatures(rawMessage));
break;
case OFPMPPORTSTATS:
builder.setMultipartRequestBody(setPortStats(rawMessage));
break;
case OFPMPPORTDESC:
builder.setMultipartRequestBody(setPortDesc(rawMessage));
break;
case OFPMPQUEUE:
builder.setMultipartRequestBody(setQueue(rawMessage));
break;
case OFPMPGROUP:
builder.setMultipartRequestBody(setGroup(rawMessage));
break;
case OFPMPGROUPDESC:
builder.setMultipartRequestBody(setGroupDesc(rawMessage));
break;
case OFPMPGROUPFEATURES:
builder.setMultipartRequestBody(setGroupFeatures(rawMessage));
break;
case OFPMPMETER:
builder.setMultipartRequestBody(setMeter(rawMessage));
break;
case OFPMPMETERCONFIG:
builder.setMultipartRequestBody(setMeterConfig(rawMessage));
break;
case OFPMPMETERFEATURES:
builder.setMultipartRequestBody(setMeterFeatures(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 MultipartRequestDescInputMessageFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 00 00 01 00 00 00 00");
MultipartRequestInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(deserializedMessage);
Assert.assertEquals("Wrong type", MultipartType.forValue(0), deserializedMessage.getType());
Assert.assertEquals("Wrong flags", new MultipartRequestFlags(true), deserializedMessage.getFlags());
Assert.assertEquals("Wrong aggregate", createRequestDesc(), deserializedMessage.getMultipartRequestBody());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput in project openflowplugin by opendaylight.
the class MultipartRequestQueueInputMessageFactoryTest method test.
@Test
public void test() {
ByteBuf bb = BufferHelper.buildBuffer("00 05 00 01 00 00 00 00 00 00 08 d0 00 00 08 a3");
MultipartRequestInput deserializedMessage = BufferHelper.deserialize(factory, bb);
BufferHelper.checkHeaderV13(deserializedMessage);
Assert.assertEquals("Wrong type", MultipartType.forValue(5), deserializedMessage.getType());
Assert.assertEquals("Wrong flags", new MultipartRequestFlags(true), deserializedMessage.getFlags());
Assert.assertEquals("Wrong aggregate", createRequestQueue(), deserializedMessage.getMultipartRequestBody());
}
Aggregations