def main():
    cfg.CONF(args=sys.argv[1:],
             default_config_files=['/etc/neutron/neutron.conf'])
    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)

    create_ea_defs(grid_id)
    participate_network_views(grid_id)
    def _setup_config(self):
        # config init is needed to initialize transport and config loading
        common_config.init([])

        # register infoblox stanza
        config.register_infoblox_ipam_opts(cfg.CONF)
        cfg.CONF.set_override("cloud_data_center_id", 100, "infoblox")
        cfg.CONF.set_override("ipam_agent_workers", 1, "infoblox")

        # register infoblox data center stanza
        data_center_id = cfg.CONF.infoblox.cloud_data_center_id
        config.register_infoblox_grid_opts(cfg.CONF, data_center_id)
        data_center = "infoblox-dc:%s" % data_center_id
        cfg.CONF.set_override("grid_master_host", "192.168.1.7", data_center)
        cfg.CONF.set_override("grid_master_name", "nios-7.2.0-master.com", data_center)
        cfg.CONF.set_override("data_center_name", "admin", data_center)
        cfg.CONF.set_override("admin_user_name", "admin", data_center)
        cfg.CONF.set_override("admin_password", "infoblox", data_center)
        cfg.CONF.set_override("wapi_version", self.wapi_version, data_center)
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)
def register_options():
    agent_conf.register_agent_state_opts_helper(cfg.CONF)
    config.register_infoblox_ipam_opts(cfg.CONF)
    config.register_infoblox_grid_opts(cfg.CONF,
                                       cfg.CONF.infoblox.cloud_data_center_id)