use of org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsInput in project openflowplugin by opendaylight.
the class OpendaylightDirectStatisticsServiceImplTest method testGetFlowStatisticsFail.
@Test
public void testGetFlowStatisticsFail() throws Exception {
RpcResult<GetFlowStatisticsOutput> result = emptyService.getFlowStatistics(getFlowStatisticsInput).get();
assertFalse(result.isSuccessful());
for (RpcError error : result.getErrors()) {
assertTrue(error.getMessage().contains(AbstractFlowDirectStatisticsService.class.getSimpleName()));
}
verify(flowDirectStatisticsService, times(0)).handleAndReply(getFlowStatisticsInput);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsInput in project netvirt by opendaylight.
the class TestOdlDirectStatisticsService method getFlowStatistics.
@Override
public Future<RpcResult<GetFlowStatisticsOutput>> getFlowStatistics(GetFlowStatisticsInput input) {
LOG.info("getFlowStatistics rpc input = {}", input);
List<FlowAndStatisticsMapList> flowStatsList = new ArrayList<>();
FlowAndStatisticsMapList portIngressFlowStats1 = buildFlowStats(NwConstants.EGRESS_ACL_FILTER_CUM_DISPATCHER_TABLE, AclConstants.ACL_PORT_SPECIFIC_DROP_PRIORITY, 1, 5, 5);
FlowAndStatisticsMapList portIngressFlowStats2 = buildFlowStats(NwConstants.EGRESS_ACL_FILTER_CUM_DISPATCHER_TABLE, AclConstants.CT_STATE_TRACKED_INVALID_PRIORITY, 1, 10, 10);
FlowAndStatisticsMapList portEgressFlowStats1 = buildFlowStats(NwConstants.INGRESS_ACL_FILTER_CUM_DISPATCHER_TABLE, AclConstants.ACL_PORT_SPECIFIC_DROP_PRIORITY, 1, 15, 15);
FlowAndStatisticsMapList portEgressFlowStats2 = buildFlowStats(NwConstants.INGRESS_ACL_FILTER_CUM_DISPATCHER_TABLE, AclConstants.CT_STATE_TRACKED_INVALID_PRIORITY, 1, 20, 20);
if (input.getTableId() == null || input.getTableId() == NwConstants.EGRESS_ACL_FILTER_CUM_DISPATCHER_TABLE) {
flowStatsList.add(portIngressFlowStats1);
flowStatsList.add(portIngressFlowStats2);
}
if (input.getTableId() == null || input.getTableId() == NwConstants.INGRESS_ACL_FILTER_CUM_DISPATCHER_TABLE) {
flowStatsList.add(portEgressFlowStats1);
flowStatsList.add(portEgressFlowStats2);
}
GetFlowStatisticsOutput output = new GetFlowStatisticsOutputBuilder().setFlowAndStatisticsMapList(flowStatsList).build();
RpcResultBuilder<GetFlowStatisticsOutput> rpcResultBuilder = RpcResultBuilder.success();
rpcResultBuilder.withResult(output);
return Futures.immediateFuture(rpcResultBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsInput in project openflowplugin by opendaylight.
the class FlowDirectStatisticsServiceTest method testBuildRequestBody.
@Override
public void testBuildRequestBody() throws Exception {
final GetFlowStatisticsInput input = mock(GetFlowStatisticsInput.class);
when(input.getNode()).thenReturn(createNodeRef(NODE_ID));
when(input.getTableId()).thenReturn(TABLE_NO);
final MultipartRequestFlowStats body = (MultipartRequestFlowStats) ((MultipartRequest) service.buildRequest(new Xid(42L), input)).getMultipartRequestBody();
assertEquals(TABLE_NO, body.getTableId());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsInput in project openflowplugin by opendaylight.
the class FlowDirectStatisticsServiceTest method testBuildRequestBody.
@Override
public void testBuildRequestBody() throws Exception {
final GetFlowStatisticsInput input = mock(GetFlowStatisticsInput.class);
when(input.getNode()).thenReturn(createNodeRef(NODE_ID));
when(input.getTableId()).thenReturn(TABLE_NO);
final MultipartRequestFlowCase body = (MultipartRequestFlowCase) ((MultipartRequestInput) service.buildRequest(new Xid(42L), input)).getMultipartRequestBody();
final MultipartRequestFlow flow = body.getMultipartRequestFlow();
assertEquals(TABLE_NO, flow.getTableId());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsInput 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();
}
Aggregations