def api_common_opts(): _COMMON = [ cfg.IPOpt('bind-host', default='0.0.0.0', dest='bind_host', help='IP address to listen on. Default is 0.0.0.0'), cfg.PortOpt('bind-port', default=9090, dest='bind_port', help='Port number to listen on. Default is 9090') ] return _COMMON
def api_common_opts(): _COMMON = [ cfg.IPOpt('bind-host', default='0.0.0.0', dest='bind_host', help='IP address to listen on. Default is 0.0.0.0'), cfg.PortOpt('bind-port', default=9090, dest='bind_port', help='Port number to listen on. Default is 9090'), cfg.BoolOpt('enable_v1_api', default=True, help="""Deploy the v1 OpenStack Freezer API. When this option is set to ``True``, Freezer-api service will respond to requests on registered endpoints conforming to the v1 OpenStack Freezer API. NOTES: * Multi-tenancy is not supported under this api version. * Everything is user based. * Freezer api v1 doesn't support Oslo.db. * Use elasticsearch db with v1 api version Possible values: * True * False Related options: * enable_v2_api """), cfg.BoolOpt('enable_v2_api', default=True, help="""Deploy the v2 OpenStack Freezer API. When this option is set to ``True``, Freezer-api service will respond to requests on registered endpoints conforming to the v2 OpenStack Freezer api. NOTES: * Multi-tenancy is supported under this api version. * Freezer api v2 supports Oslo.db. * Recommended to use oslo.db with api v2 Possible values: * True * False Related options: * enable_v1_api """) ] return _COMMON
help=_("Integration bridge to use. " "Do not change this parameter unless you have a good " "reason to. This is the name of the OVS integration " "bridge. There is one per hypervisor. The integration " "bridge acts as a virtual 'patch bay'. All VM VIFs are " "attached to this bridge and then 'patched' according " "to their network connectivity.")), cfg.StrOpt('tunnel_bridge', default='br-tun', help=_("Tunnel bridge to use.")), cfg.StrOpt('int_peer_patch_port', default='patch-tun', help=_("Peer patch port in integration bridge for tunnel " "bridge.")), cfg.StrOpt('tun_peer_patch_port', default='patch-int', help=_("Peer patch port in tunnel bridge for integration " "bridge.")), cfg.IPOpt('local_ip', version=4, help=_("Local IP address of tunnel endpoint.")), cfg.ListOpt('bridge_mappings', default=DEFAULT_BRIDGE_MAPPINGS, help=_("Comma-separated list of <physical_network>:<bridge> " "tuples mapping physical network names to the agent's " "node-specific Open vSwitch bridge names to be used " "for flat and VLAN networks. The length of bridge " "names should be no more than 11. Each bridge must " "exist, and should have a physical network interface " "configured as a port. All physical networks " "configured on the server should have mappings to " "appropriate bridges on each agent. " "Note: If you remove a bridge from this " "mapping, make sure to disconnect it from the " "integration bridge as it won't be managed by the " "agent anymore. Deprecated for ofagent.")),
# 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. from oslo_config import cfg influxdb_opts = [ cfg.StrOpt('database_name', help='database name where metrics are stored', default='mon'), cfg.IPOpt('ip_address', help='ip address to influxdb'), cfg.PortOpt('port', help='port to influxdb', default=8086), cfg.StrOpt('user', help='influxdb user ', default='mon_persister'), cfg.StrOpt('password', secret=True, help='influxdb password') ] influxdb_group = cfg.OptGroup(name='influxdb', title='influxdb') def register_opts(conf): conf.register_group(influxdb_group) conf.register_opts(influxdb_opts, influxdb_group) def list_opts(): return influxdb_group, influxdb_opts
from oslo_utils import units import six from six.moves import urllib from cinder import exception from cinder.i18n import _ from cinder import interface from cinder import utils from cinder.volume import driver from cinder.volume.drivers.zte import zte_pub LOG = logging.getLogger(__name__) zte_opts = [ cfg.IPOpt('zteControllerIP0', default=None, help='Main controller IP.'), cfg.IPOpt('zteControllerIP1', default=None, help='Slave controller IP.'), cfg.IPOpt('zteLocalIP', default=None, help='Local IP.'), cfg.StrOpt('zteUserName', default=None, help='User name.'), cfg.StrOpt('zteUserPassword', default=None, secret=True, help='User password.'), cfg.IntOpt('zteChunkSize', default=4, help='Virtual block size of pool. ' 'Unit : KB. ' 'Valid value : 4, 8, 16, 32, 64, 128, 256, 512. '), cfg.IntOpt('zteAheadReadSize', default=8, help='Cache readahead size.'), cfg.IntOpt('zteCachePolicy', default=1, help='Cache policy. ' '0, Write Back; 1, Write Through.'), cfg.IntOpt('zteSSDCacheSwitch', default=1,
from routes import middleware import webob.dec import webob.exc from heat.api.aws import exception as aws_exception from heat.common import exception from heat.common.i18n import _ from heat.common import serializers LOG = logging.getLogger(__name__) URL_LENGTH_LIMIT = 50000 api_opts = [ cfg.IPOpt('bind_host', default='0.0.0.0', help=_('Address to bind the server. Useful when ' 'selecting a particular network interface.'), deprecated_group='DEFAULT'), cfg.PortOpt('bind_port', default=8004, help=_('The port on which the server will listen.'), deprecated_group='DEFAULT'), cfg.IntOpt('backlog', default=4096, help=_("Number of backlog requests " "to configure the socket with."), deprecated_group='DEFAULT'), cfg.StrOpt('cert_file', help=_("Location of the SSL certificate file " "to use for SSL mode."), deprecated_group='DEFAULT'), cfg.StrOpt('key_file', help=_("Location of the SSL key file to use " "for enabling SSL mode."),
help='if support graceful restart'), cfg.BoolOpt('cisco_multi_session', default=True, help='if support cisco multi session'), cfg.DictOpt('running_config', default={}, help='The running configuration for BGP'), cfg.StrOpt('config_file', help='BGP peers configuration file') ] CONF.register_opts(bgp_config_opts, group='bgp') bgp_peer_conf_cli_opts = [ cfg.IntOpt('remote_as', help='The remote BGP peer AS number'), cfg.IntOpt('local_as', help='The Local BGP AS number'), cfg.IPOpt('remote_addr', help='The remote address of the peer'), cfg.IntOpt('remote_port', default=179, help='The remote port of the peer'), cfg.IPOpt('local_addr', default='0.0.0.0', help='The local address of the BGP'), cfg.StrOpt('md5', help='The MD5 string use to auth', secret=True), cfg.BoolOpt('rib', default=False, help='Whether maintain BGP rib table'), cfg.StrOpt('tag', choices=['SRC', 'DST', 'BOTH', 'MON'], help='The agent role tag'), cfg.ListOpt( 'afi_safi', default=['ipv4'], help='The Global config for address family and sub address family') ]
class GeneratorTestCase(base.BaseTestCase): groups = { 'group1': cfg.OptGroup(name='group1', help='Lorem ipsum dolor sit amet, consectetur ' 'adipisicing elit, sed do eiusmod tempor ' 'incididunt ut labore et dolore magna ' 'aliqua. Ut enim ad minim veniam, quis ' 'nostrud exercitation ullamco laboris ' 'nisi ut aliquip ex ea commodo ' 'consequat. Duis aute irure dolor in.'), 'group2': cfg.OptGroup(name='group2', title='Group 2'), 'foo': cfg.OptGroup(name='foo', title='Foo Title', help='foo help'), } opts = { 'foo': cfg.StrOpt('foo', help='foo option'), 'bar': cfg.StrOpt('bar', help='bar option'), 'foo-bar': cfg.StrOpt('foo-bar', help='foobar'), 'no_help': cfg.StrOpt('no_help'), 'long_help': cfg.StrOpt('long_help', help='Lorem ipsum dolor sit amet, consectetur ' 'adipisicing elit, sed do eiusmod tempor ' 'incididunt ut labore et dolore magna ' 'aliqua. Ut enim ad minim veniam, quis ' 'nostrud exercitation ullamco laboris ' 'nisi ut aliquip ex ea commodo ' 'consequat. Duis aute irure dolor in ' 'reprehenderit in voluptate velit esse ' 'cillum dolore eu fugiat nulla ' 'pariatur. Excepteur sint occaecat ' 'cupidatat non proident, sunt in culpa ' 'qui officia deserunt mollit anim id est ' 'laborum.'), 'long_help_pre': cfg.StrOpt('long_help_pre', help='This is a very long help text which ' 'is preformatted with line breaks. ' 'It should break when it is too long ' 'but also keep the specified line ' 'breaks. This makes it possible to ' 'create lists with items:\n' '\n' '* item 1\n' '* item 2\n' '\n' 'and should increase the ' 'readability.'), 'choices_opt': cfg.StrOpt('choices_opt', default='a', choices=(None, '', 'a', 'b', 'c'), help='a string with choices'), 'deprecated_opt_without_deprecated_group': cfg.StrOpt('bar', deprecated_name='foobar', help='deprecated'), 'deprecated_for_removal_opt': cfg.StrOpt('bar', deprecated_for_removal=True, help='deprecated for removal'), 'deprecated_reason_opt': cfg.BoolOpt( 'turn_off_stove', default=False, deprecated_for_removal=True, deprecated_reason='This was supposed to work but it really, ' 'really did not. Always buy house insurance.', help='DEPRECATED: Turn off stove'), 'deprecated_opt_with_deprecated_since': cfg.BoolOpt('tune_in', deprecated_for_removal=True, deprecated_since='13.0'), 'deprecated_opt_with_deprecated_group': cfg.StrOpt('bar', deprecated_name='foobar', deprecated_group='group1', help='deprecated'), 'opt_with_DeprecatedOpt': cfg.BoolOpt( 'foo-bar', help='Opt with DeprecatedOpt', deprecated_opts=[cfg.DeprecatedOpt('foo-bar', group='deprecated')]), # Unknown Opt default must be a string 'unknown_type': cfg.Opt('unknown_opt', default='123', help='unknown', type=types.String(type_name='unknown type')), 'str_opt': cfg.StrOpt('str_opt', default='foo bar', help='a string'), 'str_opt_sample_default': cfg.StrOpt('str_opt', default='fooishbar', help='a string'), 'str_opt_with_space': cfg.StrOpt('str_opt', default=' foo bar ', help='a string with spaces'), 'bool_opt': cfg.BoolOpt('bool_opt', default=False, help='a boolean'), 'int_opt': cfg.IntOpt('int_opt', default=10, min=1, max=20, help='an integer'), 'int_opt_min_0': cfg.IntOpt('int_opt_min_0', default=10, min=0, max=20, help='an integer'), 'int_opt_max_0': cfg.IntOpt('int_opt_max_0', default=-1, max=0, help='an integer'), 'float_opt': cfg.FloatOpt('float_opt', default=0.1, help='a float'), 'list_opt': cfg.ListOpt('list_opt', default=['1', '2', '3'], help='a list'), 'dict_opt': cfg.DictOpt('dict_opt', default={ '1': 'yes', '2': 'no' }, help='a dict'), 'ip_opt': cfg.IPOpt('ip_opt', default='127.0.0.1', help='an ip address'), 'port_opt': cfg.PortOpt('port_opt', default=80, help='a port'), 'hostname_opt': cfg.HostnameOpt('hostname_opt', default='compute01.nova.site1', help='a hostname'), 'uri_opt': cfg.URIOpt('uri_opt', default='http://example.com', help='a URI'), 'multi_opt': cfg.MultiStrOpt('multi_opt', default=['1', '2', '3'], help='multiple strings'), 'multi_opt_none': cfg.MultiStrOpt('multi_opt_none', help='multiple strings'), 'multi_opt_empty': cfg.MultiStrOpt('multi_opt_empty', default=[], help='multiple strings'), 'multi_opt_sample_default': cfg.MultiStrOpt('multi_opt', default=['1', '2', '3'], sample_default=['5', '6'], help='multiple strings'), 'string_type_with_bad_default': cfg.Opt('string_type_with_bad_default', help='string with bad default', default=4096), 'native_str_type': cfg.Opt('native_str_type', help='native help', type=str), 'native_int_type': cfg.Opt('native_int_type', help='native help', type=int), 'native_float_type': cfg.Opt('native_float_type', help='native help', type=float), 'custom_type': cfg.Opt('custom_type', help='custom help', type=custom_type), 'custom_type_name': cfg.Opt('custom_opt_type', type=types.Integer(type_name='port' ' number'), default=5511, help='this is a port'), } content_scenarios = [ ('empty', dict(opts=[], expected='''[DEFAULT] ''')), ('single_namespace', dict(opts=[('test', [(None, [opts['foo']])])], expected='''[DEFAULT] # # From test # # foo option (string value) #foo = <None> ''')), ('multiple_namespaces', dict(opts=[('test', [(None, [opts['foo']])]), ('other', [(None, [opts['bar']])])], expected='''[DEFAULT] # # From other # # bar option (string value) #bar = <None> # # From test # # foo option (string value) #foo = <None> ''')), ('group', dict(opts=[('test', [(groups['group1'], [opts['foo']])])], expected='''[DEFAULT] [group1] # Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do # eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim # ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut # aliquip ex ea commodo consequat. Duis aute irure dolor in. # # From test # # foo option (string value) #foo = <None> ''')), ('empty_group', dict(opts=[('test', [(groups['group1'], [])])], expected='''[DEFAULT] ''')), ('multiple_groups', dict(opts=[('test', [(groups['group1'], [opts['foo']]), (groups['group2'], [opts['bar']])])], expected='''[DEFAULT] [group1] # Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do # eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim # ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut # aliquip ex ea commodo consequat. Duis aute irure dolor in. # # From test # # foo option (string value) #foo = <None> [group2] # # From test # # bar option (string value) #bar = <None> ''')), ('group_in_multiple_namespaces', dict(opts=[('test', [(groups['group1'], [opts['foo']])]), ('other', [(groups['group1'], [opts['bar']])])], expected='''[DEFAULT] [group1] # Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do # eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim # ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut # aliquip ex ea commodo consequat. Duis aute irure dolor in. # # From other # # bar option (string value) #bar = <None> # # From test # # foo option (string value) #foo = <None> ''')), ('hyphenated_name', dict(opts=[('test', [(None, [opts['foo-bar']])])], expected='''[DEFAULT] # # From test # # foobar (string value) #foo_bar = <None> ''')), ('no_help', dict(opts=[('test', [(None, [opts['no_help']])])], log_warning=('"%s" is missing a help string', 'no_help'), expected='''[DEFAULT] # # From test # # (string value) #no_help = <None> ''')), ('long_help', dict(opts=[('test', [(None, [opts['long_help']])])], expected='''[DEFAULT] # # From test # # Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do # eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim # ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut # aliquip ex ea commodo consequat. Duis aute irure dolor in # reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla # pariatur. Excepteur sint occaecat cupidatat non proident, sunt in # culpa qui officia deserunt mollit anim id est laborum. (string # value) #long_help = <None> ''')), ('long_help_wrap_at_40', dict(opts=[('test', [(None, [opts['long_help']])])], wrap_width=40, expected='''[DEFAULT] # # From test # # Lorem ipsum dolor sit amet, # consectetur adipisicing elit, sed do # eiusmod tempor incididunt ut labore et # dolore magna aliqua. Ut enim ad minim # veniam, quis nostrud exercitation # ullamco laboris nisi ut aliquip ex ea # commodo consequat. Duis aute irure # dolor in reprehenderit in voluptate # velit esse cillum dolore eu fugiat # nulla pariatur. Excepteur sint # occaecat cupidatat non proident, sunt # in culpa qui officia deserunt mollit # anim id est laborum. (string value) #long_help = <None> ''')), ( 'long_help_no_wrapping', dict( opts=[('test', [(None, [opts['long_help']])])], wrap_width=0, expected='''[DEFAULT] # # From test # ''' # noqa '# Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod ' 'tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, ' 'quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo ' 'consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse ' 'cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat ' 'non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. ' '(string value)' ''' #long_help = <None> ''')), ('long_help_with_preformatting', dict(opts=[('test', [(None, [opts['long_help_pre']])])], wrap_width=70, expected='''[DEFAULT] # # From test # # This is a very long help text which is preformatted with line # breaks. It should break when it is too long but also keep the # specified line breaks. This makes it possible to create lists with # items: # # * item 1 # * item 2 # # and should increase the readability. (string value) #long_help_pre = <None> ''')), ('choices_opt', dict(opts=[('test', [(None, [opts['choices_opt']])])], expected='''[DEFAULT] # # From test # # a string with choices (string value) # Allowed values: <None>, '', a, b, c #choices_opt = a ''')), ('deprecated opt without deprecated group', dict(opts=[('test', [ (groups['foo'], [opts['deprecated_opt_without_deprecated_group']]) ])], expected='''[DEFAULT] [foo] # foo help # # From test # # deprecated (string value) # Deprecated group/name - [foo]/foobar #bar = <None> ''')), ('deprecated_for_removal', dict(opts=[('test', [(groups['foo'], [opts['deprecated_for_removal_opt']])])], expected='''[DEFAULT] [foo] # foo help # # From test # # DEPRECATED: deprecated for removal (string value) # This option is deprecated for removal. # Its value may be silently ignored in the future. #bar = <None> ''')), ('deprecated_reason', dict(opts=[('test', [(groups['foo'], [opts['deprecated_reason_opt']]) ])], expected='''[DEFAULT] [foo] # foo help # # From test # # DEPRECATED: Turn off stove (boolean value) # This option is deprecated for removal. # Its value may be silently ignored in the future. # Reason: This was supposed to work but it really, really did not. # Always buy house insurance. #turn_off_stove = false ''')), ('deprecated_opt_with_deprecated_group', dict(opts=[('test', [ (groups['foo'], [opts['deprecated_opt_with_deprecated_group']]) ])], expected='''[DEFAULT] [foo] # foo help # # From test # # deprecated (string value) # Deprecated group/name - [group1]/foobar #bar = <None> ''')), ('unknown_type', dict(opts=[('test', [(None, [opts['unknown_type']])])], expected='''[DEFAULT] # # From test # # unknown (unknown type) #unknown_opt = 123 ''')), ('str_opt', dict(opts=[('test', [(None, [opts['str_opt']])])], expected='''[DEFAULT] # # From test # # a string (string value) #str_opt = foo bar ''')), ('str_opt_with_space', dict(opts=[('test', [(None, [opts['str_opt_with_space']])])], expected='''[DEFAULT] # # From test # # a string with spaces (string value) #str_opt = " foo bar " ''')), ('bool_opt', dict(opts=[('test', [(None, [opts['bool_opt']])])], expected='''[DEFAULT] # # From test # # a boolean (boolean value) #bool_opt = false ''')), ('int_opt', dict(opts=[('test', [(None, [opts['int_opt']])])], expected='''[DEFAULT] # # From test # # an integer (integer value) # Minimum value: 1 # Maximum value: 20 #int_opt = 10 ''')), ('int_opt_min_0', dict(opts=[('test', [(None, [opts['int_opt_min_0']])])], expected='''[DEFAULT] # # From test # # an integer (integer value) # Minimum value: 0 # Maximum value: 20 #int_opt_min_0 = 10 ''')), ('int_opt_max_0', dict(opts=[('test', [(None, [opts['int_opt_max_0']])])], expected='''[DEFAULT] # # From test # # an integer (integer value) # Maximum value: 0 #int_opt_max_0 = -1 ''')), ('float_opt', dict(opts=[('test', [(None, [opts['float_opt']])])], expected='''[DEFAULT] # # From test # # a float (floating point value) #float_opt = 0.1 ''')), ('list_opt', dict(opts=[('test', [(None, [opts['list_opt']])])], expected='''[DEFAULT] # # From test # # a list (list value) #list_opt = 1,2,3 ''')), ('dict_opt', dict(opts=[('test', [(None, [opts['dict_opt']])])], expected='''[DEFAULT] # # From test # # a dict (dict value) #dict_opt = 1:yes,2:no ''')), ('ip_opt', dict(opts=[('test', [(None, [opts['ip_opt']])])], expected='''[DEFAULT] # # From test # # an ip address (IP address value) #ip_opt = 127.0.0.1 ''')), ('port_opt', dict(opts=[('test', [(None, [opts['port_opt']])])], expected='''[DEFAULT] # # From test # # a port (port value) # Minimum value: 0 # Maximum value: 65535 #port_opt = 80 ''')), ('hostname_opt', dict(opts=[('test', [(None, [opts['hostname_opt']])])], expected='''[DEFAULT] # # From test # # a hostname (hostname value) #hostname_opt = compute01.nova.site1 ''')), ('multi_opt', dict(opts=[('test', [(None, [opts['multi_opt']])])], expected='''[DEFAULT] # # From test # # multiple strings (multi valued) #multi_opt = 1 #multi_opt = 2 #multi_opt = 3 ''')), ('multi_opt_none', dict(opts=[('test', [(None, [opts['multi_opt_none']])])], expected='''[DEFAULT] # # From test # # multiple strings (multi valued) #multi_opt_none = ''')), ('multi_opt_empty', dict(opts=[('test', [(None, [opts['multi_opt_empty']])])], expected='''[DEFAULT] # # From test # # multiple strings (multi valued) #multi_opt_empty = ''')), ('str_opt_sample_default', dict(opts=[('test', [(None, [opts['str_opt_sample_default']])])], expected='''[DEFAULT] # # From test # # a string (string value) #str_opt = fooishbar ''')), ('native_str_type', dict(opts=[('test', [(None, [opts['native_str_type']])])], expected='''[DEFAULT] # # From test # # native help (string value) #native_str_type = <None> ''')), ('native_int_type', dict(opts=[('test', [(None, [opts['native_int_type']])])], expected='''[DEFAULT] # # From test # # native help (integer value) #native_int_type = <None> ''')), ('native_float_type', dict(opts=[('test', [(None, [opts['native_float_type']])])], expected='''[DEFAULT] # # From test # # native help (floating point value) #native_float_type = <None> ''')), ('multi_opt_sample_default', dict(opts=[('test', [(None, [opts['multi_opt_sample_default']])])], expected='''[DEFAULT] # # From test # # multiple strings (multi valued) #multi_opt = 5 #multi_opt = 6 ''')), ('custom_type_name', dict(opts=[('test', [(None, [opts['custom_type_name']])])], expected='''[DEFAULT] # # From test # # this is a port (port number) #custom_opt_type = 5511 ''')), ('custom_type', dict(opts=[('test', [(None, [opts['custom_type']])])], expected='''[DEFAULT] # # From test # # custom help (unknown value) #custom_type = <None> ''')), ('string_type_with_bad_default', dict(opts=[('test', [(None, [opts['string_type_with_bad_default']])]) ], expected='''[DEFAULT] # # From test # # string with bad default (string value) #string_type_with_bad_default = 4096 ''')), ('str_opt_str_group', dict(opts=[('test', [('foo', [opts['str_opt']]), (groups['foo'], [opts['int_opt']])]), ('foo', [('foo', [opts['bool_opt']])])], expected='''[DEFAULT] [foo] # foo help # # From foo # # a boolean (boolean value) #bool_opt = false # # From test # # a string (string value) #str_opt = foo bar # # From test # # an integer (integer value) # Minimum value: 1 # Maximum value: 20 #int_opt = 10 ''')), ('opt_str_opt_group', dict(opts=[('test', [(groups['foo'], [opts['int_opt']]), ('foo', [opts['str_opt']])]), ('foo', [(groups['foo'], [opts['bool_opt']])])], expected='''[DEFAULT] [foo] # foo help # # From foo # # a boolean (boolean value) #bool_opt = false # # From test # # an integer (integer value) # Minimum value: 1 # Maximum value: 20 #int_opt = 10 # # From test # # a string (string value) #str_opt = foo bar ''')), ('opt_with_DeprecatedOpt', dict(opts=[('test', [(None, [opts['opt_with_DeprecatedOpt']])])], expected='''[DEFAULT] # # From test # # Opt with DeprecatedOpt (boolean value) # Deprecated group/name - [deprecated]/foo_bar #foo_bar = <None> ''')), ] output_file_scenarios = [ ('stdout', dict(stdout=True, output_file=None)), ('output_file', dict(output_file='sample.conf', stdout=False)), ] @classmethod def generate_scenarios(cls): cls.scenarios = testscenarios.multiply_scenarios( cls.content_scenarios, cls.output_file_scenarios) def setUp(self): super(GeneratorTestCase, self).setUp() self.conf = cfg.ConfigOpts() self.config_fixture = config_fixture.Config(self.conf) self.config = self.config_fixture.config self.useFixture(self.config_fixture) self.tempdir = self.useFixture(fixtures.TempDir()) def _capture_stream(self, stream_name): self.useFixture( fixtures.MonkeyPatch("sys.%s" % stream_name, moves.StringIO())) return getattr(sys, stream_name) def _capture_stdout(self): return self._capture_stream('stdout') @mock.patch.object(generator, '_get_raw_opts_loaders') @mock.patch.object(generator, 'LOG') def test_generate(self, mock_log, raw_opts_loader): generator.register_cli_opts(self.conf) namespaces = [i[0] for i in self.opts] self.config(namespace=namespaces) for group in self.groups.values(): self.conf.register_group(group) wrap_width = getattr(self, 'wrap_width', None) if wrap_width is not None: self.config(wrap_width=wrap_width) if self.stdout: stdout = self._capture_stdout() else: output_file = self.tempdir.join(self.output_file) self.config(output_file=output_file) # We have a static data structure matching what should be # returned by _list_opts() but we're mocking out a lower level # function that needs to return a namespace and a callable to # return options from that namespace. We have to pass opts to # the lambda to cache a reference to the name because the list # comprehension changes the thing pointed to by the name each # time through the loop. raw_opts_loader.return_value = [(ns, lambda opts=opts: opts) for ns, opts in self.opts] generator.generate(self.conf) if self.stdout: self.assertEqual(self.expected, stdout.getvalue()) else: with open(output_file, 'r') as f: actual = f.read() self.assertEqual(self.expected, actual) log_warning = getattr(self, 'log_warning', None) if log_warning is not None: mock_log.warning.assert_called_once_with(*log_warning) else: self.assertFalse(mock_log.warning.called)
LOG = log.getLogger(__name__) auth_opts = [ cfg.StrOpt('api_paste_config', default="api_paste.ini", help="Configuration file for WSGI definition of API."), cfg.StrOpt('auth_strategy', choices=['noauth', 'keystone'], default='keystone', help=("The strategy to use for auth. Supports noauth and " "keystone")), ] api_opts = [ cfg.IPOpt('host_ip', default='0.0.0.0', help='The listen IP for the cloudkitty API server.'), cfg.PortOpt('port', default=8889, help='The port for the cloudkitty API server.'), cfg.BoolOpt('pecan_debug', default=False, help='Toggle Pecan Debug Middleware.'), ] CONF = cfg.CONF CONF.register_opts(auth_opts) CONF.register_opts(api_opts, group='api') def get_pecan_config():
# 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. from oslo_config import cfg from dragonflow._i18n import _ from neutron.extensions import portbindings DF_OPTS = [ cfg.IPOpt('remote_db_ip', default='127.0.0.1', help=_('The remote db server ip address')), cfg.PortOpt('remote_db_port', default=4001, help=_('The remote db server port')), cfg.ListOpt('remote_db_hosts', default=['$remote_db_ip:$remote_db_port'], help=_('Remote DB cluster host:port pairs.')), cfg.StrOpt('nb_db_class', default='etcd_nb_db_driver', help=_('The driver to use for the NB database')), cfg.IPOpt('local_ip', default='127.0.0.1', help=_('Local host VTEP IP')), cfg.StrOpt('tunnel_type', default='geneve',
from heat.api.aws import exception as aws_exception from heat.common import exception from heat.common.i18n import _ from heat.common.i18n import _LE from heat.common.i18n import _LI from heat.common.i18n import _LW from heat.common import serializers LOG = logging.getLogger(__name__) URL_LENGTH_LIMIT = 50000 api_opts = [ cfg.IPOpt('bind_host', default='0.0.0.0', help=_('Address to bind the server. Useful when ' 'selecting a particular network interface.'), deprecated_group='DEFAULT'), cfg.PortOpt('bind_port', default=8004, help=_('The port on which the server will listen.'), deprecated_group='DEFAULT'), cfg.IntOpt('backlog', default=4096, help=_("Number of backlog requests " "to configure the socket with."), deprecated_group='DEFAULT'), cfg.StrOpt('cert_file', help=_("Location of the SSL certificate file " "to use for SSL mode."), deprecated_group='DEFAULT'),
cfg.IntOpt('workers', help='Number of api worker processes to spawn'), cfg.IntOpt('threads', default=1000, help='Number of api greenthreads to spawn'), cfg.BoolOpt('enable_host_header', default=False, help='Enable host request headers'), cfg.StrOpt('api_base_uri', default='http://127.0.0.1:9001/', help='the url used as the base for all API responses,' 'This should consist of the scheme (http/https),' 'the hostname, port, and any paths that are added' 'to the base of Designate is URLs,' 'For example http://dns.openstack.example.com/dns'), cfg.IPOpt('api_host', deprecated_for_removal=True, deprecated_reason="Replaced by 'listen' option", help='API Bind Host'), cfg.PortOpt('api_port', deprecated_for_removal=True, deprecated_reason="Replaced by 'listen' option", help='API Port Number'), cfg.ListOpt('listen', default=['0.0.0.0:9001'], help='API host:port pairs to listen on'), cfg.StrOpt('api_paste_config', default='api-paste.ini', help='File name for the paste.deploy config for designate-api'), cfg.StrOpt('auth_strategy', default='keystone', help='The strategy to use for auth. Supports noauth or ' 'keystone'),
from cinder import context from cinder import exception from cinder.i18n import _ from cinder.volume import configuration from cinder.volume.drivers.nec import cli from cinder.volume.drivers.san import san from cinder.volume import qos_specs from cinder.volume import volume_types LOG = logging.getLogger(__name__) FLAGS = cfg.CONF mstorage_opts = [ cfg.IPOpt('nec_ismcli_fip', default=None, help='FIP address of M-Series Storage iSMCLI.'), cfg.StrOpt('nec_ismcli_user', default='', help='User name for M-Series Storage iSMCLI.'), cfg.StrOpt('nec_ismcli_password', secret=True, default='', help='Password for M-Series Storage iSMCLI.'), cfg.StrOpt('nec_ismcli_privkey', default='', help='Filename of RSA private key for ' 'M-Series Storage iSMCLI.'), cfg.StrOpt('nec_ldset', default='', help='M-Series Storage LD Set name for Compute Node.'),
from zaqar.common import decorators from zaqar.common.transport.wsgi import helpers from zaqar.i18n import _ from zaqar import transport from zaqar.transport import acl from zaqar.transport import auth from zaqar.transport import validation from zaqar.transport.wsgi import v1_0 from zaqar.transport.wsgi import v1_1 from zaqar.transport.wsgi import v2_0 from zaqar.transport.wsgi import version _WSGI_OPTIONS = ( cfg.IPOpt('bind', default='127.0.0.1', help='Address on which the self-hosting server will listen.'), cfg.PortOpt('port', default=8888, help='Port on which the self-hosting server will listen.'), ) _WSGI_GROUP = 'drivers:transport:wsgi' LOG = logging.getLogger(__name__) def _config_options(): return [(_WSGI_GROUP, _WSGI_OPTIONS)]
dns_opts = [ cfg.BoolOpt('use_designate', default=False, help='Use Designate for internal and external hostnames ' 'resolution'), cfg.ListOpt('nameservers', default=[], help="IP addresses of Designate nameservers. " "This is required if 'use_designate' is True") ] accessible_ip_opts = [ cfg.IPOpt('identity_ip_accessible', default=None, help='IP address of Keystone endpoint, accessible by tenant' ' machines. If not set, the results of the DNS lookup' ' performed where Sahara services are running will be' ' used.'), cfg.IPOpt('object_store_ip_accessible', default=None, help='IP address of Swift endpoint, accessible by tenant' ' machines. If not set, the results of the DNS lookup' ' performed where Sahara services are running will be' ' used.'), ] CONF = cfg.CONF CONF.register_cli_opts(cli_opts) CONF.register_opts(networking_opts) CONF.register_opts(edp_opts) CONF.register_opts(db_opts)
cfg.IntOpt('ttl', help=_("TTL for vxlan interface protocol packets.")), cfg.IntOpt('tos', help=_("TOS for vxlan interface protocol packets.")), cfg.StrOpt('vxlan_group', default=DEFAULT_VXLAN_GROUP, help=_("Multicast group(s) for vxlan interface. A range of " "group addresses may be specified by using CIDR " "notation. Specifying a range allows different VNIs to " "use different group addresses, reducing or eliminating " "spurious broadcast traffic to the tunnel endpoints. " "To reserve a unique group for each possible " "(24-bit) VNI, use a /8 such as 239.0.0.0/8. This " "setting must be the same on all the agents.")), cfg.IPOpt('local_ip', help=_("IP address of local overlay (tunnel) network endpoint. " "Use either an IPv4 or IPv6 address that resides on one " "of the host network interfaces. The IP version of this " "value must match the value of the 'overlay_ip_version' " "option in the ML2 plug-in configuration file on the " "neutron server node(s).")), cfg.PortOpt('udp_srcport_min', default=0, help=_("The minimum of the UDP source port range used for " "VXLAN communication.")), cfg.PortOpt('udp_srcport_max', default=0, help=_("The maximum of the UDP source port range used for " "VXLAN communication.")), cfg.PortOpt('udp_dstport', help=_("The UDP port used for VXLAN communication. By " "default, the Linux kernel doesn't use the IANA " "assigned standard value, so if you want to use it, "
default=None, help=_('Provide an existing Server template name on VThunder ' 'to associate with server')), ] A10_HARDWARE_THUNDER_OPTS = [ config_types.ListOfDictOpt('devices', default=[], item_type=config_types.ListOfObjects(), bounds=True, help=_('List of all device configuration')) ] A10_HEALTH_MANAGER_OPTS = [ cfg.IPOpt('udp_server_ip_address', help=_('Server IP address that sends udp packets for ' 'health manager.')), cfg.IPOpt('bind_ip', default='127.0.0.1', help=_('IP address the controller will listen on for ' 'heart beats')), cfg.IntOpt('failover_timeout', default=600, help=_('Interval(in seconds) to wait before considering ' 'a vThunder is eligible for failover.')), cfg.IntOpt('health_check_timeout', min=1, max=180, default=3, help=_('Specify the Healthcheck timeout(in seconds) in ' ' vThunder. ')),
# # 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. from oslo_config import cfg _DEFAULT_HOST = '127.0.0.1' _DEFAULT_PORT = 8125 _DEFAULT_BUFFER_SIZE = 50 monitoring_opts = [ cfg.IPOpt('statsd_host', default=_DEFAULT_HOST, help=('IP address of statsd server, default to %s' % _DEFAULT_HOST)), cfg.PortOpt('statsd_port', default=_DEFAULT_PORT, help='Port of statsd server, default to %d' % _DEFAULT_PORT), cfg.IntOpt('statsd_buffer', default=_DEFAULT_BUFFER_SIZE, required=True, help=('Maximum number of metric to buffer before sending, ' 'default to %d' % _DEFAULT_BUFFER_SIZE)), cfg.DictOpt('dimensions', default={}, required=False, help='Additional dimensions that can be set') ] monitoring_group = cfg.OptGroup(name='monitoring', title='monitoring')
cfg.BoolOpt('enable_vxlan', default=True, help=_("Enable VXLAN on the agent. Can be enabled when " "agent is managed by ml2 plugin using linuxbridge " "mechanism driver")), cfg.IntOpt('ttl', help=_("TTL for vxlan interface protocol packets.")), cfg.IntOpt('tos', help=_("TOS for vxlan interface protocol packets.")), cfg.StrOpt('vxlan_group', default=DEFAULT_VXLAN_GROUP, help=_("Multicast group(s) for vxlan interface. A range of " "group addresses may be specified by using CIDR " "notation. To reserve a unique group for each possible " "(24-bit) VNI, use a /8 such as 239.0.0.0/8. This " "setting must be the same on all the agents.")), cfg.IPOpt('local_ip', version=4, help=_("Local IP address of the VXLAN endpoints.")), cfg.BoolOpt('l2_population', default=False, help=_("Extension to use alongside ml2 plugin's l2population " "mechanism driver. It enables the plugin to populate " "VXLAN forwarding table.")), ] bridge_opts = [ cfg.ListOpt('physical_interface_mappings', default=DEFAULT_INTERFACE_MAPPINGS, help=_("List of <physical_network>:<physical_interface>")), ] agent_opts = [
def test_encode_ip(self): """Test the json encoding of IP option""" opt = cfg.IPOpt('opt') expected = '"type": {"type": "IPAddress"}' self._test_encode_specific(opt, expected)
TLS_PROTOCOL_CHOICES = [ p[9:].replace('_', '.') for p in ssl._PROTOCOL_NAMES.values() ] core_opts = [ cfg.HostnameOpt('host', default=utils.get_hostname(), help=_("The hostname Octavia is running on")), cfg.StrOpt('octavia_plugins', default='hot_plug_plugin', help=_("Name of the controller plugin to use")), ] api_opts = [ cfg.IPOpt('bind_host', default='127.0.0.1', help=_("The host IP to bind to")), cfg.PortOpt('bind_port', default=9876, help=_("The port to bind to")), cfg.StrOpt( 'auth_strategy', default=constants.KEYSTONE, choices=[constants.NOAUTH, constants.KEYSTONE, constants.TESTING], help=_("The auth strategy for API requests.")), cfg.BoolOpt('allow_pagination', default=True, help=_("Allow the usage of pagination")), cfg.BoolOpt('allow_sorting', default=True, help=_("Allow the usage of sorting")), cfg.BoolOpt('allow_filtering', default=True,
help='Resources scope created by Qinling.' ), cfg.IntOpt( 'replicas', default=3, help='Number of desired replicas in deployment.' ), cfg.StrOpt( 'kube_host', default='127.0.0.1:8001', help='Kubernetes server address, e.g. you can start a proxy to the ' 'Kubernetes API server by using "kubectl proxy" command.' ), cfg.IPOpt( 'qinling_service_address', default='127.0.0.1', help='Qinling API service ip address.' ), ] CONF = cfg.CONF CLI_OPTS = [launch_opt] CONF.register_cli_opts(CLI_OPTS) default_group_opts = itertools.chain(CLI_OPTS, []) def list_opts(): return [ (API_GROUP, api_opts), (PECAN_GROUP, pecan_opts), (ENGINE_GROUP, engine_opts),
LOG = logging.getLogger(__name__) # TODO(rm_work) Remove in or after "R" release API_SETTINGS_DEPRECATION_MESSAGE = _( 'This setting has moved to the [api_settings] section.') core_opts = [ cfg.HostnameOpt('host', default=utils.get_hostname(), help=_("The hostname Octavia is running on")), cfg.StrOpt('octavia_plugins', default='hot_plug_plugin', help=_("Name of the controller plugin to use")), # TODO(johnsom) Remove in or after "R" release cfg.IPOpt('bind_host', help=_("The host IP to bind to"), deprecated_for_removal=True, deprecated_reason=API_SETTINGS_DEPRECATION_MESSAGE), # TODO(johnsom) Remove in or after "R" release cfg.PortOpt('bind_port', help=_("The port to bind to"), deprecated_for_removal=True, deprecated_reason=API_SETTINGS_DEPRECATION_MESSAGE), # TODO(johnsom) Remove in or after "R" release cfg.StrOpt('auth_strategy', choices=[constants.NOAUTH, constants.KEYSTONE, constants.TESTING], help=_("The auth strategy for API requests."), deprecated_for_removal=True, deprecated_reason=API_SETTINGS_DEPRECATION_MESSAGE), # TODO(johnsom) Remove in or after "R" release cfg.StrOpt('api_handler',
"to their network connectivity.")), cfg.StrOpt('tunnel_bridge', default='br-tun', help=_("Tunnel bridge to use.")), cfg.StrOpt('int_peer_patch_port', default='patch-tun', help=_("Peer patch port in integration bridge for tunnel " "bridge.")), cfg.StrOpt('tun_peer_patch_port', default='patch-int', help=_("Peer patch port in tunnel bridge for integration " "bridge.")), cfg.IPOpt('local_ip', help=_("IP address of local overlay (tunnel) network endpoint. " "Use either an IPv4 or IPv6 address that resides on one " "of the host network interfaces. The IP version of this " "value must match the value of the 'overlay_ip_version' " "option in the ML2 plug-in configuration file on the " "neutron server node(s).")), cfg.ListOpt('bridge_mappings', default=DEFAULT_BRIDGE_MAPPINGS, help=_("Comma-separated list of <physical_network>:<bridge> " "tuples mapping physical network names to the agent's " "node-specific Open vSwitch bridge names to be used " "for flat and VLAN networks. The length of bridge " "names should be no more than 11. Each bridge must " "exist, and should have a physical network interface " "configured as a port. All physical networks " "configured on the server should have mappings to " "appropriate bridges on each agent. " "Note: If you remove a bridge from this "
--datapath_type=system # in all other cases """)), cfg.StrOpt( 'host', default=socket.gethostname(), # pylint: disable=no-member help=_(""" It specifies the host name of the target machine. Default: --host=$HOSTNAME # running machine host name """)), cfg.IPOpt('local_ip', help=_(""" IP address of local overlay (tunnel) network end-point. It accepts either an IPv4 or IPv6 address that resides on one of the host network interfaces. The IP version of this value must match the value of the 'overlay_ip_version' option in the ML2 plug-in configuration file on the Neutron server node(s). Default: local_ip= """)), cfg.BoolOpt('ovs_dpdk', default=None, help=_(""" It uses user-space type of virtual interface (vhostuser) instead of the system based one (ovs). If this option is not specified it tries to detect vhostuser support on running host and in case of positive match it uses it. NOTE: if --datapath_type is given then this option is ignored.
from ryu.ofproto import nicira_ext LOG = log.getLogger(__name__) FLOW_IDLE_TIMEOUT = 60 # TODO(oanson) The TCP_* flag constants have already made it into ryu # master, but not to pip. Once that is done, they should be taken from # there. (ryu.lib.packet.tcp.TCP_SYN and ryu.lib.packet.tcp.TCP_ACK) TCP_SYN = 0x002 TCP_ACK = 0x010 DF_METADATA_OPTS = [ cfg.IPOpt( 'ip', default='169.254.169.254', help=_('The IP to which the DF metadata service proxy is bound'), ), cfg.PortOpt( 'port', default='18080', help=_('The port to which the DF metadata service proxy is bound'), ), ] class MetadataServiceApp(df_base_app.DFlowApp): def __init__(self, api, db_store=None, vswitch_api=None, nb_api=None): super(MetadataServiceApp, self).__init__(api, db_store=db_store, vswitch_api=vswitch_api,
DEFAULT_VLAN_RANGES = [] DEFAULT_TUNNEL_RANGES = [] DEFAULT_TUNNEL_TYPES = [] ovs_opts = [ cfg.StrOpt('integration_bridge', default='br-int', help=_("Integration bridge to use.")), cfg.StrOpt('tunnel_bridge', default='br-tun', help=_("Tunnel bridge to use.")), cfg.StrOpt('int_peer_patch_port', default='patch-tun', help=_("Peer patch port in integration bridge for tunnel " "bridge.")), cfg.StrOpt('tun_peer_patch_port', default='patch-int', help=_("Peer patch port in tunnel bridge for integration " "bridge.")), cfg.IPOpt('local_ip', version=4, help=_("Local IP address of tunnel endpoint.")), cfg.ListOpt('bridge_mappings', default=DEFAULT_BRIDGE_MAPPINGS, help=_("List of <physical_network>:<bridge>. " "Deprecated for ofagent.")), cfg.BoolOpt('use_veth_interconnection', default=False, help=_("Use veths instead of patch ports to interconnect the " "integration bridge to physical bridges.")), cfg.StrOpt('of_interface', default='ovsdpdk-ofctl', choices=['ovs-ofctl', 'ovsdpdk-ofctl'], help=_("OpenFlow interface to use.")), ] agent_opts = [ cfg.IntOpt('polling_interval', default=2, help=_("The number of seconds the agent will wait between "
""" import os from oslo_config import cfg from oslo_db import options as db_options from oslo_log import log as logging import oslo_messaging as messaging from kosmos._i18n import _, _LI from kosmos.common import utils from kosmos import version LOG = logging.getLogger(__name__) core_opts = [ cfg.IPOpt('bind_host', default='0.0.0.0', help=_("The host IP to bind to")), cfg.PortOpt('bind_port', default=9876, help=_("The port to bind to")), cfg.StrOpt('host', default=utils.get_hostname(), help=_("The hostname Kosmos is running on")), ] core_cli_opts = [] # Register the configuration options cfg.CONF.register_opts(core_opts) cfg.CONF.register_cli_opts(core_cli_opts) cfg.CONF.register_opts([ cfg.StrOpt(
LOG = log.getLogger(__name__) auth_opts = [ cfg.StrOpt('api_paste_config', default="api_paste.ini", help="Configuration file for WSGI definition of API."), cfg.StrOpt('auth_strategy', choices=['noauth', 'keystone'], default='keystone', help=("The strategy to use for auth. Supports noauth and " "keystone")), ] api_opts = [ cfg.IPOpt('host_ip', default="0.0.0.0", help='Host serving the API.'), cfg.PortOpt('port', default=8889, help='Host port serving the API.'), cfg.BoolOpt('pecan_debug', default=False, help='Toggle Pecan Debug Middleware.'), ] CONF = cfg.CONF CONF.register_opts(auth_opts) CONF.register_opts(api_opts, group='api') def get_pecan_config(): # Set up the pecan configuration filename = api_config.__file__.replace('.pyc', '.py') return pecan.configuration.conf_from_file(filename)
# 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. from oslo_config import cfg from zun.common.i18n import _ api_service_opts = [ cfg.PortOpt('port', default=9512, help='The port for the zun API server.'), cfg.IPOpt('host_ip', default='127.0.0.1', help='The listen IP for the zun API server.'), cfg.BoolOpt('enable_ssl_api', default=False, help=_("Enable the integrated stand-alone API to service " "requests via HTTPS instead of HTTP. If there is a " "front-end service performing HTTPS offloading from " "the service, this option should be False; note, you " "will want to change public API endpoint to represent " "SSL termination URL with 'public_endpoint' option.")), cfg.IntOpt('workers', help=_("Number of workers for zun-api service. " "The default will be the number of CPUs available.")), cfg.IntOpt('max_limit', default=1000, help='The maximum number of items returned in a single '