aboutsummaryrefslogtreecommitdiff
path: root/rpkid/rpki/gui/models.py
diff options
context:
space:
mode:
Diffstat (limited to 'rpkid/rpki/gui/models.py')
-rw-r--r--rpkid/rpki/gui/models.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/rpkid/rpki/gui/models.py b/rpkid/rpki/gui/models.py
index dba10b80..24361c5d 100644
--- a/rpkid/rpki/gui/models.py
+++ b/rpkid/rpki/gui/models.py
@@ -111,4 +111,22 @@ class PrefixV6(Prefix):
class Meta(Prefix.Meta):
abstract = True
+class ASN(models.Model):
+ """Represents a range of ASNs.
+
+ This model is abstract, and is intended to be reused by applications."""
+
+ min = models.PositiveIntegerField(null=False)
+ max = models.PositiveIntegerField(null=False)
+
+ class Meta:
+ abstract = True
+ ordering = ('min', 'max')
+
+ def __unicode__(self):
+ if self.min == self.max:
+ return u'AS%d' % self.min
+ else:
+ return u'AS%s-%s' % (self.min, self.max)
+
# vim:sw=4 ts=8 expandtab