interface_hrn = config.SFA_INTERFACE_HRN
keys_filename = config.config_path + os.sep + 'person_keys.py'
sfaImporter = sfaImport()
+ sfaImporter.create_top_level_records()
logger=sfaImporter.logger
logger.setLevelFromOptVerbose(config.SFA_API_LOGLEVEL)
shell = sfaImporter.shell
- # initialize registry db table
- table = SfaTable()
-
- # create root authority
- sfaImporter.create_top_level_auth_records(interface_hrn)
-
- # create s user record for the slice manager
- sfaImporter.create_sm_client_record()
-
- # create interface records
- logger.info("Import: creating interface records")
- sfaImporter.create_interface_records()
-
- # add local root authority's cert to trusted list
- logger.info("Import: adding " + interface_hrn + " to trusted list")
- authority = sfaImporter.AuthHierarchy.get_auth_info(interface_hrn)
- sfaImporter.TrustedRoots.add_gid(authority.get_gid_object())
-
# special case for vini
if ".vini" in interface_hrn and interface_hrn.endswith('vini'):
# create a fake internet2 site first
existing_hrns = []
key_ids = []
person_keys = {}
+ table = SfaTable()
results = table.find()
for result in results:
existing_records[(result['hrn'], result['type'])] = result
from sfa.util.xrn import get_authority, hrn_to_urn
from sfa.util.plxrn import email_to_hrn
from sfa.util.config import Config
-
from sfa.trust.certificate import convert_public_key, Keypair
from sfa.trust.trustedroots import TrustedRoots
from sfa.trust.hierarchy import Hierarchy
from sfa.trust.gid import create_uuid
-
+from sfa.storage.table import SfaTable
from sfa.storage.record import SfaRecord
from sfa.storage.table import SfaTable
def __init__(self):
self.logger = _SfaLogger(logfile='/var/log/sfa_import.log', loggername='importlog')
self.AuthHierarchy = Hierarchy()
+ self.table = SfaTable()
self.config = Config()
self.TrustedRoots = TrustedRoots(Config.get_trustedroots_dir(self.config))
self.root_auth = self.config.SFA_REGISTRY_ROOT_AUTH
-
# should use a driver instead...
from sfa.plc.plshell import PlShell
# how to connect to planetlab
self.shell = PlShell (self.config)
+ def create_top_level_records(self):
+ """
+ Create top level and interface records
+ """
+ # create root authority
+ self.create_top_level_auth_records(interface_hrn)
+
+ # create s user record for the slice manager
+ self.create_sm_client_record()
+
+ # create interface records
+ self.logger.info("Import: creating interface records")
+ self.create_interface_records()
+
+ # add local root authority's cert to trusted list
+ self.logger.info("Import: adding " + interface_hrn + " to trusted list")
+ authority = sfaImporter.AuthHierarchy.get_auth_info(interface_hrn)
+ self.TrustedRoots.add_gid(authority.get_gid_object())
+
def create_top_level_auth_records(self, hrn):
"""
Create top level db records (includes root and sub authorities (local/remote)
record['authority'] = get_authority(interface_hrn)
table.insert(record)
-
-
def import_person(self, parent_hrn, person):
"""
Register a user record