backing up
[vsorcdistro/.git] / ryu / build / lib.linux-armv7l-2.7 / ryu / flags.py
1 # Copyright (C) 2011 Nippon Telegraph and Telephone Corporation.
2 # Copyright (C) 2011 Isaku Yamahata <yamahata at valinux co jp>
3 #
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
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,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13 # implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 """
17 global flags
18 """
19
20 from distutils.version import LooseVersion
21
22 from ryu import cfg
23
24 CONF = cfg.CONF
25
26 CONF.register_cli_opts([
27     # tests/switch/tester
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 '
32                '(default: 1)'),
33     cfg.IntOpt('target_send_port_1', default=2,
34                help='target sw sending port 1 '
35                '(default: 2)'),
36     cfg.IntOpt('target_send_port_2', default=3,
37                help='target sw sending port 2  '
38                '(default: 3)'),
39     cfg.IntOpt('tester_send_port', default=1,
40                help='tester sw sending port '
41                '(default: 1)'),
42     cfg.IntOpt('tester_recv_port_1', default=2,
43                help='tester sw receiving port 1 '
44                '(default: 2)'),
45     cfg.IntOpt('tester_recv_port_2', default=3,
46                help='tester sw receiving port 2 '
47                '(default: 3)'),
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 '
60                '(default: 0)'),
61 ], group='test-switch')
62
63
64 DEFAULT_RPC_PORT = 50002
65 DEFAULT_RPC_HOST = '0.0.0.0'
66
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.')
75 ], group='bgp-app')
76
77
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
86 # should be None.
87 DEFAULT_ZSERV_FRR_VERSION = '0.0'
88
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
95
96 CONF.register_cli_opts([
97     cfg.StrOpt(
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),
101     cfg.IntOpt(
102         'server-port', default=DEFAULT_ZSERV_PORT,
103         help='Port number of Zebra server '
104              '(default: %s)'
105         % DEFAULT_ZSERV_PORT),
106     cfg.IntOpt(
107         'server-version', default=DEFAULT_ZSERV_VERSION,
108         help='Zebra protocol version of Zebra server '
109              '(default: %s)' % DEFAULT_ZSERV_VERSION),
110     cfg.StrOpt(
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),
114     cfg.IntOpt(
115         'retry-interval', default=DEFAULT_ZSERV_INTERVAL,
116         help='Retry interval connecting to Zebra server '
117              '(default: %s)' % DEFAULT_ZSERV_INTERVAL),
118     cfg.StrOpt(
119         'db-url', default=DEFAULT_ZSERV_DATABASE,
120         help='URL to database used by Zebra protocol service '
121              '(default: %s)' % DEFAULT_ZSERV_DATABASE),
122     cfg.StrOpt(
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),
126     cfg.Opt(
127         'frr-version', LooseVersion, default=DEFAULT_ZSERV_FRR_VERSION,
128         help='FRRouting version when integrated with FRRouting (e.g., 3.0)'),
129 ], group='zapi')