Search in sources :

Example 11 with MeterRef

use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef in project openflowplugin by opendaylight.

the class MeterNotificationSupplierImpl method deleteNotification.

@Override
public MeterRemoved deleteNotification(final InstanceIdentifier<Meter> path) {
    Preconditions.checkArgument(path != null);
    final MeterRemovedBuilder builder = new MeterRemovedBuilder();
    builder.setMeterId(path.firstKeyOf(Meter.class, MeterKey.class).getMeterId());
    builder.setMeterRef(new MeterRef(path));
    builder.setNode(createNodeRef(path));
    return builder.build();
}
Also used : MeterRemovedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterRemovedBuilder) MeterRef(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef)

Example 12 with MeterRef

use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef in project openflowplugin by opendaylight.

the class MeterNotificationSupplierImpl method createNotification.

@Override
public MeterAdded createNotification(final Meter dataTreeItemObject, final InstanceIdentifier<Meter> path) {
    Preconditions.checkArgument(dataTreeItemObject != null);
    Preconditions.checkArgument(path != null);
    final MeterAddedBuilder builder = new MeterAddedBuilder(dataTreeItemObject);
    builder.setMeterRef(new MeterRef(path));
    builder.setNode(createNodeRef(path));
    return builder.build();
}
Also used : MeterAddedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterAddedBuilder) MeterRef(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef)

Example 13 with MeterRef

use of org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef in project openflowplugin by opendaylight.

the class OpenflowpluginStatsTestCommandProvider method _meterConfigStats.

public void _meterConfigStats(CommandInterpreter ci) {
    int meterCount = 0;
    int meterConfigStatsCount = 0;
    NodeMeterConfigStats data = null;
    List<Node> nodes = getNodes();
    for (Node node2 : nodes) {
        NodeKey nodeKey = node2.getKey();
        InstanceIdentifier<FlowCapableNode> nodeRef = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class);
        ReadOnlyTransaction readOnlyTransaction = dataProviderService.newReadOnlyTransaction();
        FlowCapableNode node = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, nodeRef);
        if (node != null) {
            if (node.getMeter() != null) {
                List<Meter> meters = node.getMeter();
                for (Meter meter2 : meters) {
                    meterCount++;
                    MeterKey meterKey = meter2.getKey();
                    InstanceIdentifier<Meter> meterRef = InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey).augmentation(FlowCapableNode.class).child(Meter.class, meterKey);
                    Meter meter = TestProviderTransactionUtil.getDataObject(readOnlyTransaction, meterRef);
                    if (meter != null) {
                        data = meter.getAugmentation(NodeMeterConfigStats.class);
                        if (null != data) {
                            meterConfigStatsCount++;
                        }
                    }
                }
            }
        }
    }
    if (meterCount == meterConfigStatsCount) {
        LOG.debug("---------------------------meterConfigStats - Success-------------------------------------");
        ci.print(data);
    } else {
        LOG.debug("----------------------------meterConfigStats - Failed-------------------------------------");
        LOG.debug("System fetchs stats data in 50 seconds interval, so pls wait and try again.");
    }
}
Also used : Meter(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) NodeMeterConfigStats(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterConfigStats) MeterKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey) ReadOnlyTransaction(org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)

Aggregations

MeterRef (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef)11 NodeRef (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef)7 Uri (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)4 Nodes (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes)3 Node (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node)3 NodeKey (org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey)3 RemoveMeterInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInputBuilder)3 ReadOnlyTransaction (org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)2 FlowCapableNode (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode)2 Meter (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter)2 MeterKey (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey)2 AddMeterInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInputBuilder)2 UpdateMeterInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.UpdateMeterInputBuilder)2 OriginalMeterBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.OriginalMeterBuilder)2 UpdatedMeterBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.meter.update.UpdatedMeterBuilder)2 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)2 Test (org.junit.Test)1 MeterAddedBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterAddedBuilder)1 MeterRemovedBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterRemovedBuilder)1 MeterUpdatedBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.MeterUpdatedBuilder)1