From: Tony Mack Date: Wed, 2 Dec 2009 03:27:33 +0000 (+0000) Subject: added fetch_context, main, and get_rspec methods X-Git-Tag: sfa-0.9-7~216 X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=46e5a6106eed8239befc50b27a1744dcbbf81bec;p=sfa.git added fetch_context, main, and get_rspec methods --- diff --git a/sfa/managers/aggregate_manager_pl.py b/sfa/managers/aggregate_manager_pl.py index 34230e08..a9792b62 100644 --- a/sfa/managers/aggregate_manager_pl.py +++ b/sfa/managers/aggregate_manager_pl.py @@ -76,7 +76,9 @@ def get_slices(api): slices.refresh() return slices['hrn'] - + + + def get_rspec(api, hrn=None): nodes = Nodes(api) if hrn: @@ -86,3 +88,21 @@ def get_rspec(api, hrn=None): rspec = nodes['rspec'] return rspec + +""" +Returns the request context required by sfatables. At some point, this mechanism should be changed +to refer to "contexts", which is the information that sfatables is requesting. But for now, we just +return the basic information needed in a dict. +""" +def fetch_context(slice_hrn, user_hrn, contexts): + base_context = {'sfa':{'user':{'hrn':user_hrn}}} + return base_context + +def main(): + r = RSpec() + r.parseFile(sys.argv[1]) + rspec = r.toDict() + create_slice(None,'plc.princeton.tmacktestslice',rspec) + +if __name__ == "__main__": + main()