<commit_before># vim: tabstop=4 shiftwidth=4 softtabstop=4

# Copyright 2011 Nicira Networks, Inc.
# All Rights Reserved.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

"""
Routines for configuring Quantum
"""

import os

from paste import deploy

from quantum.api.v2 import attributes
from quantum.common import utils
from quantum.openstack.common import cfg
from quantum.openstack.common import log as logging
from quantum.openstack.common import rpc
from quantum.version import version_info as quantum_version


LOG = logging.getLogger(__name__)

core_opts = [
    cfg.StrOpt('bind_host', default='0.0.0.0'),
    cfg.IntOpt('bind_port', default=9696),
    cfg.StrOpt('api_paste_config', default="api-paste.ini"),
    cfg.StrOpt('api_extensions_path', default=""),
    cfg.StrOpt('policy_file', default="policy.json"),
    cfg.StrOpt('auth_strategy', default='keystone'),
    cfg.StrOpt('core_plugin'),
    cfg.ListOpt('service_plugins',
                default=[]),
    cfg.StrOpt('base_mac', default="fa:16:3e:00:00:00"),
    cfg.IntOpt('mac_generation_retries', default=16),
    cfg.BoolOpt('allow_bulk', default=True),
    cfg.IntOpt('max_dns_nameservers', default=5),
    cfg.IntOpt('max_subnet_host_routes', default=20),
    cfg.IntOpt('dhcp_lease_duration', default=120),
    cfg.BoolOpt('allow_overlapping_ips', default=False),
    cfg.StrOpt('host', default=utils.get_hostname()),
    cfg.BoolOpt('force_gateway_on_subnet', default=False,
                help=_("Ensure that configured gateway is on subnet")),
]

core_cli_opts = [
    cfg.StrOpt('state_path', default='/var/lib/quantum'),
]

# Register the configuration options
cfg.CONF.register_opts(core_opts)
cfg.CONF.register_cli_opts(core_cli_opts)


def parse(args):
    rpc.set_defaults(control_exchange='quantum')
    cfg.CONF(args=args, project='quantum',
             version='%%prog %s' % quantum_version.version_string_with_vcs())

    # Validate that the base_mac is of the correct format
    msg = attributes._validate_regex(cfg.CONF.base_mac,
                                     attributes.MAC_PATTERN)
    if msg:
        msg = "Base MAC: %s" % msg<commit_msg>Ensure that agents also set control_exchange<commit_after># vim: tabstop=4 shiftwidth=4 softtabstop=4

# Copyright 2011 Nicira Networks, Inc.
# All Rights Reserved.
#
#    Licensed under the Apache License, Version 2.0 (the "License"); you may
#    not use this file except in compliance with the License. You may obtain
#    a copy of the License at
#
#         http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
#    License for the specific language governing permissions and limitations
#    under the License.

"""
Routines for configuring Quantum
"""

import os

from paste import deploy

from quantum.api.v2 import attributes
from quantum.common import utils
from quantum.openstack.common import cfg
from quantum.openstack.common import log as logging
from quantum.openstack.common import rpc
from quantum.version import version_info as quantum_version


LOG = logging.getLogger(__name__)

core_opts = [
    cfg.StrOpt('bind_host', default='0.0.0.0'),
    cfg.IntOpt('bind_port', default=9696),
    cfg.StrOpt('api_paste_config', default="api-paste.ini"),
    cfg.StrOpt('api_extensions_path', default=""),
    cfg.StrOpt('policy_file', default="policy.json"),
    cfg.StrOpt('auth_strategy', default='keystone'),
    cfg.StrOpt('core_plugin'),
    cfg.ListOpt('service_plugins',
                default=[]),
    cfg.StrOpt('base_mac', default="fa:16:3e:00:00:00"),
    cfg.IntOpt('mac_generation_retries', default=16),
    cfg.BoolOpt('allow_bulk', default=True),
    cfg.IntOpt('max_dns_nameservers', default=5),
    cfg.IntOpt('max_subnet_host_routes', default=20),
    cfg.IntOpt('dhcp_lease_duration', default=120),
    cfg.BoolOpt('allow_overlapping_ips', default=False),
    cfg.StrOpt('host', default=utils.get_hostname()),
    cfg.BoolOpt('force_gateway_on_subnet', default=False,
                help=_("Ensure that configured gateway is on subnet")),
]

core_cli_opts = [
    cfg.StrOpt('state_path', default='/var/lib/quantum'),
]

# Register the configuration options
cfg.CONF.register_opts(core_opts)
cfg.CONF.register_cli_opts(core_cli_opts)

# Ensure that the control exchange is set correctly
rpc.set_defaults(control_exchange='quantum')


def parse(args):
    cfg.CONF(args=args, project='quantum',
             version='%%prog %s' % quantum_version.version_string_with_vcs())

    # Validate that the base_mac is of the correct format
    msg = attributes._validate_regex(cfg.CONF.base_mac,
                                     attributes.MAC_PATTERN)
    if msg:
        msg = "Base MAC: %s" % msg
{'fraction_non_alphanumeric': 0.11429098966026588, 'fraction_numerical': 0.013663220088626292, 'mean_word_length': 4.081613508442777, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2726108', 'n_tokens_mistral': 1691, 'n_tokens_neox': 1638, 'n_words': 428}