- rspecs = {}
- aggregates = Aggregates(api)
- credential = api.getCredential()
- # split the netspecs into individual rspecs
- netspecs = spec.getDictsByTagName('NetSpec')
- for netspec in netspecs:
- net_hrn = netspec['name']
- resources = {'start_time': start_time, 'end_time': end_time, 'networks': {'NetSpec' : netspec}}
- resourceDict = {'RSpec': resources}
- tempspec.parseDict(resourceDict)
- rspecs[net_hrn] = tempspec.toxml()
-
- #print "rspecs:", rspecs.keys()
- #print "aggregates:", aggregates.keys()
- # send each rspec to the appropriate aggregate/sm
- for net_hrn in rspecs:
- net_urn = hrn_to_urn(net_hrn, 'authority')
- try:
- # if we are directly connected to the aggregate then we can just
- # send them the rspec. if not, then we may be connected to an sm
- # thats connected to the aggregate
- if net_hrn in aggregates:
- # send the whloe rspec to the local aggregate
- if net_hrn in [api.hrn]:
- aggregates[net_hrn].create_slice(credential, xrn, rspec, \
- origin_hrn)
- else:
- aggregates[net_hrn].create_slice(credential, xrn, \
- rspecs[net_hrn], origin_hrn)
- else:
- # lets forward this rspec to a sm that knows about the network
- for aggregate in aggregates:
- network_found = aggregates[aggregate].get_aggregates(credential, net_hrn)
- if network_found:
- aggregates[aggregate].create_slice(credential, xrn, \
- rspecs[net_hrn], origin_hrn)