aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rpkid/rpki/gui/app/models.py8
-rw-r--r--rpkid/rpki/gui/app/templates/rpkigui/routes_view.html28
-rw-r--r--rpkid/rpki/gui/app/timestamp.py4
3 files changed, 20 insertions, 20 deletions
diff --git a/rpkid/rpki/gui/app/models.py b/rpkid/rpki/gui/app/models.py
index d59cbb08..f81526e8 100644
--- a/rpkid/rpki/gui/app/models.py
+++ b/rpkid/rpki/gui/app/models.py
@@ -255,11 +255,13 @@ class Timestamp(models.Model):
"""Model to hold metadata about the collection of external data.
This model is a hash table mapping a timestamp name to the
- timestamp value. The timestamp value has `auto_now=True` so it
- merely needs to be saved to be updated."""
+ timestamp value. All timestamps values are in UTC.
+
+ The utility function rpki.gui.app.timestmap.update(name) should be used to
+ set timestamps rather than updating this model directly."""
name = models.CharField(max_length=30, primary_key=True)
- ts = models.DateTimeField(null=False, auto_now=True)
+ ts = models.DateTimeField(null=False, default=0)
def __unicode__(self):
return '%s: %s' % (self.name, self.ts)
diff --git a/rpkid/rpki/gui/app/templates/rpkigui/routes_view.html b/rpkid/rpki/gui/app/templates/rpkigui/routes_view.html
index d8600d99..c5834ba2 100644
--- a/rpkid/rpki/gui/app/templates/rpkigui/routes_view.html
+++ b/rpkid/rpki/gui/app/templates/rpkigui/routes_view.html
@@ -1,29 +1,25 @@
{% extends "rpkigui/app_base.html" %}
+{% block sidebar_extra %}
+<p>
+BGP data updated<br>
+IPv4: {{ timestamp.bgp_v4_import.isoformat }}<br>
+IPv6: {{ timestamp.bgp_v6_import.isoformat }}
+<p>
+rcynic cache updated<br>
+{{ timestamp.rcynic_import.isoformat }}
+
+{% endblock sidebar_extra %}
+
{% block content %}
<div class='page-header'>
- <h1>Route View</h1>
+ <h1>Route View</h1>
</div>
<p>
This view shows currently advertised routes for the prefixes listed in resource certs received from RPKI parents.
-<table class='condensed-table'>
- <tr>
- <th>Source</th>
- <td>BGP IPv4</td>
- <td>BGP IPv6</td>
- <td>rcynic</td>
- </tr>
- <tr>
- <th>Last Update</th>
- <td>{{ timestamp.bgp_v4_import }}</td>
- <td>{{ timestamp.bgp_v6_import }}</td>
- <td>{{ timestamp.rcynic_import }}</td>
- </tr>
-</table>
-
<table class='zebra-striped condensed-table'>
<tr>
<th>Prefix</th>
diff --git a/rpkid/rpki/gui/app/timestamp.py b/rpkid/rpki/gui/app/timestamp.py
index c460ff86..93f1d032 100644
--- a/rpkid/rpki/gui/app/timestamp.py
+++ b/rpkid/rpki/gui/app/timestamp.py
@@ -15,8 +15,10 @@
#
import models
+from datetime import datetime
def update(name):
"Set the timestamp value for the given name to the current time."
obj, created = models.Timestamp.objects.get_or_create(name=name)
- if not created: obj.save() # force update for existing objects
+ obj.ts = datetime.utcnow()
+ obj.save()