sfa settings : sfa_plc category split into sfa_plc and sfa_db
[sfa.git] / sfa / util / config.py
index 923df4f..2ad7f7b 100644 (file)
 # Note that SFA does not access any of the PLC databases directly via
 # a mysql connection; All PLC databases are accessed via PLCAPI.
 
-### $Id$
-### $URL$
-
 import os.path
 import traceback
 
-from sfa.util.debug import log
-
 class Config:
     """
     Parse the bash/Python/PHP version of the configuration file. Very
@@ -71,6 +66,9 @@ class Config:
             if not hasattr(self, 'SFA_CM_TYPE'):
                 self.SFA_COMPONENT_TYPE='pl'
 
+            if not hasattr(self, 'SFA_MAX_SLICE_RENEW'):
+                self.SFA_MAX_SLICE_RENEW=60
+
             # create the data directory if it doesnt exist
             if not os.path.isdir(self.SFA_DATA_DIR):
                 try:
@@ -78,7 +76,7 @@ class Config:
                 except: pass
              
         except IOError, e:
-            raise IOError, "Could not find the configuration file: %s" % config_file
+            raise IOError, "Could not find or load the configuration file: %s" % config_file
 
     def get_trustedroots_dir(self):
         return self.config_path + os.sep + 'trusted_roots'
@@ -100,15 +98,33 @@ class Config:
         else:
             return "pl"
 
+    def get_interface_hrn(self):
+        if (hasattr(self,'SFA_INTERFACE_HRN')):
+            return self.SFA_INTERFACE_HRN
+        else:
+            return "plc"
+
     def get_plc_dbinfo(self):
         return {
-            'dbname' : self.SFA_PLC_DB_NAME,
-            'address' : self.SFA_PLC_DB_HOST,
-            'port' : self.SFA_PLC_DB_PORT,
-            'user' : self.SFA_PLC_DB_USER,
-            'password' : self.SFA_PLC_DB_PASSWORD
+            'dbname' : self.SFA_DB_NAME,
+            'address' : self.SFA_DB_HOST,
+            'port' : self.SFA_DB_PORT,
+            'user' : self.SFA_DB_USER,
+            'password' : self.SFA_DB_PASSWORD
             }
 
+    # TODO: find a better place to put this method
+    def get_max_aggrMgr_info(self):
+        am_apiclient_path = '/usr/local/MAXGENI_AM_APIClient'
+        if (hasattr(self,'MAXGENI_AM_APICLIENT_PATH')):
+            am_client_path = self.MAXGENI_AM_APICLIENT_PATH
+
+        am_url = 'https://geni.dragon.maxgigapop.net:8443/axis2/services/AggregateGENI'
+        if (hasattr(self,'MAXGENI_AM_URL')):
+            am_url = self.MAXGENI_AM_URL
+
+        return (am_apiclient_path,am_url)
+
     ##
     # SFA uses a PLCAPI connection to perform operations on the registry,
     # such as creating and deleting slices. This connection requires an account