Search in sources :

Example 46 with OfHeader

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader in project openflowplugin by opendaylight.

the class GroupStatsService method buildRequest.

@Override
protected OfHeader buildRequest(final Xid xid, final GetGroupStatisticsInput input) throws ServiceException {
    final MultipartRequestGroupCaseBuilder caseBuilder = new MultipartRequestGroupCaseBuilder();
    final MultipartRequestGroupBuilder mprGroupBuild = new MultipartRequestGroupBuilder();
    mprGroupBuild.setGroupId(new GroupId(input.getGroupId().getValue()));
    caseBuilder.setMultipartRequestGroup(mprGroupBuild.build());
    final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(MultipartType.OFPMPGROUP, xid.getValue(), getVersion());
    mprInput.setMultipartRequestBody(caseBuilder.build());
    return mprInput.build();
}
Also used : MultipartRequestGroupCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupCaseBuilder) MultipartRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder) MultipartRequestGroupBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroupBuilder) GroupId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.GroupId)

Example 47 with OfHeader

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader in project openflowplugin by opendaylight.

the class MeterStatsService method buildRequest.

@Override
protected OfHeader buildRequest(final Xid xid, final GetMeterStatisticsInput input) throws ServiceException {
    MultipartRequestMeterCaseBuilder caseBuilder = new MultipartRequestMeterCaseBuilder();
    MultipartRequestMeterBuilder mprMeterBuild = new MultipartRequestMeterBuilder();
    mprMeterBuild.setMeterId(new MeterId(input.getMeterId().getValue()));
    caseBuilder.setMultipartRequestMeter(mprMeterBuild.build());
    MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(MultipartType.OFPMPMETER, xid.getValue(), getVersion());
    mprInput.setMultipartRequestBody(caseBuilder.build());
    return mprInput.build();
}
Also used : MultipartRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder) MultipartRequestMeterCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestMeterCaseBuilder) MultipartRequestMeterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.meter._case.MultipartRequestMeterBuilder) MeterId(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MeterId)

Example 48 with OfHeader

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader in project openflowplugin by opendaylight.

the class PortStatsService method buildRequest.

@Override
protected OfHeader buildRequest(final Xid xid, final GetNodeConnectorStatisticsInput input) throws ServiceException {
    MultipartRequestPortStatsCaseBuilder caseBuilder = new MultipartRequestPortStatsCaseBuilder();
    MultipartRequestPortStatsBuilder mprPortStatsBuilder = new MultipartRequestPortStatsBuilder();
    // Set specific port
    final short version = getVersion();
    mprPortStatsBuilder.setPortNo(InventoryDataServiceUtil.portNumberfromNodeConnectorId(OpenflowVersion.get(version), input.getNodeConnectorId()));
    caseBuilder.setMultipartRequestPortStats(mprPortStatsBuilder.build());
    MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(MultipartType.OFPMPPORTSTATS, xid.getValue(), version);
    mprInput.setMultipartRequestBody(caseBuilder.build());
    return mprInput.build();
}
Also used : MultipartRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder) MultipartRequestPortStatsCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestPortStatsCaseBuilder) MultipartRequestPortStatsBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.port.stats._case.MultipartRequestPortStatsBuilder)

Example 49 with OfHeader

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader in project openflowplugin by opendaylight.

the class FlowDirectStatisticsService method buildRequest.

@Override
protected OfHeader buildRequest(final Xid xid, final GetFlowStatisticsInput input) {
    final MultipartRequestFlowBuilder mprFlowRequestBuilder = new MultipartRequestFlowBuilder();
    if (input.getTableId() != null) {
        mprFlowRequestBuilder.setTableId(input.getTableId());
    } else {
        mprFlowRequestBuilder.setTableId(OFConstants.OFPTT_ALL);
    }
    if (input.getOutPort() != null) {
        mprFlowRequestBuilder.setOutPort(input.getOutPort().longValue());
    } else {
        mprFlowRequestBuilder.setOutPort(OFConstants.OFPP_ANY);
    }
    if (input.getOutGroup() != null) {
        mprFlowRequestBuilder.setOutGroup(input.getOutGroup());
    } else {
        mprFlowRequestBuilder.setOutGroup(OFConstants.OFPG_ANY);
    }
    if (input.getCookie() != null) {
        mprFlowRequestBuilder.setCookie(input.getCookie().getValue());
    } else {
        mprFlowRequestBuilder.setCookie(OFConstants.DEFAULT_COOKIE);
    }
    if (input.getCookieMask() != null) {
        mprFlowRequestBuilder.setCookieMask(input.getCookieMask().getValue());
    } else {
        mprFlowRequestBuilder.setCookieMask(OFConstants.DEFAULT_COOKIE_MASK);
    }
    // convert and inject match
    final Optional<Object> conversionMatch = getConvertorExecutor().convert(input.getMatch(), data);
    MatchInjector.inject(conversionMatch, mprFlowRequestBuilder, data.getVersion());
    return RequestInputUtils.createMultipartHeader(getMultipartType(), xid.getValue(), getVersion()).setMultipartRequestBody(new MultipartRequestFlowCaseBuilder().setMultipartRequestFlow(mprFlowRequestBuilder.build()).build()).build();
}
Also used : MultipartRequestFlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder) MultipartRequestFlowCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestFlowCaseBuilder)

Example 50 with OfHeader

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader in project openflowplugin by opendaylight.

the class AllFlowsInAllTablesService method buildRequest.

@Override
protected OfHeader buildRequest(final Xid xid, final GetAllFlowsStatisticsFromAllFlowTablesInput input) throws ServiceException {
    final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(MultipartType.OFPMPFLOW, xid.getValue(), getVersion());
    mprInput.setMultipartRequestBody(flowCase);
    return mprInput.build();
}
Also used : MultipartRequestInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder)

Aggregations

OfHeader (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader)30 Test (org.junit.Test)23 MultipartRequestInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartRequestInputBuilder)17 Xid (org.opendaylight.openflowplugin.api.openflow.device.Xid)10 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)5 ExecutionException (java.util.concurrent.ExecutionException)3 ServiceException (org.opendaylight.openflowplugin.impl.services.util.ServiceException)3 GroupMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupMessage)3 MultipartType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType)3 FutureCallback (com.google.common.util.concurrent.FutureCallback)2 List (java.util.List)2 Future (java.util.concurrent.Future)2 Function (java.util.function.Function)2 OFDeserializer (org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer)2 TypeVersionKey (org.opendaylight.openflowplugin.extension.api.TypeVersionKey)2 ConversionException (org.opendaylight.openflowplugin.extension.api.exception.ConversionException)2 ConverterNotFoundException (org.opendaylight.openflowplugin.extension.api.exception.ConverterNotFoundException)2 ConvertorExecutor (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor)2 PortMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortMessage)2 FlowMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowMessage)2