Add enable-fwaas to relation data

Add enable-fwaas to neutron-plugin-api relation data so
that neutron-openvswitch updates neutron-l3-agent
configuration accordingly.

TODO: Sync charmhelpers to get related changes
https://github.com/juju/charm-helpers/pull/635

Closes-Bug: #1934129
Change-Id: I5019c5ed3b8ab556d4900f1fe46dee69f5f09ee7
This commit is contained in:
Hemanth Nakkina 2021-08-31 11:07:12 +05:30
parent 3f0855a8d3
commit 53013249b2
3 changed files with 32 additions and 0 deletions

View File

@ -282,6 +282,28 @@ def is_port_forwarding_enabled():
return False
def is_fwaas_enabled():
"""
Check if Firewall as a service feature should be enabled.
returns: True if enable-fwaas config item is True,
otherwise False.
:rtype: boolean
"""
if config('enable-fwaas'):
cmp_release = CompareOpenStackReleases(os_release('neutron-server'))
if cmp_release < 'stein' or cmp_release > 'ussuri':
log("The fwaas option is only supported"
"on Stein to Ussuri",
ERROR)
return False
return True
return False
def is_vlan_trunking_requested_and_valid():
"""Check whether VLAN trunking should be enabled by checking whether
it has been requested and, if it has, is it supported in the current

View File

@ -107,6 +107,7 @@ from neutron_api_context import (
get_l2population,
get_l3ha,
get_overlay_network_type,
is_fwaas_enabled,
is_nfg_logging_enabled,
is_nsg_logging_enabled,
is_qos_requested_and_valid,
@ -554,6 +555,7 @@ def neutron_plugin_api_relation_joined(rid=None):
'enable-nsg-logging': is_nsg_logging_enabled(),
'enable-nfg-logging': is_nfg_logging_enabled(),
'enable-port-forwarding': is_port_forwarding_enabled(),
'enable-fwaas': is_fwaas_enabled(),
'overlay-network-type': get_overlay_network_type(),
'addr': unit_get('private-address'),
'polling-interval': config('polling-interval'),

View File

@ -542,6 +542,7 @@ class NeutronAPIHooksTests(CharmTestCase):
'enable-nsg-logging': False,
'enable-nfg-logging': False,
'enable-port-forwarding': False,
'enable-fwaas': True,
'global-physnet-mtu': 1500,
'physical-network-mtus': None,
}
@ -588,6 +589,7 @@ class NeutronAPIHooksTests(CharmTestCase):
'enable-nsg-logging': True,
'enable-nfg-logging': False,
'enable-port-forwarding': False,
'enable-fwaas': True,
'global-physnet-mtu': 1500,
'physical-network-mtus': None,
}
@ -640,6 +642,7 @@ class NeutronAPIHooksTests(CharmTestCase):
'enable-nsg-logging': False,
'enable-nfg-logging': True,
'enable-port-forwarding': False,
'enable-fwaas': True,
'global-physnet-mtu': 1500,
'physical-network-mtus': None,
}
@ -691,6 +694,7 @@ class NeutronAPIHooksTests(CharmTestCase):
'enable-nsg-logging': False,
'enable-nfg-logging': False,
'enable-port-forwarding': True,
'enable-fwaas': True,
'global-physnet-mtu': 1500,
'physical-network-mtus': None,
}
@ -742,6 +746,7 @@ class NeutronAPIHooksTests(CharmTestCase):
'enable-nsg-logging': False,
'enable-nfg-logging': False,
'enable-port-forwarding': False,
'enable-fwaas': True,
'global-physnet-mtu': 1500,
'physical-network-mtus': None,
}
@ -788,6 +793,7 @@ class NeutronAPIHooksTests(CharmTestCase):
'enable-nsg-logging': False,
'enable-nfg-logging': False,
'enable-port-forwarding': False,
'enable-fwaas': True,
'global-physnet-mtu': 1500,
'physical-network-mtus': None,
}
@ -836,6 +842,7 @@ class NeutronAPIHooksTests(CharmTestCase):
'enable-nsg-logging': False,
'enable-nfg-logging': False,
'enable-port-forwarding': False,
'enable-fwaas': True,
'global-physnet-mtu': 1500,
'physical-network-mtus': None,
}
@ -883,6 +890,7 @@ class NeutronAPIHooksTests(CharmTestCase):
'enable-nsg-logging': False,
'enable-nfg-logging': False,
'enable-port-forwarding': False,
'enable-fwaas': True,
'global-physnet-mtu': 1500,
'physical-network-mtus': None,
}