class CloudAggregator:
    """
    This class is responsible for querying remote Cloud sites, retrieving their resource and real time XML,
    aggregate and validate the retrieved XML and then finally storing the aggregated XML into a RedisDB
    """
    # Since this is the "primary" class, it is designed to be instantiated first and thus will load the 
    # global ConfigMapping data
    def __init__(self, logger=None):
        if(logger):
            self.logger = logger
        else:
            self.logger = Logger("cloud_aggregator", "cloud_aggregator.log")
        loadConfig(self.logger) 
        
        #Connect to the RedisDB with the configured options
        self.storageDb = Redis(db=ConfigMapping[TARGET_REDIS_DB], host=ConfigMapping[REDISDB_SERVER_HOSTNAME], port=int(ConfigMapping[REDISDB_SERVER_PORT]))

        # Verify the DB is up and running
        try:
           self.storageDb.ping()
           self.logger.debug("RedisDB server alive")
        except ConnectionError, err:
#            print str(err)
            self.logger.error("redis-server running on desired port? "+str(err))
            sys.exit(RET_CRITICAL)
Example #2
0
class getCloudsClient:
    """
     This class is responsible for querying the RedisDB for the Sky XML and binding it back into 
     a usable data structure. This data structure format is a nested Dictionary of dictionaries and lists. The 
     exact format and names for various keys mimics the public XML format. This means that this class is dependant
     on the public XML format - If the XML changes this class needs to be updated accordingly.
     This dependancy is unavoidable conceptually, and the use of the Amara utility to provide the binding mechanism
     requires this knowledge.
    
    """
    def __init__(self, logger=None):
        if (logger):
            self.logger = logger
        else:
            self.logger = Logger("get_clouds", "get_clouds.log")

        loadGetCloudsClientConfig(self.logger)

        self.db = Redis(db=ConfigMapping[CLOUDS_DB],
                        host=ConfigMapping[REDISDB_SERVER_HOSTNAME],
                        port=int(ConfigMapping[REDISDB_SERVER_PORT]))
        try:
            self.db.ping()
        except ConnectionError, err:
            self.logger.error(
                "ConnectionError pinging DB - redis-server running on desired port?"
            )
            sys.exit(RET_CRITICAL)
Example #3
0
    def __init__(self, logger=None):
        if (logger):
            self.logger = logger
        else:
            self.logger = Logger("get_clouds", "get_clouds.log")

        loadGetCloudsClientConfig(self.logger)

        self.db = Redis(db=ConfigMapping[CLOUDS_DB],
                        host=ConfigMapping[REDISDB_SERVER_HOSTNAME],
                        port=int(ConfigMapping[REDISDB_SERVER_PORT]))
        try:
            self.db.ping()
        except ConnectionError, err:
            self.logger.error(
                "ConnectionError pinging DB - redis-server running on desired port?"
            )
            sys.exit(RET_CRITICAL)
Example #4
0
    def __init__(self, logger=None):
        if(logger):
            self.logger = logger
        else:
            self.logger = Logger("get_clouds","get_clouds.log")

        loadGetCloudsClientConfig(self.logger)

        self.db = Redis(db=ConfigMapping[CLOUDS_DB], host=ConfigMapping[REDISDB_SERVER_HOSTNAME], port=int(ConfigMapping[REDISDB_SERVER_PORT]))
        try:
            self.db.ping()
        except ConnectionError, err:
            self.logger.error("ConnectionError pinging DB - redis-server running on desired port?")
            sys.exit(RET_CRITICAL)
Example #5
0
class getCloudsClient:
    """
     This class is responsible for querying the RedisDB for the Sky XML and binding it back into 
     a usable data structure. This data structure format is a nested Dictionary of dictionaries and lists. The 
     exact format and names for various keys mimics the public XML format. This means that this class is dependant
     on the public XML format - If the XML changes this class needs to be updated accordingly.
     This dependancy is unavoidable conceptually, and the use of the Amara utility to provide the binding mechanism
     requires this knowledge.
    
    """
    def __init__(self, logger=None):
        if(logger):
            self.logger = logger
        else:
            self.logger = Logger("get_clouds","get_clouds.log")

        loadGetCloudsClientConfig(self.logger)

        self.db = Redis(db=ConfigMapping[CLOUDS_DB], host=ConfigMapping[REDISDB_SERVER_HOSTNAME], port=int(ConfigMapping[REDISDB_SERVER_PORT]))
        try:
            self.db.ping()
        except ConnectionError, err:
            self.logger.error("ConnectionError pinging DB - redis-server running on desired port?")
            sys.exit(RET_CRITICAL)
    def __init__(self, logger=None):
        if(logger):
            self.logger = logger
        else:
            self.logger = Logger("cloud_aggregator", "cloud_aggregator.log")
        loadConfig(self.logger) 
        
        #Connect to the RedisDB with the configured options
        self.storageDb = Redis(db=ConfigMapping[TARGET_REDIS_DB], host=ConfigMapping[REDISDB_SERVER_HOSTNAME], port=int(ConfigMapping[REDISDB_SERVER_PORT]))

        # Verify the DB is up and running
        try:
           self.storageDb.ping()
           self.logger.debug("RedisDB server alive")
        except ConnectionError, err:
#            print str(err)
            self.logger.error("redis-server running on desired port? "+str(err))
            sys.exit(RET_CRITICAL)