Ejemplo n.º 1
0
    def setUp(self):

        app = Flask('api')
        #self.rest.registry = CloudRegistry()
        #self.rest.logger = utils.get_logger()
        self.rest = api_utils.set_api_manager(self.rest, CloudRegistry())

        app.register_blueprint(self.rest)
        self.app = self.TestClientWithAuth(app.test_client())
Ejemplo n.º 2
0
    def setUp(self):

        app = Flask('api')
        #self.rest.registry = CloudRegistry()
        #self.rest.logger = utils.get_logger()
        self.rest = api_utils.set_api_manager(self.rest, CloudRegistry())

        app.register_blueprint(self.rest)
        self.app = self.TestClientWithAuth(app.test_client())
Ejemplo n.º 3
0
def make_app():
    '''App builder (wsgi) Entry point for REST API server'''

    app = Flask('api')

    @app.route('/', methods=['GET'])
    def version_list():
        '''Basic HTTP API version listing for Compatible APIs '''
        return json.dumps({
            "versions": [
                {
                    "id": "v1",
                    "status": "CURRENT",
                    "comment": "Nova compatibility API"
                },
                {
                    "id": "v1",
                    "status": "CURRENT",
                    "comment": "Nova and Glance compatibility API"
                },
                {
                    "id": "v1",
                    "status": "CURRENT",
                    "comment": "Glance compatibility API"
                },
                {
                    "id": "v2.0",
                    "status": "CURRENT",
                    "comment": "Keystone compatibility API"
                },
                {
                    "id": "user_info/v0",
                    "status": "CURRENT",
                    "comment": "VM username and password provider"
                },
                {
                    "id": "user_info/v0",
                    "status": "CURRENT",
                    "comment": "VM username and password provider"
                },
                {
                    "id": "modules/v0",
                    "status": "CURRENT",
                    "comment": "VM username and password provider for "
                            "init-cloud.sh"
                },
                {
                    "id": "metadata/v0",
                    "status": "CURRENT",
                    "comment": "Metadata service"
                },
                {
                    "id": "ids/v0",
                    "status": "CURRENT",
                    "comment": "Object ID service"
                }
            ]
        })

    registry = CloudRegistry(settings=local_settings.settings)

    nova_bp = utils.set_api_manager(nova.rest, registry)
    glance_bp = utils.set_api_manager(glance.rest, registry)
    cinder_bp = utils.set_api_manager(cinder.rest, registry)
    keystone_bp = utils.set_api_manager(keystone.rest, registry)
    osdc_bp = utils.set_api_manager(osdc.rest, registry)

    # TODO: need to have some kind of module thing
    pipeline_bp = utils.set_api_manager(pipelines.rest, registry)

    # this is stupid this is all really stupid!
    app.register_blueprint(nova_bp, url_prefix='/compute')
    app.register_blueprint(glance_bp, url_prefix='/v1')
    app.register_blueprint(cinder_bp, url_prefix='/volume')

    app.register_blueprint(keystone_bp, url_prefix='/v2.0')

    app.register_blueprint(osdc_bp, url_prefix='/osdc/v0')

    utils.Rest.has_tenant_id = False

    user_info_bp = utils.set_api_manager(user_info.rest, registry)
    ids_bp = utils.set_api_manager(ids.rest, registry)
    metadata_bp = utils.set_api_manager(metadata.rest, registry)

    app.register_blueprint(user_info_bp, url_prefix='/user_info/v0')
    app.register_blueprint(user_info_bp, url_prefix='/modules/v0')

    app.register_blueprint(ids_bp, url_prefix='/ids/v0')
    app.register_blueprint(metadata_bp, url_prefix='/metadata/v0')

    return app
