Add network argument to rspec calls
[sfa.git] / sfa / managers / registry_manager_pl.py
index 28f9198..d0998dd 100644 (file)
@@ -12,12 +12,17 @@ from sfa.util.plxrn import hrn_to_pl_login_base
 from sfa.trust.credential import Credential
 from sfa.trust.certificate import Certificate, Keypair
 from sfa.trust.gid import create_uuid
+from sfa.util.version import version_core
 
-def get_version(api):
-    version = {}
-    version['geni_api'] = 1
-    version['sfa'] = 1
-    return version
+# The GENI GetVersion call
+def GetVersion(api):
+    peers =dict ([ (peername,v._ServerProxy__host) for (peername,v) in api.registries.items() 
+                   if peername != api.hrn])
+    xrn=Xrn(api.hrn)
+    return version_core({'interface':'registry',
+                         'hrn':xrn.get_hrn(),
+                         'urn':xrn.get_urn(),
+                         'peers':peers})
 
 def get_credential(api, xrn, type, is_self=False):
     # convert xrn to hrn     
@@ -79,17 +84,13 @@ def get_credential(api, xrn, type, is_self=False):
     return new_cred.save_to_string(save_parents=True)
 
 
-# The GENI GetVersion call
-def GetVersion():
-    version = {}
-    version['geni_api'] = 1
-    return version
-
 def resolve(api, xrns, type=None, full=True):
 
     # load all know registry names into a prefix tree and attempt to find
     # the longest matching prefix
     if not isinstance(xrns, types.ListType):
+        if not type:
+            type = Xrn(xrns).get_type()
         xrns = [xrns]
     hrns = [urn_to_hrn(xrn)[0] for xrn in xrns] 
     # create a dict whre key is an registry hrn and its value is a