Enable Mitaka amulet tests

Disable Juno tests (no longer supported).

Switch Xenial tests to use BE release of ODL, as the default
Helium release is not compatible with Java 8 (which is the
default in 16.04).

Update ovs bridge controller checks to validate against
legacy 6633 and IANA assigned 6653 ports; only check br-int
configuration for later ODL releases.

Drop wider service checks from amulet test.

Re-align with Neutron security group management.

Change-Id: Ic1e92b292c0276232a29695d02096ba1e3275236
This commit is contained in:
James Page 2016-04-13 10:15:49 +01:00
parent ab0ec1c2e6
commit 93efa99b5a
5 changed files with 34 additions and 31 deletions

View File

@ -11,7 +11,7 @@ test:
functional_test: functional_test:
@echo Starting amulet tests... @echo Starting amulet tests...
@tests/setup/00-setup @tests/setup/00-setup
@juju test -v -p AMULET_ODL_LOCATION,AMULET_HTTP_PROXY,AMULET_OS_VIP \ @juju test -v -p AMULET_ODL_LOCATION,AMULET_ODL_HE_LOCATION,AMULET_ODL_LI_LOCATION,AMULET_ODL_BE_LOCATION,AMULET_HTTP_PROXY,AMULET_OS_VIP \
--timeout 2700 --timeout 2700
bin/charm_helpers_sync.py: bin/charm_helpers_sync.py:

View File

@ -1,11 +0,0 @@
#!/usr/bin/python
"""Amulet tests on a basic odl controller deployment on trusty-juno."""
from basic_deployment import ODLControllerBasicDeployment
if __name__ == '__main__':
deployment = ODLControllerBasicDeployment(series='trusty',
openstack='cloud:trusty-juno',
source='cloud:trusty-updates/juno')
deployment.run_tests()

0
tests/019-basic-trusty-mitaka Normal file → Executable file
View File

3
tests/021-basic-xenial-mitaka Normal file → Executable file
View File

@ -5,5 +5,6 @@
from basic_deployment import ODLControllerBasicDeployment from basic_deployment import ODLControllerBasicDeployment
if __name__ == '__main__': if __name__ == '__main__':
deployment = ODLControllerBasicDeployment(series='xenial') deployment = ODLControllerBasicDeployment(series='xenial',
odl_version='beryllium')
deployment.run_tests() deployment.run_tests()

View File

