script used to test aggregate interface
authorTony Mack <tmack@cs.princeton.edu>
Fri, 6 Feb 2009 18:55:47 +0000 (18:55 +0000)
committerTony Mack <tmack@cs.princeton.edu>
Fri, 6 Feb 2009 18:55:47 +0000 (18:55 +0000)
cmdline/testAggregate.py [new file with mode: 0644]

diff --git a/cmdline/testAggregate.py b/cmdline/testAggregate.py
new file mode 100644 (file)
index 0000000..e65eb09
--- /dev/null
@@ -0,0 +1,31 @@
+from geni.util.geniclient import *
+from geni.util.credential import *
+from pprint import pprint
+
+cred = Credential(filename = 'tmack.pl.sa.cred')
+slicehrn = 'planetlab.us.pl.tmack'
+print cred.get_privileges().save_to_string()
+
+r = GeniClient('https://128.112.139.120:12345', 'tmack.pkey', 'tmack.cert') 
+a = GeniClient('https://128.112.139.120:12346', 'tmack.pkey', 'tmack.cert')
+
+#pprint(r.list(cred, 'planetlab.us.princeton'))
+pprint(a.get_policy(cred))
+
+print "components at this aggregate"
+components = a.list_components()
+pprint(components)
+
+print "resources being used by %(slicehrn)s" % locals()
+tmack_components = a.list_resources(cred, slicehrn)
+pprint(tmack_components)
+
+print "removing %(slicehrn)s from all nodes" % locals()
+a.delete_slice(cred, slicehrn)
+
+print "adding %(slicehrn)s back to its original nodes"
+a.list_resources(cred, slicehrn)
+a.create_slice(cred, slicehrn, tmack_components)
+a.list_resources(cred, slicehrn)
+