use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCase in project openflowplugin by opendaylight.
the class MultipartRequestInputFactory method serializeFlowBody.
private void serializeFlowBody(final MultipartRequestBody multipartRequestBody, final ByteBuf output) {
MultipartRequestFlowCase flowCase = (MultipartRequestFlowCase) multipartRequestBody;
MultipartRequestFlow flow = flowCase.getMultipartRequestFlow();
output.writeByte(flow.getTableId().byteValue());
output.writeZero(PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_01);
output.writeInt(flow.getOutPort().intValue());
output.writeInt(flow.getOutGroup().intValue());
output.writeZero(PADDING_IN_MULTIPART_REQUEST_FLOW_BODY_02);
output.writeLong(flow.getCookie().longValue());
output.writeLong(flow.getCookieMask().longValue());
OFSerializer<Match> serializer = registry.getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, Match.class));
serializer.serialize(flow.getMatch(), output);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCase in project openflowplugin by opendaylight.
the class OF10StatsRequestInputFactory method setFlow.
private MultipartRequestFlowCase setFlow(ByteBuf input) {
final MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
MultipartRequestFlowBuilder flowBuilder = new MultipartRequestFlowBuilder();
OFDeserializer<MatchV10> matchDeserializer = registry.getDeserializer(new MessageCodeKey(EncodeConstants.OF10_VERSION_ID, EncodeConstants.EMPTY_VALUE, MatchV10.class));
flowBuilder.setMatchV10(matchDeserializer.deserialize(input));
flowBuilder.setTableId(input.readUnsignedByte());
input.skipBytes(FLOW_PADDING_1);
flowBuilder.setOutPort((long) input.readUnsignedShort());
caseBuilder.setMultipartRequestFlow(flowBuilder.build());
return caseBuilder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCase in project openflowplugin by opendaylight.
the class MultipartRequestInputFactoryTest method testMakeMultipartRequestInput_FLOW_10.
@Test
public void testMakeMultipartRequestInput_FLOW_10() throws Exception {
final MultipartType mpType = MultipartType.OFPMPFLOW;
ofVersion = OFConstants.OFP_VERSION_1_0;
final MultipartRequestInput mpRqInput = (MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
checkHeader(mpRqInput, mpType);
final MultipartRequestBody mpRqBody = mpRqInput.getMultipartRequestBody();
Assert.assertTrue(mpRqBody instanceof MultipartRequestFlowCase);
MultipartRequestFlow mpRq = ((MultipartRequestFlowCase) mpRqBody).getMultipartRequestFlow();
Assert.assertEquals(OFConstants.OFPTT_ALL, mpRq.getTableId());
Assert.assertEquals(OFConstants.OFPP_ANY, mpRq.getOutPort());
Assert.assertEquals(OFConstants.OFPG_ANY, mpRq.getOutGroup());
Assert.assertEquals(0, mpRq.getCookie().intValue());
Assert.assertEquals(0, mpRq.getCookieMask().intValue());
Assert.assertNull(mpRq.getMatch());
Assert.assertNotNull(mpRq.getMatchV10());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCase in project openflowplugin by opendaylight.
the class MultipartRequestInputFactoryTest method testMakeMultipartRequestInput_FLOW_13.
@Test
public void testMakeMultipartRequestInput_FLOW_13() throws Exception {
final MultipartType mpType = MultipartType.OFPMPFLOW;
final MultipartRequestInput mpRqInput = (MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
checkHeader(mpRqInput, mpType);
final MultipartRequestBody mpRqBody = mpRqInput.getMultipartRequestBody();
Assert.assertTrue(mpRqBody instanceof MultipartRequestFlowCase);
MultipartRequestFlow mpRq = ((MultipartRequestFlowCase) mpRqBody).getMultipartRequestFlow();
Assert.assertEquals(OFConstants.OFPTT_ALL, mpRq.getTableId());
Assert.assertEquals(OFConstants.OFPP_ANY, mpRq.getOutPort());
Assert.assertEquals(OFConstants.OFPG_ANY, mpRq.getOutGroup());
Assert.assertEquals(0, mpRq.getCookie().intValue());
Assert.assertEquals(0, mpRq.getCookieMask().intValue());
Assert.assertNotNull(mpRq.getMatch());
Assert.assertNull(mpRq.getMatchV10());
Assert.assertEquals(OxmMatchType.class, mpRq.getMatch().getType());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCase in project openflowplugin by opendaylight.
the class MultipartRequestFlowInputMessageFactoryTest method createRequestFlow.
private static MultipartRequestFlowCase createRequestFlow() {
final MultipartRequestFlowCaseBuilder caseBuilder = new MultipartRequestFlowCaseBuilder();
MultipartRequestFlowBuilder builder = new MultipartRequestFlowBuilder();
builder.setTableId((short) 8);
builder.setOutPort(85L);
builder.setOutGroup(95L);
byte[] cookie = new byte[] { 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 };
builder.setCookie(new BigInteger(1, cookie));
byte[] cookieMask = new byte[] { 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 };
builder.setCookieMask(new BigInteger(1, cookieMask));
caseBuilder.setMultipartRequestFlow(builder.build());
return caseBuilder.build();
}
Aggregations