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.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.genitable import *
+from sfa.util.namespace import *
from sfa.util.api import *
+from sfa.util.nodemanager import NodeManager
+from sfa.util.sfalogging import *
class GeniAPI(BaseAPI):
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
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
- 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
- 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)
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()
records = table.findObjects(hrn)
if not records:
pl_record["url"] = record["url"]
if "description" in record:
pl_record["description"] = record["description"]
+ if "expires" in record:
+ pl_record["expires"] = int(record["expires"])
elif type == "node":
if not "hostname" in pl_record:
def fill_record_geni_info(self, record):
geni_info = {}
type = record['type']
+ from sfa.util.genitable import GeniTable
table = GeniTable()
if (type == "slice"):
person_ids = record.get("person_ids", [])
# 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()
records = table.find({'type': 'user', 'hrn': newList})
for rec in records:
if config is None:
return
- self.nodemanager = self.getNodeManagerShell()
-
- def getNodeManagerShell(self):
- # do we need an auth ?
- auth = {}
- try:
- nodemanager = xmlrpclib.ServerProxy('http://127.0.0.1:812')
- except:
- raise
-
- return nodemanager
+ self.nodemanager = NodeManager()
def sliver_exists(self):
sliver_dict = self.nodemanager.GetXIDs()