@ -18,15 +18,27 @@ from charmhelpers.contrib.openstack.amulet.utils import (
# Use DEBUG to turn on debug logging # Use DEBUG to turn on debug logging
u = OpenStackAmuletUtils(DEBUG) u = OpenStackAmuletUtils(DEBUG)
ODL_PROFILES = {
'helium': {
'location': 'AMULET_ODL_LOCATION',
'profile': 'openvswitch-odl'
},
'beryllium': {
'location': 'AMULET_ODL_BE_LOCATION',
'profile': 'openvswitch-odl-beryllium'
},
}
class ODLControllerBasicDeployment(OpenStackAmuletDeployment): class ODLControllerBasicDeployment(OpenStackAmuletDeployment):
"""Amulet tests on a basic OVS ODL deployment.""" """Amulet tests on a basic OVS ODL deployment."""
def __init__(self, series, openstack=None, source=None, git=False, def __init__(self, series, openstack=None, source=None, git=False,
stable=False): stable=False, odl_version='helium'):
"""Deploy the entire test environment.""" """Deploy the entire test environment."""
super(ODLControllerBasicDeployment, self).__init__(series, openstack, super(ODLControllerBasicDeployment, self).__init__(series, openstack,
source, stable) source, stable)
self.odl_version = odl_version
self._add_services() self._add_services()
self._add_relations() self._add_relations()
self._configure_services() self._configure_services()
@ -98,23 +110,24 @@ class ODLControllerBasicDeployment(OpenStackAmuletDeployment):
"""Configure all of the services.""" """Configure all of the services."""
neutron_gateway_config = {'plugin': 'ovs-odl', neutron_gateway_config = {'plugin': 'ovs-odl',
'instance-mtu': '1400'} 'instance-mtu': '1400'}
neutron_api_config = {'neutron-security-groups': 'False', neutron_api_config = {'neutron-security-groups': 'True',
'manage-neutron-plugin-legacy-mode': 'False'} 'manage-neutron-plugin-legacy-mode': 'False'}
neutron_api_odl_config = {'overlay-network-type': 'vxlan gre'} neutron_api_odl_config = {'overlay-network-type': 'vxlan gre'}
odl_controller_config = {} odl_controller_config = {}
if os.environ.get('AMULET_ODL_LOCATION'): if os.environ.get(ODL_PROFILES[self.odl_version]['location']):
odl_controller_config['install-url'] = \ odl_controller_config['install-url'] = \
os.environ['AMULET_ODL_LOCATION'] os.environ.get(ODL_PROFILES[self.odl_version]['location'])
if os.environ.get('AMULET_HTTP_PROXY'): if os.environ.get('AMULET_HTTP_PROXY'):
odl_controller_config['http-proxy'] = \ odl_controller_config['http-proxy'] = \
os.environ['AMULET_HTTP_PROXY'] os.environ['AMULET_HTTP_PROXY']
if os.environ.get('AMULET_HTTP_PROXY'): if os.environ.get('AMULET_HTTP_PROXY'):
odl_controller_config['https-proxy'] = \ odl_controller_config['https-proxy'] = \
os.environ['AMULET_HTTP_PROXY'] os.environ['AMULET_HTTP_PROXY']
odl_controller_config['profile'] = \
ODL_PROFILES[self.odl_version]['profile']
keystone_config = {'admin-password': 'openstack', keystone_config = {'admin-password': 'openstack',
'admin-token': 'ubuntutesting'} 'admin-token': 'ubuntutesting'}
nova_cc_config = {'network-manager': 'Neutron', nova_cc_config = {'network-manager': 'Neutron'}
'quantum-security-groups': 'yes'}
configs = {'neutron-gateway': neutron_gateway_config, configs = {'neutron-gateway': neutron_gateway_config,
'neutron-api': neutron_api_config, 'neutron-api': neutron_api_config,
'neutron-api-odl': neutron_api_odl_config, 'neutron-api-odl': neutron_api_odl_config,
@ -187,17 +200,9 @@ class ODLControllerBasicDeployment(OpenStackAmuletDeployment):
'neutron-metering-agent', 'neutron-metering-agent',
'neutron-l3-agent'] 'neutron-l3-agent']
nova_cc_services = ['nova-api-os-compute',
'nova-cert',
'nova-scheduler',
'nova-conductor']
odl_c_services = ['odl-controller'] odl_c_services = ['odl-controller']
commands = { commands = {
self.mysql_sentry: ['mysql'],
self.keystone_sentry: ['keystone'],
self.nova_cc_sentry: nova_cc_services,
self.neutron_gateway_sentry: neutron_services, self.neutron_gateway_sentry: neutron_services,
self.odl_controller_sentry: odl_c_services, self.odl_controller_sentry: odl_c_services,
} }
@ -389,26 +394,34 @@ class ODLControllerBasicDeployment(OpenStackAmuletDeployment):
'ovsdb-manager', 'ovsdb-manager',
'openvswitch-odl:ovsdb-manager' 'openvswitch-odl:ovsdb-manager'
)['private-address'] )['private-address']
controller_url = "tcp:{}:6633".format(odl_ip) # NOTE: 6633 is legacy 6653 is IANA assigned
if self.odl_version == 'helium':
controller_url = "tcp:{}:6633".format(odl_ip)
check_bridges = ['br-int', 'br-ex', 'br-data']
else:
controller_url = "tcp:{}:6653".format(odl_ip)
# NOTE: later ODL releases only manage br-int
check_bridges = ['br-int']
cmd = 'ovs-vsctl list-br' cmd = 'ovs-vsctl list-br'
output, _ = self.neutron_gateway_sentry.run(cmd) output, _ = self.neutron_gateway_sentry.run(cmd)
bridges = output.split() bridges = output.split()
u.log.debug('Checking bridge configuration...') u.log.debug('Checking bridge configuration...')
for bridge in ['br-int', 'br-ex', 'br-data']: for bridge in check_bridges:
if bridge not in bridges: if bridge not in bridges:
amulet.raise_status( amulet.raise_status(
amulet.FAIL, amulet.FAIL,
msg="Missing bridge {} from gateway unit".format(bridge) msg="Missing bridge {} from gateway unit".format(bridge)
) )
u.log.debug('Validating ...')
cmd = 'ovs-vsctl get-controller {}'.format(bridge) cmd = 'ovs-vsctl get-controller {}'.format(bridge)
br_controllers, _ = self.neutron_gateway_sentry.run(cmd) br_controllers, _ = self.neutron_gateway_sentry.run(cmd)
br_controllers = list(set(br_controllers.split('\n'))) br_controllers = list(set(br_controllers.strip().split('\n')))
if len(br_controllers) != 1 or br_controllers[0] != controller_url: if len(br_controllers) != 1 or br_controllers[0] != controller_url:
status, _ = self.neutron_gateway_sentry.run('ovs-vsctl show') status, _ = self.neutron_gateway_sentry.run('ovs-vsctl show')
amulet.raise_status( amulet.raise_status(
amulet.FAIL, amulet.FAIL,
msg="Controller configuration on bridge" msg="Controller configuration on bridge"
" {} incorrect: !{}! != !{}!\n" " {} incorrect: !{}! not in !{}!\n"
"{}".format(bridge, "{}".format(bridge,
br_controllers, br_controllers,
controller_url, controller_url,