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) @@ -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) @@ -225,6 +225,8 @@ print mb.conn.server_show_template % mb.conn.server2dict(mirror) + @cmdln.option('--all-prefixes', action='store_true', + help='show all prefixes handled by this AS') @cmdln.option('-p', '--prefix', action='store_true', help='print the network prefix') @cmdln.option('-a', '--asn', action='store_true', @@ -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) @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.orgReceived on 2009-02-18Z14:42:57
This archive was generated by hypermail 2.2.0 : 2009-07-10Z19:18:11 GMT