split api and driver
[sfa.git] / sfa / server / sfa_component_setup.py
index 7cea637..b2ce084 100755 (executable)
@@ -3,10 +3,12 @@ import sys
 import os
 import tempfile
 from optparse import OptionParser
+
+from sfa.util.faults import ConnectionKeyGIDMismatch
 from sfa.util.config import Config
 import sfa.util.xmlrpcprotocol as xmlrpcprotocol
-from sfa.util.namespace import *
-from sfa.util.faults import *
+from sfa.util.plxrn import hrn_to_pl_slicename, slicename_to_hrn
+
 from sfa.trust.certificate import Keypair, Certificate
 from sfa.trust.credential import Credential
 from sfa.trust.gid import GID
@@ -146,7 +148,7 @@ def get_credential(registry=None, force=False, verbose=False):
         registry = get_server(url=registry, keyfile=keyfile, certfile=certfile)
         cert = Certificate(filename=certfile)
         cert_str = cert.save_to_string(save_parents=True)
-        cred = registry.get_self_credential(cert_str, 'node', hrn)    
+        cred = registry.GetSelfCredential(cert_str, 'node', hrn)
         Credential(string=cred).save_to_file(credfile, save_parents=True)
     
     return cred
@@ -220,9 +222,9 @@ def get_gids(registry=None, verbose=False):
     if verbose:
         print "Getting current slices on this node"
     # get a list of slices on this node
-    from sfa.plc.api import ComponentAPI
-    api = ComponentAPI()
-    xids_tuple = api.nodemanager.GetXIDs()
+    from sfa.plc.plcdriver import PlcComponentApi
+    api = PlcComponentApi()
+    xids_tuple = api.driver.nodemanager.GetXIDs()
     slices = eval(xids_tuple[1])
     slicenames = slices.keys()
 
@@ -238,7 +240,6 @@ def get_gids(registry=None, verbose=False):
             for slicename in slices_without_gids]
     
     # exit if there are no gids to install
-    print hrns
     if not hrns:
         return
         
@@ -246,7 +247,7 @@ def get_gids(registry=None, verbose=False):
         print "Getting gids for slices on this node from registry"  
     # get the gids
     # and save them in the right palce
-    records = registry.get_gids(cred, hrns)
+    records = registry.GetGids(hrns, cred)
     for record in records:
         # if this isnt a slice record skip it
         if not record['type'] == 'slice':