# RSA keys at this time, not DSA keys.
##
+import os
import getopt
import sys
-import tempfile
-from sfa.util.record import *
from sfa.util.table import SfaTable
from sfa.util.xrn import get_leaf, get_authority
from sfa.util.plxrn import hostname_to_hrn, slicename_to_hrn, email_to_hrn, hrn_to_pl_slicename
from sfa.util.config import Config
-from sfa.trust.certificate import convert_public_key, Keypair
-from sfa.trust.trustedroots import *
-from sfa.trust.hierarchy import *
from sfa.util.xrn import Xrn
-from sfa.plc.api import *
-from sfa.trust.gid import create_uuid
-from sfa.plc.sfaImport import sfaImport, _cleanup_string
+
+from sfa.plc.sfaImport import sfaImport
def process_options():
if not root_auth == interface_hrn:
sfaImporter.create_top_level_auth_records(interface_hrn)
+ # create s user record for the slice manager
+ sfaImporter.create_sm_client_record()
+
# create interface records
sfaImporter.logger.info("Import: creating interface records")
sfaImporter.create_interface_records()
sites_dict[site['login_base']] = site
# Get all plc users
- persons = shell.GetPersons(plc_auth, {'peer_id': None, 'enabled': True}, ['person_id', 'email', 'key_ids', 'site_ids'])
+ persons = shell.GetPersons(plc_auth, {'peer_id': None, 'enabled': True},
+ ['person_id', 'email', 'key_ids', 'site_ids'])
persons_dict = {}
for person in persons:
persons_dict[person['person_id']] = person
if node_id not in nodes_dict:
continue
node = nodes_dict[node_id]
- root_auth = get_authority(site_hrn)
+ site_auth = get_authority(site_hrn)
site_name = get_leaf(site_hrn)
- hrn = hostname_to_hrn(root_auth, site_name, node['hostname'])
+ hrn = hostname_to_hrn(site_auth, site_name, node['hostname'])
if hrn not in existing_hrns or \
(hrn, 'node') not in existing_records:
sfaImporter.import_node(hrn, node)
(hrn, 'user') not in existing_records or update_record:
sfaImporter.import_person(site_hrn, person)
+
# remove stale records
+ system_records = [interface_hrn, root_auth, interface_hrn + '.slicemanager']
for (record_hrn, type) in existing_records.keys():
+ if record_hrn in system_records:
+ continue
+
record = existing_records[(record_hrn, type)]
- # if this is the interface name dont do anything
- if record_hrn == interface_hrn or \
- record_hrn == root_auth or \
- record['peer_authority']:
+ if record['peer_authority']:
continue
+
# dont delete vini's internet2 placeholdder record
# normally this would be deleted becuase it does not have a plc record
if ".vini" in interface_hrn and interface_hrn.endswith('vini') and \