-
Notifications
You must be signed in to change notification settings - Fork 440
/
setup.py
347 lines (339 loc) · 10.7 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
# encoding: utf-8
"""
setup.py
Created by Thomas Mangin on 2014-12-23.
Copyright (c) 2014-2017 Exa Networks. All rights reserved.
License: 3-clause BSD. (See the COPYRIGHT file)
"""
from exabgp.environment import parsing
from exabgp.environment.environment import Env
_SPACE = {'space': ' ' * 33}
LOGGING_HELP_STDOUT = (
"""\
where logging should log
%(space)s syslog (or no setting) sends the data to the local syslog syslog
%(space)s host:<location> sends the data to a remote syslog server
%(space)s stdout sends the data to stdout
%(space)s stderr sends the data to stderr
%(space)s <filename> send the data to a file"""
% _SPACE
)
CONFIGURATION = {
'profile': {
'enable': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'toggle profiling of the code',
},
'file': {
'read': parsing.unquote,
'write': parsing.quote,
'value': '',
'help': 'profiling result file, none means stdout, no overwriting',
},
},
'pdb': {
'enable': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'on program fault, start pdb the python interactive debugger',
}
},
'daemon': {
'pid': {
'read': parsing.unquote,
'write': parsing.quote,
'value': '',
'help': 'where to save the pid if we manage it',
},
'user': {
'read': parsing.user,
'write': parsing.quote,
'value': 'nobody',
'help': 'user to run the program as',
},
'daemonize': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'should we run in the background',
},
'drop': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'true',
'help': 'drop privileges before forking processes',
},
'umask': {
'read': parsing.umask_read,
'write': parsing.umask_write,
'value': '0137',
'help': 'run daemon with this umask, governs perms of logfiles etc.',
},
},
'log': {
'enable': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'true',
'help': 'enable logging to file or syslog',
},
'level': {
'read': parsing.syslog_value,
'write': parsing.syslog_name,
'value': 'INFO',
'help': 'log message with at least the priority SYSLOG.<level>',
},
'destination': {
'read': parsing.unquote,
'write': parsing.quote,
'value': 'stdout',
'help': LOGGING_HELP_STDOUT,
},
'all': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'report debug information for everything',
},
'configuration': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'true',
'help': 'report command parsing',
},
'reactor': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'true',
'help': 'report signal received, command reload',
},
'daemon': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'true',
'help': 'report pid change, forking, ...',
},
'processes': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'true',
'help': 'report handling of forked processes',
},
'network': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'true',
'help': 'report networking information (TCP/IP, network state,...)',
},
'packets': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'report BGP packets sent and received',
},
'rib': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'report change in locally configured routes',
},
'message': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'report changes in route announcement on config reload',
},
'timers': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'report keepalives timers',
},
'routes': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'report received routes',
},
'parser': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'report BGP message parsing details',
},
'short': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'true',
'help': 'use short log format (not prepended with time,level,pid and source)',
},
},
'tcp': {
'once': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'only one tcp connection attempt per peer (for debuging scripts)',
},
'delay': {
'read': parsing.integer,
'write': parsing.nop,
'value': '0',
'help': 'start to announce route when the minutes in the hours is a modulo of this number',
},
'bind': {
'read': parsing.ip_list,
'write': parsing.quote_list,
'value': '',
'help': 'Space separated list of IPs to bind on when listening (no ip to disable)',
},
'port': {
'read': parsing.integer,
'write': parsing.nop,
'value': '179',
'help': 'port to bind on when listening',
},
'acl': {
'read': parsing.boolean,
'write': parsing.lower,
'value': '',
'help': '(experimental please do not use) unimplemented',
},
},
'bgp': {
'passive': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'ignore the peer configuration and make all peers passive',
},
'openwait': {
'read': parsing.integer,
'write': parsing.nop,
'value': '60',
'help': 'how many seconds we wait for an open once the TCP session is established',
},
},
'cache': {
'attributes': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'true',
'help': 'cache all attributes (configuration and wire) for faster parsing',
},
'nexthops': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'true',
'help': 'cache routes next-hops (deprecated: next-hops are always cached)',
},
},
'api': {
'ack': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'true',
'help': 'acknowledge api command(s) and report issues',
},
'chunk': {
'read': parsing.integer,
'write': parsing.nop,
'value': '1',
'help': 'maximum lines to print before yielding in show routes api',
},
'encoder': {
'read': parsing.api,
'write': parsing.lower,
'value': 'json',
'help': '(experimental) default encoder to use with with external API (text or json)',
},
'compact': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'shorter JSON encoding for IPv4/IPv6 Unicast NLRI',
},
'respawn': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'true',
'help': 'should we try to respawn helper processes if they dies',
},
'terminate': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'should we terminate ExaBGP if any helper process dies',
},
'cli': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'true',
'help': 'should we create a named pipe for the cli',
},
'pipename': {
'read': parsing.unquote,
'write': parsing.quote,
'value': 'exabgp',
'help': 'name to be used for the exabgp pipe',
},
},
'reactor': {
'speed': {
'read': parsing.real,
'write': parsing.nop,
'value': '1.0',
'help': 'reactor loop time\n%(space)s use only if you understand the code.' % _SPACE,
},
},
# Here for internal use
'debug': {
'pdb': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'enable python debugger on errors',
},
'memory': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'command line option --memory',
},
'configuration': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'undocumented option: raise when parsing configuration errors',
},
'selfcheck': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'does a self check on the configuration file',
},
'route': {
'read': parsing.unquote,
'write': parsing.quote,
'value': '',
'help': 'decode the route using the configuration',
},
'defensive': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'generate random fault in the code in purpose',
},
'rotate': {
'read': parsing.boolean,
'write': parsing.lower,
'value': 'false',
'help': 'rotate configurations file on reload (signal)',
},
},
}
# load the environment
Env.setup(CONFIGURATION)