Search in sources :

Example 6 with MultipartRequestAggregateBuilder

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

the class MultipartRequestInputFactoryTest method createRequestAggregate.

private static MultipartRequestAggregateCase createRequestAggregate() {
    final MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
    MultipartRequestAggregateBuilder builder = new MultipartRequestAggregateBuilder();
    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.setMultipartRequestAggregate(builder.build());
    // TODO match field
    return caseBuilder.build();
}
Also used : MultipartRequestAggregateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder) BigInteger(java.math.BigInteger) MultipartRequestAggregateCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder)

Example 7 with MultipartRequestAggregateBuilder

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

the class OF10StatsRequestAggregateTest method test.

/**
 * Tests {@link OF10StatsRequestInputFactory} for correct serialization.
 */
@Test
public void test() throws Exception {
    MultipartRequestInputBuilder builder = new MultipartRequestInputBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF10_VERSION_ID);
    builder.setType(MultipartType.OFPMPAGGREGATE);
    builder.setFlags(new MultipartRequestFlags(false));
    final MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
    final MultipartRequestAggregateBuilder aggBuilder = new MultipartRequestAggregateBuilder();
    MatchV10Builder matchBuilder = new MatchV10Builder();
    matchBuilder.setWildcards(new FlowWildcardsV10(true, true, true, true, true, true, true, true, true, true));
    matchBuilder.setNwSrcMask((short) 8);
    matchBuilder.setNwDstMask((short) 16);
    matchBuilder.setInPort(51);
    matchBuilder.setDlSrc(new MacAddress("00:01:02:03:04:05"));
    matchBuilder.setDlDst(new MacAddress("05:04:03:02:01:00"));
    matchBuilder.setDlVlan(52);
    matchBuilder.setDlVlanPcp((short) 53);
    matchBuilder.setDlType(54);
    matchBuilder.setNwTos((short) 55);
    matchBuilder.setNwProto((short) 56);
    matchBuilder.setNwSrc(new Ipv4Address("10.0.0.1"));
    matchBuilder.setNwDst(new Ipv4Address("10.0.0.2"));
    matchBuilder.setTpSrc(57);
    matchBuilder.setTpDst(58);
    aggBuilder.setMatchV10(matchBuilder.build());
    aggBuilder.setTableId((short) 5);
    aggBuilder.setOutPort(42L);
    caseBuilder.setMultipartRequestAggregate(aggBuilder.build());
    builder.setMultipartRequestBody(caseBuilder.build());
    MultipartRequestInput message = builder.build();
    ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
    statsFactory.serialize(message, out);
    BufferHelper.checkHeaderV10(out, (byte) 16, 56);
    Assert.assertEquals("Wrong type", 2, out.readUnsignedShort());
    Assert.assertEquals("Wrong flags", 0, out.readUnsignedShort());
    // skip match check
    out.skipBytes(40);
    Assert.assertEquals("Wrong table-id", 5, out.readUnsignedByte());
    out.skipBytes(1);
    Assert.assertEquals("Wrong out port", 42, out.readUnsignedShort());
}
Also used : MultipartRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder) FlowWildcardsV10(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10) MultipartRequestAggregateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder) MatchV10Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10Builder) MultipartRequestFlags(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartRequestFlags) MultipartRequestAggregateCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder) MacAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress) ByteBuf(io.netty.buffer.ByteBuf) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) MultipartRequestInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInput) Test(org.junit.Test)

Example 8 with MultipartRequestAggregateBuilder

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

the class MultipartRequestAggregateInputMessageFactoryTest method createRequestAggregate.

private static MultipartRequestAggregateCase createRequestAggregate() {
    final MultipartRequestAggregateCaseBuilder caseBuilder = new MultipartRequestAggregateCaseBuilder();
    MultipartRequestAggregateBuilder builder = new MultipartRequestAggregateBuilder();
    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.setMultipartRequestAggregate(builder.build());
    return caseBuilder.build();
}
Also used : MultipartRequestAggregateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder) BigInteger(java.math.BigInteger) MultipartRequestAggregateCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder)

Example 9 with MultipartRequestAggregateBuilder

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

the class FlowCreatorUtilTest method testSetWildcardedFlowMatch_.

/**
 * Test method for
 * {@link FlowCreatorUtil#setWildcardedFlowMatch(short version, MultipartRequestAggregateBuilder aggregateBuilder)}.
 */
@Test
public void testSetWildcardedFlowMatch_() {
    MultipartRequestAggregateBuilder multipartRequestAggregateBuilder = new MultipartRequestAggregateBuilder();
    FlowCreatorUtil.setWildcardedFlowMatch(OFConstants.OFP_VERSION_1_0, multipartRequestAggregateBuilder);
    MultipartRequestAggregate multipartRequestAggregate = multipartRequestAggregateBuilder.build();
    assertMatch(multipartRequestAggregate.getMatchV10());
    multipartRequestAggregateBuilder = new MultipartRequestAggregateBuilder();
    FlowCreatorUtil.setWildcardedFlowMatch(OFConstants.OFP_VERSION_1_3, multipartRequestAggregateBuilder);
    multipartRequestAggregate = multipartRequestAggregateBuilder.build();
    assertMatch(multipartRequestAggregate.getMatch());
}
Also used : MultipartRequestAggregateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder) MultipartRequestAggregate(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregate) Test(org.junit.Test)

Example 10 with MultipartRequestAggregateBuilder

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

the class AggregateFlowsInTableService method buildRequest.

@Override
protected OfHeader buildRequest(final Xid xid, final GetAggregateFlowStatisticsFromFlowTableForAllFlowsInput input) throws ServiceException {
    // Create multipart request body for fetch all the group stats
    final MultipartRequestAggregateCaseBuilder multipartRequestAggregateCaseBuilder = new MultipartRequestAggregateCaseBuilder();
    final MultipartRequestAggregateBuilder mprAggregateRequestBuilder = new MultipartRequestAggregateBuilder();
    mprAggregateRequestBuilder.setTableId(input.getTableId().getValue());
    mprAggregateRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
    mprAggregateRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
    mprAggregateRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
    mprAggregateRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
    final short version = getVersion();
    FlowCreatorUtil.setWildcardedFlowMatch(version, mprAggregateRequestBuilder);
    // Set request body to main multipart request
    multipartRequestAggregateCaseBuilder.setMultipartRequestAggregate(mprAggregateRequestBuilder.build());
    final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(MultipartType.OFPMPAGGREGATE, xid.getValue(), version);
    mprInput.setMultipartRequestBody(multipartRequestAggregateCaseBuilder.build());
    return mprInput.build();
}
Also used : MultipartRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder) MultipartRequestAggregateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder) MultipartRequestAggregateCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder)

Aggregations

MultipartRequestAggregateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.aggregate._case.MultipartRequestAggregateBuilder)11 MultipartRequestAggregateCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestAggregateCaseBuilder)9 BigInteger (java.math.BigInteger)4 MultipartRequestInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder)3 Test (org.junit.Test)2 MessageCodeKey (org.opendaylight.openflowjava.protocol.api.keys.MessageCodeKey)2 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)2 MacAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress)2 FlowWildcardsV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10)2 MatchV10 (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10)2 MatchV10Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.v10.grouping.MatchV10Builder)2 ByteBuf (io.netty.buffer.ByteBuf)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 EncodeConstants (org.opendaylight.openflowjava.protocol.api.util.EncodeConstants)1 OFConstants (org.opendaylight.openflowplugin.api.OFConstants)1 ConvertorKey (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ConvertorKey)1 ResultInjector (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.ResultInjector)1