+ # get ma credential
+ ma_cred_filename = self.server_basedir + os.sep + "smgr." + self.hrn + ".sa.cred"
+ ma_cred = self.registry.get_credential(self_cred, 'sa', self.hrn)
+ ma_cred.save_to_file(ma_cred_filename, save_parents=True)
+ return ma_cred
+
+ def connectRegistry(self):
+ """
+ Connect to the registry
+ """
+ # connect to registry using GeniClient
+ address = self.config.GENI_REGISTRY_HOSTNAME
+ port = self.config.GENI_REGISTRY_PORT
+ url = 'http://%(address)s:%(port)s' % locals()
+ self.registry = GeniClient(url, self.key_file, self.cert_file)
+
+ def connectAggregates(self):
+ """
+ Get connection details for the trusted peer aggregates from file and
+ create a GeniClient connection to each.
+ """
+ self.aggregates = {}
+ aggregates = self.aggregate_info['aggregates']['aggregate']
+ if isinstance(aggregates, dict):
+ aggregates = [aggregates]
+ if isinstance(aggregates, list):
+ for aggregate in aggregates:
+ # create xmlrpc connection using GeniClient
+ hrn, address, port = aggregate['hrn'], aggregate['addr'], aggregate['port']
+ if not hrn or not address or not port:
+ continue
+ url = 'http://%(address)s:%(port)s' % locals()
+ self.aggregates[hrn] = GeniClient(url, self.key_file, self.cert_file)