2 # Geniwrapper Configuration Info
4 # This module holds configuration parameters for geniwrapper. There are two
5 # main pieces of information that are used: the database connection and
6 # the PLCAPI connection
10 # Geniwrapper uses a MYSQL database to store records. This database may be
11 # co-located with the PLC database, or it may be a separate database. The
12 # following parameters define the connection to the database.
14 # Note that Geniwrapper does not access any of the PLC databases directly via
15 # a mysql connection; All PLC databases are accessed via PLCAPI.
20 # If we have been checked out into a directory at the same
21 # level as myplc, where plc_config.py lives. If we are in a
22 # MyPLC environment, plc_config.py has already been installed
24 myplc = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) + \
29 Parse the bash/Python/PHP version of the configuration file. Very
30 fast but no type conversions.
33 def __init__(self, file = "/etc/planetlab/plc_config"):
36 execfile(file, self.__dict__)
40 execfile(myplc + os.sep + "plc_config", self.__dict__)
42 raise PLCAPIError("Could not find plc_config in " + \
44 myplc + os.sep + "plc_config")
49 def get_default_dbinfo():
50 dbinfo={ 'dbname' = plcConfig.PLC_DB_NAME,
51 'address' = plcConfig.PLC_DB_HOST,
52 'port' = plcConfig.PLC_DB_PORT,
53 'user' = plcConfig.PLC_DB_USER,
54 'password' = plcConfig.PLC_DB_PASSWORD
60 # Geniwrapper uses a PLCAPI connection to perform operations on the registry,
61 # such as creating and deleting slices. This connection requires an account
62 # on the PLC server with full administrator access.
64 # The Url parameter controls whether the connection uses PLCAPI directly (i.e.
65 # Geniwrapper is located on the same machine as PLC), or uses a XMLRPC connection
66 # to the PLC machine. If you wish to use the API directly, then remove the Url
67 # field from the dictionary.
70 pl_auth = {'Username': plcConfig.PLC_API_MAINTENANCE_USER,
71 'AuthMethod': 'password',
72 'AuthString': plcConfig.PLC_MAINTENANCE_PASSWORD,
73 "Url": 'https://%s:%s%s' %(plcConfig.PLC_API_HOST, plcConfig.PLC_API_PORT, plcConfig.PLC_API_PATH)