from geni.util.trustedroot import *
from geni.util.excep import *
from geni.util.misc import *
-from geni.util.config import Config
+from geni.util.config import *
from geni.util.rspec import Rspec
from geni.util.specdict import *
from geni.util.storage import SimpleStorage, XmlStorage
# Get list of aggregates this sm talks to
aggregates_file = self.server_basedir + os.sep + 'aggregates.xml'
- self.aggregate_info = XmlStorage(aggregates_file, {'aggregates': {'aggregate': []}} )
+ connection_dict = {'hrn': '', 'addr': '', 'port': ''}
+ self.aggregate_info = XmlStorage(aggregates_file, {'aggregates': {'aggregate': [connection_dict]}} )
self.aggregate_info.load()
# Get cached list of nodes (rspec)
try:
self.credential = Credential(filename = ma_cred_filename)
except IOError:
- self.credential = self.getCrednetialFromRegistry()
+ self.credential = self.getCredentialFromRegistry()
def getCredentialFromRegistry(self):
def connectAggregates(self):
"""
- Get info about the aggregates available to us from file and create
- an xmlrpc connection to each. If any info is invalid, skip it.
+ 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']
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)
self.decode_authentication(cred, 'listslices')
return self.getSlices()
- def get_resources(self, cred, hrn):
+ def get_resources(self, cred, hrn=None):
self.decode_authentication(cred, 'listnodes')
- return self.getResources(hrn)
+ if not hrn:
+ return self.getNodes()
+ else:
+ return self.getResources(hrn)
def get_ticket(self, cred, hrn, rspec):
self.decode_authentication(cred, 'getticket')
return self.getPolicy()
def create_slice(self, cred, hrn, rspec):
- self.decode_authentication(cred, 'creatslice')
+ self.decode_authentication(cred, 'createslice')
return self.createSlice(cred, hrn, rspec)
def delete_slice(self, cred, hrn):