from sfa.util.rspec import Rspec
import sys
import pdb
-
+from sfa.util.misc import *
+from sfa.util.rspec import *
+from sfa.util.specdict import *
+from sfa.util.faults import *
+from sfa.util.storage import *
+from sfa.util.policy import Policy
+from sfa.util.debug import log
+from sfa.server.aggregate import Aggregates
+from sfa.server.registry import Registries
SFA_MAX_CONF_FILE = '/etc/sfa/max_allocations'
# Topology
def alloc_links(api, links_to_add, links_to_drop, foo):
return True
-def alloc_nodes(api,hrn, requested_links, links_to_delete):
+def alloc_nodes(api,hrn, requested_links):
- nodes_to_add = link_endpoints(links_to_add)
- nodes_to_delete = link_endpoints(links_to_delete)
+ requested_nodes = link_endpoints(requested_links)
pdb.set_trace()
- create_slice_max_aggregate(api, hrn, nodes_to_add, nodes_to_delete)
+ create_slice_max_aggregate(api, hrn, requested_nodes)
# Taken from slices.py
return (allocations_to_rspec_dict(current_allocations))
-def create_slice(api, hrn, rspec):
+def create_slice(api, hrn, rspec_xml):
# Check if everything in rspec is either allocated by hrn
# or not allocated at all.
+ r = Rspec()
+ r.parseString(rspec_xml)
+ rspec = r.toDict()
+
lock_state_file()
allocations = read_alloc_dict()
allocations_to_delete.extend([a])
# Ok, let's do our thing
- alloc_nodes(api, hrn, requested_allocations, allocations_to_delete)
+ alloc_nodes(api, hrn, requested_allocations)
alloc_links(api, hrn, requested_allocations, allocations_to_delete)
allocations[hrn] = requested_allocations
commit_alloc_dict(allocations)