From c5e4e0489a8dd58866cfbec8391a31c20328b33c Mon Sep 17 00:00:00 2001 From: Sapan Bhatia Date: Mon, 26 Oct 2009 15:32:46 +0000 Subject: [PATCH] Returning the request context in the right format. This is needed by sfatables. --- sfa/rspecs/aggregates/rspec_manager_openflow.py | 8 +++++++- sfa/rspecs/aggregates/rspec_manager_pl.py | 7 +++++-- sfa/rspecs/aggregates/rspec_manager_vini.py | 11 ++++++++--- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/sfa/rspecs/aggregates/rspec_manager_openflow.py b/sfa/rspecs/aggregates/rspec_manager_openflow.py index 314f21a2..adc56799 100755 --- a/sfa/rspecs/aggregates/rspec_manager_openflow.py +++ b/sfa/rspecs/aggregates/rspec_manager_openflow.py @@ -147,8 +147,14 @@ def get_rspec(cred, hrn=None): print "IO error" return None +""" +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): - return None + base_context = {'sfa':{'user':{'hrn':user_hrn}}} + return base_context def main(): r = Rspec() diff --git a/sfa/rspecs/aggregates/rspec_manager_pl.py b/sfa/rspecs/aggregates/rspec_manager_pl.py index 51fb1295..ffc0a2b4 100644 --- a/sfa/rspecs/aggregates/rspec_manager_pl.py +++ b/sfa/rspecs/aggregates/rspec_manager_pl.py @@ -1,5 +1,8 @@ -# Nothing here for now. - +""" +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 diff --git a/sfa/rspecs/aggregates/rspec_manager_vini.py b/sfa/rspecs/aggregates/rspec_manager_vini.py index f6a21c55..a8370ff3 100644 --- a/sfa/rspecs/aggregates/rspec_manager_vini.py +++ b/sfa/rspecs/aggregates/rspec_manager_vini.py @@ -187,15 +187,20 @@ def create_slice(api, hrn, xml): return True +""" +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',rspec) - -def fetch_context(slice_hrn, user_hrn, contexts): - return None if __name__ == "__main__": main() -- 2.47.0