aboutsummaryrefslogtreecommitdiff
path: root/rpkid/portal-gui/scripts/rpkigui-query-routes
diff options
context:
space:
mode:
Diffstat (limited to 'rpkid/portal-gui/scripts/rpkigui-query-routes')
-rwxr-xr-xrpkid/portal-gui/scripts/rpkigui-query-routes66
1 files changed, 0 insertions, 66 deletions
diff --git a/rpkid/portal-gui/scripts/rpkigui-query-routes b/rpkid/portal-gui/scripts/rpkigui-query-routes
deleted file mode 100755
index 1f698f23..00000000
--- a/rpkid/portal-gui/scripts/rpkigui-query-routes
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/usr/bin/env python
-
-# Copyright (C) 2013 SPARTA, Inc. a Parsons Company
-#
-# Permission to use, copy, modify, and distribute this software for any
-# purpose with or without fee is hereby granted, provided that the above
-# copyright notice and this permission notice appear in all copies.
-#
-# THE SOFTWARE IS PROVIDED "AS IS" AND SPARTA DISCLAIMS ALL WARRANTIES WITH
-# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
-# AND FITNESS. IN NO EVENT SHALL SPARTA BE LIABLE FOR ANY SPECIAL, DIRECT,
-# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
-# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-# PERFORMANCE OF THIS SOFTWARE.
-
-__version__ = '$Id$'
-
-import sys
-import optparse
-
-from rpki.gui.script_util import setup
-setup()
-
-from rpki.gui.routeview import models as rv
-from rpki.resource_set import resource_range_ip
-
-parser = optparse.OptionParser(
- usage='%prog [options] PREFIX',
- description='query the rpki web portal database for routes covering a '
- 'prefix specified as an argument, and display the validity and covering '
- 'ROAs for each route',
- version=__version__,
-)
-options, args = parser.parse_args()
-
-if len(args) == 0:
- print 'error: Specify an address/prefix'
- sys.exit(1)
-
-# allow bare IP addresses
-if '/' not in args[0]:
- args[0] = args[0] + '/32'
-
-r = resource_range_ip.parse_str(args[0])
-
-qs = rv.RouteOrigin.objects.filter(
- prefix_min__lte=r.min,
- prefix_max__gte=r.max
-)
-
-
-def validity_marker(route, roa, roa_prefix):
- "Return + if the roa would cause the route to be accepted, or - if not"
- # we already know the ROA covers this route because they are returned
- # from RouteOrigin.roas, so just check the ASN and max prefix length
- return '-' if (roa.asid == 0 or route.asn != roa.asid or
- route.prefixlen > roa_prefix.max_length) else '+'
-
-# xxx.xxx.xxx.xxx/xx-xx is 22 characters
-for route in qs:
- print route.as_resource_range(), route.asn, route.status
- for pfx in route.roa_prefixes:
- for roa in pfx.roas.all():
- print validity_marker(route, roa, pfx), pfx.as_roa_prefix(), roa.asid, roa.repo.uri
- print