Search in sources :

Example 1 with GetAclPortStatisticsInput

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);
}
Also used : GetAclPortStatisticsOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsOutput) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) GetAclPortStatisticsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsInput) Direction(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.Direction) GetAclPortStatisticsInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsInputBuilder) Test(org.junit.Test)

Example 2 with GetAclPortStatisticsInput

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());
}
Also used : GetAclPortStatisticsOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsOutput) GetAclPortStatisticsOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsOutputBuilder) AclPortStats(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.AclPortStats) Direction(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.Direction)

Example 3 with GetAclPortStatisticsInput

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);
}
Also used : GetAclPortStatisticsOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsOutput) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) GetAclPortStatisticsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsInput) Direction(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.Direction) GetAclPortStatisticsInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsInputBuilder) Test(org.junit.Test)

Example 4 with GetAclPortStatisticsInput

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);
}
Also used : GetAclPortStatisticsOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsOutput) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) GetAclPortStatisticsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsInput) Direction(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.Direction) GetAclPortStatisticsInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsInputBuilder) Test(org.junit.Test)

Aggregations

Direction (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.Direction)4 GetAclPortStatisticsOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsOutput)4 Test (org.junit.Test)3 GetAclPortStatisticsInput (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsInput)3 GetAclPortStatisticsInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsInputBuilder)3 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)3 GetAclPortStatisticsOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsOutputBuilder)1 AclPortStats (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.AclPortStats)1