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))
-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.
SFA_REGISTRY_HOST="localhost"
# Port
-# Geni registry port
+# SFA registry port
SFA_REGISTRY_PORT=12345
## ==============================================================
SFA_AGGREGATE_HOST="localhost"
#
## Port
-## Geni aggregate server port
+## SFA aggregate server port
SFA_AGGREGATE_PORT=12346
## ==============================================================
SFA_SM_HOST="localhost"
# Port
-# Geni slice manager server port
+# SFA slice manager server port
SFA_SM_PORT=12347
## ===============================================================
SFA_CM_HOST="localhost"
#
# Port
-# Geni slice manager server port
+# SFA slice manager server port
SFA_CM_PORT=12346
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
#!/usr/bin/python
"""
-Installation script for the geniwrapper module
+Installation script for the sfa module
"""
import sys, os, os.path
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',
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
%{_bindir}/getNodes.py*
%{_bindir}/getRecord.py*
%{_bindir}/setRecord.py*
-%{_bindir}/genidump.py*
+%{_bindir}/sfadump.py*
%files sfatables
%{_bindir}/sfatables
#! /usr/bin/env python
+# $Id$
+# $URL$
from __future__ import with_statement
import sys
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):
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")
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
# load methods
def load_record_from_file(filename):
str = file(filename, "r").read()
- record = GeniRecord(string=str)
+ record = SfaRecord(string=str)
return record
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()
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:
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
# 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 = {}
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
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
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
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]
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 *
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)
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:
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)
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
# 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']
# 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)
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)
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:
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:
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)
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)
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
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)
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 *
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):
"""
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):
"""
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):
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']))
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):
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)
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
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):
Parameter(None, "Origin hrn not specified"))
]
- returns = [GeniRecord]
+ returns = [SfaRecord]
def call(self, cred, hrn, origin_hrn=None):
user_cred = Credential(string=cred)
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
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
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
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
# 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:
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
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:
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']
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):
"""
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)
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
#
-# Geniwrapper XML-RPC and SOAP interfaces
+# SFA XML-RPC and SOAP interfaces
#
### $Id$
### $URL$
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
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
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:
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"
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.
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'])
- 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", [])
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
# 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'])
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']:
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:
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
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
#
# 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$
### $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
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
plc_auth = sfaImporter.plc_auth
AuthHierarchy = sfaImporter.AuthHierarchy
TrustedRoots = sfaImporter.TrustedRoots
- table = GeniTable()
+ table = SfaTable()
if not table.exists():
table.create()
#!/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)
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():
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()
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
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)
# 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:
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)
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:
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:
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)
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
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
# 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 = {}
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
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
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]
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))
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:
"""\r
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:
"""\r
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:
"""\r
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
GeniClientLight = None
-class Aggregate(GeniServer):
+class Aggregate(SfaServer):
##
# Create a new aggregate object.
# @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'
##
#
-# Component is a GeniServer that implements the Component interface
+# Component is a SfaServer that implements the Component interface
#
### $Id:
### $URL:
GeniClientLight = None
##
-# Component is a GeniServer that serves component operations.
+# Component is a SfaServer that serves component operations.
class Component(ComponentServer):
##
-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
# 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
-export PYTHONPATH=/home/smbaker/projects/geniwrapper/trunk
+export PYTHONPATH=/home/smbaker/projects/sfa/trunk
python ./test.py
#
-# Registry is a GeniServer that implements the Registry interface
+# Registry is a SfaServer that implements the Registry interface
#
### $Id$
### $URL$
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
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.
#
# @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'
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
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']
### $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.
#
# 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
import sys
import datetime
import time
-from sfa.util.geniserver import *
+from sfa.util.server import *
-class SliceMgr(GeniServer):
+class SliceMgr(SfaServer):
##
# @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'
#
-# GeniAPI authentication
+# SfaAPI authentication
#
### $Id$
### $URL$
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
##
-# 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
##
-# Implements Geni Credentials
+# Implements SFA Credentials
#
# Credentials are layered on top of certificates, and are essentially a
# certificate that stores a tuple of parameters.
##
-# 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.
##
##
# 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.
##
-# 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
print >> log, query
print >> log, "Params:"
print >> log, pformat(params)
- raise GeniDBError("Please contact support")
+ raise SfaDBError("Please contact support")
return cursor
#
-# 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
"""
# Look up method
if method not in self.methods:
- raise GeniInvalidAPIMethod, method
+ raise SfaInvalidAPIMethod, method
# Get new instance of method
try:
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):
"""
# 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)
##
-# 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?
##
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.
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.
#
#
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.
#
#
# 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
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
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
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
##
-# 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$
}
##
- # 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.
#
-# GeniAPI XML-RPC faults
+# SFA API faults
#
#
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)
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)
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)
+
-# $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
# 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':[]
# 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)):
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':
#
-# Base class for all GeniAPI functions
+# Base class for all SfaAPI functions
#
#
# 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]
def call(self, *args):
"""
- Method body for all GeniAPI functions. Must override.
+ Method body for all SfaAPI functions. Must override.
"""
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().
"""
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"):
# 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)
return result
- except GeniFault, fault:
+ except SfaFault, fault:
caller = ""
try:
self.type_check(name, value, item, args)
return
- except GeniInvalidArgument, fault:
+ except SfaInvalidArgument, fault:
pass
raise fault
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)
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)):
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)
"""
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):
"""
-### $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 *
"""
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):
"""
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)
# 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
##
-# Implements support for geni records
+# Implements support for SFA records
#
# TODO: Use existing PLC database methods? or keep this separate?
##
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
}
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
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
# 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)
return dict(self)
-class UserRecord(GeniRecord):
+class UserRecord(SfaRecord):
fields = {
'email': Parameter(str, 'email'),
'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'),
'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'),
'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'),
'researcher': Parameter([str], 'List of researchers'),
'PI': Parameter([str], 'List of Principal Investigators'),
}
- fields.update(GeniRecord.fields)
+ fields.update(SfaRecord.fields)
#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():
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
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
##
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
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
-# SOAP-specific code for GeniClient
+# SOAP-specific code for SFA Client
import pdb
from ZSI.client import Binding
-# 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 *
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
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):
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()
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
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)
-# XMLRPC-specific code for GeniClient
+# XMLRPC-specific code for SFA Client
import xmlrpclib
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.
# @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)
# 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
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():
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
#
-# 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 $
#
-# Component is a GeniServer that implements the Component interface
+# Component is a SfaServer that implements the Component interface
#
### $Id:
### $URL:
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
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.
#
# @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'
try:
self.type_check(name, value, item, args)
return
- except GeniInvalidArgument, fault:
+ except SfaInvalidArgument, fault:
pass
raise fault
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)
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)):
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)
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')
pass
def testCreate(self):
- r = GeniRecord()
+ r = SfaRecord()
if __name__ == "__main__":
unittest.main()