コード例 #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);
 }
コード例 #2
0
  @Override
  protected MeterStats updateSingleStat(DataModificationTransaction trans, MeterStats item) {
    MeterBuilder meterBuilder = new MeterBuilder();
    MeterKey meterKey = new MeterKey(item.getMeterId());
    meterBuilder.setKey(meterKey);

    InstanceIdentifier<Meter> meterRef =
        getNodeIdentifierBuilder()
            .augmentation(FlowCapableNode.class)
            .child(Meter.class, meterKey)
            .build();

    NodeMeterStatisticsBuilder meterStatsBuilder = new NodeMeterStatisticsBuilder();
    meterStatsBuilder.setMeterStatistics(new MeterStatisticsBuilder(item).build());

    // Update augmented data
    meterBuilder.addAugmentation(NodeMeterStatistics.class, meterStatsBuilder.build());
    trans.putOperationalData(meterRef, meterBuilder.build());
    return item;
  }