Search in sources :

Example 56 with Stats

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.peers.peer.Stats in project netvirt by opendaylight.

the class AclLiveStatisticsHelper method addError.

/**
 * Adds the error.
 *
 * @param lstAclPortStats the lst acl port stats
 * @param aclStatsBuilder the acl stats builder
 * @param errMsg the error message
 */
private static void addError(List<AclPortStats> lstAclPortStats, AclPortStatsBuilder aclStatsBuilder, String errMsg) {
    aclStatsBuilder.setError(new ErrorBuilder().setErrorMessage(errMsg).build());
    lstAclPortStats.add(aclStatsBuilder.build());
}
Also used : ErrorBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.acl.live.statistics.rev161129.acl.stats.output.acl.port.stats.ErrorBuilder)

Example 57 with Stats

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.peers.peer.Stats 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 58 with Stats

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.peers.peer.Stats 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)

Example 59 with Stats

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.peers.peer.Stats 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)

Example 60 with Stats

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.monitor.rev200120.peers.peer.Stats in project bgpcep by opendaylight.

the class TopologyStatsRpcServiceImpl method getStats.

@Override
public ListenableFuture<RpcResult<GetStatsOutput>> getStats(final GetStatsInput input) {
    final var iTopologies = input.getTopology();
    final List<TopologyId> iTopologyIds;
    if (iTopologies != null) {
        iTopologyIds = iTopologies.values().stream().map(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.topology.stats.rpc.rev190321.get.stats.input.Topology::getTopologyId).collect(Collectors.toList());
    } else {
        iTopologyIds = getAvailableTopologyIds();
    }
    return Futures.immediateFuture(SuccessfulRpcResult.create(new GetStatsOutputBuilder().setTopology(iTopologyIds.stream().map(iTopologyId -> {
        final Collection<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.topology.stats.rpc.rev190321.get.stats.input.topology.Node> iNodes;
        if (iTopologies != null) {
            final var nodes = iTopologies.values().stream().filter(t -> iTopologyId.equals(t.getTopologyId())).findFirst().get().getNode();
            iNodes = nodes != null ? nodes.values() : null;
        } else {
            iNodes = null;
        }
        final List<NodeId> iNodeIds;
        if (iNodes != null) {
            iNodeIds = iNodes.stream().map(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.topology.stats.rpc.rev190321.get.stats.input.topology.Node::getNodeId).collect(Collectors.toList());
        } else {
            iNodeIds = getAvailableNodeIds(iTopologyId);
        }
        return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.topology.stats.rpc.rev190321.get.stats.output.TopologyBuilder().setTopologyId(iTopologyId).setNode(iNodeIds.stream().map(iNodeId -> {
            final PcepSessionState state = sessionStateMap.get(InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class, new TopologyKey(iTopologyId)).child(Node.class, new NodeKey(iNodeId)).augmentation(PcepTopologyNodeStatsAug.class).child(PcepSessionState.class).build());
            if (state == null) {
                LOG.debug("Pcep session stats not available for node {} in topology {}", iNodeId.getValue(), iTopologyId.getValue());
            }
            return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.topology.stats.rpc.rev190321.get.stats.output.topology.NodeBuilder().setNodeId(iNodeId).setPcepSessionState(transformStatefulAugmentation(state)).build();
        }).collect(BindingMap.toOrderedMap())).build();
    }).collect(BindingMap.toOrderedMap())).build()));
}
Also used : ListenableFuture(com.google.common.util.concurrent.ListenableFuture) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) GetStatsOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.topology.stats.rpc.rev190321.GetStatsOutputBuilder) StatefulCapabilitiesRpcAugBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulCapabilitiesRpcAugBuilder) LoggerFactory(org.slf4j.LoggerFactory) DataTreeIdentifier(org.opendaylight.mdsal.binding.api.DataTreeIdentifier) PcepSessionStateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.grouping.PcepSessionStateBuilder) GetStatsInput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.topology.stats.rpc.rev190321.GetStatsInput) ListenerRegistration(org.opendaylight.yangtools.concepts.ListenerRegistration) ConcurrentMap(java.util.concurrent.ConcurrentMap) PeerCapabilitiesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.PeerCapabilitiesBuilder) MessagesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.MessagesBuilder) PeerCapabilities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.PeerCapabilities) NodeId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NodeId) PcepEntityIdRpcAugBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.PcepEntityIdRpcAugBuilder) Objects.requireNonNull(java.util.Objects.requireNonNull) StatefulCapabilitiesStatsAug(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulCapabilitiesStatsAug) DataTreeModification(org.opendaylight.mdsal.binding.api.DataTreeModification) ClusteredDataTreeChangeListener(org.opendaylight.mdsal.binding.api.ClusteredDataTreeChangeListener) DataObjectModification(org.opendaylight.mdsal.binding.api.DataObjectModification) PcepTopologyNodeStatsAug(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.stats.rev181109.PcepTopologyNodeStatsAug) Messages(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.Messages) Logger(org.slf4j.Logger) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) BindingMap(org.opendaylight.yangtools.yang.binding.util.BindingMap) Collection(java.util.Collection) SuccessfulRpcResult(org.opendaylight.bgpcep.programming.spi.SuccessfulRpcResult) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) TopologyId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId) LocalPref(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.LocalPref) Collectors(java.util.stream.Collectors) NetworkTopology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology) StatefulMessagesStatsAug(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulMessagesStatsAug) PcepTopologyStatsRpcService(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.topology.stats.rpc.rev190321.PcepTopologyStatsRpcService) GetStatsOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.topology.stats.rpc.rev190321.GetStatsOutput) PcepEntityIdStatsAug(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.PcepEntityIdStatsAug) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) Futures(com.google.common.util.concurrent.Futures) List(java.util.List) StatefulMessagesRpcAugBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.StatefulMessagesRpcAugBuilder) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) LogicalDatastoreType(org.opendaylight.mdsal.common.api.LogicalDatastoreType) LocalPrefBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.LocalPrefBuilder) PcepSessionState(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.grouping.PcepSessionState) TopologyKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey) NodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey) DataBroker(org.opendaylight.mdsal.binding.api.DataBroker) PcepSessionState(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stats.rev171113.pcep.session.state.grouping.PcepSessionState) NetworkTopology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.NetworkTopology) Topology(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology) GetStatsOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.topology.stats.rpc.rev190321.GetStatsOutputBuilder) PcepTopologyNodeStatsAug(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.stats.rev181109.PcepTopologyNodeStatsAug) TopologyKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey) Collection(java.util.Collection) List(java.util.List) NodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey) TopologyId(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.TopologyId)

Aggregations

Test (org.junit.Test)15 ArrayList (java.util.ArrayList)14 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)11 ReadOnlyTransaction (org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)10 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)10 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)10 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)10 MultipartReply (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReply)10 VersionConvertorData (org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData)9 List (java.util.List)8 BigInteger (java.math.BigInteger)6 GroupStats (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.reply.multipart.reply.body.multipart.reply.group._case.multipart.reply.group.GroupStats)6 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)6 GetFlowStatisticsOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetFlowStatisticsOutput)5 GetNodeConnectorStatisticsOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetNodeConnectorStatisticsOutput)5 MatchBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder)5 GetGroupStatisticsOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetGroupStatisticsOutput)4 GetMeterStatisticsOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetMeterStatisticsOutput)4 FlowAndStatisticsMapList (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.flow.and.statistics.map.list.FlowAndStatisticsMapList)4 GroupId (org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId)4