10
14
from socket import gethostname as get_unit_hostname
13
def _neutron_api_settings():
15
'neutron_security_groups': False,
16
'l2_population': True,
17
'overlay_network_type': 'gre',
19
for rid in relation_ids('neutron-plugin-api'):
20
for unit in related_units(rid):
21
rdata = relation_get(rid=rid, unit=unit)
22
if 'l2-population' not in rdata:
25
'l2_population': rdata['l2-population'],
26
'neutron_security_groups': rdata['neutron-security-groups'],
27
'overlay_network_type': rdata['overlay-network-type'],
29
# Override with configuration if set to true
30
if config('disable-security-groups'):
31
neutron_settings['neutron_security_groups'] = False
32
return neutron_settings
33
return neutron_settings
37
17
class PGDirContext(context.NeutronContext):
22
Over-riding function in NeutronContext Class to return 'plumgrid'
23
as the neutron plugin.
45
28
def network_manager(self):
30
Over-riding function in NeutronContext Class to return 'neutron'
31
as the network manager.
48
35
def _save_flag_file(self):
37
Over-riding function in NeutronContext Class.
38
Function only needed for OVS.
52
#def neutron_security_groups(self):
53
# neutron_api_settings = _neutron_api_settings()
54
# return neutron_api_settings['neutron_security_groups']
57
#Generated Config for all Plumgrid templates inside
44
Generated Config for all PLUMgrid templates inside the templates folder.
59
46
pg_ctxt = super(PGDirContext, self).pg_ctxt()
64
51
pg_ctxt['local_ip'] = \
65
52
get_address_in_network(network=None,
66
53
fallback=get_host_ip(unit_get('private-address')))
67
#neutron_api_settings = _neutron_api_settings()
69
#TODO: Get this value from the neutron-api charm
70
54
pg_ctxt['virtual_ip'] = conf['plumgrid-virtual-ip']
71
55
pg_ctxt['pg_hostname'] = "pg-director"
72
56
pg_ctxt['interface'] = "juju-br0"