Search in sources :

Example 11 with Timestamp

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timestamp in project lispflowmapping by opendaylight.

the class DataStoreBackEnd method saveLastUpdateTimestamp.

public void saveLastUpdateTimestamp() {
    Long timestamp = System.currentTimeMillis();
    LOG.debug("MD-SAL: Saving last update timestamp to operational datastore: {}", new Date(timestamp).toString());
    writePutTransaction(LAST_UPDATED, new LastUpdatedBuilder().setLastUpdated(timestamp).build(), LogicalDatastoreType.OPERATIONAL, "Couldn't save last update timestamp to operational datastore");
}
Also used : LastUpdatedBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.LastUpdatedBuilder) Date(java.util.Date)

Example 12 with Timestamp

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timestamp in project lispflowmapping by opendaylight.

the class DataStoreBackEnd method getLastUpdateTimestamp.

public Long getLastUpdateTimestamp() {
    LastUpdated lastUpdated = readTransaction(LAST_UPDATED, LogicalDatastoreType.OPERATIONAL);
    if (lastUpdated != null && lastUpdated.getLastUpdated() != null) {
        Long timestamp = lastUpdated.getLastUpdated();
        LOG.debug("MD-SAL: Retrieved last update timestamp from operational datastore: {}", new Date(timestamp).toString());
        return timestamp;
    } else {
        LOG.debug("MD-SAL: Couldn't retrieve last update timestamp from operational datastore");
        return null;
    }
}
Also used : LastUpdated(org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.mappingservice.rev150906.mapping.database.LastUpdated) Date(java.util.Date)

Example 13 with Timestamp

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timestamp in project bgpcep by opendaylight.

the class BmpRouterPeerImpl method createStats.

private static ContainerNode createStats(final Stat stat, final Timestamp timestamp) {
    final DataContainerNodeAttrBuilder<NodeIdentifier, ContainerNode> builder = Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(Stats.QNAME));
    builder.withChild(ImmutableNodes.leafNode(PEER_STATS_TIMESTAMP_QNAME, timestamp.getValue()));
    final Tlvs tlvs = stat.getTlvs();
    if (tlvs != null) {
        statsForTlvs(tlvs, builder);
    }
    return builder.build();
}
Also used : Tlvs(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.stat.Tlvs) NodeIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier) ContainerNode(org.opendaylight.yangtools.yang.data.api.schema.ContainerNode)

Example 14 with Timestamp

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timestamp in project bgpcep by opendaylight.

the class AbstractBmpPerPeerMessageParserTest method testPerPeerHeader.

@Test
public void testPerPeerHeader() {
    final byte[] msgBytes = { (byte) 0x00, (byte) 0x40, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, // IPV4 192.168.1.1
    (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xC0, (byte) 0xA8, (byte) 0x01, (byte) 0x01, // AS 168
    (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xA8, // Peer BGP ID 1.1.1.1
    (byte) 0x01, (byte) 0x01, (byte) 0x01, (byte) 0x01, // Timestamp
    (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04, (byte) 0x01, (byte) 0x02, (byte) 0x03, (byte) 0x04 };
    final PeerHeader perHeader = AbstractBmpPerPeerMessageParser.parsePerPeerHeader(Unpooled.wrappedBuffer(msgBytes));
    final PeerHeaderBuilder phBuilder = new PeerHeaderBuilder();
    phBuilder.setType(PeerType.forValue(0));
    phBuilder.setAdjRibInType(AdjRibInType.forValue(1));
    phBuilder.setIpv4(true);
    phBuilder.setAddress(new IpAddress(new Ipv4Address("192.168.1.1")));
    phBuilder.setAs(new AsNumber(168L));
    phBuilder.setBgpId(new Ipv4Address("1.1.1.1"));
    phBuilder.setTimestampSec(new Timestamp(16909060L));
    phBuilder.setTimestampMicro(new Timestamp(16909060L));
    assertEquals(perHeader, phBuilder.build());
    final ByteBuf aggregator = Unpooled.buffer();
    this.parser.serializePerPeerHeader(perHeader, aggregator);
    assertArrayEquals(msgBytes, ByteArray.getAllBytes(aggregator));
}
Also used : PeerHeader(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.header.PeerHeader) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) PeerHeaderBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.header.PeerHeaderBuilder) ByteBuf(io.netty.buffer.ByteBuf) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber) Timestamp(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timestamp) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) Test(org.junit.Test)

Example 15 with Timestamp

use of org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timestamp in project openflowplugin by opendaylight.

the class StatisticsGatheringUtils method markDeviceStateSnapshotStart.

/**
 * Writes snapshot gathering start timestamp + cleans end mark.
 *
 * @param deviceInfo device info
 * @param txFacade tx manager
 */
static void markDeviceStateSnapshotStart(final DeviceInfo deviceInfo, final TxFacade txFacade) {
    final InstanceIdentifier<FlowCapableStatisticsGatheringStatus> statusPath = deviceInfo.getNodeInstanceIdentifier().augmentation(FlowCapableStatisticsGatheringStatus.class);
    final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_AND_TIME_FORMAT);
    final FlowCapableStatisticsGatheringStatus gatheringStatus = new FlowCapableStatisticsGatheringStatusBuilder().setSnapshotGatheringStatusStart(new SnapshotGatheringStatusStartBuilder().setBegin(new DateAndTime(simpleDateFormat.format(new Date()))).build()).setSnapshotGatheringStatusEnd(// TODO: reconsider if really need to clean end mark here
    null).build();
    try {
        txFacade.writeToTransaction(LogicalDatastoreType.OPERATIONAL, statusPath, gatheringStatus);
    } catch (final 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) FlowCapableStatisticsGatheringStatusBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableStatisticsGatheringStatusBuilder) TransactionChainClosedException(org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException) SimpleDateFormat(java.text.SimpleDateFormat) SnapshotGatheringStatusStartBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.snapshot.gathering.status.grouping.SnapshotGatheringStatusStartBuilder) Date(java.util.Date)

Aggregations

Date (java.util.Date)7 IpAddress (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress)4 SimpleDateFormat (java.text.SimpleDateFormat)3 Test (org.junit.Test)3 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)3 Timestamp (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Timestamp)3 FlowCapableStatisticsGatheringStatus (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableStatisticsGatheringStatus)3 PeerHeaderBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.peer.header.PeerHeaderBuilder)3 ByteBuf (io.netty.buffer.ByteBuf)2 TransactionChainClosedException (org.opendaylight.controller.md.sal.common.api.data.TransactionChainClosedException)2 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)2 DateAndTime (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.DateAndTime)2 SnapshotGatheringStatusEnd (org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.snapshot.gathering.status.grouping.SnapshotGatheringStatusEnd)2 EidLispAddress (org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.map.register.cache.metadata.container.map.register.cache.metadata.EidLispAddress)2 PeerDistinguisher (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bmp.message.rev171207.Peer.PeerDistinguisher)2 ImageProcessingException (com.drew.imaging.ImageProcessingException)1 BalloonStyle (de.micromata.opengis.kml.v_2_2_0.BalloonStyle)1 Folder (de.micromata.opengis.kml.v_2_2_0.Folder)1 Icon (de.micromata.opengis.kml.v_2_2_0.Icon)1 IconStyle (de.micromata.opengis.kml.v_2_2_0.IconStyle)1