From 3d7237fa0b5f2b4a60cb97c7fb3b6aecfd94558a Mon Sep 17 00:00:00 2001 From: Thierry Parmentelat Date: Tue, 5 Jan 2010 16:31:37 +0000 Subject: [PATCH] removed another bunch of references to geni --- Makefile | 2 +- README.txt | 2 +- config/sfa_component_config | 8 +- docs/Makefile | 4 +- setup.py | 58 ++++---- sfa.spec | 4 +- sfa/client/{genidump.py => sfadump.py} | 6 +- sfa/client/sfi.py | 8 +- sfa/managers/aggregate_manager_max.py | 14 +- sfa/managers/aggregate_manager_openflow.py | 2 +- sfa/managers/aggregate_manager_pl.py | 2 +- sfa/managers/aggregate_manager_vini.py | 2 +- sfa/managers/registry_manager_pl.py | 45 +++--- sfa/managers/slice_manager_pl.py | 2 +- sfa/methods/get_gid.py | 1 - sfa/methods/get_gids.py | 1 - sfa/methods/get_key.py | 4 +- sfa/methods/get_self_credential.py | 4 +- sfa/methods/get_ticket.py | 2 +- sfa/methods/list.py | 4 +- sfa/methods/register.py | 5 +- sfa/methods/register_peer_object.py | 12 +- sfa/methods/remove_peer_object.py | 10 +- sfa/methods/resolve.py | 4 +- sfa/methods/update.py | 2 +- sfa/plc/api.py | 48 +++---- sfa/plc/nodes.py | 8 +- sfa/plc/remoteshell.py | 2 +- sfa/plc/sfa-import-plc.py | 8 +- sfa/plc/sfa-nuke-plc.py | 8 +- sfa/plc/sfaImport.py | 24 ++-- sfa/plc/slices.py | 2 +- sfa/rspecs/aggregates/rspec_manager_max.py | 14 +- .../aggregates/rspec_manager_openflow.py | 2 +- sfa/rspecs/aggregates/rspec_manager_vini.py | 2 +- sfa/rspecs/aggregates/vini/utils.py | 2 +- sfa/server/SfaAggregateModPython.py | 4 +- sfa/server/SfaRegistryModPython.py | 4 +- sfa/server/SfaSliceMgrModPython.py | 4 +- sfa/server/aggregate.py | 6 +- sfa/server/component.py | 4 +- sfa/server/modpythonapi/installTest.sh | 18 +-- sfa/server/modpythonapi/test.sh | 2 +- sfa/server/registry.py | 10 +- sfa/server/sfa-clean-peer-records.py | 8 +- sfa/server/sfa-server.py | 6 +- sfa/server/slicemgr.py | 6 +- sfa/trust/auth.py | 4 +- sfa/trust/certificate.py | 2 +- sfa/trust/credential.py | 2 +- sfa/trust/gid.py | 2 +- sfa/trust/hierarchy.py | 2 +- sfa/trust/rights.py | 2 +- sfa/util/PostgreSQL.py | 2 +- sfa/util/api.py | 12 +- sfa/util/{geniclient.py => client.py} | 16 +-- sfa/util/componentserver.py | 10 +- sfa/util/config.py | 12 +- sfa/util/faults.py | 135 ++++++++++-------- sfa/util/filter.py | 10 +- sfa/util/method.py | 32 ++--- sfa/util/misc.py | 4 +- sfa/util/namespace.py | 8 +- sfa/util/nodemanager.py | 1 + sfa/util/parameter.py | 2 +- sfa/util/record.py | 30 ++-- sfa/util/row.py | 4 +- sfa/util/{geniserver.py => server.py} | 16 +-- sfa/util/soapprotocol.py | 2 +- sfa/util/{genitable.py => table.py} | 39 +++-- sfa/util/xmlrpcprotocol.py | 2 +- sfacomponent/component.py | 14 +- sfacomponent/copynode.sh | 2 +- sfacomponent/plc/api.py | 2 +- sfacomponent/server/component.py | 10 +- sfatables/commands/moo.py | 18 +-- tests/client/testAggregate.py | 2 +- tests/testRecord.py | 2 +- 78 files changed, 404 insertions(+), 397 deletions(-) rename sfa/client/{genidump.py => sfadump.py} (95%) rename sfa/util/{geniclient.py => client.py} (96%) rename sfa/util/{geniserver.py => server.py} (95%) rename sfa/util/{genitable.py => table.py} (87%) diff --git a/Makefile b/Makefile index ff7e7f3b..1ad12d26 100644 --- a/Makefile +++ b/Makefile @@ -83,7 +83,7 @@ RSYNC := rsync -a -v $(RSYNC_COND_DRY_RUN) $(RSYNC_EXCLUDES) BINS = ./config/sfa-config-tty ./sfa/plc/sfa-import-plc.py ./sfa/plc/sfa-nuke-plc.py \ ./sfa/server/sfa-server.py \ ./sfa/client/sfi.py ./sfa/client/getNodes.py ./sfa/client/getRecord.py \ - ./sfa/client/setRecord.py ./sfa/client/genidump.py + ./sfa/client/setRecord.py ./sfa/client/sfadump.py sync: ifeq (,$(SSHURL)) diff --git a/README.txt b/README.txt index 5df1a947..42255d4a 100644 --- a/README.txt +++ b/README.txt @@ -1,4 +1,4 @@ -This module (geniwrapper) is installed as part of MyPLC, available as +This module (sfa) is installed as part of MyPLC, available as part of the PlanetLab development effort. For more information on accessing, installing, developing and deploying PlanetLab software, visit http://svn.planet-lab.org. diff --git a/config/sfa_component_config b/config/sfa_component_config index 0698a62f..137405eb 100644 --- a/config/sfa_component_config +++ b/config/sfa_component_config @@ -37,7 +37,7 @@ SFA_REGISTRY_LEVEL1_AUTH="" SFA_REGISTRY_HOST="localhost" # Port -# Geni registry port +# SFA registry port SFA_REGISTRY_PORT=12345 ## ============================================================== @@ -60,7 +60,7 @@ SFA_AGGREGATE_TYPE='pl' SFA_AGGREGATE_HOST="localhost" # ## Port -## Geni aggregate server port +## SFA aggregate server port SFA_AGGREGATE_PORT=12346 ## ============================================================== @@ -83,7 +83,7 @@ SFA_SM_TYPE='pl' SFA_SM_HOST="localhost" # Port -# Geni slice manager server port +# SFA slice manager server port SFA_SM_PORT=12347 ## =============================================================== @@ -103,7 +103,7 @@ SFA_CM_TYPE='pl' SFA_CM_HOST="localhost" # # Port -# Geni slice manager server port +# SFA slice manager server port SFA_CM_PORT=12346 diff --git a/docs/Makefile b/docs/Makefile index 43f9ad0a..463dbaf6 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -2,8 +2,8 @@ doc: pythondoc.py ../sfa/util/certificate.py ../sfa/util/credential.py ../sfa/util/gid.py \ ../sfa/util/rights.py ../sfa/util/config.py ../sfa/trust/hierarchy.py \ - ../sfa/util/record.py ../sfa/util/geniclient.py \ - ../sfa/util/geniserver.py + ../sfa/util/record.py ../sfa/util/client.py \ + ../sfa/util/server.py pythondoc.py ../sfa/registry/registry.py ../sfa/registry/import.py \ ../sfa/registry/nuke.py diff --git a/setup.py b/setup.py index f4e2c9a6..18f5618c 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ #!/usr/bin/python """ -Installation script for the geniwrapper module +Installation script for the sfa module """ import sys, os, os.path @@ -9,34 +9,36 @@ from glob import glob import shutil from distutils.core import setup -bins = [ 'config/sfa-config-tty', - 'sfa/plc/sfa-import-plc.py', - 'sfa/plc/sfa-nuke-plc.py', - 'sfa/server/sfa-server.py', - 'sfa/server/sfa-clean-peer-records.py', - 'sfa/client/sfi.py', - 'sfa/client/getNodes.py', - 'sfa/client/getRecord.py', - 'sfa/client/setRecord.py', - 'sfa/client/genidump.py', - 'sfatables/sfatables', - ] +bins = [ + 'config/sfa-config-tty', + 'sfa/plc/sfa-import-plc.py', + 'sfa/plc/sfa-nuke-plc.py', + 'sfa/server/sfa-server.py', + 'sfa/server/sfa-clean-peer-records.py', + 'sfa/client/sfi.py', + 'sfa/client/getNodes.py', + 'sfa/client/getRecord.py', + 'sfa/client/setRecord.py', + 'sfa/client/sfadump.py', + 'sfatables/sfatables', + ] -package_dirs = [ 'sfa', - 'sfa/client', - 'sfa/methods', - 'sfa/plc', - 'sfa/server', - 'sfa/trust', - 'sfa/util', - 'sfa/managers', - 'sfa/rspecs', - 'sfa/rspecs/aggregates', - 'sfa/rspecs/aggregates/vini', - 'sfatables', - 'sfatables/commands', - 'sfatables/processors', - ] +package_dirs = [ + 'sfa', + 'sfa/client', + 'sfa/methods', + 'sfa/plc', + 'sfa/server', + 'sfa/trust', + 'sfa/util', + 'sfa/managers', + 'sfa/rspecs', + 'sfa/rspecs/aggregates', + 'sfa/rspecs/aggregates/vini', + 'sfatables', + 'sfatables/commands', + 'sfatables/processors', + ] data_files = [('/etc/sfa/', [ 'config/aggregates.xml', diff --git a/sfa.spec b/sfa.spec index ccb8683a..eafcf312 100644 --- a/sfa.spec +++ b/sfa.spec @@ -62,7 +62,7 @@ Requires: sfa This package provides the python libraries that the SFA implementation requires %description plc -Geniwrapper implements the SFA interface which serves as a layer +This package implements the SFA interface which serves as a layer between the existing PlanetLab interfaces and the SFA API. %description client @@ -113,7 +113,7 @@ rm -rf $RPM_BUILD_ROOT %{_bindir}/getNodes.py* %{_bindir}/getRecord.py* %{_bindir}/setRecord.py* -%{_bindir}/genidump.py* +%{_bindir}/sfadump.py* %files sfatables %{_bindir}/sfatables diff --git a/sfa/client/genidump.py b/sfa/client/sfadump.py similarity index 95% rename from sfa/client/genidump.py rename to sfa/client/sfadump.py index 311fbef1..6496ca64 100644 --- a/sfa/client/genidump.py +++ b/sfa/client/sfadump.py @@ -1,4 +1,6 @@ #! /usr/bin/env python +# $Id$ +# $URL$ from __future__ import with_statement import sys @@ -10,7 +12,7 @@ from optparse import OptionParser from sfa.trust.certificate import Certificate from sfa.trust.credential import Credential -from sfa.util.record import GeniRecord +from sfa.util.record import SfaRecord from sfa.util.rspec import RSpec def determine_sfa_filekind(fn): @@ -59,7 +61,7 @@ def extract_gids(cred, extract_parents): def create_parser(): # Generate command line parser - parser = OptionParser(usage="genidump [options] filename") + parser = OptionParser(usage="%prog [options] filename") parser.add_option("-e", "--extractgids", action="store_true", dest="extract_gids", default=False, help="Extract GIDs from credentials") parser.add_option("-p", "--dumpparents", action="store_true", dest="dump_parents", default=False, help="Show parents") diff --git a/sfa/client/sfi.py b/sfa/client/sfi.py index 688dd2ca..b1a4379e 100755 --- a/sfa/client/sfi.py +++ b/sfa/client/sfi.py @@ -106,7 +106,7 @@ def save_record_to_file(filename, record): elif record['type'] in ['authority', 'ma', 'sa']: record = AuthorityRecord(dict = record) else: - record = GeniRecord(dict = record) + record = SfaRecord(dict = record) str = record.save_to_string() file(filename, "w").write(str) return @@ -115,7 +115,7 @@ def save_record_to_file(filename, record): # load methods def load_record_from_file(filename): str = file(filename, "r").read() - record = GeniRecord(string=str) + record = SfaRecord(string=str) return record @@ -449,7 +449,7 @@ class Sfi: raise Exception, "Error: Didn't find a %(type)s record for %(hrn)s" % locals() # the gid of the user who will be delegated too - record = GeniRecord(dict=records[0]) + record = SfaRecord(dict=records[0]) delegee_gid = record.get_gid_object() delegee_hrn = delegee_gid.get_hrn() @@ -572,7 +572,7 @@ class Sfi: elif record['type'] in ['authority', 'ma', 'sa']: record = AuthorityRecord(dict = record) else: - record = GeniRecord(dict = record) + record = SfaRecord(dict = record) if (opts.format=="text"): record.dump() else: diff --git a/sfa/managers/aggregate_manager_max.py b/sfa/managers/aggregate_manager_max.py index 7f0a2536..5c128754 100644 --- a/sfa/managers/aggregate_manager_max.py +++ b/sfa/managers/aggregate_manager_max.py @@ -22,15 +22,15 @@ SFA_MAX_CANNED_RSPEC = '/etc/sfa/max_physical_canned.xml' topology = {} -class GeniOutOfResource(GeniFault): +class SfaOutOfResource(SfaFault): def __init__(self, interface): faultString = "Interface " + interface + " not available" - GeniFault.__init__(self, 100, faultString, '') + SfaFault.__init__(self, 100, faultString, '') -class GeniNoPairRSpec(GeniFault): +class SfaNoPairRSpec(SfaFault): def __init__(self, interface, interface2): faultString = "Interface " + interface + " should be paired with " + interface2 - GeniFault.__init__(self, 100, faultString, '') + SfaFault.__init__(self, 100, faultString, '') # Returns a mapping from interfaces to the nodes they lie on and their peer interfaces # i -> node,i_peer @@ -140,7 +140,7 @@ def alloc_nodes(api,hrn, requested_ifs): # Taken from slices.py def create_slice_max_aggregate(api, hrn, nodes): - # Get the slice record from geni + # Get the slice record global topology topology = get_interface_map() slice = {} @@ -288,9 +288,9 @@ def create_slice(api, hrn, rspec_xml): for a in requested_interfaces: if (a not in current_hrn_interfaces and a in current_interfaces): - raise GeniOutOfResource(a) + raise SfaOutOfResource(a) if (topology[a][1] not in requested_interfaces): - raise GeniNoPairRSpec(a,topology[a][1]) + raise SfaNoPairRSpec(a,topology[a][1]) # Request OK # Allocations to delete diff --git a/sfa/managers/aggregate_manager_openflow.py b/sfa/managers/aggregate_manager_openflow.py index e784f6fc..a745b6ea 100755 --- a/sfa/managers/aggregate_manager_openflow.py +++ b/sfa/managers/aggregate_manager_openflow.py @@ -14,7 +14,7 @@ import sys import socket import struct -# Message IDs for all the GENI light calls +# Message IDs for all the SFA light calls # This will be used by the aggrMgr controller SFA_GET_RESOURCES = 101 SFA_CREATE_SLICE = 102 diff --git a/sfa/managers/aggregate_manager_pl.py b/sfa/managers/aggregate_manager_pl.py index 949d71e1..f890a697 100644 --- a/sfa/managers/aggregate_manager_pl.py +++ b/sfa/managers/aggregate_manager_pl.py @@ -11,7 +11,7 @@ from sfa.util.namespace import * from sfa.util.rspec import * from sfa.util.specdict import * from sfa.util.faults import * -from sfa.util.record import GeniRecord +from sfa.util.record import SfaRecord from sfa.util.policy import Policy from sfa.util.record import * from sfa.util.sfaticket import SfaTicket diff --git a/sfa/managers/aggregate_manager_vini.py b/sfa/managers/aggregate_manager_vini.py index a5966682..e8f879c2 100644 --- a/sfa/managers/aggregate_manager_vini.py +++ b/sfa/managers/aggregate_manager_vini.py @@ -13,7 +13,7 @@ SFA_VINI_WHITELIST = '/etc/sfa/vini.whitelist' Copied from create_slice_aggregate() in sfa.plc.slices """ def create_slice_vini_aggregate(api, hrn, nodes): - # Get the slice record from geni + # Get the slice record slice = {} registries = Registries(api) registry = registries[api.hrn] diff --git a/sfa/managers/registry_manager_pl.py b/sfa/managers/registry_manager_pl.py index f08e18d0..584f580a 100644 --- a/sfa/managers/registry_manager_pl.py +++ b/sfa/managers/registry_manager_pl.py @@ -2,10 +2,9 @@ import types import time from sfa.server.registry import Registries from sfa.util.prefixTree import prefixTree -from sfa.util.record import GeniRecord -from sfa.util.genitable import GeniTable -from sfa.util.record import GeniRecord -from sfa.util.genitable import GeniTable +from sfa.util.record import SfaRecord +from sfa.util.table import SfaTable +from sfa.util.record import SfaRecord from sfa.trust.gid import GID from sfa.util.namespace import * from sfa.trust.credential import * @@ -19,7 +18,7 @@ def get_credential(api, hrn, type, is_self=False): auth_hrn = hrn # get record info auth_info = api.auth.get_auth_info(auth_hrn) - table = GeniTable() + table = SfaTable() records = table.findObjects({'type': type, 'hrn': hrn}) if not records: raise RecordNotFound(hrn) @@ -92,12 +91,12 @@ def resolve(api, hrns, type=None, origin_hrn=None): if registry_hrn != api.hrn: credential = api.getCredential() peer_records = registries[registry_hrn].resolve(credential, hrn, origin_hrn) - records.extend([GeniRecord(dict=record).as_dict() for record in peer_records]) + records.extend([SfaRecord(dict=record).as_dict() for record in peer_records]) # try resolving the remaining unfound records at the local registry remaining_hrns = set(hrns).difference([record['hrn'] for record in records]) remaining_hrns = [hrn for hrn in remaining_hrns] - table = GeniTable() + table = SfaTable() local_records = table.findObjects({'hrn': remaining_hrns}) for record in local_records: try: @@ -105,7 +104,7 @@ def resolve(api, hrns, type=None, origin_hrn=None): records.append(dict(record)) except PlanetLabRecordDoesNotExist: # silently drop the ones that are missing in PL - print >> log, "ignoring geni record ", record['hrn'], \ + print >> log, "ignoring SFA record ", record['hrn'], \ " because pl record does not exist" table.remove(record) @@ -137,14 +136,14 @@ def list(api, hrn): if registry_hrn != api.hrn: credential = api.getCredential() record_list = registries[registry_hrn].list(credential, hrn, origin_hrn) - records = [GeniRecord(dict=record).as_dict() for record in record_list] + records = [SfaRecord(dict=record).as_dict() for record in record_list] # if we still havnt found the record yet, try the local registry if not records: if not api.auth.hierarchy.auth_exists(hrn): raise MissingAuthority(hrn) - table = GeniTable() + table = SfaTable() records = table.find({'authority': hrn}) return records @@ -156,15 +155,15 @@ def register(api, record): # validate the type if type not in ['authority', 'slice', 'node', 'user']: - raise UnknownGeniType(type) + raise UnknownSfaType(type) # check if record already exists - table = GeniTable() + table = SfaTable() existing_records = table.find({'type': type, 'hrn': hrn}) if existing_records: raise ExistingRecord(hrn) - record = GeniRecord(dict = record) + record = SfaRecord(dict = record) record['authority'] = get_authority(record['hrn']) type = record['type'] hrn = record['hrn'] @@ -195,7 +194,7 @@ def register(api, record): # get the GID from the newly created authority gid = auth_info.get_gid_object() record.set_gid(gid.save_to_string(save_parents=True)) - pl_record = api.geni_fields_to_pl_fields(type, hrn, record) + pl_record = api.sfa_fields_to_pl_fields(type, hrn, record) sites = api.plshell.GetSites(api.plauth, [pl_record['login_base']]) if not sites: pointer = api.plshell.AddSite(api.plauth, pl_record) @@ -207,7 +206,7 @@ def register(api, record): elif (type == "slice"): acceptable_fields=['url', 'instantiation', 'name', 'description'] - pl_record = api.geni_fields_to_pl_fields(type, hrn, record) + pl_record = api.sfa_fields_to_pl_fields(type, hrn, record) for key in pl_record.keys(): if key not in acceptable_fields: pl_record.pop(key) @@ -241,7 +240,7 @@ def register(api, record): api.plshell.AddPersonKey(api.plauth, pointer, {'key_type' : 'ssh', 'key' : pub_key}) elif (type == "node"): - pl_record = api.geni_fields_to_pl_fields(type, hrn, record) + pl_record = api.sfa_fields_to_pl_fields(type, hrn, record) login_base = hrn_to_pl_login_base(record['authority']) nodes = api.plshell.GetNodes(api.plauth, [pl_record['hostname']]) if not nodes: @@ -260,11 +259,11 @@ def register(api, record): return record.get_gid_object().save_to_string(save_parents=True) def update(api, record_dict): - new_record = GeniRecord(dict = record_dict) + new_record = SfaRecord(dict = record_dict) type = new_record['type'] hrn = new_record['hrn'] api.auth.verify_object_permission(hrn) - table = GeniTable() + table = SfaTable() # make sure the record exists records = table.findObjects({'type': type, 'hrn': hrn}) if not records: @@ -285,7 +284,7 @@ def update(api, record_dict): api.plshell.UpdateSite(api.plauth, pointer, new_record) elif type == "slice": - pl_record=api.geni_fields_to_pl_fields(type, hrn, new_record) + pl_record=api.sfa_fields_to_pl_fields(type, hrn, new_record) if 'name' in pl_record: pl_record.pop('name') api.plshell.UpdateSlice(api.plauth, pointer, pl_record) @@ -330,14 +329,14 @@ def update(api, record_dict): gid_object = api.auth.hierarchy.create_gid(hrn, uuid, pkey) gid = gid_object.save_to_string(save_parents=True) record['gid'] = gid - record = GeniRecord(dict=record) + record = SfaRecord(dict=record) table.update(record) elif type == "node": api.plshell.UpdateNode(api.plauth, pointer, new_record) else: - raise UnknownGeniType(type) + raise UnknownSfaType(type) # update membership for researchers, pis, owners, operators api.update_membership(record, new_record) @@ -345,7 +344,7 @@ def update(api, record_dict): return 1 def remove(api, hrn, type, origin_hrn=None): - table = GeniTable() + table = SfaTable() filter = {'hrn': hrn} if type not in ['all', '*']: filter['type'] = type @@ -383,7 +382,7 @@ def remove(api, hrn, type, origin_hrn=None): if api.plshell.GetSites(api.plauth, record['pointer']): api.plshell.DeleteSite(api.plauth, record['pointer']) else: - raise UnknownGeniType(type) + raise UnknownSfaType(type) table.remove(record) diff --git a/sfa/managers/slice_manager_pl.py b/sfa/managers/slice_manager_pl.py index c5b0f26e..dd80ddd7 100644 --- a/sfa/managers/slice_manager_pl.py +++ b/sfa/managers/slice_manager_pl.py @@ -11,7 +11,7 @@ from sfa.util.namespace import * from sfa.util.rspec import * from sfa.util.specdict import * from sfa.util.faults import * -from sfa.util.record import GeniRecord +from sfa.util.record import SfaRecord from sfa.util.policy import Policy from sfa.util.prefixTree import prefixTree from sfa.util.rspec import * diff --git a/sfa/methods/get_gid.py b/sfa/methods/get_gid.py index 66320e6b..b3d7c6f1 100644 --- a/sfa/methods/get_gid.py +++ b/sfa/methods/get_gid.py @@ -11,7 +11,6 @@ from sfa.util.parameter import Parameter, Mixed from sfa.trust.auth import Auth from sfa.trust.gid import GID from sfa.trust.certificate import Certificate -from sfa.util.genitable import GeniTable class get_gid(Method): """ diff --git a/sfa/methods/get_gids.py b/sfa/methods/get_gids.py index 5f1e0aab..51590870 100644 --- a/sfa/methods/get_gids.py +++ b/sfa/methods/get_gids.py @@ -12,7 +12,6 @@ from sfa.trust.auth import Auth from sfa.trust.gid import GID from sfa.trust.certificate import Certificate from sfa.trust.credential import Credential -from sfa.util.genitable import GeniTable class get_gids(Method): """ diff --git a/sfa/methods/get_key.py b/sfa/methods/get_key.py index 6ede861a..c641985b 100644 --- a/sfa/methods/get_key.py +++ b/sfa/methods/get_key.py @@ -8,7 +8,7 @@ from sfa.util.namespace import * from sfa.util.method import Method from sfa.util.parameter import Parameter, Mixed from sfa.trust.auth import Auth -from sfa.util.genitable import * +from sfa.util.table import SfaTable from sfa.trust.certificate import Keypair class get_key(Method): @@ -36,7 +36,7 @@ class get_key(Method): node = nodes[0] # look up the sfa record - table = GeniTable() + table = SfaTable() records = table.findObjects({'type': 'node', 'pointer': node['node_id']}) if not records: raise RecordNotFound("pointer:" + str(node['node_id'])) diff --git a/sfa/methods/get_self_credential.py b/sfa/methods/get_self_credential.py index ab55c47c..49bad017 100644 --- a/sfa/methods/get_self_credential.py +++ b/sfa/methods/get_self_credential.py @@ -6,7 +6,7 @@ from sfa.trust.rights import * from sfa.util.faults import * from sfa.util.method import Method from sfa.util.parameter import Parameter, Mixed -from sfa.util.record import GeniRecord +from sfa.util.record import SfaRecord from sfa.util.debug import log class get_self_credential(Method): @@ -58,7 +58,7 @@ class get_self_credential(Method): records = manager.resolve(self.api, hrn, type) if not records: raise RecordNotFound(hrn) - record = GeniRecord(dict=records[0]) + record = SfaRecord(dict=records[0]) gid = record.get_gid_object() gid_str = gid.save_to_string(save_parents=True) self.api.auth.authenticateGid(gid_str, [cert, type, hrn], request_hash) diff --git a/sfa/methods/get_ticket.py b/sfa/methods/get_ticket.py index 2ee18f20..314e3595 100644 --- a/sfa/methods/get_ticket.py +++ b/sfa/methods/get_ticket.py @@ -7,7 +7,7 @@ from sfa.util.parameter import Parameter, Mixed from sfa.trust.auth import Auth from sfa.util.config import Config from sfa.trust.credential import Credential -from sfa.util.genitable import GeniTable +from sfa.util.table import SfaTable from sfa.util.sfaticket import SfaTicket from sfa.plc.slices import Slices from sfatables.runtime import SFATablesRules diff --git a/sfa/methods/list.py b/sfa/methods/list.py index bd600d3f..489c0831 100644 --- a/sfa/methods/list.py +++ b/sfa/methods/list.py @@ -4,7 +4,7 @@ from sfa.util.faults import * from sfa.util.method import Method from sfa.util.parameter import Parameter, Mixed -from sfa.util.record import GeniRecord +from sfa.util.record import SfaRecord from sfa.trust.credential import Credential class list(Method): @@ -24,7 +24,7 @@ class list(Method): Parameter(None, "Origin hrn not specified")) ] - returns = [GeniRecord] + returns = [SfaRecord] def call(self, cred, hrn, origin_hrn=None): user_cred = Credential(string=cred) diff --git a/sfa/methods/register.py b/sfa/methods/register.py index c8216059..1e3e24a6 100644 --- a/sfa/methods/register.py +++ b/sfa/methods/register.py @@ -6,8 +6,7 @@ from sfa.trust.gid import * from sfa.util.faults import * from sfa.util.method import Method from sfa.util.parameter import Parameter, Mixed -from sfa.util.record import GeniRecord -from sfa.util.genitable import GeniTable +from sfa.util.record import SfaRecord from sfa.util.debug import log from sfa.trust.auth import Auth from sfa.trust.gid import create_uuid @@ -16,7 +15,7 @@ from sfa.trust.credential import Credential class register(Method): """ Register an object with the registry. In addition to being stored in the - Geni database, the appropriate records will also be created in the + SFA database, the appropriate records will also be created in the PLC databases @param cred credential string diff --git a/sfa/methods/register_peer_object.py b/sfa/methods/register_peer_object.py index 0d8c8537..68b3105c 100644 --- a/sfa/methods/register_peer_object.py +++ b/sfa/methods/register_peer_object.py @@ -8,8 +8,8 @@ from sfa.util.faults import * from sfa.util.namespace import * from sfa.util.method import Method from sfa.util.parameter import Parameter, Mixed -from sfa.util.record import GeniRecord -from sfa.util.genitable import GeniTable +from sfa.util.record import SfaRecord +from sfa.util.table import SfaTable from sfa.util.debug import log from sfa.trust.auth import Auth from sfa.trust.gid import create_uuid @@ -18,7 +18,7 @@ from sfa.trust.credential import Credential class register_peer_object(Method): """ Register a peer object with the registry. In addition to being stored in the - Geni database, the appropriate records will also be created in the + SFA database, the appropriate records will also be created in the PLC databases @param cred credential string @@ -51,16 +51,16 @@ class register_peer_object(Method): # make sure this is a peer record if 'peer_authority' not in record_dict or \ not record_dict['peer_authority']: - raise GeniInvalidArgument, "peer_authority must be specified" + raise SfaInvalidArgument, "peer_authority must be specified" - record = GeniRecord(dict = record_dict) + record = SfaRecord(dict = record_dict) type, hrn, peer_authority = record['type'], record['hrn'], record['peer_authority'] record['authority'] = get_authority(record['hrn']) # verify permissions self.api.auth.verify_cred_is_me(cred) # check if record already exists - table = GeniTable() + table = SfaTable() existing_records = table.find({'type': type, 'hrn': hrn, 'peer_authority': peer_authority}) if existing_records: for existing_record in existing_records: diff --git a/sfa/methods/remove_peer_object.py b/sfa/methods/remove_peer_object.py index 83432642..32b756ac 100644 --- a/sfa/methods/remove_peer_object.py +++ b/sfa/methods/remove_peer_object.py @@ -2,8 +2,8 @@ from sfa.util.faults import * from sfa.util.method import Method from sfa.util.parameter import Parameter, Mixed from sfa.trust.auth import Auth -from sfa.util.record import GeniRecord -from sfa.util.genitable import GeniTable +from sfa.util.record import SfaRecord +from sfa.util.table import SfaTable from sfa.util.debug import log from sfa.trust.credential import Credential from types import StringTypes @@ -46,7 +46,7 @@ class remove_peer_object(Method): try: self.api.auth.verify_object_permission(record['hrn']) except: self.api.auth.verify_cred_is_me(cred) - table = GeniTable() + table = SfaTable() hrn, type = record['hrn'], record['type'] records = table.find({'hrn': hrn, 'type': type }) for record in records: @@ -88,14 +88,14 @@ class remove_peer_object(Method): self.api.plshell.DeleteSite(self.api.plauth, site['site_id']) else: - raise UnknownGeniType(type) + raise UnknownSfaType(type) return 1 def get_peer_name(self, peer_id): peers = self.api.plshell.GetPeers(self.api.plauth, [peer_id], ['peername', 'shortname', 'hrn_root']) if not peers: - raise GeniInvalidArgument, "No such peer" + raise SfaInvalidArgument, "No such peer" peer = peers[0] return peer['shortname'] diff --git a/sfa/methods/resolve.py b/sfa/methods/resolve.py index 5761d342..b854d656 100644 --- a/sfa/methods/resolve.py +++ b/sfa/methods/resolve.py @@ -6,7 +6,7 @@ from sfa.util.method import Method from sfa.util.parameter import Parameter, Mixed from sfa.util.debug import log from sfa.trust.credential import Credential -from sfa.util.record import GeniRecord +from sfa.util.record import SfaRecord class resolve(Method): """ @@ -25,7 +25,7 @@ class resolve(Method): Parameter(list, "List of Human readable names ([hrn])")) ] - returns = [GeniRecord] + returns = [SfaRecord] def call(self, cred, hrn, origin_hrn=None): user_cred = Credential(string=cred) diff --git a/sfa/methods/update.py b/sfa/methods/update.py index 05916b3b..2a1be732 100644 --- a/sfa/methods/update.py +++ b/sfa/methods/update.py @@ -11,7 +11,7 @@ from sfa.trust.credential import Credential class update(Method): """ Update an object in the registry. Currently, this only updates the - PLC information associated with the record. The Geni fields (name, type, + PLC information associated with the record. The SFA fields (name, type, GID) are fixed. @param cred credential string specifying rights of the caller diff --git a/sfa/plc/api.py b/sfa/plc/api.py index ef3b9c3d..b5c9ce49 100644 --- a/sfa/plc/api.py +++ b/sfa/plc/api.py @@ -1,5 +1,5 @@ # -# Geniwrapper XML-RPC and SOAP interfaces +# SFA XML-RPC and SOAP interfaces # ### $Id$ ### $URL$ @@ -21,8 +21,9 @@ from sfa.util.namespace import * from sfa.util.api import * from sfa.util.nodemanager import NodeManager from sfa.util.sfalogging import * +from sfa.util.table import SfaTable -class GeniAPI(BaseAPI): +class SfaAPI(BaseAPI): # flat list of method names import sfa.methods @@ -135,8 +136,7 @@ class GeniAPI(BaseAPI): if not auth_hrn or hrn == self.config.SFA_INTERFACE_HRN: auth_hrn = hrn auth_info = self.auth.get_auth_info(auth_hrn) - from sfa.util.genitable import GeniTable - table = GeniTable() + table = SfaTable() records = table.findObjects(hrn) if not records: raise RecordNotFound @@ -177,15 +177,15 @@ class GeniAPI(BaseAPI): self.credential = self.getCredentialFromRegistry() ## - # Convert geni fields to PLC fields for use when registering up updating + # Convert SFA fields to PLC fields for use when registering up updating # registry record in the PLC database # # @param type type of record (user, slice, ...) # @param hrn human readable name - # @param geni_fields dictionary of geni fields + # @param sfa_fields dictionary of SFA fields # @param pl_fields dictionary of PLC fields (output) - def geni_fields_to_pl_fields(self, type, hrn, record): + def sfa_fields_to_pl_fields(self, type, hrn, record): def convert_ints(tmpdict, int_fields): for field in int_fields: @@ -210,7 +210,7 @@ class GeniAPI(BaseAPI): elif type == "node": if not "hostname" in pl_record: if not "hostname" in record: - raise MissingGeniInfo("hostname") + raise MissingSfaInfo("hostname") pl_record["hostname"] = record["hostname"] if not "model" in pl_record: pl_record["model"] = "geni" @@ -234,7 +234,7 @@ class GeniAPI(BaseAPI): def fill_record_pl_info(self, record): """ - Fill in the planetlab specific fields of a Geni record. This + Fill in the planetlab specific fields of a SFA record. This involves calling the appropriate PLC method to retrieve the database record for the object. @@ -262,7 +262,7 @@ class GeniAPI(BaseAPI): elif (type == "node"): pl_res = self.plshell.GetNodes(self.plauth, [pointer]) else: - raise UnknownGeniType(type) + raise UnknownSfaType(type) if not pl_res: raise PlanetLabRecordDoesNotExist(record['hrn']) @@ -306,16 +306,15 @@ class GeniAPI(BaseAPI): - def fill_record_geni_info(self, record): - geni_info = {} + def fill_record_sfa_info(self, record): + sfa_info = {} type = record['type'] - from sfa.util.genitable import GeniTable - table = GeniTable() + table = SfaTable() if (type == "slice"): person_ids = record.get("person_ids", []) persons = table.find({'type': 'user', 'pointer': person_ids}) researchers = [person['hrn'] for person in persons] - geni_info['researcher'] = researchers + sfa_info['researcher'] = researchers elif (type == "authority"): person_ids = record.get("person_ids", []) @@ -339,28 +338,28 @@ class GeniAPI(BaseAPI): if 'admin' in person['roles']: admins.append(hrn) - geni_info['PI'] = pis - geni_info['operator'] = techs - geni_info['owner'] = admins + sfa_info['PI'] = pis + sfa_info['operator'] = techs + sfa_info['owner'] = admins # xxx TODO: OrganizationName elif (type == "node"): - geni_info['dns'] = record.get("hostname", "") + sfa_info['dns'] = record.get("hostname", "") # xxx TODO: URI, LatLong, IP, DNS elif (type == "user"): - geni_info['email'] = record.get("email", "") + sfa_info['email'] = record.get("email", "") # xxx TODO: PostalAddress, Phone - record.update(geni_info) + record.update(sfa_info) def fill_record_info(self, record): """ - Given a geni record, fill in the PLC specific and Geni specific + Given a SFA record, fill in the PLC specific and SFA specific fields in the record. """ self.fill_record_pl_info(record) - self.fill_record_geni_info(record) + self.fill_record_sfa_info(record) def update_membership_list(self, oldRecord, record, listName, addFunc, delFunc): # get a list of the HRNs tht are members of the old and new records @@ -377,8 +376,7 @@ class GeniAPI(BaseAPI): # build a list of the new person ids, by looking up each person to get # their pointer newIdList = [] - from sfa.util.genitable import GeniTable - table = GeniTable() + table = SfaTable() records = table.find({'type': 'user', 'hrn': newList}) for rec in records: newIdList.append(rec['pointer']) diff --git a/sfa/plc/nodes.py b/sfa/plc/nodes.py index 9a2a8534..f80bd1ab 100644 --- a/sfa/plc/nodes.py +++ b/sfa/plc/nodes.py @@ -203,7 +203,7 @@ class Nodes(SimpleStorage): elif self.api.plshell_version in ['4.3']: interface_ids.extend(node['interface_ids']) else: - raise GeniAPIError, "Unsupported plcapi version ", \ + raise SfaAPIError, "Unsupported plcapi version ", \ self.api.plshell_version if self.api.plshell_version in ['4.2']: @@ -211,7 +211,7 @@ class Nodes(SimpleStorage): elif self.api.plshell_version in ['4.3']: interfaces = self.api.plshell.GetInterfaces(self.api.plauth, interface_ids) else: - raise GeniAPIError, "Unsupported plcapi version ", \ + raise SfaAPIError, "Unsupported plcapi version ", \ self.api.plshell_version interface_dict = {} for interface in interfaces: @@ -220,7 +220,7 @@ class Nodes(SimpleStorage): elif self.api.plshell_version in ['4.3']: interface_dict[interface['interface_id']] = interface else: - raise GeniAPIError, "Unsupported plcapi version", \ + raise SfaAPIError, "Unsupported plcapi version", \ self.api.plshell_version # join nodes with thier interfaces @@ -233,7 +233,7 @@ class Nodes(SimpleStorage): for interface_id in node['interface_ids']: node['interfaces'].append(interface_dict[interface_id]) else: - raise GeniAPIError, "Unsupported plcapi version", \ + raise SfaAPIError, "Unsupported plcapi version", \ self.api.plshell_version # convert and threshold to ints diff --git a/sfa/plc/remoteshell.py b/sfa/plc/remoteshell.py index 6d5453d7..14cd629a 100644 --- a/sfa/plc/remoteshell.py +++ b/sfa/plc/remoteshell.py @@ -4,7 +4,7 @@ # # RemoteShell() exports an API that looks identical to that exported by # PLC.Shell.Shell(). It's meant to be a drop in replacement for running -# geniwrapper on a different machine than PLC. +# SFA on a different machine than PLC. ### $Id$ ### $URL$ diff --git a/sfa/plc/sfa-import-plc.py b/sfa/plc/sfa-import-plc.py index 2ca9b740..cf2fa4ab 100755 --- a/sfa/plc/sfa-import-plc.py +++ b/sfa/plc/sfa-import-plc.py @@ -4,8 +4,8 @@ ### $URL$ # ## -# Import PLC records into the Geni database. It is indended that this tool be -# run once to create Geni records that reflect the current state of the +# Import PLC records into the SFA database. It is indended that this tool be +# run once to create SFA records that reflect the current state of the # planetlab database. # # The import tool assumes that the existing PLC hierarchy should all be part @@ -23,7 +23,7 @@ import tempfile import logging.handlers import logging from sfa.util.record import * -from sfa.util.genitable import GeniTable +from sfa.util.table import SfaTable from sfa.util.namespace import * from sfa.util.config import Config from sfa.trust.certificate import convert_public_key, Keypair @@ -81,7 +81,7 @@ def main(): plc_auth = sfaImporter.plc_auth AuthHierarchy = sfaImporter.AuthHierarchy TrustedRoots = sfaImporter.TrustedRoots - table = GeniTable() + table = SfaTable() if not table.exists(): table.create() diff --git a/sfa/plc/sfa-nuke-plc.py b/sfa/plc/sfa-nuke-plc.py index eac6ed75..16c12dcd 100755 --- a/sfa/plc/sfa-nuke-plc.py +++ b/sfa/plc/sfa-nuke-plc.py @@ -1,6 +1,6 @@ #!/usr/bin/python ## -# Delete all the database records for Geni. This tool is used to clean out Geni +# Delete all the database records for SFA. This tool is used to clean out SFA # records during testing. # # Authority info (maintained by the hierarchy module in a subdirectory tree) @@ -12,7 +12,7 @@ import sys from sfa.trust.hierarchy import * from sfa.util.record import * -from sfa.util.genitable import GeniTable +from sfa.util.table import SfaTable from sfa.util.config import Config def process_options(): @@ -25,8 +25,8 @@ def process_options(): def main(): process_options() - print "purging geni records from database" - GeniTable.geni_records_purge(Config().get_plc_dbinfo()) + print "Purging SFA records from database" + SfaTable.sfa_records_purge(Config().get_plc_dbinfo()) if __name__ == "__main__": main() diff --git a/sfa/plc/sfaImport.py b/sfa/plc/sfaImport.py index 399c23a6..a554cb61 100644 --- a/sfa/plc/sfaImport.py +++ b/sfa/plc/sfaImport.py @@ -13,7 +13,7 @@ import sys import tempfile from sfa.util.record import * -from sfa.util.genitable import GeniTable +from sfa.util.table import SfaTable from sfa.util.namespace import * from sfa.util.config import Config from sfa.util.report import trace, error @@ -90,11 +90,11 @@ class sfaImport: parent_hrn = hrn auth_info = AuthHierarchy.get_auth_info(parent_hrn) - table = GeniTable() + table = SfaTable() auth_record = table.find({'type': 'authority', 'hrn': hrn}) if not auth_record: - auth_record = GeniRecord(hrn=hrn, gid=auth_info.get_gid_object(), type="authority", pointer=-1) + auth_record = SfaRecord(hrn=hrn, gid=auth_info.get_gid_object(), type="authority", pointer=-1) auth_record['authority'] = get_authority(auth_record['hrn']) trace("Import: inserting authority record for " + hrn, self.logger) table.insert(auth_record) @@ -128,8 +128,8 @@ class sfaImport: # create the gid person_gid = AuthHierarchy.create_gid(hrn, create_uuid(), pkey) - table = GeniTable() - person_record = GeniRecord(hrn=hrn, gid=person_gid, type="user", pointer=person['person_id']) + table = SfaTable() + person_record = SfaRecord(hrn=hrn, gid=person_gid, type="user", pointer=person['person_id']) person_record['authority'] = get_authority(person_record['hrn']) existing_records = table.find({'hrn': hrn, 'type': 'user', 'pointer': person['person_id']}) if not existing_records: @@ -154,9 +154,9 @@ class sfaImport: pkey = Keypair(create=True) slice_gid = AuthHierarchy.create_gid(hrn, create_uuid(), pkey) - slice_record = GeniRecord(hrn=hrn, gid=slice_gid, type="slice", pointer=slice['slice_id']) + slice_record = SfaRecord(hrn=hrn, gid=slice_gid, type="slice", pointer=slice['slice_id']) slice_record['authority'] = get_authority(slice_record['hrn']) - table = GeniTable() + table = SfaTable() existing_records = table.find({'hrn': hrn, 'type': 'slice', 'pointer': slice['slice_id']}) if not existing_records: table.insert(slice_record) @@ -181,11 +181,11 @@ class sfaImport: if len(hrn) > 64: hrn = hrn[:64] - table = GeniTable() + table = SfaTable() node_record = table.find({'type': 'node', 'hrn': hrn}) pkey = Keypair(create=True) node_gid = AuthHierarchy.create_gid(hrn, create_uuid(), pkey) - node_record = GeniRecord(hrn=hrn, gid=node_gid, type="node", pointer=node['node_id']) + node_record = SfaRecord(hrn=hrn, gid=node_gid, type="node", pointer=node['node_id']) node_record['authority'] = get_authority(node_record['hrn']) existing_records = table.find({'hrn': hrn, 'type': 'node', 'pointer': node['node_id']}) if not existing_records: @@ -225,8 +225,8 @@ class sfaImport: auth_info = AuthHierarchy.get_auth_info(hrn) - table = GeniTable() - auth_record = GeniRecord(hrn=hrn, gid=auth_info.get_gid_object(), type="authority", pointer=site['site_id']) + table = SfaTable() + auth_record = SfaRecord(hrn=hrn, gid=auth_info.get_gid_object(), type="authority", pointer=site['site_id']) auth_record['authority'] = get_authority(auth_record['hrn']) existing_records = table.find({'hrn': hrn, 'type': 'authority', 'pointer': site['site_id']}) if not existing_records: @@ -242,7 +242,7 @@ class sfaImport: def delete_record(self, hrn, type): # delete the record - table = GeniTable() + table = SfaTable() record_list = table.find({'type': type, 'hrn': hrn}) for record in record_list: trace("Import: Removing record %s %s" % (type, hrn), self.logger) diff --git a/sfa/plc/slices.py b/sfa/plc/slices.py index 4fa30988..cfeed465 100644 --- a/sfa/plc/slices.py +++ b/sfa/plc/slices.py @@ -12,7 +12,7 @@ from sfa.util.rspec import * from sfa.util.specdict import * from sfa.util.faults import * from sfa.util.storage import * -from sfa.util.record import GeniRecord +from sfa.util.record import SfaRecord from sfa.util.policy import Policy from sfa.util.prefixTree import prefixTree from sfa.util.debug import log diff --git a/sfa/rspecs/aggregates/rspec_manager_max.py b/sfa/rspecs/aggregates/rspec_manager_max.py index 7f0a2536..c6504b99 100644 --- a/sfa/rspecs/aggregates/rspec_manager_max.py +++ b/sfa/rspecs/aggregates/rspec_manager_max.py @@ -22,15 +22,15 @@ SFA_MAX_CANNED_RSPEC = '/etc/sfa/max_physical_canned.xml' topology = {} -class GeniOutOfResource(GeniFault): +class SfaOutOfResource(SfaFault): def __init__(self, interface): faultString = "Interface " + interface + " not available" - GeniFault.__init__(self, 100, faultString, '') + SfaFault.__init__(self, 100, faultString, '') -class GeniNoPairRSpec(GeniFault): +class SfaNoPairRSpec(SfaFault): def __init__(self, interface, interface2): faultString = "Interface " + interface + " should be paired with " + interface2 - GeniFault.__init__(self, 100, faultString, '') + SfaFault.__init__(self, 100, faultString, '') # Returns a mapping from interfaces to the nodes they lie on and their peer interfaces # i -> node,i_peer @@ -140,7 +140,7 @@ def alloc_nodes(api,hrn, requested_ifs): # Taken from slices.py def create_slice_max_aggregate(api, hrn, nodes): - # Get the slice record from geni + # Get the slice record from SFA global topology topology = get_interface_map() slice = {} @@ -288,9 +288,9 @@ def create_slice(api, hrn, rspec_xml): for a in requested_interfaces: if (a not in current_hrn_interfaces and a in current_interfaces): - raise GeniOutOfResource(a) + raise SfaOutOfResource(a) if (topology[a][1] not in requested_interfaces): - raise GeniNoPairRSpec(a,topology[a][1]) + raise SfaNoPairRSpec(a,topology[a][1]) # Request OK # Allocations to delete diff --git a/sfa/rspecs/aggregates/rspec_manager_openflow.py b/sfa/rspecs/aggregates/rspec_manager_openflow.py index e784f6fc..a745b6ea 100755 --- a/sfa/rspecs/aggregates/rspec_manager_openflow.py +++ b/sfa/rspecs/aggregates/rspec_manager_openflow.py @@ -14,7 +14,7 @@ import sys import socket import struct -# Message IDs for all the GENI light calls +# Message IDs for all the SFA light calls # This will be used by the aggrMgr controller SFA_GET_RESOURCES = 101 SFA_CREATE_SLICE = 102 diff --git a/sfa/rspecs/aggregates/rspec_manager_vini.py b/sfa/rspecs/aggregates/rspec_manager_vini.py index a5966682..20dc7fb5 100644 --- a/sfa/rspecs/aggregates/rspec_manager_vini.py +++ b/sfa/rspecs/aggregates/rspec_manager_vini.py @@ -13,7 +13,7 @@ SFA_VINI_WHITELIST = '/etc/sfa/vini.whitelist' Copied from create_slice_aggregate() in sfa.plc.slices """ def create_slice_vini_aggregate(api, hrn, nodes): - # Get the slice record from geni + # Get the slice record from SFA slice = {} registries = Registries(api) registry = registries[api.hrn] diff --git a/sfa/rspecs/aggregates/vini/utils.py b/sfa/rspecs/aggregates/vini/utils.py index 32f2bc42..ea36aadd 100644 --- a/sfa/rspecs/aggregates/vini/utils.py +++ b/sfa/rspecs/aggregates/vini/utils.py @@ -542,7 +542,7 @@ class Topology: maxbps = get_tc_rate(maxbw) for link in self.nodelinks: if link.bps <= 0: - raise GeniInvalidArgument(bw, "BW") + raise SfaInvalidArgument(bw, "BW") if link.bps > maxbps: raise PermissionError(" %s requested %s but max BW is %s" % (hrn, format_tc_rate(link.bps), maxbw)) diff --git a/sfa/server/SfaAggregateModPython.py b/sfa/server/SfaAggregateModPython.py index 7193ba6f..e1ab86dc 100755 --- a/sfa/server/SfaAggregateModPython.py +++ b/sfa/server/SfaAggregateModPython.py @@ -12,10 +12,10 @@ import traceback import xmlrpclib from mod_python import apache -from sfa.plc.api import GeniAPI +from sfa.plc.api import SfaAPI from sfa.util.debug import log -api = GeniAPI(interface='aggregate') +api = SfaAPI(interface='aggregate') class unbuffered: """ diff --git a/sfa/server/SfaRegistryModPython.py b/sfa/server/SfaRegistryModPython.py index 4eeb913d..a9044ebb 100755 --- a/sfa/server/SfaRegistryModPython.py +++ b/sfa/server/SfaRegistryModPython.py @@ -12,9 +12,9 @@ import traceback import xmlrpclib from mod_python import apache from sfa.util.debug import log -from sfa.plc.api import GeniAPI +from sfa.plc.api import SfaAPI -api = GeniAPI(interface='registry') +api = SfaAPI(interface='registry') class unbuffered: """ diff --git a/sfa/server/SfaSliceMgrModPython.py b/sfa/server/SfaSliceMgrModPython.py index ea7b7342..7ad8e0d4 100755 --- a/sfa/server/SfaSliceMgrModPython.py +++ b/sfa/server/SfaSliceMgrModPython.py @@ -12,10 +12,10 @@ import traceback import xmlrpclib from mod_python import apache -from sfa.plc.api import GeniAPI +from sfa.plc.api import SfaAPI from sfa.util.debug import log -api = GeniAPI(interface='slicemgr') +api = SfaAPI(interface='slicemgr') class unbuffered: """ diff --git a/sfa/server/aggregate.py b/sfa/server/aggregate.py index 478a5ac0..9295e3f5 100644 --- a/sfa/server/aggregate.py +++ b/sfa/server/aggregate.py @@ -8,7 +8,7 @@ import time import xmlrpclib from types import StringTypes, ListType -from sfa.util.geniserver import GeniServer +from sfa.util.server import SfaServer from sfa.util.storage import * from sfa.util.faults import * import sfa.util.xmlrpcprotocol as xmlrpcprotocol @@ -21,7 +21,7 @@ except ImportError: GeniClientLight = None -class Aggregate(GeniServer): +class Aggregate(SfaServer): ## # Create a new aggregate object. @@ -31,7 +31,7 @@ class Aggregate(GeniServer): # @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): - GeniServer.__init__(self, ip, port, key_file, cert_file) + SfaServer.__init__(self, ip, port, key_file, cert_file) self.server.interface = 'aggregate' ## diff --git a/sfa/server/component.py b/sfa/server/component.py index df5d4836..c83ac4af 100644 --- a/sfa/server/component.py +++ b/sfa/server/component.py @@ -1,5 +1,5 @@ # -# Component is a GeniServer that implements the Component interface +# Component is a SfaServer that implements the Component interface # ### $Id: ### $URL: @@ -19,7 +19,7 @@ except ImportError: GeniClientLight = None ## -# Component is a GeniServer that serves component operations. +# Component is a SfaServer that serves component operations. class Component(ComponentServer): ## diff --git a/sfa/server/modpythonapi/installTest.sh b/sfa/server/modpythonapi/installTest.sh index 7ae489e9..1a6514eb 100755 --- a/sfa/server/modpythonapi/installTest.sh +++ b/sfa/server/modpythonapi/installTest.sh @@ -1,4 +1,4 @@ -GENI_SRC_DIR=/home/smbaker/projects/geniwrapper/trunk +SFA_SRC_DIR=/home/smbaker/projects/sfa/trunk mkdir -p /usr/local/testapi/bin mkdir -p /usr/local/testapi/bin/sfa/trust @@ -19,19 +19,19 @@ cp trusted_roots/*.gid /usr/local/testapi/var/trusted_roots/ # apache config file to enable the api cp testapi.conf /etc/httpd/conf.d/ -# copy over geniwrapper stuff that we need +# copy over sfa stuff that we need echo > /usr/local/testapi/bin/sfa/__init__.py echo > /usr/local/testapi/bin/sfa/trust/__init__.py echo > /usr/local/testapi/bin/sfa/util/__init__.py -cp $GENI_SRC_DIR/sfa/trust/gid.py /usr/local/testapi/bin/sfa/trust/ -cp $GENI_SRC_DIR/sfa/trust/certificate.py /usr/local/testapi/bin/sfa/trust/ -cp $GENI_SRC_DIR/sfa/trust/trustedroot.py /usr/local/testapi/bin/sfa/trust/ -cp $GENI_SRC_DIR/sfa/trust/credential.py /usr/local/testapi/bin/sfa/trust/ -cp $GENI_SRC_DIR/sfa/trust/rights.py /usr/local/testapi/bin/sfa/trust/ -cp $GENI_SRC_DIR/sfa/util/faults.py /usr/local/testapi/bin/sfa/util/ +cp $SFA_SRC_DIR/sfa/trust/gid.py /usr/local/testapi/bin/sfa/trust/ +cp $SFA_SRC_DIR/sfa/trust/certificate.py /usr/local/testapi/bin/sfa/trust/ +cp $SFA_SRC_DIR/sfa/trust/trustedroot.py /usr/local/testapi/bin/sfa/trust/ +cp $SFA_SRC_DIR/sfa/trust/credential.py /usr/local/testapi/bin/sfa/trust/ +cp $SFA_SRC_DIR/sfa/trust/rights.py /usr/local/testapi/bin/sfa/trust/ +cp $SFA_SRC_DIR/sfa/util/faults.py /usr/local/testapi/bin/sfa/util/ # make everything owned by apache chown -R apache /usr/local/testapi chown apache /etc/httpd/conf.d/testapi.conf -/etc/init.d/httpd restart \ No newline at end of file +/etc/init.d/httpd restart diff --git a/sfa/server/modpythonapi/test.sh b/sfa/server/modpythonapi/test.sh index 745c6a84..cafa0fb8 100755 --- a/sfa/server/modpythonapi/test.sh +++ b/sfa/server/modpythonapi/test.sh @@ -1,3 +1,3 @@ -export PYTHONPATH=/home/smbaker/projects/geniwrapper/trunk +export PYTHONPATH=/home/smbaker/projects/sfa/trunk python ./test.py diff --git a/sfa/server/registry.py b/sfa/server/registry.py index c5d7cdf1..1902a648 100644 --- a/sfa/server/registry.py +++ b/sfa/server/registry.py @@ -1,5 +1,5 @@ # -# Registry is a GeniServer that implements the Registry interface +# Registry is a SfaServer that implements the Registry interface # ### $Id$ ### $URL$ @@ -10,7 +10,7 @@ import os import time import sys -from sfa.util.geniserver import GeniServer +from sfa.util.server import SfaServer from sfa.util.faults import * from sfa.util.storage import * import sfa.util.xmlrpcprotocol as xmlrpcprotocol @@ -23,9 +23,9 @@ except ImportError: GeniClientLight = None ## -# Registry is a GeniServer that serves registry and slice operations at PLC. +# Registry is a SfaServer that serves registry and slice operations at PLC. -class Registry(GeniServer): +class Registry(SfaServer): ## # Create a new registry object. # @@ -35,7 +35,7 @@ class Registry(GeniServer): # @param cert_file certificate filename containing public key (could be a GID file) def __init__(self, ip, port, key_file, cert_file): - GeniServer.__init__(self, ip, port, key_file, cert_file) + SfaServer.__init__(self, ip, port, key_file, cert_file) self.server.interface = 'registry' diff --git a/sfa/server/sfa-clean-peer-records.py b/sfa/server/sfa-clean-peer-records.py index 358aee24..5c133351 100644 --- a/sfa/server/sfa-clean-peer-records.py +++ b/sfa/server/sfa-clean-peer-records.py @@ -4,8 +4,8 @@ import sys import os import traceback from sfa.util.namespace import * -from sfa.util.genitable import GeniTable -from sfa.plc.api import GeniAPI +from sfa.util.table import SfaTable +from sfa.plc.api import SfaAPI from sfa.util.config import Config from sfa.trust.certificate import Keypair from sfa.trust.hierarchy import Hierarchy @@ -32,14 +32,14 @@ def main(): authority = config.SFA_INTERFACE_HRN url = 'http://%s:%s/' %(config.SFA_REGISTRY_HOST, config.SFA_REGISTRY_PORT) registry = xmlrpcprotocol.get_server((url, key_file, cert_file) - sfa_api = GeniAPI(key_file = key_file, cert_file = cert_file, interface='registry') + sfa_api = SfaAPI(key_file = key_file, cert_file = cert_file, interface='registry') credential = sfa_api.getCredential() # get peer registries registries = Registries(sfa_api) # get local peer records - table = GeniTable() + table = SfaTable() peer_records = table.find({'~peer_authority': None}) for peer_record in peer_records: peer_auth = peer_record['peer_authority'] diff --git a/sfa/server/sfa-server.py b/sfa/server/sfa-server.py index 9bdf9cb0..134b44ae 100755 --- a/sfa/server/sfa-server.py +++ b/sfa/server/sfa-server.py @@ -3,9 +3,9 @@ ### $Id$ ### $URL$ # -# GENI PLC Wrapper +# SFA PLC Wrapper # -# This wrapper implements the Geni Registry and Slice Interfaces on PLC. +# This wrapper implements the SFA Registry and Slice Interfaces on PLC. # Depending on command line options, it starts some combination of a # Registry, an Aggregate Manager, and a Slice Manager. # @@ -18,7 +18,7 @@ # is up to date and accurate. # # 1) Import the existing planetlab database, creating the -# appropriate geni records. This is done by running the "sfa-import-plc.py" tool. +# appropriate SFA records. This is done by running the "sfa-import-plc.py" tool. # # 2) Create a "trusted_roots" directory and place the certificate of the root # authority in that directory. Given the defaults in sfa-import-plc.py, this diff --git a/sfa/server/slicemgr.py b/sfa/server/slicemgr.py index f459fab5..11948878 100644 --- a/sfa/server/slicemgr.py +++ b/sfa/server/slicemgr.py @@ -5,9 +5,9 @@ import os import sys import datetime import time -from sfa.util.geniserver import * +from sfa.util.server import * -class SliceMgr(GeniServer): +class SliceMgr(SfaServer): ## @@ -19,5 +19,5 @@ class SliceMgr(GeniServer): # @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) + SfaServer.__init__(self, ip, port, key_file, cert_file) self.server.interface = 'slicemgr' diff --git a/sfa/trust/auth.py b/sfa/trust/auth.py index 0d578715..66887670 100644 --- a/sfa/trust/auth.py +++ b/sfa/trust/auth.py @@ -1,5 +1,5 @@ # -# GeniAPI authentication +# SfaAPI authentication # ### $Id$ ### $URL$ @@ -149,7 +149,7 @@ class Auth: caller_gid = cred.get_gid_caller() caller_hrn = caller_gid.get_hrn() if caller_hrn != self.config.SFA_INTERFACE_HRN: - raise GeniPermissionError(self.config.SFA_INTEFACE_HRN) + raise SfaPermissionDenied(self.config.SFA_INTEFACE_HRN) return diff --git a/sfa/trust/certificate.py b/sfa/trust/certificate.py index b34e5cde..9b488357 100644 --- a/sfa/trust/certificate.py +++ b/sfa/trust/certificate.py @@ -1,5 +1,5 @@ ## -# Geniwrapper uses two crypto libraries: pyOpenSSL and M2Crypto to implement +# SFA uses two crypto libraries: pyOpenSSL and M2Crypto to implement # the necessary crypto functionality. Ideally just one of these libraries # would be used, but unfortunately each of these libraries is independently # lacking. The pyOpenSSL library is missing many necessary functions, and diff --git a/sfa/trust/credential.py b/sfa/trust/credential.py index 0954cd84..d8451d74 100644 --- a/sfa/trust/credential.py +++ b/sfa/trust/credential.py @@ -1,5 +1,5 @@ ## -# Implements Geni Credentials +# Implements SFA Credentials # # Credentials are layered on top of certificates, and are essentially a # certificate that stores a tuple of parameters. diff --git a/sfa/trust/gid.py b/sfa/trust/gid.py index c1670be6..a87b3dfb 100644 --- a/sfa/trust/gid.py +++ b/sfa/trust/gid.py @@ -1,5 +1,5 @@ ## -# Implements GENI GID. GIDs are based on certificates, and the GID class is a +# Implements SFA GID. GIDs are based on certificates, and the GID class is a # descendant of the certificate class. ## diff --git a/sfa/trust/hierarchy.py b/sfa/trust/hierarchy.py index 990a394d..ce74c9f5 100644 --- a/sfa/trust/hierarchy.py +++ b/sfa/trust/hierarchy.py @@ -1,6 +1,6 @@ ## # This module implements a hierarchy of authorities and performs a similar -# function as the "tree" module of the original geniwrapper prototype. An HRN +# function as the "tree" module of the original SFA prototype. An HRN # is assumed to be a string of authorities separated by dots. For example, # "planetlab.us.arizona.bakers". Each component of the HRN is a different # authority, with the last component being a leaf in the tree. diff --git a/sfa/trust/rights.py b/sfa/trust/rights.py index ea10d5d7..6d7fc85b 100644 --- a/sfa/trust/rights.py +++ b/sfa/trust/rights.py @@ -1,5 +1,5 @@ ## -# This Module implements rights and lists of rights for the Geni wrapper. Rights +# This Module implements rights and lists of rights for the SFA. Rights # are implemented by two classes: # # Right - represents a single right diff --git a/sfa/util/PostgreSQL.py b/sfa/util/PostgreSQL.py index 17541198..5b349016 100644 --- a/sfa/util/PostgreSQL.py +++ b/sfa/util/PostgreSQL.py @@ -202,7 +202,7 @@ class PostgreSQL: print >> log, query print >> log, "Params:" print >> log, pformat(params) - raise GeniDBError("Please contact support") + raise SfaDBError("Please contact support") return cursor diff --git a/sfa/util/api.py b/sfa/util/api.py index db98a265..514364ab 100644 --- a/sfa/util/api.py +++ b/sfa/util/api.py @@ -1,8 +1,8 @@ # -# Geniwrapper XML-RPC and SOAP interfaces +# SFA XML-RPC and SOAP interfaces # -### $Id: api.py 15596 2009-10-31 21:42:05Z anil $ -### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/plc/api.py $ +### $Id$ +### $URL$ # import sys @@ -131,7 +131,7 @@ class BaseAPI: """ # Look up method if method not in self.methods: - raise GeniInvalidAPIMethod, method + raise SfaInvalidAPIMethod, method # Get new instance of method try: @@ -140,7 +140,7 @@ class BaseAPI: callablemethod = getattr(module, classname)(self) return getattr(module, classname)(self) except ImportError, AttributeError: - raise GeniInvalidAPIMethod, method + raise SfaInvalidAPIMethod, method def call(self, source, method, *args): """ @@ -186,7 +186,7 @@ class BaseAPI: # Return result if interface == xmlrpclib: - if not isinstance(result, GeniFault): + if not isinstance(result, SfaFault): result = (result,) data = xmlrpclib.dumps(result, methodresponse = True, encoding = self.encoding, allow_none = 1) diff --git a/sfa/util/geniclient.py b/sfa/util/client.py similarity index 96% rename from sfa/util/geniclient.py rename to sfa/util/client.py index d591daca..ed3ec812 100644 --- a/sfa/util/geniclient.py +++ b/sfa/util/client.py @@ -1,7 +1,7 @@ ## -# This module implements the client-side of the Geni API. Stubs are provided +# This module implements the client-side of the SFA API. Stubs are provided # that convert the supplied parameters to the necessary format and send them -# via XMLRPC to a Geni Server. +# via XMLRPC to an SFA Server. # # TODO: Investigate ways to combine this with existing PLC API? ## @@ -16,11 +16,11 @@ from sfa.util.record import * from sfa.util.sfaticket import SfaTicket ## -# The GeniClient class provides stubs for executing Geni operations. A given +# The GeniClient class provides stubs for executing SFA operations. A given # client object connects to one server. To connect to multiple servers, create # multiple GeniClient objects. # -# The Geni protocol uses an HTTPS connection, and the client's side of the +# The SFA protocol uses an HTTPS connection, and the client's side of the # connection uses his private key. Generally, this private key must match the # public key that is containing in the GID that the client is providing for # those functions that take a GID. @@ -142,12 +142,12 @@ class GeniClient: result_dict_list = self.server.list(cred.save_to_string(save_parents=True), auth_hrn, caller_cred) result_rec_list = [] for dict in result_dict_list: - result_rec_list.append(GeniRecord(dict=dict)) + result_rec_list.append(SfaRecord(dict=dict)) return result_rec_list ## # Register an object with the registry. In addition to being stored in the - # Geni database, the appropriate records will also be created in the + # SFA database, the appropriate records will also be created in the # PLC databases. # # @@ -219,12 +219,12 @@ class GeniClient: elif dict['type'] in ['user']: result_rec_list.append(UserRecord(dict=dict)) else: - result_rec_list.append(GeniRecord(dict=dict)) + result_rec_list.append(SfaRecord(dict=dict)) return result_rec_list ## # Update an object in the registry. Currently, this only updates the - # PLC information associated with the record. The Geni fields (name, type, + # PLC information associated with the record. The SFA fields (name, type, # GID) are fixed. # # diff --git a/sfa/util/componentserver.py b/sfa/util/componentserver.py index 86a00c29..933ecfef 100644 --- a/sfa/util/componentserver.py +++ b/sfa/util/componentserver.py @@ -6,8 +6,8 @@ # TODO: investigate ways to combine this with existing PLC server? ## -### $Id: geniserver.py 15849 2009-11-23 01:36:21Z tmack $ -### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/util/geniserver.py $ +### $Id$ +### $URL$ import sys import traceback @@ -26,7 +26,7 @@ from sfa.trust.credential import * from sfa.util.faults import * from sfa.plc.api import ComponentAPI -from sfa.util.geniserver import verify_callback, SecureXMLRPCServer +from sfa.util.server import verify_callback, SecureXMLRPCServer from sfa.util.debug import log @@ -88,7 +88,7 @@ class SecureXMLRpcRequestHandler(SimpleXMLRPCServer.SimpleXMLRPCRequestHandler): self.connection.shutdown() # Modified here! ## -# Implements an HTTPS XML-RPC server. Generally it is expected that GENI +# Implements an HTTPS XML-RPC server. Generally it is expected that SFA # functions will take a credential string, which is passed to # decode_authentication. Decode_authentication() will verify the validity of # the credential, and verify that the user is using the key that matches the @@ -97,7 +97,7 @@ class SecureXMLRpcRequestHandler(SimpleXMLRPCServer.SimpleXMLRPCRequestHandler): class ComponentServer(threading.Thread): ## - # Create a new GeniServer object. + # Create a new SfaServer object. # # @param ip the ip address to listen on # @param port the port to listen on diff --git a/sfa/util/config.py b/sfa/util/config.py index d7723469..aec8556f 100644 --- a/sfa/util/config.py +++ b/sfa/util/config.py @@ -1,17 +1,17 @@ ## -# Geniwrapper Configuration Info +# SFA Configuration Info # -# This module holds configuration parameters for geniwrapper. There are two +# This module holds configuration parameters for SFA. There are two # main pieces of information that are used: the database connection and # the PLCAPI connection ## ## -# Geniwrapper uses a MYSQL database to store records. This database may be +# SFA uses a MYSQL database to store records. This database may be # co-located with the PLC database, or it may be a separate database. The # following parameters define the connection to the database. # -# Note that Geniwrapper does not access any of the PLC databases directly via +# Note that SFA does not access any of the PLC databases directly via # a mysql connection; All PLC databases are accessed via PLCAPI. ### $Id$ @@ -110,12 +110,12 @@ class Config: } ## - # Geniwrapper uses a PLCAPI connection to perform operations on the registry, + # SFA uses a PLCAPI connection to perform operations on the registry, # such as creating and deleting slices. This connection requires an account # on the PLC server with full administrator access. # # The Url parameter controls whether the connection uses PLCAPI directly (i.e. - # Geniwrapper is located on the same machine as PLC), or uses a XMLRPC connection + # SFA is located on the same machine as PLC), or uses a XMLRPC connection # to the PLC machine. If you wish to use the API directly, then remove the Url # field from the dictionary. diff --git a/sfa/util/faults.py b/sfa/util/faults.py index b8dee9e3..ca375a1b 100644 --- a/sfa/util/faults.py +++ b/sfa/util/faults.py @@ -1,5 +1,5 @@ # -# GeniAPI XML-RPC faults +# SFA API faults # # @@ -8,20 +8,20 @@ import xmlrpclib -class GeniFault(xmlrpclib.Fault): +class SfaFault(xmlrpclib.Fault): def __init__(self, faultCode, faultString, extra = None): if extra: faultString += ": " + extra xmlrpclib.Fault.__init__(self, faultCode, faultString) -class GeniInvalidAPIMethod(GeniFault): +class SfaInvalidAPIMethod(SfaFault): def __init__(self, method, interface = None, extra = None): faultString = "Invalid method " + method if interface: faultString += " for interface " + interface - GeniFault.__init__(self, 100, faultString, extra) + SfaFault.__init__(self, 100, faultString, extra) -class GeniInvalidArgumentCount(GeniFault): +class SfaInvalidArgumentCount(SfaFault): def __init__(self, got, min, max = min, extra = None): if min != max: expected = "%d-%d" % (min, max) @@ -29,208 +29,208 @@ class GeniInvalidArgumentCount(GeniFault): expected = "%d" % min faultString = "Expected %s arguments, got %d" % \ (expected, got) - GeniFault.__init__(self, 101, faultString, extra) + SfaFault.__init__(self, 101, faultString, extra) -class GeniInvalidArgument(GeniFault): +class SfaInvalidArgument(SfaFault): def __init__(self, extra = None, name = None): if name is not None: faultString = "Invalid %s value" % name else: faultString = "Invalid argument" - GeniFault.__init__(self, 102, faultString, extra) + SfaFault.__init__(self, 102, faultString, extra) -class GeniAuthenticationFailure(GeniFault): +class SfaAuthenticationFailure(SfaFault): def __init__(self, extra = None): faultString = "Failed to authenticate call" - GeniFault.__init__(self, 103, faultString, extra) + SfaFault.__init__(self, 103, faultString, extra) -class GeniDBError(GeniFault): +class SfaDBError(SfaFault): def __init__(self, extra = None): faultString = "Database error" - GeniFault.__init__(self, 106, faultString, extra) + SfaFault.__init__(self, 106, faultString, extra) -class GeniPermissionDenied(GeniFault): +class SfaPermissionDenied(SfaFault): def __init__(self, extra = None): faultString = "Permission denied" - GeniFault.__init__(self, 108, faultString, extra) + SfaFault.__init__(self, 108, faultString, extra) -class GeniNotImplemented(GeniFault): +class SfaNotImplemented(SfaFault): def __init__(self, extra = None): faultString = "Not fully implemented" - GeniFault.__init__(self, 109, faultString, extra) + SfaFault.__init__(self, 109, faultString, extra) -class GeniAPIError(GeniFault): +class SfaAPIError(SfaFault): def __init__(self, extra = None): faultString = "Internal API error" - GeniFault.__init__(self, 111, faultString, extra) + SfaFault.__init__(self, 111, faultString, extra) -class MalformedHrnException(GeniFault): +class MalformedHrnException(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "Malformed HRN: %(value)s" % locals() - GeniFault.__init__(self, 102, faultString, extra) + SfaFault.__init__(self, 102, faultString, extra) def __str__(self): return repr(self.value) -class TreeException(GeniFault): +class TreeException(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "Tree Exception: %(value)s, " % locals() - GeniFault.__init__(self, 111, faultString, extra) + SfaFault.__init__(self, 111, faultString, extra) def __str__(self): return repr(self.value) -class NonexistingRecord(GeniFault): +class NonexistingRecord(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "Non exsiting record %(value)s, " % locals() - GeniFault.__init__(self, 111, faultString, extra) + SfaFault.__init__(self, 111, faultString, extra) def __str__(self): return repr(self.value) -class ExistingRecord(GeniFault): +class ExistingRecord(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "Existing record: %(value)s, " % locals() - GeniFault.__init__(self, 111, faultString, extra) + SfaFault.__init__(self, 111, faultString, extra) def __str__(self): return repr(self.value) -class NonexistingCredType(GeniFault): +class NonexistingCredType(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "Non existing record: %(value)s, " % locals() - GeniFault.__init__(self, 111, faultString, extra) + SfaFault.__init__(self, 111, faultString, extra) def __str__(self): return repr(self.value) -class NonexistingFile(GeniFault): +class NonexistingFile(SfaFault): def __init__(self, value): self.value = value faultString = "Non existing file: %(value)s, " % locals() - GeniFault.__init__(self, 111, faultString, extra) + SfaFault.__init__(self, 111, faultString, extra) def __str__(self): return repr(self.value) -class InvalidRPCParams(GeniFault): +class InvalidRPCParams(SfaFault): def __init__(self, value): self.value = value faultString = "Invalid RPC Params: %(value)s, " % locals() - GeniFault.__init__(self, 102, faultString, extra) + SfaFault.__init__(self, 102, faultString, extra) def __str__(self): return repr(self.value) # SMBAKER exceptions follow -class ConnectionKeyGIDMismatch(GeniFault): +class ConnectionKeyGIDMismatch(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "Connection Key GID mismatch: %(value)s" % locals() - GeniFault.__init__(self, 102, faultString, extra) + SfaFault.__init__(self, 102, faultString, extra) def __str__(self): return repr(self.value) -class MissingCallerGID(GeniFault): +class MissingCallerGID(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "Missing Caller GID: %(value)s" % locals() - GeniFault.__init__(self, 102, faultString, extra) + SfaFault.__init__(self, 102, faultString, extra) def __str__(self): return repr(self.value) -class RecordNotFound(GeniFault): +class RecordNotFound(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "Record not found: %(value)s" % locals() - GeniFault.__init__(self, 102, faultString, extra) + SfaFault.__init__(self, 102, faultString, extra) #def __str__(self): # return repr(self.value) -class UnknownGeniType(GeniFault): +class UnknownSfaType(SfaFault): def __init__(self, value, extra = None): self.value = value - faultString = "Unknown Geni Type: %(value)s" % locals() - GeniFault.__init__(self, 102, faultString, extra) + faultString = "Unknown SFA Type: %(value)s" % locals() + SfaFault.__init__(self, 102, faultString, extra) def __str__(self): return repr(self.value) -class MissingAuthority(GeniFault): +class MissingAuthority(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "Missing authority: %(value)s" % locals() - GeniFault.__init__(self, 102, faultString, extra) + SfaFault.__init__(self, 102, faultString, extra) def __str__(self): return repr(self.value) -class PlanetLabRecordDoesNotExist(GeniFault): +class PlanetLabRecordDoesNotExist(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "PlanetLab record does not exist : %(value)s" % locals() - GeniFault.__init__(self, 102, faultString, extra) + SfaFault.__init__(self, 102, faultString, extra) def __str__(self): return repr(self.value) -class PermissionError(GeniFault): +class PermissionError(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "Permission error: %(value)s" % locals() - GeniFault.__init__(self, 108, faultString, extra) + SfaFault.__init__(self, 108, faultString, extra) def __str__(self): return repr(self.value) -class InsufficientRights(GeniFault): +class InsufficientRights(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "Insufficient rights: %(value)s" % locals() - GeniFault.__init__(self, 108, faultString, extra) + SfaFault.__init__(self, 108, faultString, extra) def __str__(self): return repr(self.value) -class MissingDelegateBit(GeniFault): +class MissingDelegateBit(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "Missing delegate bit: %(value)s" % locals() - GeniFault.__init__(self, 108, faultString, extra) + SfaFault.__init__(self, 108, faultString, extra) def __str__(self): return repr(self.value) -class ChildRightsNotSubsetOfParent(GeniFault): +class ChildRightsNotSubsetOfParent(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "Child rights not subset of parent: %(value)s" % locals() - GeniFault.__init__(self, 103, faultString, extra) + SfaFault.__init__(self, 103, faultString, extra) def __str__(self): return repr(self.value) -class CertMissingParent(GeniFault): +class CertMissingParent(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "Cert missing parent: %(value)s" % locals() - GeniFault.__init__(self, 103, faultString, extra) + SfaFault.__init__(self, 103, faultString, extra) def __str__(self): return repr(self.value) -class CertNotSignedByParent(GeniFault): +class CertNotSignedByParent(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "Cert not signed by parent: %(value)s" % locals() - GeniFault.__init__(self, 103, faultString, extra) + SfaFault.__init__(self, 103, faultString, extra) def __str__(self): return repr(self.value) -class GidInvalidParentHrn(GeniFault): +class GidInvalidParentHrn(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "GID invalid parent hrn: %(value)s" % locals() - GeniFault.__init__(self, 102, faultString, extra) + SfaFault.__init__(self, 102, faultString, extra) def __str__(self): return repr(self.value) -class SliverDoesNotExist(GeniFault): +class SliverDoesNotExist(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "Sliver does not exist : %(value)s" % locals() - GeniFault.__init__(self, 102, faultString, extra) + SfaFault.__init__(self, 102, faultString, extra) def __str__(self): return repr(self.value) @@ -239,10 +239,19 @@ class BadRequestHash(xmlrpclib.Fault): faultString = "bad request hash: " + str(hash) xmlrpclib.Fault.__init__(self, 902, faultString) -class MissingTrustedRoots(GeniFault): +class MissingTrustedRoots(SfaFault): def __init__(self, value, extra = None): self.value = value faultString = "Trusted root directory does not exist: %(value)s" % locals() - GeniFault.__init__(self, 102, faultString, extra) + SfaFault.__init__(self, 102, faultString, extra) def __str__(self): return repr(self.value) + +class MissingSfaInfo(SfaFault): + def __init__(self, value, extra = None): + self.value = value + faultString = "Missing information: %(value)s" % locals() + SfaFault.__init__(self, 102, faultString, extra) + def __str__(self): + return repr(self.value) + diff --git a/sfa/util/filter.py b/sfa/util/filter.py index 5ab16640..bc22f1b5 100644 --- a/sfa/util/filter.py +++ b/sfa/util/filter.py @@ -1,5 +1,5 @@ -# $Id: Filter.py 14587 2009-07-19 13:18:50Z thierry $ -# $URL: svn+ssh://svn.planet-lab.org/svn/PLCAPI/trunk/PLC/Filter.py $ +# $Id$ +# $URL$ from types import StringTypes try: set @@ -136,7 +136,7 @@ class Filter(Parameter, dict): # filter on fields if not modifiers['-']: if field not in self.fields: - raise GeniInvalidArgument, "Invalid filter field '%s'" % field + raise SfaInvalidArgument, "Invalid filter field '%s'" % field if isinstance(value, (list, tuple, set)): # handling filters like '~slice_id':[] @@ -186,7 +186,7 @@ class Filter(Parameter, dict): # sorting and clipping else: if field not in ('SORT','OFFSET','LIMIT'): - raise GeniInvalidArgument, "Invalid filter, unknown sort and clip field %r"%field + raise SfaInvalidArgument, "Invalid filter, unknown sort and clip field %r"%field # sorting if field == 'SORT': if not isinstance(value,(list,tuple,set)): @@ -199,7 +199,7 @@ class Filter(Parameter, dict): field = field[1:] order = 'DESC' if field not in self.fields: - raise GeniInvalidArgument, "Invalid field %r in SORT filter"%field + raise SfaInvalidArgument, "Invalid field %r in SORT filter"%field sorts.append("%s %s"%(field,order)) # clipping elif field == 'OFFSET': diff --git a/sfa/util/method.py b/sfa/util/method.py index f24dee53..1df12457 100644 --- a/sfa/util/method.py +++ b/sfa/util/method.py @@ -1,5 +1,5 @@ # -# Base class for all GeniAPI functions +# Base class for all SfaAPI functions # # @@ -22,7 +22,7 @@ from sfa.util.debug import profile, log # we inherit object because we use new-style classes for legacy methods class Method (object): """ - Base class for all GeniAPI functions. At a minimum, all GeniAPI + Base class for all SfaAPI functions. At a minimum, all SfaAPI functions must define: interfaces = [allowed interfaces] @@ -47,7 +47,7 @@ class Method (object): def call(self, *args): """ - Method body for all GeniAPI functions. Must override. + Method body for all SfaAPI functions. Must override. """ @@ -66,7 +66,7 @@ class Method (object): def __call__(self, *args, **kwds): """ - Main entry point for all GeniAPI functions. Type checks + Main entry point for all SfaAPI functions. Type checks arguments, authenticates, and executes call(). """ @@ -74,7 +74,7 @@ class Method (object): start = time.time() methodname = self.name if not self.api.interface or self.api.interface not in self.interfaces: - raise GeniInvalidAPIMethod, methodname, self.api.interface + raise SfaInvalidAPIMethod, methodname, self.api.interface # legacy code cannot be type-checked, due to the way Method.args() works if not hasattr(self,"skip_typecheck"): @@ -82,7 +82,7 @@ class Method (object): # Check that the right number of arguments were passed in if len(args) < len(min_args) or len(args) > len(max_args): - raise GeniInvalidArgumentCount(len(args), len(min_args), len(max_args)) + raise SfaInvalidArgumentCount(len(args), len(min_args), len(max_args)) for name, value, expected in zip(max_args, args, self.accepts): self.type_check(name, value, expected, args) @@ -97,7 +97,7 @@ class Method (object): return result - except GeniFault, fault: + except SfaFault, fault: caller = "" @@ -218,7 +218,7 @@ class Method (object): try: self.type_check(name, value, item, args) return - except GeniInvalidArgument, fault: + except SfaInvalidArgument, fault: pass raise fault @@ -257,7 +257,7 @@ class Method (object): pass elif not isinstance(value, expected_type): - raise GeniInvalidArgument("expected %s, got %s" % \ + raise SfaInvalidArgument("expected %s, got %s" % \ (xmlrpc_type(expected_type), xmlrpc_type(type(value))), name) @@ -266,20 +266,20 @@ class Method (object): if expected_type in StringTypes: if min is not None and \ len(value.encode(self.api.encoding)) < min: - raise GeniInvalidArgument, "%s must be at least %d bytes long" % (name, min) + raise SfaInvalidArgument, "%s must be at least %d bytes long" % (name, min) if max is not None and \ len(value.encode(self.api.encoding)) > max: - raise GeniInvalidArgument, "%s must be at most %d bytes long" % (name, max) + raise SfaInvalidArgument, "%s must be at most %d bytes long" % (name, max) elif expected_type in (list, tuple, set): if min is not None and len(value) < min: - raise GeniInvalidArgument, "%s must contain at least %d items" % (name, min) + raise SfaInvalidArgument, "%s must contain at least %d items" % (name, min) if max is not None and len(value) > max: - raise GeniInvalidArgument, "%s must contain at most %d items" % (name, max) + raise SfaInvalidArgument, "%s must contain at most %d items" % (name, max) else: if min is not None and value < min: - raise GeniInvalidArgument, "%s must be > %s" % (name, str(min)) + raise SfaInvalidArgument, "%s must be > %s" % (name, str(min)) if max is not None and value > max: - raise GeniInvalidArgument, "%s must be < %s" % (name, str(max)) + raise SfaInvalidArgument, "%s must be < %s" % (name, str(max)) # If a list with particular types of items is expected if isinstance(expected, (list, tuple, set)): @@ -300,7 +300,7 @@ class Method (object): if isinstance(subparam, Parameter) and \ subparam.optional is not None and \ not subparam.optional and key not in value.keys(): - raise GeniInvalidArgument("'%s' not specified" % key, name) + raise SfaInvalidArgument("'%s' not specified" % key, name) #if auth is not None: # auth.check(self, *args) diff --git a/sfa/util/misc.py b/sfa/util/misc.py index e46d8de2..ca8dbba9 100644 --- a/sfa/util/misc.py +++ b/sfa/util/misc.py @@ -28,8 +28,8 @@ def hostname_to_hrn(auth_hrn, login_base, hostname): """ Convert hrn to plantelab name. """ - genihostname = ".".join([auth_hrn, login_base, hostname.split(".")[0]]) - return genihostname + sfa_hostname = ".".join([auth_hrn, login_base, hostname.split(".")[0]]) + return sfa_hostname def slicename_to_hrn(auth_hrn, slicename): """ diff --git a/sfa/util/namespace.py b/sfa/util/namespace.py index 86af66f1..61b05b91 100644 --- a/sfa/util/namespace.py +++ b/sfa/util/namespace.py @@ -1,5 +1,5 @@ -### $Id: namespace.py 15020 2009-09-14 23:11:37Z tmack $ -### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/util/namespace.py $ +### $Id$ +### $URL$ from sfa.util.faults import * @@ -30,8 +30,8 @@ def hostname_to_hrn(auth_hrn, login_base, hostname): """ Convert hrn to plantelab name. """ - genihostname = ".".join([auth_hrn, login_base, hostname.split(".")[0]]) - return genihostname + sfa_hostname = ".".join([auth_hrn, login_base, hostname.split(".")[0]]) + return sfa_hostname def slicename_to_hrn(auth_hrn, slicename): """ diff --git a/sfa/util/nodemanager.py b/sfa/util/nodemanager.py index ebf84087..be07cf80 100644 --- a/sfa/util/nodemanager.py +++ b/sfa/util/nodemanager.py @@ -12,6 +12,7 @@ class NodeManager: def __call__(self, *args): method = self.method + ### WARNING -- hardwired name needs to be computed sfa_slice = "pl_genicw" python = "/usr/bin/python" vserver_path = "/vservers/%s" % (sfa_slice) diff --git a/sfa/util/parameter.py b/sfa/util/parameter.py index fb45bd1b..00d9319b 100644 --- a/sfa/util/parameter.py +++ b/sfa/util/parameter.py @@ -105,4 +105,4 @@ def xmlrpc_type(arg): # documentation purposes. return "mixed" else: - raise GeniAPIError, "XML-RPC cannot marshal %s objects" % arg_type + raise SfaAPIError, "XML-RPC cannot marshal %s objects" % arg_type diff --git a/sfa/util/record.py b/sfa/util/record.py index de221fc6..aad12ca6 100644 --- a/sfa/util/record.py +++ b/sfa/util/record.py @@ -1,5 +1,5 @@ ## -# Implements support for geni records +# Implements support for SFA records # # TODO: Use existing PLC database methods? or keep this separate? ## @@ -17,9 +17,9 @@ from sfa.util.parameter import * from sfa.util.namespace import * from sfa.util.row import Row -class GeniRecord(Row): +class SfaRecord(Row): """ - The GeniRecord class implements a Geni Record. A GeniRecord is a tuple + The SfaRecord class implements an SFA Record. A SfaRecord is a tuple (Hrn, GID, Type, Info). Hrn specifies the Human Readable Name of the object @@ -58,7 +58,7 @@ class GeniRecord(Row): } all_fields = dict(fields.items() + internal_fields.items()) ## - # Create a Geni Record + # Create an SFA Record # # @param name if !=None, assign the name of the record # @param gid if !=None, assign the gid of the record @@ -309,8 +309,8 @@ class GeniRecord(Row): record = RecordSpec() record.parseString(str) record_dict = record.toDict() - geni_dict = record_dict['record'] - self.load_from_dict(geni_dict) + sfa_dict = record_dict['record'] + self.load_from_dict(sfa_dict) ## # Dump the record to stdout @@ -331,7 +331,7 @@ class GeniRecord(Row): # self.get_gid_object().dump(8, dump_parents) #print " pointer:", self.pointer - order = GeniRecord.fields.keys() + order = SfaRecord.fields.keys() for key in self.keys(): if key not in order: order.append(key) @@ -348,7 +348,7 @@ class GeniRecord(Row): return dict(self) -class UserRecord(GeniRecord): +class UserRecord(SfaRecord): fields = { 'email': Parameter(str, 'email'), @@ -358,9 +358,9 @@ class UserRecord(GeniRecord): 'key': Parameter(str, 'Public key'), 'slices': Parameter([str], 'List of slices this user belongs to'), } - fields.update(GeniRecord.fields) + fields.update(SfaRecord.fields) -class SliceRecord(GeniRecord): +class SliceRecord(SfaRecord): fields = { 'name': Parameter(str, 'Slice name'), 'url': Parameter(str, 'Slice url'), @@ -368,10 +368,10 @@ class SliceRecord(GeniRecord): 'researcher': Parameter([str], 'List of users for this slice'), 'description': Parameter([str], 'Description of this slice'), } - fields.update(GeniRecord.fields) + fields.update(SfaRecord.fields) -class NodeRecord(GeniRecord): +class NodeRecord(SfaRecord): fields = { 'hostname': Parameter(str, 'This nodes dns name'), 'node_type': Parameter(str, 'Type of node this is'), @@ -379,10 +379,10 @@ class NodeRecord(GeniRecord): 'latitude': Parameter(str, 'latitude'), 'longitude': Parameter(str, 'longitude'), } - fields.update(GeniRecord.fields) + fields.update(SfaRecord.fields) -class AuthorityRecord(GeniRecord): +class AuthorityRecord(SfaRecord): fields = { 'name': Parameter(str, 'Name'), 'login_base': Parameter(str, 'login base'), @@ -393,6 +393,6 @@ class AuthorityRecord(GeniRecord): 'researcher': Parameter([str], 'List of researchers'), 'PI': Parameter([str], 'List of Principal Investigators'), } - fields.update(GeniRecord.fields) + fields.update(SfaRecord.fields) diff --git a/sfa/util/row.py b/sfa/util/row.py index f4db1414..7334fccd 100644 --- a/sfa/util/row.py +++ b/sfa/util/row.py @@ -25,7 +25,7 @@ class Row(dict): #mandatory_fields = self.db.fields(self.table_name, notnull = True, hasdef = False) #for field in mandatory_fields: # if not self.has_key(field) or self[field] is None: - # raise GeniInvalidArgument, field + " must be specified and cannot be unset in class %s"%self.__class__.__name__ + # raise SfaInvalidArgument, field + " must be specified and cannot be unset in class %s"%self.__class__.__name__ # Validate values before committing for key, value in self.iteritems(): @@ -52,6 +52,6 @@ class Row(dict): human = time.strftime(time_format, time.gmtime(timestamp)) if check_future and timestamp < time.time(): - raise GeniInvalidArgument, "'%s' not in the future" % human + raise SfaInvalidArgument, "'%s' not in the future" % human return human diff --git a/sfa/util/geniserver.py b/sfa/util/server.py similarity index 95% rename from sfa/util/geniserver.py rename to sfa/util/server.py index 8944f542..757d945b 100644 --- a/sfa/util/geniserver.py +++ b/sfa/util/server.py @@ -25,7 +25,7 @@ from sfa.trust.certificate import Keypair, Certificate from sfa.trust.credential import * from sfa.util.faults import * -from sfa.plc.api import GeniAPI +from sfa.plc.api import SfaAPI from sfa.util.debug import log ## @@ -146,10 +146,10 @@ class SecureXMLRpcRequestHandler(SimpleXMLRPCServer.SimpleXMLRPCRequestHandler): It was copied out from SimpleXMLRPCServer.py and modified to shutdown the socket cleanly. """ try: - self.api = GeniAPI(peer_cert = self.server.peer_cert, - interface = self.server.interface, - key_file = self.server.key_file, - cert_file = self.server.cert_file) + self.api = SfaAPI(peer_cert = self.server.peer_cert, + interface = self.server.interface, + key_file = self.server.key_file, + cert_file = self.server.cert_file) # get arguments request = self.rfile.read(int(self.headers["content-length"])) # In previous versions of SimpleXMLRPCServer, _dispatch @@ -182,16 +182,16 @@ class SecureXMLRpcRequestHandler(SimpleXMLRPCServer.SimpleXMLRPCRequestHandler): self.connection.shutdown() # Modified here! ## -# Implements an HTTPS XML-RPC server. Generally it is expected that GENI +# Implements an HTTPS XML-RPC server. Generally it is expected that SFA # functions will take a credential string, which is passed to # decode_authentication. Decode_authentication() will verify the validity of # the credential, and verify that the user is using the key that matches the # GID supplied in the credential. -class GeniServer(threading.Thread): +class SfaServer(threading.Thread): ## - # Create a new GeniServer object. + # Create a new SfaServer object. # # @param ip the ip address to listen on # @param port the port to listen on diff --git a/sfa/util/soapprotocol.py b/sfa/util/soapprotocol.py index 856b19cf..8d9b3d15 100644 --- a/sfa/util/soapprotocol.py +++ b/sfa/util/soapprotocol.py @@ -1,4 +1,4 @@ -# SOAP-specific code for GeniClient +# SOAP-specific code for SFA Client import pdb from ZSI.client import Binding diff --git a/sfa/util/genitable.py b/sfa/util/table.py similarity index 87% rename from sfa/util/genitable.py rename to sfa/util/table.py index bf436bcd..c1bfdfb1 100644 --- a/sfa/util/genitable.py +++ b/sfa/util/table.py @@ -1,15 +1,14 @@ -# genitable.py +### $Id$ +### $URL$ # -# implements support for geni records stored in db tables +# implements support for SFA records stored in db tables # # TODO: Use existing PLC database methods? or keep this separate? -### $Id$ -### $URL$ - import report -import pgdb +import pgdb from pg import DB, ProgrammingError + from sfa.util.PostgreSQL import * from sfa.trust.gid import * from sfa.util.record import * @@ -17,14 +16,14 @@ from sfa.util.debug import * from sfa.util.config import * from sfa.util.filter import * -class GeniTable(list): +class SfaTable(list): - GENI_TABLE_PREFIX = "sfa" + SFA_TABLE_PREFIX = "sfa" def __init__(self, record_filter = None): # pgsql doesn't like table names with "." in them, to replace it with "$" - self.tablename = GeniTable.GENI_TABLE_PREFIX + self.tablename = SfaTable.SFA_TABLE_PREFIX self.config = Config() self.db = PostgreSQL(self.config) # establish a connection to the pgsql server @@ -46,10 +45,10 @@ class GeniTable(list): def db_fields(self, obj=None): - db_fields = self.db.fields(self.GENI_TABLE_PREFIX) + db_fields = self.db.fields(self.SFA_TABLE_PREFIX) return dict( [ (key,value) for (key, value) in obj.items() \ if key in db_fields and - self.is_writable(key, value, GeniRecord.fields)] ) + self.is_writable(key, value, SfaRecord.fields)] ) @staticmethod def is_writable (key,value,dict): @@ -157,16 +156,16 @@ class GeniTable(list): if isinstance(record_filter, (list, tuple, set)): ints = filter(lambda x: isinstance(x, (int, long)), record_filter) strs = filter(lambda x: isinstance(x, StringTypes), record_filter) - record_filter = Filter(GeniRecord.all_fields, {'record_id': ints, 'hrn': strs}) + record_filter = Filter(SfaRecord.all_fields, {'record_id': ints, 'hrn': strs}) sql += "AND (%s) %s " % record_filter.sql("OR") elif isinstance(record_filter, dict): - record_filter = Filter(GeniRecord.all_fields, record_filter) + record_filter = Filter(SfaRecord.all_fields, record_filter) sql += " AND (%s) %s" % record_filter.sql("AND") elif isinstance(record_filter, StringTypes): - record_filter = Filter(GeniRecord.all_fields, {'hrn':[record_filter]}) + record_filter = Filter(SfaRecord.all_fields, {'hrn':[record_filter]}) sql += " AND (%s) %s" % record_filter.sql("AND") elif isinstance(record_filter, int): - record_filter = Filter(GeniRecord.all_fields, {'record_id':[record_filter]}) + record_filter = Filter(SfaRecord.all_fields, {'record_id':[record_filter]}) sql += " AND (%s) %s" % record_filter.sql("AND") results = self.cnx.query(sql).dictresult() @@ -188,7 +187,7 @@ class GeniTable(list): elif result['type'] in ['user']: result_rec_list.append(UserRecord(dict=result)) else: - result_rec_list.append(GeniRecord(dict=result)) + result_rec_list.append(SfaRecord(dict=result)) return result_rec_list @@ -202,14 +201,14 @@ class GeniTable(list): pass @staticmethod - def geni_records_purge(cninfo): + def sfa_records_purge(cninfo): cnx = DB(cninfo['dbname'], cninfo['address'], port=cninfo['port'], user=cninfo['user'], passwd=cninfo['password']) tableList = cnx.get_tables() for table in tableList: - if table.startswith(GeniTable.GENI_TABLE_PREFIX) or \ - table.startswith('public.' + GeniTable.GENI_TABLE_PREFIX) or \ - table.startswith('public."' + GeniTable.GENI_TABLE_PREFIX): + if table.startswith(SfaTable.SFA_TABLE_PREFIX) or \ + table.startswith('public.' + SfaTable.SFA_TABLE_PREFIX) or \ + table.startswith('public."' + SfaTable.SFA_TABLE_PREFIX): report.trace("dropping table " + table) cnx.query("DROP TABLE " + table) diff --git a/sfa/util/xmlrpcprotocol.py b/sfa/util/xmlrpcprotocol.py index 58b19e21..be44f082 100644 --- a/sfa/util/xmlrpcprotocol.py +++ b/sfa/util/xmlrpcprotocol.py @@ -1,4 +1,4 @@ -# XMLRPC-specific code for GeniClient +# XMLRPC-specific code for SFA Client import xmlrpclib diff --git a/sfacomponent/component.py b/sfacomponent/component.py index 7aa21635..bcb86ccf 100644 --- a/sfacomponent/component.py +++ b/sfacomponent/component.py @@ -18,13 +18,13 @@ from sfa.util.faults import * from sfa.util.misc import * from sfa.util.record import * from sfa.util.sfaticket import SfaTicket -from sfa.util.geniserver import * +from sfa.util.server import * ## -# ComponentManager is a GeniServer that serves slice and +# ComponentManager is a SfaServer that serves slice and # management operations at a node. -class ComponentManager(GeniServer): +class ComponentManager(SfaServer): ## # Create a new ComponentManager object. @@ -35,14 +35,14 @@ class ComponentManager(GeniServer): # @param cert_file certificate filename containing public key (could be a GID file) def __init__(self, ip, port, key_file, cert_file): - GeniServer.__init__(self, ip, port, key_file, cert_file) + SfaServer.__init__(self, ip, port, key_file, cert_file) self.nodemanager = ServerProxy('http://127.0.0.1:812/') ## # Register the server RPCs for the component def register_functions(self): - GeniServer.register_functions(self) + SfaServer.register_functions(self) self.server.register_function(self.stop_slice) self.server.register_function(self.start_slice) self.server.register_function(self.reset_slice) @@ -119,7 +119,7 @@ class ComponentManager(GeniServer): # signed and verified correctly. Throw an exception if something is # wrong with the ticket. # - # This is similar to geniserver.decode_authentication + # This is similar to decode_authentication # # @param ticket_string the string representation of the ticket @@ -165,7 +165,7 @@ class ComponentManager(GeniServer): else: data["initscripts"] = {} - # copy the rspec attributes from the geniticket into the plticket + # copy the rspec attributes from the sfaticket into the plticket # attributes. The NM will later copy them back out and put them into # the rspec field of the slice record for itemname in ticket_rspec.keys(): diff --git a/sfacomponent/copynode.sh b/sfacomponent/copynode.sh index 77bea0f5..aacc266d 100755 --- a/sfacomponent/copynode.sh +++ b/sfacomponent/copynode.sh @@ -3,6 +3,6 @@ source component_slice_config.sh echo connecting to node: $1 -export FILES="component.py ../util/cert.py ../util/credential.py ../util/excep.py ../util/geniserver.py ../util/sfaticket.py ../util/gid.py ../util/misc.py ../util/record.py ../util/rights.py ../util/report.py ../util/trustedroot.py ../plc/trusted_roots install" +export FILES="component.py ../util/cert.py ../util/credential.py ../util/excep.py ../util/server.py ../util/sfaticket.py ../util/gid.py ../util/misc.py ../util/record.py ../util/rights.py ../util/report.py ../util/trustedroot.py ../plc/trusted_roots install" echo $FILES scp -i $KEY_FILE -r $FILES $USER@$1:$DEST_DIR diff --git a/sfacomponent/plc/api.py b/sfacomponent/plc/api.py index 351853f7..7d581b41 100644 --- a/sfacomponent/plc/api.py +++ b/sfacomponent/plc/api.py @@ -1,5 +1,5 @@ # -# Geniwrapper XML-RPC and SOAP interfaces +# SFA XML-RPC and SOAP interfaces # ### $Id: api.py 15596 2009-10-31 21:42:05Z anil $ ### $URL: https://svn.planet-lab.org/svn/sfa/trunk/sfa/plc/api.py $ diff --git a/sfacomponent/server/component.py b/sfacomponent/server/component.py index ab76961d..34aadc90 100644 --- a/sfacomponent/server/component.py +++ b/sfacomponent/server/component.py @@ -1,5 +1,5 @@ # -# Component is a GeniServer that implements the Component interface +# Component is a SfaServer that implements the Component interface # ### $Id: ### $URL: @@ -10,7 +10,7 @@ import os import time import sys -from sfa.util.geniserver import GeniServer +from sfa.util.server import SfaServer from sfacomponent.plc.api import ComponentAPI # GeniLight client support is optional @@ -20,9 +20,9 @@ except ImportError: GeniClientLight = None ## -# Component is a GeniServer that serves component operations. +# Component is a SfaServer that serves component operations. -class Component(GeniServer): +class Component(SfaServer): ## # Create a new registry object. # @@ -32,7 +32,7 @@ class Component(GeniServer): # @param cert_file certificate filename containing public key (could be a GID file) def __init__(self, ip, port, key_file, cert_file): - GeniServer.__init__(self, ip, port, key_file, cert_file) + SfaServer.__init__(self, ip, port, key_file, cert_file) # re-initialize the servers api as Component api self.server.api = ComponentAPI(interface='component', key_file=key_file, cert_file=cert_file) self.server.interface = 'component' diff --git a/sfatables/commands/moo.py b/sfatables/commands/moo.py index 6564e9b2..bd8c88ef 100644 --- a/sfatables/commands/moo.py +++ b/sfatables/commands/moo.py @@ -122,7 +122,7 @@ class Command: try: self.type_check(name, value, item, args) return - except GeniInvalidArgument, fault: + except SfaInvalidArgument, fault: pass raise fault @@ -161,7 +161,7 @@ class Command: pass elif not isinstance(value, expected_type): - raise GeniInvalidArgument("expected %s, got %s" % \ + raise SfaInvalidArgument("expected %s, got %s" % \ (xmlrpc_type(expected_type), xmlrpc_type(type(value))), name) @@ -170,20 +170,20 @@ class Command: if expected_type in StringTypes: if min is not None and \ len(value.encode(self.api.encoding)) < min: - raise GeniInvalidArgument, "%s must be at least %d bytes long" % (name, min) + raise SfaInvalidArgument, "%s must be at least %d bytes long" % (name, min) if max is not None and \ len(value.encode(self.api.encoding)) > max: - raise GeniInvalidArgument, "%s must be at most %d bytes long" % (name, max) + raise SfaInvalidArgument, "%s must be at most %d bytes long" % (name, max) elif expected_type in (list, tuple, set): if min is not None and len(value) < min: - raise GeniInvalidArgument, "%s must contain at least %d items" % (name, min) + raise SfaInvalidArgument, "%s must contain at least %d items" % (name, min) if max is not None and len(value) > max: - raise GeniInvalidArgument, "%s must contain at most %d items" % (name, max) + raise SfaInvalidArgument, "%s must contain at most %d items" % (name, max) else: if min is not None and value < min: - raise GeniInvalidArgument, "%s must be > %s" % (name, str(min)) + raise SfaInvalidArgument, "%s must be > %s" % (name, str(min)) if max is not None and value > max: - raise GeniInvalidArgument, "%s must be < %s" % (name, str(max)) + raise SfaInvalidArgument, "%s must be < %s" % (name, str(max)) # If a list with particular types of items is expected if isinstance(expected, (list, tuple, set)): @@ -204,7 +204,7 @@ class Command: if isinstance(subparam, Parameter) and \ subparam.optional is not None and \ not subparam.optional and key not in value.keys(): - raise GeniInvalidArgument("'%s' not specified" % key, name) + raise SfaInvalidArgument("'%s' not specified" % key, name) #if auth is not None: # auth.check(self, *args) diff --git a/tests/client/testAggregate.py b/tests/client/testAggregate.py index e2bf7efd..0f9e77e0 100644 --- a/tests/client/testAggregate.py +++ b/tests/client/testAggregate.py @@ -1,6 +1,6 @@ from pprint import pprint -from sfa.util.geniclient import * +from sfa.util.client import * from sfa.trust.credential import * cred = Credential(filename = 'tmack.pl.sa.cred') diff --git a/tests/testRecord.py b/tests/testRecord.py index 8370f081..081a9bf9 100755 --- a/tests/testRecord.py +++ b/tests/testRecord.py @@ -9,7 +9,7 @@ class TestRecord(unittest.TestCase): pass def testCreate(self): - r = GeniRecord() + r = SfaRecord() if __name__ == "__main__": unittest.main() -- 2.43.0