Exemplo n.º 1
0
 @Override
 protected void cleanupSingleStat(DataModificationTransaction trans, MeterStats item) {
   InstanceIdentifier<NodeMeterStatistics> meterRef =
       getNodeIdentifierBuilder()
           .augmentation(FlowCapableNode.class)
           .child(Meter.class, new MeterKey(item.getMeterId()))
           .augmentation(NodeMeterStatistics.class)
           .build();
   trans.removeOperationalData(meterRef);
 }
Exemplo n.º 2
0
  @Override
  public void onDataChanged(DataChangeEvent<InstanceIdentifier<?>, DataObject> change) {
    for (InstanceIdentifier<?> key : change.getCreatedConfigurationData().keySet()) {
      if (Meter.class.equals(key.getTargetType())) {
        request();
      }
    }

    final DataModificationTransaction trans = startTransaction();
    for (InstanceIdentifier<?> key : change.getRemovedConfigurationData()) {
      if (Meter.class.equals(key.getTargetType())) {
        @SuppressWarnings("unchecked")
        InstanceIdentifier<Meter> meter = (InstanceIdentifier<Meter>) key;

        InstanceIdentifier<?> nodeMeterStatisticsAugmentation =
            InstanceIdentifier.builder(meter).augmentation(NodeMeterStatistics.class).toInstance();
        trans.removeOperationalData(nodeMeterStatisticsAugmentation);
      }
    }
    trans.commit();
  }