X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Fmanagers%2Faggregate_manager_vini.py;h=e1e7a179d981d8bbbbe6b91f807058c0f5fc4096;hb=93d3b8497817385dbcaeadd16c9003af31505eea;hp=b4d0984a19e769321f0c4fcd2522dec58c3d22b8;hpb=cd4a3a1f909aca582912bbd6c4a79418f609df80;p=sfa.git diff --git a/sfa/managers/aggregate_manager_vini.py b/sfa/managers/aggregate_manager_vini.py index b4d0984a..e1e7a179 100644 --- a/sfa/managers/aggregate_manager_vini.py +++ b/sfa/managers/aggregate_manager_vini.py @@ -3,12 +3,11 @@ from sfa.util.namespace import * from sfa.util.rspec import RSpec from sfa.server.registry import Registries from sfa.plc.nodes import * +from sfa.plc.api import * from sfa.rspecs.aggregates.vini.utils import * from sfa.rspecs.aggregates.vini.rspec import * import sys -SFA_VINI_WHITELIST = '/etc/sfa/vini.whitelist' - """ Copied from create_slice_aggregate() in sfa.plc.slices """ @@ -132,7 +131,7 @@ def create_slice_vini_aggregate(api, hrn, nodes): return 1 -def get_rspec(api, xrn): +def get_rspec(api, xrn, origin_hrn): hrn = urn_to_hrn(xrn)[0] topo = Topology(api) if (hrn): @@ -154,26 +153,13 @@ Hook called via 'sfi.py create' """ def create_slice(api, xrn, xml): hrn = urn_to_hrn(xrn)[0] - ### Check the whitelist - ### It consists of lines of the form: - whitelist = {} - f = open(SFA_VINI_WHITELIST) - for line in f.readlines(): - (slice, maxbw) = line.split() - whitelist[slice] = maxbw - - if hrn in whitelist: - maxbw = whitelist[hrn] - else: - raise PermissionError("%s not in VINI whitelist" % hrn) - rspec = RSpec(xml) topo = Topology(api) topo.nodeTopoFromRSpec(rspec) # Check request against current allocations - topo.verifyNodeTopo(hrn, topo, maxbw) + topo.verifyNodeTopo(hrn, topo) nodes = topo.nodesInTopo() hostnames = [] @@ -186,6 +172,8 @@ def create_slice(api, xrn, xml): if slice: topo.updateSliceTags(slice) + # print topo.toxml(hrn) + return True """ @@ -199,10 +187,13 @@ def fetch_context(slice_hrn, user_hrn, contexts): return base_context def main(): - r = RSpec() - r.parseFile(sys.argv[1]) - rspec = r.toDict() - create_slice(None,'plc',rspec) + api = SfaAPI() + #rspec = get_rspec(api, "plc.princeton.iias", None) + #print rspec + f = open(sys.argv[1]) + xml = f.read() + f.close() + create_slice(api, "plc.princeton.iias", xml) if __name__ == "__main__": main()