collects all nodes associated with a list of loginbase patterns
authorStephen Soltesz <soltesz@cs.princeton.edu>
Mon, 5 Nov 2007 17:16:28 +0000 (17:16 +0000)
committerStephen Soltesz <soltesz@cs.princeton.edu>
Mon, 5 Nov 2007 17:16:28 +0000 (17:16 +0000)
get_metasite_nodes.py [new file with mode: 0755]

diff --git a/get_metasite_nodes.py b/get_metasite_nodes.py
new file mode 100755 (executable)
index 0000000..5d88377
--- /dev/null
@@ -0,0 +1,39 @@
+#!/usr/bin/python
+import plc
+import soltesz
+import string
+import sys
+
+def main():
+       meta_sites = ['canarie', 'rnp', 'jgn2', 'i2', 'tp', 'princetondsl', 'plcolo', 'wide']
+       l_blacklist = [ "grouse.hpl.hp.com", "planet1.att.nodes.planet-lab.org"]
+       #l_blacklist = soltesz.dbLoad("l_blacklist")
+       l_sitelist = []
+       count = 0
+       # for each prefix above
+       for pre_loginbase in meta_sites:
+               print "getting sites from base %s*" % pre_loginbase
+               search_sites  = plc.getSites({'login_base' : pre_loginbase + "*"})
+               # for each of the sites that begin with this prefix
+               for site in search_sites:
+                       # get the nodes for that site
+                       l_sitelist.append(site['login_base'])
+                       print "%s : " % site['login_base']
+                       nodes = plc.getSiteNodes2(site['login_base'])
+                       for node in nodes:
+                               hn = node['hostname']
+                               if hn not in l_blacklist:
+                                       print "\t%s" % hn
+                                       count += 1
+                                       # add the nodes to the blacklist
+                                       l_blacklist.append(hn)
+                               #else:
+                               #       print "not adding %s" % hn
+       print string.join(l_sitelist,  ",")
+       print "Found %d nodes" % count
+       print "Found %d sites " % len(l_sitelist)
+
+       soltesz.dbDump("l_blacklist")
+
+if __name__=="__main__":
+       main()