use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsInput in project netvirt by opendaylight.
the class AclLiveStatisticsRpcServiceTest method getStatsTwoPortBothDirection.
/**
* Test stats for two ports and both direction. <br>
* port1 is valid <br>
* port2 is invalid <br>
* Expectation: Error expected for port2
*
* @throws Exception the exception
*/
@Test
public void getStatsTwoPortBothDirection() throws Exception {
List<String> lstInterfaces = Arrays.asList(PORT_1, PORT_2);
Direction direction = Direction.Both;
GetAclPortStatisticsInput input = new GetAclPortStatisticsInputBuilder().setDirection(direction).setInterfaceNames(lstInterfaces).build();
Future<RpcResult<GetAclPortStatisticsOutput>> rpcResultFuture = aclStatsService.getAclPortStatistics(input);
RpcResult<GetAclPortStatisticsOutput> output = rpcResultFuture.get();
LOG.info("getStatsTwoPortBothDirection output = {}", output);
assertStatsOutput(output, direction);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsInput in project netvirt by opendaylight.
the class AclLiveStatisticsRpcServiceImpl method getAclPortStatistics.
@Override
public Future<RpcResult<GetAclPortStatisticsOutput>> getAclPortStatistics(GetAclPortStatisticsInput input) {
LOG.trace("Get ACL port statistics for input: {}", input);
RpcResultBuilder<GetAclPortStatisticsOutput> rpcResultBuilder;
if (this.securityGroupMode != SecurityGroupMode.Stateful) {
rpcResultBuilder = RpcResultBuilder.failed();
rpcResultBuilder.withError(ErrorType.APPLICATION, "operation-not-supported", "Operation not supported for ACL " + this.securityGroupMode + " mode");
return Futures.immediateFuture(rpcResultBuilder.build());
}
// Default direction is Both
Direction direction = input.getDirection() == null ? Direction.Both : input.getDirection();
List<AclPortStats> lstAclInterfaceStats = AclLiveStatisticsHelper.getAclPortStats(direction, input.getInterfaceNames(), this.odlDirectStatsService, this.dataBroker);
GetAclPortStatisticsOutputBuilder output = new GetAclPortStatisticsOutputBuilder().setAclPortStats(lstAclInterfaceStats);
rpcResultBuilder = RpcResultBuilder.success();
rpcResultBuilder.withResult(output.build());
return Futures.immediateFuture(rpcResultBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsInput in project netvirt by opendaylight.
the class AclLiveStatisticsRpcServiceTest method getStatsTwoPortEgressOnly.
/**
* Test stats for two ports and egress direction only. <br>
* port1 is valid <br>
* port2 is invalid <br>
* Expectation: Error expected for port2. Drop stats should be available for
* egress direction only.
*
* @throws Exception the exception
*/
@Test
public void getStatsTwoPortEgressOnly() throws Exception {
List<String> lstInterfaces = Arrays.asList(PORT_1, PORT_2);
Direction direction = Direction.Egress;
GetAclPortStatisticsInput input = new GetAclPortStatisticsInputBuilder().setDirection(direction).setInterfaceNames(lstInterfaces).build();
Future<RpcResult<GetAclPortStatisticsOutput>> rpcResultFuture = aclStatsService.getAclPortStatistics(input);
RpcResult<GetAclPortStatisticsOutput> output = rpcResultFuture.get();
LOG.info("getStatsTwoPortEgressOnly output = {}", output);
assertStatsOutput(output, direction);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsInput in project netvirt by opendaylight.
the class AclLiveStatisticsRpcServiceTest method getStatsOnePortBothDirection.
/**
* Test stats for one port and both direction. <br>
* port1 is valid <br>
* Expectation: This is a success case.
*
* @throws Exception the exception
*/
@Test
public void getStatsOnePortBothDirection() throws Exception {
List<String> lstInterfaces = Arrays.asList(PORT_1);
Direction direction = Direction.Both;
GetAclPortStatisticsInput input = new GetAclPortStatisticsInputBuilder().setDirection(direction).setInterfaceNames(lstInterfaces).build();
Future<RpcResult<GetAclPortStatisticsOutput>> rpcResultFuture = aclStatsService.getAclPortStatistics(input);
RpcResult<GetAclPortStatisticsOutput> output = rpcResultFuture.get();
LOG.info("getStatsOnePortBothDirection output = {}", output);
assertStatsOutput(output, direction);
}
Aggregations