1 # Copyright (C) 2011 Nippon Telegraph and Telephone Corporation.
2 # Copyright (C) 2011 Isaku Yamahata <yamahata at valinux co jp>
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
20 from distutils.version import LooseVersion
26 CONF.register_cli_opts([
28 cfg.StrOpt('target', default='0000000000000001', help='target sw dp-id'),
29 cfg.StrOpt('tester', default='0000000000000002', help='tester sw dp-id'),
30 cfg.IntOpt('target_recv_port', default=1,
31 help='target sw receiving port '
33 cfg.IntOpt('target_send_port_1', default=2,
34 help='target sw sending port 1 '
36 cfg.IntOpt('target_send_port_2', default=3,
37 help='target sw sending port 2 '
39 cfg.IntOpt('tester_send_port', default=1,
40 help='tester sw sending port '
42 cfg.IntOpt('tester_recv_port_1', default=2,
43 help='tester sw receiving port 1 '
45 cfg.IntOpt('tester_recv_port_2', default=3,
46 help='tester sw receiving port 2 '
48 cfg.StrOpt('dir', default='ryu/tests/switch/of13',
49 help='test files directory'),
50 cfg.StrOpt('target-version', default='openflow13',
51 help='target sw OFP version '
52 '[openflow10|openflow13|openflow14] '
53 '(default: openflow13)'),
54 cfg.StrOpt('tester-version', default='openflow13',
55 help='tester sw OFP version '
56 '[openflow10|openflow13|openflow14] '
57 '(default: openflow13)'),
58 cfg.IntOpt('interval', default=0,
59 help='interval time in seconds of each test '
61 ], group='test-switch')
64 DEFAULT_RPC_PORT = 50002
65 DEFAULT_RPC_HOST = '0.0.0.0'
67 CONF.register_cli_opts([
68 cfg.IntOpt('rpc-port', default=DEFAULT_RPC_PORT,
69 help='Port for RPC server (default: %s)' % DEFAULT_RPC_PORT),
70 cfg.StrOpt('rpc-host', default=DEFAULT_RPC_HOST,
71 help='IP for RPC server (default: %s)' % DEFAULT_RPC_HOST),
72 cfg.StrOpt('config-file', default=None,
73 help='The config file formatted in Python source file. '
74 'Please refer to "bgp_sample_conf.py" for details.')
78 DEFAULT_ZSERV_HOST = '/var/run/quagga/zserv.api'
79 DEFAULT_ZSERV_PORT = 2600
80 DEFAULT_ZSERV_VERSION = 2 # Version of Ubuntu 16.04 LTS packaged Quagga
81 DEFAULT_ZSERV_CLIENT_ROUTE_TYPE = 'BGP'
82 DEFAULT_ZSERV_INTERVAL = 10
83 DEFAULT_ZSERV_DATABASE = 'sqlite:///zebra.db'
84 DEFAULT_ZSERV_ROUTER_ID = '1.1.1.1'
85 # For the backward compatibility with Quagga, the default FRRouting version
87 DEFAULT_ZSERV_FRR_VERSION = '0.0'
89 # Hack: In oslo_config.cfg.Opt, ConfigType might access __class__ attribute
90 # for equal comparison, but on Python 2, LooseVersion does not have __class__
91 # attribute and it causes AttributeError. So here inject __class__ attribute
92 # into LooseVersion class.
93 if not hasattr(LooseVersion, '__class__'):
94 LooseVersion.__class__ = LooseVersion
96 CONF.register_cli_opts([
98 'server-host', default=DEFAULT_ZSERV_HOST,
99 help='Path to Unix Socket or IP address of Zebra server '
100 '(default: %s)' % DEFAULT_ZSERV_HOST),
102 'server-port', default=DEFAULT_ZSERV_PORT,
103 help='Port number of Zebra server '
105 % DEFAULT_ZSERV_PORT),
107 'server-version', default=DEFAULT_ZSERV_VERSION,
108 help='Zebra protocol version of Zebra server '
109 '(default: %s)' % DEFAULT_ZSERV_VERSION),
111 'client-route-type', default=DEFAULT_ZSERV_CLIENT_ROUTE_TYPE,
112 help='Zebra route type advertised by Zebra client service. '
113 '(default: %s)' % DEFAULT_ZSERV_CLIENT_ROUTE_TYPE),
115 'retry-interval', default=DEFAULT_ZSERV_INTERVAL,
116 help='Retry interval connecting to Zebra server '
117 '(default: %s)' % DEFAULT_ZSERV_INTERVAL),
119 'db-url', default=DEFAULT_ZSERV_DATABASE,
120 help='URL to database used by Zebra protocol service '
121 '(default: %s)' % DEFAULT_ZSERV_DATABASE),
123 'router-id', default=DEFAULT_ZSERV_ROUTER_ID,
124 help='Initial Router ID used by Zebra protocol service '
125 '(default: %s)' % DEFAULT_ZSERV_ROUTER_ID),
127 'frr-version', LooseVersion, default=DEFAULT_ZSERV_FRR_VERSION,
128 help='FRRouting version when integrated with FRRouting (e.g., 3.0)'),