from sfa.trust.certificate import convert_public_key, Keypair
from sfa.trust.trustedroot 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
hrn = hostname_to_hrn(interface_hrn, site['login_base'], node['hostname'])
if hrn not in existing_hrns or \
(hrn, 'node') not in existing_records:
- sfaImporter.import_node(site_hrn, node)
+ sfaImporter.import_node(hrn, node)
# import slices
for slice_id in site['slice_ids']:
elif type == 'node':
login_base = get_leaf(get_authority(record_hrn))
- nodename = get_leaf(record_hrn)
+ nodename = Xrn.unescape(get_leaf(record_hrn))
if login_base in sites_dict:
site = sites_dict[login_base]
for node in nodes:
- tmp_nodename = node['hostname'].split(".")[0]
+ tmp_nodename = node['hostname']
if tmp_nodename == nodename and \
node['site_id'] == site['site_id'] and \
node['node_id'] == record['pointer']:
slice_record['record_id'] = existing_record['record_id']
table.update(slice_record)
- def import_node(self, parent_hrn, node):
- nodename = node['hostname'].split(".")[0]
- nodename = _cleanup_string(nodename)
-
- if not nodename:
- self.logger.error("Import: failed to parse node %s" %node['hostname'])
- return
-
- hrn = parent_hrn + "." + nodename
+ def import_node(self, hrn, node):
self.logger.info("Import: node %s" % hrn)
# ASN.1 will have problems with hrn's longer than 64 characters
if len(hrn) > 64: