[mirrorbrain-commits] [opensuse-svn] r6495 - in trunk/tools/download-redirector-v2/mirrordoctor: . mb

From: Novell Forge SVN <noreply_at_novell.com>
Date: Wed, 18 Feb 2009 07:42:28 -0700 (MST)
Author: poeml
Date: 2009-02-18 07:42:25 -0700 (Wed, 18 Feb 2009)
New Revision: 6495

Modified:
   trunk/tools/download-redirector-v2/mirrordoctor/mb/asn.py
   trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py
Log:
mb iplookup: add --all-prefixes option


Modified: trunk/tools/download-redirector-v2/mirrordoctor/mb/asn.py
===================================================================
--- trunk/tools/download-redirector-v2/mirrordoctor/mb/asn.py	2009-02-18 13:04:59 UTC (rev 6494)
+++ trunk/tools/download-redirector-v2/mirrordoctor/mb/asn.py	2009-02-18 14:42:25 UTC (rev 6495)
_at_@ -32,3 +32,13 @@
         return a
     (a.prefix, a.asn) = res[0]
     return a
+
+def asn_prefixes(conn, asn):
+
+    query = """SELECT pfx \
+                   FROM pfx2asn \
+                   WHERE asn='%s'""" % asn
+
+    res = conn.Pfx2asn._connection.queryAll(query)
+    l = [ i[0] for i in res ]
+    return l

Modified: trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py
===================================================================
--- trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py	2009-02-18 13:04:59 UTC (rev 6494)
+++ trunk/tools/download-redirector-v2/mirrordoctor/mirrordoctor.py	2009-02-18 14:42:25 UTC (rev 6495)
_at_@ -225,6 +225,8 @@
         print mb.conn.server_show_template % mb.conn.server2dict(mirror)
 
 
+    _at_cmdln.option('--all-prefixes', action='store_true',
+                        help='show all prefixes handled by this AS')
     _at_cmdln.option('-p', '--prefix', action='store_true',
                         help='print the network prefix')
     _at_cmdln.option('-a', '--asn', action='store_true',
_at_@ -251,6 +253,9 @@
             print r.prefix
         else:
             print '%s (AS%s)' % (r.prefix, r.asn)
+        if opts.all_prefixes:
+            r2 = mb.asn.asn_prefixes(self.conn, r.asn)
+            print ', '.join(r2)
 
 
     _at_cmdln.option('--all-mirrors', action='store_true',

_______________________________________________
Opensuse-svn mailing list
Opensuse-svn_at_forge.novell.com
http://forge.novell.com/mailman/listinfo/opensuse-svn


_______________________________________________
mirrorbrain-commits mailing list

Note: To remove yourself from this list, send a mail with the content
 	unsubscribe
to the address mirrorbrain-commits-request_at_mirrorbrain.org
Received on Wed Feb 18 2009 - 14:42:57 GMT

This archive was generated by hypermail 2.3.0 : Mon Feb 20 2012 - 23:47:04 GMT