From 3833476b299fc4ce3cc303361365ac28eae9a8f7 Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Fri, 3 Jul 2009 09:46:03 +0000 Subject: [PATCH] checkpoint --- CHANGES-0.2-to-0.8.txt | 3 + cmdline/sfi.py | 12 +- docs/Makefile | 3 +- geni/__init__.py | 4 - geni/alt_aggregate.py | 232 ----------------------------------- geni/methods/delete_slice.py | 1 - geni/nuke.py | 35 ------ geni/sfa-plc.py | 1 + setup.py | 33 +++-- 9 files changed, 35 insertions(+), 289 deletions(-) delete mode 100644 geni/alt_aggregate.py delete mode 100644 geni/nuke.py diff --git a/CHANGES-0.2-to-0.8.txt b/CHANGES-0.2-to-0.8.txt index 5660e582..177c832a 100644 --- a/CHANGES-0.2-to-0.8.txt +++ b/CHANGES-0.2-to-0.8.txt @@ -26,3 +26,6 @@ geni-config-tty -> sfa-config-tty gacks/ gui/ dummy/ + +nuke.py +alt_aggregate.py diff --git a/cmdline/sfi.py b/cmdline/sfi.py index cc37eb09..211213f2 100755 --- a/cmdline/sfi.py +++ b/cmdline/sfi.py @@ -55,9 +55,9 @@ def set_servers(options): else: print "No Known Registry Server" print "Try:" - print " export SFI_REGISTRY=http://your.slicemanager.url:12345/" + print " export SFI_REGISTRY=http://your.registry.url:12345/" print "Or add this argument to the command line:" - print " --registry=http://your.slicemanager.url:12345/" + print " --registry=http://your.registry.url:12345/" sys.exit(1) if options.verbose : @@ -364,10 +364,10 @@ def main(): verbose = options.verbose if verbose : print "Resgistry %s, sm %s, dir %s, user %s, auth %s" % (options.registry, - options.sm, - options.dir, - options.user, - options.auth) + options.sm, + options.dir, + options.user, + options.auth) print "Command %s" %command if command in ("resources"): print "resources cmd_opts %s" %cmd_opts.format diff --git a/docs/Makefile b/docs/Makefile index d0f092e1..8af14823 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -1,5 +1,6 @@ +### this seems like totally out-of-date doc: - pythondoc.py ../util/cert.py ../util/credential.py ../util/gid.py \ + pythondoc.py ../util/certificate.py ../util/credential.py ../util/gid.py \ ../util/rights.py ../util/config.py ../util/hierarchy.py \ ../util/record.py ../util/geniclient.py \ ../util/geniserver.py diff --git a/geni/__init__.py b/geni/__init__.py index ce913359..53dbf812 100644 --- a/geni/__init__.py +++ b/geni/__init__.py @@ -1,10 +1,6 @@ ## Please use make index to update this file all = """ aggregate -alt_aggregate -gimport -nuke -plc registry slicemgr """.split() diff --git a/geni/alt_aggregate.py b/geni/alt_aggregate.py deleted file mode 100644 index 8d5a4006..00000000 --- a/geni/alt_aggregate.py +++ /dev/null @@ -1,232 +0,0 @@ -### $Id$ -### $URL$ - -import os -import sys -import datetime -import time -import xmlrpclib - -from geni.util.geniserver import GeniServer -from geni.util.geniclient import * -from geni.util.certificate import Keypair, Certificate -from geni.util.credential import Credential -from geni.util.trustedroot import TrustedRootList -from geni.util.faults import * -from geni.util.misc import * -from geni.util.config import Config -from geni.util.rspec import Rspec -from geni.util.specdict import * -from geni.util.storage import SimpleStorage - -class AltAggregate(GeniServer): - - hrn = None - nodes_ttl = None - nodes = None - slices = None - policy = None - timestamp = None - threshold = None - shell = None - registry = None - key_file = None - cert_file = None - credential = None - - ## - # Create a new aggregate object. - # - # @param ip the ip address to listen on - # @param port the port to listen on - # @param key_file private key filename of registry - # @param cert_file certificate filename containing public key (could be a GID file) - - def __init__(self, ip, port, key_file, cert_file, config = "/etc/sfa/sfa_config"): - GeniServer.__init__(self, ip, port, key_file, cert_file) - self.key_file = key_file - self.cert_file = cert_file - self.config = Config(config) - self.basedir = self.config.GENI_BASE_DIR + os.sep - self.server_basedir = self.basedir + os.sep + "geni" + os.sep - self.hrn = self.config.GENI_INTERFACE_HRN - - nodes_file = os.sep.join([self.server_basedir, 'agg.' + self.hrn + '.components']) - self.nodes = SimpleStorage(nodes_file) - self.nodes.load() - - slices_file = os.sep.join([self.server_basedir, 'agg.' + self.hrn + '.slices']) - self.slices = SimpleStorage(slices_file) - self.slices.load() - - policy_file = os.sep.join([self.server_basedir, 'agg.' + self.hrn + '.policy']) - self.policy = SimpleStorage(policy_file, {'whitelist': [], 'blacklist': []}) - self.policy.load() - - timestamp_file = os.sep.join([self.server_basedir, 'agg.' + self.hrn + '.timestamp']) - self.timestamp = SimpleStorage(timestamp_file) - - self.nodes_ttl = 1 - - self.connectRegistry() - #self.loadCredential() - - def connectRegistry(self): - """ - Connect to the registry - """ - # connect to registry using GeniClient - address = self.config.GENI_REGISTRY_HOST - port = self.config.GENI_REGISTRY_PORT - url = 'https://%(address)s:%(port)s' % locals() - self.registry = GeniClient(url, self.key_file, self.cert_file) - - def loadCredential(self): - """ - Attempt to load credential from file if it exists. If it doesnt get - credential from registry. - """ - - self_cred_filename = self.server_basedir + os.sep + "agg." + self.hrn + ".cred" - ma_cred_filename = self.server_basedir + os.sep + "agg." + self.hrn + ".ma.cred" - - # see if this file exists - try: - cred = Credential(filename = ma_cred_filename, subject=self.hrn) - self.credential = cred.save_to_string() - except IOError: - # get self credential - self_cred = self.registry.get_credential(None, 'ma', self.hrn) - self_credential = Credential(string = self_cred) - self_credential.save_to_file(self_cred_filename) - - # get ma credential - ma_cred = self.registry.get_credential(self_cred) - ma_credential = Credential(string = ma_cred) - ma_credential.save_to_file(ma_cred_filename) - self.credential = ma_cred - - def load_policy(self): - """ - Read the list of blacklisted and whitelisted nodes. - """ - self.policy.load() - - def getNodes(self, format = 'rspec'): - """ - Return a list of components at this aggregate. - """ - - def getSlices(self): - """ - Return a list of instnatiated managed by this slice manager. - """ - - def getResources(self, slice_hrn): - """ - Return the current rspec for the specified slice. - """ - - def getTicket(self, hrn, rspec): - """ - Retrieve a ticket - """ - - def createSlice(self, slice_hrn, rspec, attributes = []): - """ - Instantiate/update slice according rspec - """ - - def updateSlice(self, slice_hrn, rspec, attributes = []): - return self.create_slice(slice_hrn, rspec, attributes) - - def deleteSlice(self, slice_hrn): - """ - Remove this slice - """ - - def startSlice(self, slice_hrn): - """ - Stop the slice - """ - - def stopSlice(self, slice_hrn): - """ - Stop the slice at the aggregate level - """ - - def resetSlice(self, slice_hrn): - """ - Reset the slice - """ - - def getPolicy(self): - """ - Return this aggregates policy. - """ - - -############################## -## Server methods here for now -############################## - - def list_nodes(self, cred, format): - self.decode_authentication(cred, 'listnodes') - return self.getNodes(format) - - def list_slices(self, cred): - self.decode_authentication(cred, 'listslices') - return self.getSlices() - - def get_resources(self, cred, hrn): - self.decode_authentication(cred, 'listnodes') - return self.getResources(hrn) - - def get_ticket(self, cred, hrn, rspec): - self.decode_authentication(cred, 'getticket') - return self.getTicket(hrn, rspec) - - def get_policy(self, cred): - self.decode_authentication(cred, 'getpolicy') - return self.getPolicy() - - def create_slice(self, cred, hrn, rspec): - self.decode_authentication(cred, 'createslice') - return self.createSlice(hrn, rspec) - - def update_slice(self, cred, hrn, rspec): - self.decode_authentication(cred, 'updateslice') - return self.updateSlice(hrn) - - def delete_slice(self, cred, hrn): - self.decode_authentication(cred, 'deleteslice') - return self.deleteSlice(hrn) - - def start_slice(self, cred, hrn): - self.decode_authentication(cred, 'startslice') - return self.startSlice(hrn) - - def stop_slice(self, cred, hrn): - self.decode_authentication(cred, 'stopslice') - return self.stopSlice(hrn) - - def reset_slice(self, cred, hrn): - self.decode_authentication(cred, 'resetslice') - return self.resetSlice(hrn) - - def register_functions(self): - GeniServer.register_functions(self) - - # Aggregate interface methods - self.server.register_function(self.list_nodes) - self.server.register_function(self.list_slices) - self.server.register_function(self.get_resources) - self.server.register_function(self.get_ticket) - self.server.register_function(self.get_policy) - self.server.register_function(self.create_slice) - self.server.register_function(self.update_slice) - self.server.register_function(self.delete_slice) - self.server.register_function(self.start_slice) - self.server.register_function(self.stop_slice) - self.server.register_function(self.reset_slice) - diff --git a/geni/methods/delete_slice.py b/geni/methods/delete_slice.py index b6be7974..187939e1 100644 --- a/geni/methods/delete_slice.py +++ b/geni/methods/delete_slice.py @@ -8,7 +8,6 @@ from geni.util.parameter import Parameter, Mixed from geni.util.auth import Auth from geni.util.slices import Slices -from geni.aggregate import Aggregates class delete_slice(Method): """ diff --git a/geni/nuke.py b/geni/nuke.py deleted file mode 100644 index 04a93ced..00000000 --- a/geni/nuke.py +++ /dev/null @@ -1,35 +0,0 @@ -### $Id$ -### $URL$ - -## -# Delete all the database records for Geni. This tool is used to clean out Geni -# records during testing. -# -# Authority info (maintained by the hierarchy module in a subdirectory tree) -# is not purged by this tool and may be deleted by a command like 'rm'. -## - -import getopt -import sys - -from geni.util.hierarchy import * -from geni.util.record import * -from geni.util.genitable import * -from geni.util.config import * - -def process_options(): - global hrn - - (options, args) = getopt.getopt(sys.argv[1:], '', []) - for opt in options: - name = opt[0] - val = opt[1] - -def main(): - process_options() - - print "purging geni records from database" - geni_records_purge(get_default_dbinfo()) - -if __name__ == "__main__": - main() diff --git a/geni/sfa-plc.py b/geni/sfa-plc.py index 88293211..b08f7e52 100644 --- a/geni/sfa-plc.py +++ b/geni/sfa-plc.py @@ -61,6 +61,7 @@ def daemon(): os.dup2(crashlog, 2) def main(): + # xxx get rid of globals - name consistently CamelCase or under_score global AuthHierarchy global TrustedRoots global registry_port diff --git a/setup.py b/setup.py index b6bd2e00..6af937b5 100755 --- a/setup.py +++ b/setup.py @@ -6,32 +6,45 @@ Installation script for the geniwrapper module import os, sys import shutil -from distutils.core import setup, Extension +from distutils.core import setup -scripts = [ 'geni/sfa-import-plc.py', +scripts = [ 'config/sfa-config-tty', + 'geni/sfa-import-plc.py', 'geni/sfa-plc.py', - 'config/sfa-config-tty', 'cmdline/sfi.py', 'cmdline/getNodes.py', 'cmdline/getRecord.py', 'cmdline/setRecord.py', 'cmdline/genidump.py', ] -package_dirs = ['geni', 'geni/util', 'geni/methods'] -data_files = [ ('/etc/sfa/', ['config/aggregates.xml', 'config/registries.xml', - 'config/sfa_config', 'config/sfi_config']), +package_dirs = [ 'geni', + 'geni/util', + 'geni/methods', + ] +data_files = [ ('/etc/sfa/', [ 'config/aggregates.xml', + 'config/registries.xml', + 'config/sfa_config', + 'config/sfi_config', + ]), ('/etc/init.d/', ['geni/init.d/sfa']), ('/var/www/html/wsdl', [ 'wsdl/sfa.wsdl' ] ), ] -symlinks = ['/usr/share/geniwrapper'] -initscripts = ['/etc/init.d/geni'] +symlinks = [ '/usr/share/geniwrapper' ] +initscripts = [ '/etc/init.d/geni' ] if sys.argv[1] in ['uninstall', 'remove', 'delete', 'clean']: python_path = sys.path site_packages_path = [ path + os.sep + 'geni' for path in python_path if path.endswith('site-packages')] remove_dirs = ['/etc/sfa/'] + site_packages_path - remove_files = ['/usr/bin/sfa-import-plc.py', '/usr/bin/sfa-plc.py', '/usr/bin/sfi.py', '/usr/bin/sfa-config-tty'] + \ - symlinks + initscripts + remove_files = [ '/usr/bin/sfa-config-tty', + '/usr/bin/sfa-import-plc.py', + '/usr/bin/sfa-plc.py', + '/usr/bin/sfi.py', + '/usr/bin/getNodes.py', + '/usr/bin/getRecord.py', + '/usr/bin/setRecord.py', + '/usr/bin/genidump.py', + ] + symlinks + initscripts # remove files for filepath in remove_files: -- 2.43.0