aboutsummaryrefslogtreecommitdiff
path: root/rpkid/rpki/resource_set.py
diff options
context:
space:
mode:
Diffstat (limited to 'rpkid/rpki/resource_set.py')
-rw-r--r--rpkid/rpki/resource_set.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/rpkid/rpki/resource_set.py b/rpkid/rpki/resource_set.py
index 2b050ad3..cd8a68d6 100644
--- a/rpkid/rpki/resource_set.py
+++ b/rpkid/rpki/resource_set.py
@@ -323,7 +323,7 @@ class resource_set_as(resource_set):
range_type = resource_range_as
def parse_str(self, x):
- """Parse AS resource sets from text (eg, XML attributes)."""
+ """Parse ASN resource sets from text (eg, XML attributes)."""
r = re.match("^([0-9]+)-([0-9]+)$", x)
if r:
return resource_range_as(long(r.group(1)), long(r.group(2)))
@@ -331,7 +331,7 @@ class resource_set_as(resource_set):
return resource_range_as(long(x), long(x))
def parse_rfc3779_tuple(self, x):
- """Parse AS resource from tuple format generated by RFC 3779 ASN.1 decoder."""
+ """Parse ASN resource from tuple format generated by RFC 3779 ASN.1 decoder."""
if x[0] == "asIdsOrRanges":
for aor in x[1]:
if aor[0] == "range":
@@ -346,7 +346,7 @@ class resource_set_as(resource_set):
self.inherit = True
def to_rfc3779_tuple(self):
- """Convert AS resource set into tuple format used for RFC 3779 ASN.1 encoding."""
+ """Convert ASN resource set into tuple format used for RFC 3779 ASN.1 encoding."""
if self:
return ("asIdsOrRanges", tuple(a.to_rfc3779_tuple() for a in self))
elif self.inherit:
@@ -448,11 +448,11 @@ def _long2bs(number, addrlen, prefixlen = None, strip = None):
return tuple(bs)
class resource_bag(object):
- """Container to simplify passing around the usual triple of AS,
+ """Container to simplify passing around the usual triple of ASN,
IPv4, and IPv6 resource sets.
"""
- ## @var as
+ ## @var asn
# Set of Autonomous System Number resources.
## @var v4
@@ -464,35 +464,35 @@ class resource_bag(object):
## @var valid_until
# Expiration date of resources, for setting certificate notAfter field.
- def __init__(self, as = None, v4 = None, v6 = None, valid_until = None):
- self.as = as or resource_set_as()
+ def __init__(self, asn = None, v4 = None, v6 = None, valid_until = None):
+ self.asn = asn or resource_set_as()
self.v4 = v4 or resource_set_ipv4()
self.v6 = v6 or resource_set_ipv6()
self.valid_until = valid_until
def oversized(self, other):
"""True iff self is oversized with respect to other."""
- return not self.as.issubset(other.as) or \
+ return not self.asn.issubset(other.asn) or \
not self.v4.issubset(other.v4) or \
not self.v6.issubset(other.v6)
def undersized(self, other):
"""True iff self is undersized with respect to other."""
- return not other.as.issubset(self.as) or \
+ return not other.asn.issubset(self.asn) or \
not other.v4.issubset(self.v4) or \
not other.v6.issubset(self.v6)
@classmethod
def from_rfc3779_tuples(cls, exts):
"""Build a resource_bag from intermediate form generated by RFC 3779 ASN.1 decoder."""
- as = None
+ asn = None
v4 = None
v6 = None
for x in exts:
if x[0] == rpki.oids.name2oid["sbgp-autonomousSysNum"]: #
assert len(x[2]) == 1 or x[2][1] is None, "RDI not implemented: %s" % (str(x))
- assert as is None
- as = resource_set_as(x[2][0])
+ assert asn is None
+ asn = resource_set_as(x[2][0])
if x[0] == rpki.oids.name2oid["sbgp-ipAddrBlock"]:
for fam in x[2]:
if fam[0] == resource_set_ipv4.afi:
@@ -501,14 +501,14 @@ class resource_bag(object):
if fam[0] == resource_set_ipv6.afi:
assert v6 is None
v6 = resource_set_ipv6(fam[1])
- return cls(as, v4, v6)
+ return cls(asn, v4, v6)
def empty(self):
"""Return True iff all resource sets in this bag are empty."""
- return not self.as and not self.v4 and not self.v6
+ return not self.asn and not self.v4 and not self.v6
def __eq__(self, other):
- return self.as == other.as and \
+ return self.asn == other.asn and \
self.v4 == other.v4 and \
self.v6 == other.v6 and \
self.valid_until == other.valid_until
@@ -520,7 +520,7 @@ class resource_bag(object):
"""Compute intersection with another resource_bag.
valid_until attribute (if any) inherits from self.
"""
- return self.__class__(self.as.intersection(other.as),
+ return self.__class__(self.asn.intersection(other.asn),
self.v4.intersection(other.v4),
self.v6.intersection(other.v6),
self.valid_until)
@@ -529,15 +529,15 @@ class resource_bag(object):
"""Compute union with another resource_bag.
valid_until attribute (if any) inherits from self.
"""
- return self.__class__(self.as.union(other.as),
+ return self.__class__(self.asn.union(other.asn),
self.v4.union(other.v4),
self.v6.union(other.v6),
self.valid_until)
def __str__(self):
s = ""
- if self.as:
- s += "AS: %s" % self.as
+ if self.asn:
+ s += "ASN: %s" % self.asn
if self.v4:
if s:
s += ", "