aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rpkid/portal-gui/scripts/rpkigui-import-routes.py9
-rw-r--r--rpkid/rpki/gui/routeview/util.py6
2 files changed, 8 insertions, 7 deletions
diff --git a/rpkid/portal-gui/scripts/rpkigui-import-routes.py b/rpkid/portal-gui/scripts/rpkigui-import-routes.py
index 4e62bdb8..776a16e2 100644
--- a/rpkid/portal-gui/scripts/rpkigui-import-routes.py
+++ b/rpkid/portal-gui/scripts/rpkigui-import-routes.py
@@ -30,7 +30,7 @@ class BadArgument(Exception):
if __name__ == '__main__':
parser = optparse.OptionParser(
- usage='%prog [options] PATH',
+ usage='%prog [options] [PATH]',
description="""This tool is used to import the IPv4/6 BGP table dumps
from routeviews.org into the RPKI Web Portal database. If the
input file is a bzip2 compressed file, it will be decompressed
@@ -54,10 +54,9 @@ automatically.""")
BGPDUMP = os.path.expanduser(options.bgpdump)
try:
- if len(args) != 1:
- raise BadArgument('no filename specified, or more than one filename specified')
- filename = args[0]
- import_routeviews_dump(filename)
+ if len(args) > 1:
+ raise BadArgument('more than one filename specified')
+ import_routeviews_dump(*args)
except Exception as e:
logging.exception(e)
diff --git a/rpkid/rpki/gui/routeview/util.py b/rpkid/rpki/gui/routeview/util.py
index 589a7714..44168be2 100644
--- a/rpkid/rpki/gui/routeview/util.py
+++ b/rpkid/rpki/gui/routeview/util.py
@@ -33,6 +33,8 @@ import rpki.gui.app.timestamp
# globals
logger = logging.getLogger(__name__)
+# Eventually this can be retrived from rpki.conf
+DEFAULT_URL = 'http://archive.routeviews.org/oix-route-views/oix-full-snapshot-latest.dat.bz2'
def parse_text(f):
last_prefix = None
@@ -161,13 +163,13 @@ class PipeFailed(ProgException):
pass
-def import_routeviews_dump(filename, filetype='auto'):
+def import_routeviews_dump(filename=DEFAULT_URL, filetype='auto'):
"""Load the oix-full-snapshot-latest.bz2 from routeview.org into the
rpki.gui.routeview database.
Arguments:
- filename [required]: the full path to the downloaded file to parse
+ filename [optional]: the full path to the downloaded file to parse
filetype [optional]: 'text' or 'mrt'