git://git.onelab.eu
/
sfa.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
removed another bunch of references to geni
[sfa.git]
/
sfa
/
plc
/
api.py
diff --git
a/sfa/plc/api.py
b/sfa/plc/api.py
index
ebfe354
..
b5c9ce4
100644
(file)
--- 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$
#
### $Id$
### $URL$
@@
-10,7
+10,6
@@
import os
import traceback
import string
import xmlrpclib
import traceback
import string
import xmlrpclib
-
from sfa.trust.auth import Auth
from sfa.util.config import *
from sfa.util.faults import *
from sfa.trust.auth import Auth
from sfa.util.config import *
from sfa.util.faults import *
@@
-18,11
+17,13
@@
from sfa.util.debug import *
from sfa.trust.rights import *
from sfa.trust.credential import *
from sfa.trust.certificate import *
from sfa.trust.rights import *
from sfa.trust.credential import *
from sfa.trust.certificate import *
-from sfa.util.misc import *
-from sfa.util.sfalogging import *
+from sfa.util.namespace import *
from sfa.util.api import *
from sfa.util.api import *
+from sfa.util.nodemanager import NodeManager
+from sfa.util.sfalogging import *
+from sfa.util.table import SfaTable
-class
Geni
API(BaseAPI):
+class
Sfa
API(BaseAPI):
# flat list of method names
import sfa.methods
# flat list of method names
import sfa.methods
@@
-100,7
+101,7
@@
class GeniAPI(BaseAPI):
def getCredentialFromRegistry(self):
"""
def getCredentialFromRegistry(self):
"""
- Get our credential from a remote registry
using a geniclient connection
+ Get our credential from a remote registry
"""
type = 'authority'
path = self.config.SFA_DATA_DIR
"""
type = 'authority'
path = self.config.SFA_DATA_DIR
@@
-113,15
+114,11
@@
class GeniAPI(BaseAPI):
from sfa.server.registry import Registries
registries = Registries(self)
registry = registries[self.hrn]
from sfa.server.registry import Registries
registries = Registries(self)
registry = registries[self.hrn]
- cert_string=self.cert.save_to_string(save_parents=True)
+
cert_string=self.cert.save_to_string(save_parents=True)
# get self credential
# get self credential
- arg_list = [cert_string,type,self.hrn]
- request_hash=self.key.compute_hash(arg_list)
- self_cred = registry.get_self_credential(cert_string, type, self.hrn, request_hash)
+ self_cred = registry.get_self_credential(cert_string, type, self.hrn)
# get credential
# get credential
- arg_list = [self_cred,type,self.hrn]
- request_hash=self.key.compute_hash(arg_list)
- cred = registry.get_credential(self_cred, type, self.hrn, request_hash)
+ cred = registry.get_credential(self_cred, type, self.hrn)
# save cred to file
Credential(string=cred).save_to_file(cred_filename, save_parents=True)
# save cred to file
Credential(string=cred).save_to_file(cred_filename, save_parents=True)
@@
-139,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)
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
records = table.findObjects(hrn)
if not records:
raise RecordNotFound
@@
-181,15
+177,15
@@
class GeniAPI(BaseAPI):
self.credential = self.getCredentialFromRegistry()
##
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
# 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)
# @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:
def convert_ints(tmpdict, int_fields):
for field in int_fields:
@@
-214,7
+210,7
@@
class GeniAPI(BaseAPI):
elif type == "node":
if not "hostname" in pl_record:
if not "hostname" in record:
elif type == "node":
if not "hostname" in pl_record:
if not "hostname" in record:
- raise Missing
Geni
Info("hostname")
+ raise Missing
Sfa
Info("hostname")
pl_record["hostname"] = record["hostname"]
if not "model" in pl_record:
pl_record["model"] = "geni"
pl_record["hostname"] = record["hostname"]
if not "model" in pl_record:
pl_record["model"] = "geni"
@@
-238,7
+234,7
@@
class GeniAPI(BaseAPI):
def fill_record_pl_info(self, record):
"""
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.
involves calling the appropriate PLC method to retrieve the
database record for the object.
@@
-266,7
+262,7
@@
class GeniAPI(BaseAPI):
elif (type == "node"):
pl_res = self.plshell.GetNodes(self.plauth, [pointer])
else:
elif (type == "node"):
pl_res = self.plshell.GetNodes(self.plauth, [pointer])
else:
- raise Unknown
Geni
Type(type)
+ raise Unknown
Sfa
Type(type)
if not pl_res:
raise PlanetLabRecordDoesNotExist(record['hrn'])
if not pl_res:
raise PlanetLabRecordDoesNotExist(record['hrn'])
@@
-310,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']
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]
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", [])
elif (type == "authority"):
person_ids = record.get("person_ids", [])
@@
-343,28
+338,28
@@
class GeniAPI(BaseAPI):
if 'admin' in person['roles']:
admins.append(hrn)
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"):
# 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"):
# 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
# xxx TODO: PostalAddress, Phone
- record.update(
geni
_info)
+ record.update(
sfa
_info)
def fill_record_info(self, record):
"""
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)
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
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
@@
-381,8
+376,7
@@
class GeniAPI(BaseAPI):
# build a list of the new person ids, by looking up each person to get
# their pointer
newIdList = []
# 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'])
records = table.find({'type': 'user', 'hrn': newList})
for rec in records:
newIdList.append(rec['pointer'])
@@
-431,14
+425,7
@@
class ComponentAPI(BaseAPI):
if config is None:
return
if config is None:
return
- self.nodemanager = self.getNodeManagerShell()
-
- def getNodeManagerShell(self):
- # just import the nm api source
- sys.path.append('/usr/share/NodeManager')
- import api_calls
- return api_calls
-
+ self.nodemanager = NodeManager()
def sliver_exists(self):
sliver_dict = self.nodemanager.GetXIDs()
def sliver_exists(self):
sliver_dict = self.nodemanager.GetXIDs()