172
172
'services': ['calico-felix',
174
174
'neutron-dhcp-agent',
175
'nova-api-metadata'],
176
177
'packages': [[headers_package()] + determine_dkms_package(),
177
178
['calico-compute',
179
180
'neutron-dhcp-agent',
180
'nova-api-metadata']],
181
'server_packages': ['neutron-server', 'calico-control'],
182
'server_services': ['neutron-server']
183
'server_packages': ['neutron-server', 'calico-control', 'etcd'],
184
'server_services': ['neutron-server', 'etcd']
185
187
'config': '/etc/neutron/plugins/nuage/nuage_plugin.ini',
256
def parse_mappings(mappings):
258
def parse_mappings(mappings, key_rvalue=False):
259
"""By default mappings are lvalue keyed.
261
If key_rvalue is True, the mapping will be reversed to allow multiple
262
configs for the same lvalue.
259
mappings = mappings.split(' ')
266
mappings = mappings.split()
260
267
for m in mappings:
261
268
p = m.partition(':')
263
parsed[p[0].strip()] = p[2].strip()
273
# if there is no rvalue skip to next
280
key = p[key_index].strip()
281
parsed[key] = p[val_index].strip()
278
296
def parse_data_port_mappings(mappings, default_bridge='br-data'):
279
297
"""Parse data port mappings.
281
Mappings must be a space-delimited list of bridge:port mappings.
299
Mappings must be a space-delimited list of port:bridge mappings.
283
Returns dict of the form {bridge:port}.
301
Returns dict of the form {port:bridge} where port may be an mac address or
285
_mappings = parse_mappings(mappings)
305
# NOTE(dosaboy): we use rvalue for key to allow multiple values to be
306
# proposed for <port> since it may be a mac address which will differ
307
# across units this allowing first-known-good to be chosen.
308
_mappings = parse_mappings(mappings, key_rvalue=True)
309
if not _mappings or list(_mappings.values()) == ['']:
290
313
# For backwards-compatibility we need to support port-only provided in
292
_mappings = {default_bridge: mappings.split(' ')[0]}
294
bridges = _mappings.keys()
295
ports = _mappings.values()
296
if len(set(bridges)) != len(bridges):
297
raise Exception("It is not allowed to have more than one port "
298
"configured on the same bridge")
315
_mappings = {mappings.split()[0]: default_bridge}
317
ports = _mappings.keys()
300
318
if len(set(ports)) != len(ports):
301
319
raise Exception("It is not allowed to have the same port configured "
302
320
"on more than one bridge")
310
328
Mappings must be a space-delimited list of provider:start:end mappings.
330
The start:end range is optional and may be omitted.
312
332
Returns dict of the form {provider: (start, end)}.
314
334
_mappings = parse_mappings(mappings)