Search in sources :

Example 1 with MeterRef

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

the class MeterNotificationSupplierImpl method updateNotification.

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

Example 2 with MeterRef

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

the class MeterUtilTest method testBuildGroupPath.

@Test
public void testBuildGroupPath() throws Exception {
    final InstanceIdentifier<Node> nodePath = InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(DUMMY_NODE_ID));
    final MeterRef meterRef = MeterUtil.buildMeterPath(nodePath, DUMMY_METER_ID);
    final InstanceIdentifier<?> meterRefValue = meterRef.getValue();
    Assert.assertEquals(DUMMY_NODE_ID, meterRefValue.firstKeyOf(Node.class).getId());
    Assert.assertEquals(DUMMY_METER_ID, meterRefValue.firstKeyOf(Meter.class).getMeterId());
}
Also used : Node(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node) MeterRef(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef) NodeKey(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey) Nodes(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes) Test(org.junit.Test)

Example 3 with MeterRef

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

the class OpenflowpluginStatsTestCommandProvider method _meterStats.

public void _meterStats(CommandInterpreter ci) {
    int meterCount = 0;
    int meterStatsCount = 0;
    NodeMeterStatistics 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(NodeMeterStatistics.class);
                        if (null != data) {
                            meterStatsCount++;
                        }
                    }
                }
            }
        }
    }
    if (meterCount == meterStatsCount) {
        LOG.debug("---------------------------meterStats - Success-------------------------------------");
    } else {
        LOG.debug("----------------------------meterStats - 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) NodeMeterStatistics(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.NodeMeterStatistics) 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) 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)

Example 4 with MeterRef

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

the class MeterForwarder method removeWithResult.

@Override
public Future<RpcResult<RemoveMeterOutput>> removeWithResult(final InstanceIdentifier<Meter> identifier, final Meter removeDataObj, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
    final RemoveMeterInputBuilder builder = new RemoveMeterInputBuilder(removeDataObj);
    builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
    builder.setMeterRef(new MeterRef(identifier));
    builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
    return this.provider.getSalMeterService().removeMeter(builder.build());
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) RemoveMeterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.RemoveMeterInputBuilder) MeterRef(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef) Uri(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)

Example 5 with MeterRef

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

the class MeterForwarder method add.

@Override
public Future<RpcResult<AddMeterOutput>> add(final InstanceIdentifier<Meter> identifier, final Meter addDataObj, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
    final AddMeterInputBuilder builder = new AddMeterInputBuilder(addDataObj);
    builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)));
    builder.setMeterRef(new MeterRef(identifier));
    builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
    return this.provider.getSalMeterService().addMeter(builder.build());
}
Also used : NodeRef(org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef) AddMeterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.service.rev130918.AddMeterInputBuilder) MeterRef(org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterRef) Uri(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri)

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