rename configuration variables like from GENI_ to SFA_
Thierry Parmentelat [Mon, 6 Jul 2009 20:19:51 +0000 (20:19 +0000)]
INSTALL.txt
config/sfa-config-tty
config/sfa_config
sfa/init.d/sfa
sfa/plc/sfa-import-plc.py
sfa/server/aggregate.py
sfa/server/registry.py
sfa/trust/auth.py
sfa/util/api.py
sfa/util/config.py
sfa/util/method.py

index 63a83f5..10913d1 100644 (file)
@@ -21,8 +21,8 @@ These two configuration parameters are required for SFA server configuration
 
 (a) # sfa-config-tty
 
- set GENI_PLC_USER     to     PLC_ROOT_USER 
- set GENI_PLC_PASSWORD to     PLC_ROOT_PASSWORD
+ set SFA_PLC_USER      to     PLC_ROOT_USER 
+ set SFA_PLC_PASSWORD  to     PLC_ROOT_PASSWORD
 write and quit
 
 *NOTE* at this point you get a warning b/c the authorities hierarchy has not been created yet; ignore
index 0c2f84e..5cb575d 100755 (executable)
@@ -24,32 +24,32 @@ from sfa.trust.hierarchy import *
 from sfa.util.misc import *
 
 
-all_variables   = ["GENI_REGISTRY_ROOT_AUTH",
-                   "GENI_REGISTRY_LEVEL1_AUTH",
-                   "GENI_REGISTRY_ENABLED",
-                   "GENI_REGISTRY_HOST", 
-                   "GENI_REGISTRY_PORT",
-                   "GENI_AGGREGATE_ENABLED",
-                   "GENI_AGGREGATE_HOST",
-                   "GENI_AGGREGATE_PORT",
-                   "GENI_SM_ENABLED",
-                   "GENI_SM_HOST",
-                   "GENI_SM_PORT",
-                   "GENI_PLC_USER",
-                   "GENI_PLC_PASSWORD",    
-                   "GENI_PLC_URL",
-                   "GENI_PLC_DB_NAME",
-                   "GENI_PLC_DB_HOST",
-                   "GENI_PLC_DB_PORT",
-                   "GENI_PLC_DB_USER",
-                   "GENI_PLC_DB_PASSWORD",
+all_variables   = ["SFA_REGISTRY_ROOT_AUTH",
+                   "SFA_REGISTRY_LEVEL1_AUTH",
+                   "SFA_REGISTRY_ENABLED",
+                   "SFA_REGISTRY_HOST", 
+                   "SFA_REGISTRY_PORT",
+                   "SFA_AGGREGATE_ENABLED",
+                   "SFA_AGGREGATE_HOST",
+                   "SFA_AGGREGATE_PORT",
+                   "SFA_SM_ENABLED",
+                   "SFA_SM_HOST",
+                   "SFA_SM_PORT",
+                   "SFA_PLC_USER",
+                   "SFA_PLC_PASSWORD",    
+                   "SFA_PLC_URL",
+                   "SFA_PLC_DB_NAME",
+                   "SFA_PLC_DB_HOST",
+                   "SFA_PLC_DB_PORT",
+                   "SFA_PLC_DB_USER",
+                   "SFA_PLC_DB_PASSWORD",
                    ]
-usual_variables = ["GENI_REGISTRY_ROOT_AUTH",
-                   "GENI_REGISTRY_LEVEL1_AUTH",
-                   "GENI_PLC_USER",
-                   "GENI_PLC_PASSWORD",
-                   "GENI_PLC_DB_USER",
-                   "GENI_PLC_DB_PASSWORD",
+usual_variables = ["SFA_REGISTRY_ROOT_AUTH",
+                   "SFA_REGISTRY_LEVEL1_AUTH",
+                   "SFA_PLC_USER",
+                   "SFA_PLC_PASSWORD",
+                   "SFA_PLC_DB_USER",
+                   "SFA_PLC_DB_PASSWORD",
                    ]
 
 
@@ -113,25 +113,25 @@ def validate(changes):
 
     defaults = get_defaults()
     
-    # GENI_INTERFACE_HRN is GENI_REGISTRY_LEVEL1_AUTH, if thats blank it
-    # then defaults to GENI_REGISTRY_ROOT_AUTH 
-    # GENI_REGISTRY_LEVEL1_AUTH, so if either of these are present we must 
-    # update GENI_INTERFACE_HRN
-    if 'GENI_REGISTRY_ROOT_AUTH' in changes:
-        root_auth = changes['GENI_REGISTRY_ROOT_AUTH']
+    # SFA_INTERFACE_HRN is SFA_REGISTRY_LEVEL1_AUTH, if thats blank it
+    # then defaults to SFA_REGISTRY_ROOT_AUTH 
+    # SFA_REGISTRY_LEVEL1_AUTH, so if either of these are present we must 
+    # update SFA_INTERFACE_HRN
+    if 'SFA_REGISTRY_ROOT_AUTH' in changes:
+        root_auth = changes['SFA_REGISTRY_ROOT_AUTH']
     else:
-        root_auth = defaults['GENI_REGISTRY_ROOT_AUTH']
+        root_auth = defaults['SFA_REGISTRY_ROOT_AUTH']
              
-    if 'GENI_REGISTRY_LEVEL1_AUTH' in changes:
-        level1_auth = changes['GENI_REGISTRY_LEVEL1_AUTH']
+    if 'SFA_REGISTRY_LEVEL1_AUTH' in changes:
+        level1_auth = changes['SFA_REGISTRY_LEVEL1_AUTH']
     else:
-        level1_auth = defaults['GENI_REGISTRY_LEVEL1_AUTH']
+        level1_auth = defaults['SFA_REGISTRY_LEVEL1_AUTH']
                 
     if level1_auth:
         interface_hrn = level1_auth
     else:
         interface_hrn = root_auth
-    changes['GENI_INTERFACE_HRN'] = interface_hrn
+    changes['SFA_INTERFACE_HRN'] = interface_hrn
     return changes                            
 
 def get_defaults():
@@ -230,7 +230,7 @@ def mainloop (default_config, config_file):
     return result
     
 def setup_server_key(config_dict):
-    hrn = config_dict.get('GENI_INTERFACE_HRN')
+    hrn = config_dict.get('SFA_INTERFACE_HRN')
     if not hrn: return
    
     # Get the path to the authorities directory hierarchy
index 7c78b0f..c4bae71 100644 (file)
@@ -1,98 +1,98 @@
 # Directory where SFA interfaces are installed
-GENI_BASE_DIR="/usr/share/sfa/" 
+SFA_BASE_DIR="/usr/share/sfa/" 
 
 # HRN
 # Human readable name for the interfaces
-GENI_INTERFACE_HRN="plc"   
+SFA_INTERFACE_HRN="plc"   
 
 
 # API Debug
 # Are we logging
-GENI_API_DEBUG=1
+SFA_API_DEBUG=1
 
 # Registry Configuration
 #
 # Enabled
 # Enable the registry interface 
-GENI_REGISTRY_ENABLED=1
+SFA_REGISTRY_ENABLED=1
 
 # Root Auth
 # The hrn of the registry's root auth
-GENI_REGISTRY_ROOT_AUTH="plc"
+SFA_REGISTRY_ROOT_AUTH="plc"
 
 # Level1 Auth
 # The hrn of the registry's level1 auth
 # xxx could be determined from hrn above
-GENI_REGISTRY_LEVEL1_AUTH=""
+SFA_REGISTRY_LEVEL1_AUTH=""
 
 # Hostname
 # The fully qualified hostname of the registry server
-GENI_REGISTRY_HOST="localhost"
+SFA_REGISTRY_HOST="localhost"
 
 # Port
 # Geni registry port
-GENI_REGISTRY_PORT=12345
+SFA_REGISTRY_PORT=12345
 
 
 ## Aggregate Configuration
 ##
 ## Enable aggregate inteface
 ## Enable the aggregate inteface.
-GENI_AGGREGATE_ENABLED=1
+SFA_AGGREGATE_ENABLED=1
 #
 ## Hostname
 ## The fully qualified hostname of the aggregate server
-GENI_AGGREGATE_HOST="localhost"
+SFA_AGGREGATE_HOST="localhost"
 #
 ## Port
 ## Geni aggregate server port
-GENI_AGGREGATE_PORT=12346
+SFA_AGGREGATE_PORT=12346
 
 # Slice Manager Configuration
 #
 # Enabled
 # Enable the slice manager  
-GENI_SM_ENABLED=1 
+SFA_SM_ENABLED=1 
 
 # Host
 ## The fully qualified hostname or IP address of the slice manager server
-GENI_SM_HOST="localhost"
+SFA_SM_HOST="localhost"
 
 # Port
 # Geni slice manager server port  
-GENI_SM_PORT=12347
+SFA_SM_PORT=12347
 
 # PLC Interface Access Configuration
 #
 # PLC user
 # Valid plc account geni interfaces will use for plc requests   
 
-GENI_PLC_USER='root@localhost.localdomain'
+SFA_PLC_USER='root@localhost.localdomain'
 
 # Password
 # Password for user account
-GENI_PLC_PASSWORD='root'
+SFA_PLC_PASSWORD='root'
 
 # Hostname
 # Fully qualified hostname of PLC interface
-GENI_PLC_URL='https://localhost:443/PLCAPI/'
+SFA_PLC_URL='https://localhost:443/PLCAPI/'
 
 # PLC Shell PATH
 # Path of PLC shell. This only applies if Geni interfaces and PLC interface are running on the same 
 # machine
-GENI_PLC_SHELL_PATH='/usr/share/plc_api'
+SFA_PLC_SHELL_PATH='/usr/share/plc_api'
 
 # PLC DB Name
-GENI_PLC_DB_NAME='planetlab5'
+SFA_PLC_DB_NAME='planetlab5'
 
 # PLC DB Host
-GENI_PLC_DB_HOST='www.planet-lab.org'
+SFA_PLC_DB_HOST='www.planet-lab.org'
 
 # PLC DB port
-GENI_PLC_DB_PORT=5432
+SFA_PLC_DB_PORT=5432
 
 # PLC DB User
-GENI_PLC_DB_USER='pgsqluser'
+SFA_PLC_DB_USER='pgsqluser'
 
 # PLC DB Password
-GENI_PLC_DB_PASSWORD=''
+SFA_PLC_DB_PASSWORD=''
index bbfa396..06051b0 100755 (executable)
 start() {
         echo -n $"Starting SFA:  "
 
-        if [ "$GENI_REGISTRY_ENABLED" ]; then
+        if [ "$SFA_REGISTRY_ENABLED" ]; then
             echo "Registry"
             daemon /usr/bin/sfa-server.py -r -d $OPTIONS
         fi
 
-        if [ "$GENI_AGGREGATE_ENABLED" ]; then
+        if [ "$SFA_AGGREGATE_ENABLED" ]; then
             echo "Aggregate"
             daemon /usr/bin/sfa-server.py -a -d $OPTIONS
         fi
         
-        if [ "$GENI_SM_ENABLED" ]; then
+        if [ "$SFA_SM_ENABLED" ]; then
             echo "SliceMgr"
             daemon /usr/bin/sfa-server.py -s -d $OPTIONS
         fi
index 97eecc1..34601b0 100755 (executable)
@@ -62,8 +62,8 @@ shell = connect_shell()
 #level1_auth = "planetlab.us"
 config = Config()
 
-root_auth = config.GENI_REGISTRY_ROOT_AUTH
-level1_auth = config.GENI_REGISTRY_LEVEL1_AUTH
+root_auth = config.SFA_REGISTRY_ROOT_AUTH
+level1_auth = config.SFA_REGISTRY_LEVEL1_AUTH
 if not level1_auth or level1_auth in ['']:
     level1_auth = None
 
index 696c996..7f2fa87 100644 (file)
@@ -105,8 +105,8 @@ class Aggregates(dict):
 
         # set up a connection to the local registry
         # connect to registry using GeniClient
-        address = self.api.config.GENI_AGGREGATE_HOST
-        port = self.api.config.GENI_AGGREGATE_PORT
+        address = self.api.config.SFA_AGGREGATE_HOST
+        port = self.api.config.SFA_AGGREGATE_PORT
         url = 'http://%(address)s:%(port)s' % locals()
         self[self.api.hrn] = GeniClient(url, self.api.key_file, self.api.cert_file)
                    
index 3b209ea..65da7c5 100644 (file)
@@ -112,8 +112,8 @@ class Registries(dict):
 
         # set up a connection to the local registry
         # connect to registry using GeniClient
-        address = self.api.config.GENI_REGISTRY_HOST
-        port = self.api.config.GENI_REGISTRY_PORT
+        address = self.api.config.SFA_REGISTRY_HOST
+        port = self.api.config.SFA_REGISTRY_PORT
         url = 'http://%(address)s:%(port)s' % locals()
         self[self.api.hrn] = GeniClient(url, self.api.key_file, self.api.cert_file)            
     
index 67d6d71..c8251d6 100644 (file)
@@ -207,7 +207,7 @@ class Auth:
 
         type = record.get_type()
         cred_object_hrn = src_cred.get_gid_object().get_hrn()
-        if cred_object_hrn in [self.config.GENI_REGISTRY_ROOT_AUTH]:
+        if cred_object_hrn in [self.config.SFA_REGISTRY_ROOT_AUTH]:
             return
         if type=="slice":
             researchers = record.get("researcher", [])
index 03ea9a1..ce6a7ab 100644 (file)
@@ -117,16 +117,16 @@ class GeniAPI:
         self.credential = None
         self.plshell = self.getPLCShell()
         self.plshell_version = self.getPLCShellVersion()
-        self.basedir = self.config.GENI_BASE_DIR + os.sep
+        self.basedir = self.config.SFA_BASE_DIR + os.sep
         self.server_basedir = self.basedir + os.sep + "geni" + os.sep
-        self.hrn = self.config.GENI_INTERFACE_HRN
+        self.hrn = self.config.SFA_INTERFACE_HRN
         self.time_format = "%Y-%m-%d %H:%M:%S"
 
 
     def getPLCShell(self):
-        self.plauth = {'Username': self.config.GENI_PLC_USER,
+        self.plauth = {'Username': self.config.SFA_PLC_USER,
                        'AuthMethod': 'password',
-                       'AuthString': self.config.GENI_PLC_PASSWORD}
+                       'AuthString': self.config.SFA_PLC_PASSWORD}
         try:
             import PLC.Shell
             shell = PLC.Shell.Shell(globals = globals())
@@ -134,7 +134,7 @@ class GeniAPI:
             return shell
         except ImportError:
             # connect via xmlrpc
-            url = self.config.GENI_PLC_URL
+            url = self.config.SFA_PLC_URL
              
             shell = xmlrpclib.Server(url, verbose = 0, allow_none = True)
             shell.AuthCheck(self.plauth)
index 680cd8d..bde3f56 100644 (file)
@@ -45,11 +45,11 @@ class Config:
 def get_default_dbinfo():
     config = Config()
     dbinfo={
-        'dbname' : config.GENI_PLC_DB_NAME,
-        'address' : config.GENI_PLC_DB_HOST,
-        'port' : config.GENI_PLC_DB_PORT,
-        'user' : config.GENI_PLC_DB_USER,
-        'password' : config.GENI_PLC_DB_PASSWORD
+        'dbname' : config.SFA_PLC_DB_NAME,
+        'address' : config.SFA_PLC_DB_HOST,
+        'port' : config.SFA_PLC_DB_PORT,
+        'user' : config.SFA_PLC_DB_USER,
+        'password' : config.SFA_PLC_DB_PASSWORD
         }
     return dbinfo
 
@@ -66,9 +66,9 @@ def get_default_dbinfo():
 def get_pl_auth():
     config = Config()
     pl_auth = {
-        'Username': config.GENI_PLC_USER,
+        'Username': config.SFA_PLC_USER,
         'AuthMethod': 'capability',
-        'AuthString':  config.GENI_PLC_PASSWORD,
-        "Url": config.GENI_PLC_URL
+        'AuthString':  config.SFA_PLC_PASSWORD,
+        "Url": config.SFA_PLC_URL
         }
     return pl_auth
index d382042..9683bc5 100644 (file)
@@ -91,7 +91,7 @@ class Method (object):
             result = self.call(*args, **kwds)
             runtime = time.time() - start
 
-            if self.api.config.GENI_API_DEBUG or hasattr(self, 'message'):
+            if self.api.config.SFA_API_DEBUG or hasattr(self, 'message'):
                 # XX print to some log file
                 # print >> log, "some output"
                    pass
@@ -106,7 +106,7 @@ class Method (object):
             fault.faultString = caller + ": " +  self.name + ": " + fault.faultString
             runtime = time.time() - start
            
-            if self.api.config.GENI_API_DEBUG:
+            if self.api.config.SFA_API_DEBUG:
                 # XX print to some log file
                 #print >> log, "Some debugging output"              
                 pass