X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=sfa%2Futil%2Fconfig.py;h=2ad7f7b5e4fbadb2ecaa77b96f4c0b165b27f516;hb=11156a540daa4b6ac2f6348f31f5f0d850161b2b;hp=923df4f481f4e1c6adc249bc6cd75d208938e951;hpb=25e4defe0cca44cc49a6c05c4bfe74b723ed14e6;p=sfa.git diff --git a/sfa/util/config.py b/sfa/util/config.py index 923df4f4..2ad7f7b5 100644 --- a/sfa/util/config.py +++ b/sfa/util/config.py @@ -14,14 +14,9 @@ # 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