Ejemplo n.º 4
0
def make_app():
    '''App builder (wsgi) Entry point for REST API server'''

    app = Flask('api')

    @app.route('/', methods=['GET'])
    def version_list():
        '''Basic HTTP API version listing for Compatible APIs '''
        return json.dumps({
            "versions": [{
                "id": "v1",
                "status": "CURRENT",
                "comment": "Nova compatibility API"
            }, {
                "id": "v1",
                "status": "CURRENT",
                "comment": "Nova and Glance compatibility API"
            }, {
                "id": "v1",
                "status": "CURRENT",
                "comment": "Glance compatibility API"
            }, {
                "id": "v2.0",
                "status": "CURRENT",
                "comment": "Keystone compatibility API"
            }, {
                "id": "user_info/v0",
                "status": "CURRENT",
                "comment": "VM username and password provider"
            }, {
                "id": "user_info/v0",
                "status": "CURRENT",
                "comment": "VM username and password provider"
            }, {
                "id":
                "modules/v0",
                "status":
                "CURRENT",
                "comment":
                "VM username and password provider for "
                "init-cloud.sh"
            }, {
                "id": "metadata/v0",
                "status": "CURRENT",
                "comment": "Metadata service"
            }, {
                "id": "ids/v0",
                "status": "CURRENT",
                "comment": "Object ID service"
            }]
        })

    registry = CloudRegistry(settings=local_settings.settings)

    nova_bp = utils.set_api_manager(nova.rest, registry)
    glance_bp = utils.set_api_manager(glance.rest, registry)
    cinder_bp = utils.set_api_manager(cinder.rest, registry)
    keystone_bp = utils.set_api_manager(keystone.rest, registry)
    osdc_bp = utils.set_api_manager(osdc.rest, registry)

    # TODO: need to have some kind of module thing
    pipeline_bp = utils.set_api_manager(pipelines.rest, registry)

    # this is stupid this is all really stupid!
    app.register_blueprint(nova_bp, url_prefix='/compute')
    app.register_blueprint(glance_bp, url_prefix='/v1')
    app.register_blueprint(cinder_bp, url_prefix='/volume')

    app.register_blueprint(keystone_bp, url_prefix='/v2.0')

    app.register_blueprint(osdc_bp, url_prefix='/osdc/v0')

    utils.Rest.has_tenant_id = False

    user_info_bp = utils.set_api_manager(user_info.rest, registry)
    ids_bp = utils.set_api_manager(ids.rest, registry)
    metadata_bp = utils.set_api_manager(metadata.rest, registry)

    app.register_blueprint(user_info_bp, url_prefix='/user_info/v0')
    app.register_blueprint(user_info_bp, url_prefix='/modules/v0')

    app.register_blueprint(ids_bp, url_prefix='/ids/v0')
    app.register_blueprint(metadata_bp, url_prefix='/metadata/v0')

    return app
Ejemplo n.º 5
0
def make_app():
    '''App builder (wsgi) Entry point for REST API server'''

    app = Flask('api')

    @app.route('/', methods=['GET'])
    def version_list():
        '''Basic HTTP API version listing for Compatible APIs '''
        return json.dumps({
            "versions": [
                {
                    "id": "v1.1",
                    "status": "CURRENT",
                    "comment": "Nova compatibility API"
                },
                {
                    "id": "v1",
                    "status": "CURRENT",
                    "comment": "Glance compatibility API"
                }
            ]
        })

    settings = {
        "test_cloud": {
            "driver": "tukey_middleware.cloud_driver.osdc_euca.OsdcEucaDriver",
            "name": "Adler",
            "auth_driver_parameters": {
                "memcache_client":  {
                    "class":
                        "tukey_middleware.tests.services.mc_mock.ClientPreload",
                    "params": [["localhost:11211"], 1]
                },
                "eucarc_path":  "tukey_middleware/tests/data/%s"
            }
        },
        "test_openstack": {
            "driver": "tukey_middleware.cloud_driver.openstack.OpenStackDriver",
            "name": "Sullivan",
            "auth_driver_parameters": {
                "memcache_client":  {
                    "class":
                        "tukey_middleware.tests.services.mc_mock.ClientPreload",
                    "params": [["localhost:11211"], 1]
                }
            }

        }
    }

    registry = CloudRegistry(settings=settings)

    nova_bp = utils.set_api_manager(nova.rest, registry)
    glance_bp = utils.set_api_manager(glance.rest, registry)

    app.register_blueprint(nova_bp, url_prefix='/v1.1')
    app.register_blueprint(nova_bp, url_prefix='/v2')
    app.register_blueprint(glance_bp, url_prefix='/v2')
    app.register_blueprint(glance_bp, url_prefix='/v1')

    utils.Rest.has_tenant_id = False
    user_info_bp = utils.set_api_manager(user_info.rest, registry)
    ids_bp = utils.set_api_manager(ids.rest, registry)

    app.register_blueprint(user_info_bp, url_prefix='/user_info/v0')
    app.register_blueprint(ids_bp, url_prefix='/ids/v0')

    return app