aboutsummaryrefslogtreecommitdiff
path: root/scripts/roa-to-irr.py
diff options
context:
space:
mode:
authorRob Austein <sra@hactrn.net>2012-02-16 23:43:51 +0000
committerRob Austein <sra@hactrn.net>2012-02-16 23:43:51 +0000
commitddc8ca372a8d2a4cb93bb5ff26947a1722f8aa3b (patch)
tree8f22132d5085bd4be99ecc4e7dd7cd438f704120 /scripts/roa-to-irr.py
parentafb8989b786acccecac5a1f125fcf5ca74ca65aa (diff)
Add --password hack to feed "override: password" lines to irr_rpsl_submit.
svn path=/trunk/; revision=4345
Diffstat (limited to 'scripts/roa-to-irr.py')
-rw-r--r--scripts/roa-to-irr.py41
1 files changed, 27 insertions, 14 deletions
diff --git a/scripts/roa-to-irr.py b/scripts/roa-to-irr.py
index 09526328..d02e1e3a 100644
--- a/scripts/roa-to-irr.py
+++ b/scripts/roa-to-irr.py
@@ -23,7 +23,7 @@ right.
$Id$
-Copyright (C) 2010 Internet Systems Consortium ("ISC")
+Copyright (C) 2010-2012 Internet Systems Consortium ("ISC")
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
@@ -38,7 +38,14 @@ OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
"""
-import os, socket, sys, getopt, errno, time, rpki.x509, rpki.ipaddrs
+import os
+import socket
+import sys
+import getopt
+import errno
+import time
+import rpki.x509
+import rpki.ipaddrs
class route_virtual(object):
"""
@@ -71,14 +78,17 @@ class route_virtual(object):
return result
def __str__(self):
- return "".join((
- ("%-14s%s/%s\n" % (self.label, self.prefix, self.prefixlen)),
- ("descr: %s/%s-%s\n" % (self.prefix, self.prefixlen, self.max_prefixlen)),
- ("origin: AS%d\n" % self.asn),
- ("notify: %s\n" % irr_notify),
- ("mnt-by: %s\n" % irr_mnt_by),
- ("changed: %s %s\n" % (irr_changed_by, self.date)),
- ("source: %s\n" % irr_source)))
+ lines = (
+ "%-14s%s/%s" % (self.label, self.prefix, self.prefixlen),
+ "descr: %s/%s-%s" % (self.prefix, self.prefixlen, self.max_prefixlen),
+ "origin: AS%d" % self.asn,
+ "notify: %s" % irr_notify,
+ "mnt-by: %s" % irr_mnt_by,
+ "changed: %s %s" % (irr_changed_by, self.date),
+ "source: %s" % irr_source,
+ "override: %s" % password if password is not None else None,
+ "")
+ return "\n".join(line for line in lines if line is not None)
def write(self, output_directory):
name = "%s-%s-%s-AS%d-%s" % (self.prefix, self.prefixlen, self.max_prefixlen, self.asn, self.date)
@@ -136,8 +146,10 @@ irr_source = "RPKI"
irr_from = whoami
output = None
email = False
+password = None
-options = ["changed_by=", "email", "from=", "help", "mnt_by=", "notify=", "output=", "source="]
+options = ["changed_by=", "email", "from=", "help", "mnt_by=",
+ "notify=", "output=", "password=", "source="]
def usage(code = 1):
f = sys.stderr if code else sys.stdout
@@ -147,11 +159,10 @@ def usage(code = 1):
f.write(__doc__)
sys.exit(code)
-opts, argv = getopt.getopt(sys.argv[1:], "c:ef:hm:n:o:s:?", options)
+opts, argv = getopt.getopt(sys.argv[1:], "c:ef:hm:n:o:p:s:?", options)
for o, a in opts:
if o in ("-h", "--help", "-?"):
- print __doc__
- sys.exit(0)
+ usage(0)
elif o in ("-c", "--changed_by"):
irr_changed_by = a
elif o in ("-e", "--email"):
@@ -164,6 +175,8 @@ for o, a in opts:
irr_notify = a
elif o in ("-o", "--output"):
output = a
+ elif o in ("-p", "--password"):
+ password = a
elif o in ("-s", "--source"):
source = a
else: