예제 #1
0
    def prepare_grid_manager(self, wapi_version):
        self.wapi_version = wapi_version

        self._setup_config()
        self.grid_mgr = grid.GridManager(self.context)
        self.grid_mgr.grid_config.gm_connector = mock.Mock()
        self.grid_mgr.member._discover_dns_settings = mock.Mock(
            return_value=[])
        self.grid_mgr.member._discover_dhcp_settings = mock.Mock(
            return_value=[])

        self._prepare_discovery_resources()
예제 #2
0
    def __init__(self, neutron_context, plugin=None, grid_manager=None):
        self.context = neutron_context
        self.plugin = plugin if plugin else directory.get_plugin()
        if grid_manager:
            self.grid_mgr = grid_manager
        else:
            self.grid_mgr = grid.GridManager(self.context)
            self.grid_mgr.sync(True)

        self.grid_config = self.grid_mgr.grid_config
        self.grid_id = self.grid_config.grid_id

        self._cached_grid_members = None
        self._cached_network_views = None
        self._cached_mapping_conditions = None
예제 #3
0
 def __init__(self, report_interval=None):
     super(NotificationService, self).__init__()
     self.report_thread = None
     self.event_listener = None
     if report_interval:
         self.report_interval = report_interval
     else:
         self.report_interval = config.CONF.AGENT.report_interval
     self.context = context.get_admin_context()
     # Make sure config is in sync before using grid_sync_maximum_wait_time
     self.grid_manager = grid.GridManager(self.context)
     self.grid_syncer = grid.GridSyncer()
     self.grid_syncer.sync(True)
     self._init_agent_report_thread()
     self._init_notification_listener()
     self._init_periodic_resync()
def main():
    cfg.CONF(args=sys.argv[1:],
             default_config_files=DEFAULT_CONFIG_FILES)
    common_config.setup_logging()
    config.register_infoblox_ipam_opts(cfg.CONF)
    grid_id = cfg.CONF.infoblox.cloud_data_center_id
    config.register_infoblox_grid_opts(cfg.CONF, grid_id)

    try:
        credentials, version = get_credentials()
    except KeyError:
        print("\nYou must provide an admin user credentials in the shell "
              "environment.\nPlease export variables such as env[OS_USERNAME],"
              " env[OS_PASSWORD], env[OS_AUTH_URL], env[OS_TENANT_NAME] or "
              "env[OS_PROJECT_NAME]\n")
        return
    password_creds = credentials.copy()
    password_creds.pop('region_name', None)

    # keystoneauth1 provides generic api to create auth object based on the
    # arguments passed.
    auth = generic.Password(**password_creds)

    # Load keystone session using the ssl options which are in environment
    session = load_session.Session().load_from_options(**get_session_options())
    session.auth = auth
    if version == '3':
        client = client_3.Client(session=session)
    else:
        client = client_2_0.Client(session=session)

    context = neutron_context.get_admin_context()
    context.auth_token = client.ec2.client.get_token()
    context.user_id = client.ec2.client.get_user_id()
    context.tenant_id = client.ec2.client.get_project_id()

    grid_manager = grid.GridManager(context)
    grid_manager.sync(force_sync=True)
    context.session.expunge_all()

    credentials['session'] = session
    for key in ('user_domain_id', 'project_domain_id'):
        credentials.pop(key, None)

    sync_neutron_to_infoblox(context, credentials, grid_manager)
예제 #5
0
def main():
    cfg.CONF(args=sys.argv[1:], default_config_files=DEFAULT_CONFIG_FILES)
    common_config.setup_logging()
    config.register_infoblox_ipam_opts(cfg.CONF)
    grid_id = cfg.CONF.infoblox.cloud_data_center_id
    config.register_infoblox_grid_opts(cfg.CONF, grid_id)
    register_keystone_opts(cfg.CONF)

    try:
        credentials, version = get_credentials()
    except KeyError:
        print("\nYou must provide an admin user credentials in the shell "
              "environment.\nPlease export variables such as env[OS_USERNAME],"
              " env[OS_PASSWORD], env[OS_AUTH_URL], env[OS_TENANT_NAME], and "
              "env[OS_REGION_NAME]\n")
        return

    password_creds = credentials.copy()
    password_creds.pop('region_name', None)
    if version == '3':
        auth = v3.Password(**password_creds)
        session = ks_session.Session(auth=auth)
        client = client_3.Client(session=session)
    else:
        auth = v2.Password(**password_creds)
        session = ks_session.Session(auth=auth)
        client = client_2_0.Client(session=session)

    context = neutron_context.get_admin_context()
    context.auth_token = client.ec2.client.get_token()
    context.user_id = client.ec2.client.get_user_id()
    context.tenant_id = client.ec2.client.get_project_id()

    grid_manager = grid.GridManager(context)
    grid_manager.sync(force_sync=True)

    credentials['session'] = session
    for key in ('user_domain_id', 'project_domain_id'):
        credentials.pop(key, None)

    sync_neutron_to_infoblox(context, credentials, grid_manager)
예제 #6
0
    def __init__(self, neutron_context, plugin=None, grid_manager=None):
        self.context = neutron_context
        # Check if neutron_manager is loaded as accessing directory methods
        # before a Neutron Manager has had the chances to load the environment
        # may result in callers handling an empty directory.
        if not directory.is_loaded():
            manager.init()

        self.plugin = plugin if plugin else directory.get_plugin()
        if grid_manager:
            self.grid_mgr = grid_manager
        else:
            self.grid_mgr = grid.GridManager(self.context)
            self.grid_mgr.sync(True)

        self.grid_config = self.grid_mgr.grid_config
        self.grid_id = self.grid_config.grid_id

        self._cached_grid_members = None
        self._cached_network_views = None
        self._cached_mapping_conditions = None
예제 #7
0
def main():
    common_config.init(sys.argv[1:])
    common_config.setup_logging()
    register_options()
    grid.GridManager(context.get_admin_context()).sync(force_sync=True)
예제 #8
0
 def __init__(self, subnetpool, context):
     super(InfobloxPool, self).__init__(subnetpool, context)
     self._plugin = directory.get_plugin()
     self._grid_manager = grid.GridManager(self._context)
     self._grid_manager.get_config()
     self._grid_config = self._grid_manager.grid_config