Search in sources :

Example 1 with AclPortStatsKey

use of org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.AclPortStatsKey in project netvirt by opendaylight.

the class AclLiveStatisticsRpcServiceTest method assertStatsOutput.

private void assertStatsOutput(RpcResult<GetAclPortStatisticsOutput> output, Direction inputDirection) {
    assertNotNull(output);
    GetAclPortStatisticsOutput aclPortStats = output.getResult();
    assertNotNull(aclPortStats);
    Map<AclPortStatsKey, AclPortStats> aclPortStatsKeyAclPortStatsMap = aclPortStats.getAclPortStats();
    assertNotNull(aclPortStatsKeyAclPortStatsMap);
    assertFalse(aclPortStatsKeyAclPortStatsMap.isEmpty());
    for (AclPortStats stats : aclPortStatsKeyAclPortStatsMap.values()) {
        List<AclDropStats> aclDropStats = stats.getAclDropStats();
        if (stats.getInterfaceName().equals(PORT_1)) {
            assertNotNull(aclDropStats);
            assertTrue(!aclDropStats.isEmpty());
            if (inputDirection == Direction.Both) {
                assertTrue(aclDropStats.size() == 2);
            } else {
                assertTrue(aclDropStats.size() == 1);
            }
            for (AclDropStats dropStats : aclDropStats) {
                if (inputDirection != Direction.Both) {
                    Assert.assertEquals(dropStats.getDirection(), inputDirection);
                }
                assertTrue(dropStats.getBytes().getDropCount().intValue() > 0);
                assertTrue(dropStats.getBytes().getInvalidDropCount().intValue() > 0);
                assertTrue(dropStats.getPackets().getDropCount().intValue() > 0);
                assertTrue(dropStats.getPackets().getInvalidDropCount().intValue() > 0);
            }
            assertNull(stats.getError());
        } else {
            // Other than port1, error is returned in the output
            assertNull(aclDropStats);
            assertNotNull(stats.getError());
        }
    }
}
Also used : GetAclPortStatisticsOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsOutput) AclPortStatsKey(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.AclPortStatsKey) AclDropStats(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.AclDropStats) AclPortStats(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.AclPortStats)

Aggregations

GetAclPortStatisticsOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.GetAclPortStatisticsOutput)1 AclPortStats (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.AclPortStats)1 AclPortStatsKey (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.AclPortStatsKey)1 AclDropStats (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.AclDropStats)1