X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Frspecs%2Faggregates%2Frspec_manager_vini.py;h=20dc7fb566e57aa4dea4402e6e4286bd9a81f131;hb=3d7237fa0b5f2b4a60cb97c7fb3b6aecfd94558a;hp=a8370ff38a4519d336325eddca64505fc3ee9a61;hpb=c5e4e0489a8dd58866cfbec8391a31c20328b33c;p=sfa.git diff --git a/sfa/rspecs/aggregates/rspec_manager_vini.py b/sfa/rspecs/aggregates/rspec_manager_vini.py index a8370ff3..20dc7fb5 100644 --- a/sfa/rspecs/aggregates/rspec_manager_vini.py +++ b/sfa/rspecs/aggregates/rspec_manager_vini.py @@ -1,6 +1,6 @@ from sfa.util.faults import * -from sfa.util.misc import * -from sfa.util.rspec import Rspec +from sfa.util.namespace import * +from sfa.util.rspec import RSpec from sfa.server.registry import Registries from sfa.plc.nodes import * from sfa.rspecs.aggregates.vini.utils import * @@ -13,15 +13,15 @@ SFA_VINI_WHITELIST = '/etc/sfa/vini.whitelist' Copied from create_slice_aggregate() in sfa.plc.slices """ def create_slice_vini_aggregate(api, hrn, nodes): - # Get the slice record from geni + # Get the slice record from SFA slice = {} registries = Registries(api) registry = registries[api.hrn] credential = api.getCredential() records = registry.resolve(credential, hrn) for record in records: - if record.get_type() in ['slice']: - slice = record.as_dict() + if record['type'] in ['slice']: + slice = record if not slice: raise RecordNotFound(hrn) @@ -39,8 +39,7 @@ def create_slice_vini_aggregate(api, hrn, nodes): site_record = {} if not site_records: raise RecordNotFound(authority) - site_record = site_records[0] - site = site_record.as_dict() + site = site_records[0] # add the site site.pop('site_id') @@ -66,11 +65,11 @@ def create_slice_vini_aggregate(api, hrn, nodes): person_record = {} person_records = registry.resolve(credential, researcher) for record in person_records: - if record.get_type() in ['user']: + if record['type'] in ['user']: person_record = record if not person_record: pass - person_dict = person_record.as_dict() + person_dict = person_record persons = api.plshell.GetPersons(api.plauth, [person_dict['email']], ['person_id', 'key_ids']) @@ -166,10 +165,10 @@ def create_slice(api, hrn, xml): else: raise PermissionError("%s not in VINI whitelist" % hrn) - rspec = Rspec(xml) + rspec = RSpec(xml) topo = Topology(api) - topo.nodeTopoFromRspec(rspec) + topo.nodeTopoFromRSpec(rspec) # Check request against current allocations topo.verifyNodeTopo(hrn, topo, maxbw) @@ -193,11 +192,12 @@ to refer to "contexts", which is the information that sfatables is requesting. B return the basic information needed in a dict. """ def fetch_context(slice_hrn, user_hrn, contexts): - base_context = {'sfa':{'user':{'hrn':user_hrn}}} + base_context = {'sfa':{'user':{'hrn':user_hrn}, + 'slice':{'hrn':slice_hrn}}} return base_context def main(): - r = Rspec() + r = RSpec() r.parseFile(sys.argv[1]) rspec = r.toDict() create_slice(None,'plc',rspec)