Search in sources :

Example 1 with SnapshotGatheringStatusEndBuilder

use of org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.snapshot.gathering.status.grouping.SnapshotGatheringStatusEndBuilder in project openflowplugin by opendaylight.

the class StatisticsGatheringUtils method markDeviceStateSnapshotEnd.

/**
 * Writes snapshot gathering end timestamp + outcome.
 *
 * @param deviceInfo device info
 * @param txFacade tx manager
 * @param succeeded     outcome of currently finished gathering
 */
static void markDeviceStateSnapshotEnd(final DeviceInfo deviceInfo, final TxFacade txFacade, final boolean succeeded) {
    final InstanceIdentifier<SnapshotGatheringStatusEnd> statusEndPath = deviceInfo.getNodeInstanceIdentifier().augmentation(FlowCapableStatisticsGatheringStatus.class).child(SnapshotGatheringStatusEnd.class);
    final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_AND_TIME_FORMAT);
    final SnapshotGatheringStatusEnd gatheringStatus = new SnapshotGatheringStatusEndBuilder().setEnd(new DateAndTime(simpleDateFormat.format(new Date()))).setSucceeded(succeeded).build();
    try {
        txFacade.writeToTransaction(LogicalDatastoreType.OPERATIONAL, statusEndPath, gatheringStatus);
    } catch (TransactionChainClosedException e) {
        LOG.warn("Can't write to transaction, transaction chain probably closed.");
        LOG.trace("Write to transaction exception: ", e);
    }
    txFacade.submitTransaction();
}
Also used : FlowCapableStatisticsGatheringStatus(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableStatisticsGatheringStatus) DateAndTime(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime) TransactionChainClosedException(org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException) SnapshotGatheringStatusEnd(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.snapshot.gathering.status.grouping.SnapshotGatheringStatusEnd) SimpleDateFormat(java.text.SimpleDateFormat) Date(java.util.Date) SnapshotGatheringStatusEndBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.snapshot.gathering.status.grouping.SnapshotGatheringStatusEndBuilder)

Aggregations

SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 TransactionChainClosedException (org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException)1 DateAndTime (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime)1 FlowCapableStatisticsGatheringStatus (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableStatisticsGatheringStatus)1 SnapshotGatheringStatusEnd (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.snapshot.gathering.status.grouping.SnapshotGatheringStatusEnd)1 SnapshotGatheringStatusEndBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.snapshot.gathering.status.grouping.SnapshotGatheringStatusEndBuilder)1