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();
}
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());
}
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.");
}
}
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());
}
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());
}
Aggregations