- # send the rspec to the appropiate aggregate/sm
- aggregates = api.aggregates
- credential = api.getCredential()
- tickets = {}
- for net_hrn in rspecs:
- net_urn = urn_to_hrn(net_hrn)
- try:
- # if we are directly connected to the aggregate then we can just
- # send them the request. if not, then we may be connected to an sm
- # thats connected to the aggregate
- if net_hrn in aggregates:
- ticket = aggregates[net_hrn].get_ticket(credential, xrn, \
- rspecs[net_hrn], origin_hrn)
- tickets[net_hrn] = ticket
- else:
- # lets forward this rspec to a sm that knows about the network
- for agg in aggregates:
- network_found = aggregates[agg].get_aggregates(credential, net_urn)
- if network_found:
- ticket = aggregates[aggregate].get_ticket(credential, \
- slice_hrn, rspecs[net_hrn], origin_hrn)
- tickets[aggregate] = ticket
- except:
- print >> log, "Error getting ticket for %(slice_hrn)s at aggregate %(net_hrn)s" % \
- locals()
-
- # create a new ticket
- new_ticket = SfaTicket(subject = slice_hrn)
- new_ticket.set_gid_caller(api.auth.client_gid)
- new_ticket.set_issuer(key=api.key, subject=api.hrn)
-
- tmp_rspec = RSpec()
- networks = []
- valid_data = {
- 'timestamp': int(time.time()),
- 'initscripts': [],
- 'slivers': []
- }
- # merge data from aggregate ticket into new ticket
- for agg_ticket in tickets.values():
- # get data from this ticket
- agg_ticket = SfaTicket(string=agg_ticket)
- attributes = agg_ticket.get_attributes()
- if attributes.get('initscripts', []) != None:
- valid_data['initscripts'].extend(attributes.get('initscripts', []))
- if attributes.get('slivers', []) != None:
- valid_data['slivers'].extend(attributes.get('slivers', []))
-
- # set the object gid
- object_gid = agg_ticket.get_gid_object()
- new_ticket.set_gid_object(object_gid)
- new_ticket.set_pubkey(object_gid.get_pubkey())