Ejemplo n.º 1
0
 def setUp(self):
     super(MidoClientTestCase, self).setUp()
     self._tenant_id = 'test-tenant'
     self.mock_api = mock.Mock()
     self.mock_api_cfg = mock_lib.MidoClientMockConfig(self.mock_api)
     self.mock_api_cfg.setup()
     self.client = midonet_lib.MidoClient(self.mock_api)
Ejemplo n.º 2
0
    def __init__(self):

        # Read config values
        midonet_conf = cfg.CONF.MIDONET
        midonet_uri = midonet_conf.midonet_uri
        admin_user = midonet_conf.username
        admin_pass = midonet_conf.password
        admin_project_id = midonet_conf.project_id
        provider_router_id = midonet_conf.provider_router_id
        mode = midonet_conf.mode

        self.mido_api = api.MidonetApi(midonet_uri, admin_user,
                                       admin_pass,
                                       project_id=admin_project_id)
        self.client = midonet_lib.MidoClient(self.mido_api)

        if provider_router_id:
            self.provider_router = self.client.get_router(provider_router_id)
        else:
            msg = _('provider_router_id should be configured in the plugin '
                    'config file')
            LOG.exception(msg)
            raise MidonetPluginException(msg=msg)

        db.configure_db()
Ejemplo n.º 3
0
    def __init__(self):

        # Read config values
        midonet_conf = cfg.CONF.MIDONET
        midonet_uri = midonet_conf.midonet_uri
        admin_user = midonet_conf.username
        admin_pass = midonet_conf.password
        admin_project_id = midonet_conf.project_id
        provider_router_id = midonet_conf.provider_router_id
        metadata_router_id = midonet_conf.metadata_router_id
        mode = midonet_conf.mode

        self.mido_api = api.MidonetApi(midonet_uri, admin_user,
                                       admin_pass,
                                       project_id=admin_project_id)
        self.client = midonet_lib.MidoClient(self.mido_api)

        if provider_router_id and metadata_router_id:
            # get MidoNet provider router and metadata router
            self.provider_router = self.client.get_router(provider_router_id)
            self.metadata_router = self.client.get_router(metadata_router_id)

        elif not provider_router_id or not metadata_router_id:
            if mode == 'dev':
                msg = _('No provider router and metadata device ids found. '
                        'But skipping because running in dev env.')
                LOG.debug(msg)
            else:
                msg = _('provider_router_id and metadata_router_id '
                        'should be configured in the plugin config file')
                LOG.exception(msg)
                raise MidonetPluginException(msg=msg)

        db.configure_db()
Ejemplo n.º 4
0
    def __init__(self):
        # Read config values
        midonet_conf = cfg.CONF.MIDONET
        midonet_uri = midonet_conf.midonet_uri
        admin_user = midonet_conf.username
        admin_pass = midonet_conf.password
        admin_project_id = midonet_conf.project_id
        self.provider_router_id = midonet_conf.provider_router_id
        self.provider_router = None

        self.mido_api = api.MidonetApi(midonet_uri, admin_user,
                                       admin_pass,
                                       project_id=admin_project_id)
        self.client = midonet_lib.MidoClient(self.mido_api)

        # self.provider_router_id should have been set.
        if self.provider_router_id is None:
            msg = _('provider_router_id should be configured in the plugin '
                    'config file')
            LOG.exception(msg)
            raise MidonetPluginException(msg=msg)

        self.setup_rpc()
        db.configure_db()