| 1 |
# Copyright 2015 OpenStack Foundation |
| 2 |
# All Rights Reserved. |
| 3 |
# |
| 4 |
# Licensed under the Apache License, Version 2.0 (the "License"); you may |
| 5 |
# not use this file except in compliance with the License. You may obtain |
| 6 |
# a copy of the License at |
| 7 |
# |
| 8 |
# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
# |
| 10 |
# Unless required by applicable law or agreed to in writing, software |
| 11 |
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
| 12 |
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the |
| 13 |
# License for the specific language governing permissions and limitations |
| 14 |
# under the License. |
| 15 |
|
| 16 |
from neutron.common import config |
| 17 |
|
| 18 |
from oslo_config import cfg |
| 19 |
|
| 20 |
from networking_l2gw._i18n import _ |
| 21 |
|
| 22 |
|
| 23 |
OVSDB_OPTS = [ |
| 24 |
cfg.StrOpt('ovsdb_hosts', |
| 25 |
default='host1:127.0.0.1:6632', |
| 26 |
help=_("OVSDB server name:host/IP:port")), |
| 27 |
cfg.StrOpt('l2_gw_agent_priv_key_base_path', |
| 28 |
help=_('L2 gateway agent private key')), |
| 29 |
cfg.StrOpt('l2_gw_agent_cert_base_path', |
| 30 |
help=_('L2 gateway agent public certificate')), |
| 31 |
cfg.StrOpt('l2_gw_agent_ca_cert_base_path', |
| 32 |
help=_('Trusted issuer CA cert')), |
| 33 |
cfg.IntOpt('periodic_interval', |
| 34 |
default=20, |
| 35 |
help=_('Seconds between periodic task runs')), |
| 36 |
cfg.IntOpt('socket_timeout', |
| 37 |
default=30, |
| 38 |
help=_('Socket timeout in seconds. ' |
| 39 |
'If there is no echo request on the socket for ' |
| 40 |
'socket_timeout seconds, the agent can safely ' |
| 41 |
'assume that the connection with the remote ' |
| 42 |
'OVSDB server is lost')), |
| 43 |
cfg.BoolOpt('enable_manager', |
| 44 |
default=False, |
| 45 |
help=_('Set to True if ovsdb Manager manages the client')), |
| 46 |
cfg.PortOpt('manager_table_listening_port', |
| 47 |
default=6632, |
| 48 |
help=_('Set port number for l2gw agent, so that it can ' |
| 49 |
'listen to whenever its IP is entered in manager ' |
| 50 |
'table of ovsdb server, For Ex: tcp:x.x.x.x:6640, ' |
| 51 |
'where x.x.x.x is IP of l2gw agent')), |
| 52 |
cfg.IntOpt('max_connection_retries', |
| 53 |
default=10, |
| 54 |
help=_('Maximum number of retries to open a socket ' |
| 55 |
'with the OVSDB server')) |
| 56 |
] |
| 57 |
|
| 58 |
L2GW_OPTS = [ |
| 59 |
cfg.StrOpt('default_interface_name', |
| 60 |
default='FortyGigE1/0/1', |
| 61 |
help=_('default_interface_name of the l2 gateway')), |
| 62 |
cfg.StrOpt('default_device_name', |
| 63 |
default='Switch1', |
| 64 |
help=_('default_device_name of the l2 gateway')), |
| 65 |
cfg.IntOpt('quota_l2_gateway', |
| 66 |
default=5, |
| 67 |
help=_('Number of l2 gateways allowed per tenant, ' |
| 68 |
'-1 for unlimited')), |
| 69 |
cfg.IntOpt('periodic_monitoring_interval', |
| 70 |
default=5, |
| 71 |
help=_('Periodic interval at which the plugin ' |
| 72 |
'checks for the monitoring L2 gateway agent')), |
| 73 |
cfg.StrOpt('l2gw_callback_class', |
| 74 |
default='networking_l2gw.services.l2gateway.ovsdb.' |
| 75 |
'data.L2GatewayOVSDBCallbacks', |
| 76 |
help=_('L2 gateway plugin callback class where the ' |
| 77 |
'RPCs from the agent are going to get invoked')) |
| 78 |
] |
| 79 |
|
| 80 |
|
| 81 |
def register_l2gw_opts_helper(): |
| 82 |
cfg.CONF.register_opts(L2GW_OPTS) |
| 83 |
|
| 84 |
|
| 85 |
def register_ovsdb_opts_helper(conf): |
| 86 |
conf.register_opts(OVSDB_OPTS, 'ovsdb') |
| 87 |
|
| 88 |
|
| 89 |
# add a logging setup method here for convenience |
| 90 |
setup_logging = config.setup_logging |