Refresh Amulet tests

Enable tests for later Ubuntu and OpenStack release
versions; tidy headers in each test target; update
base deployment task to support multiple ODL
releases as Helium is not Java 8 compatible, blocking
testing on Ubuntu 16.04.

Change-Id: Idf9f0cf46e4c5a5c9914e203a4f8acf23a62edd9
This commit is contained in:
James Page 2016-04-18 11:28:09 +01:00
parent e6675d4a88
commit 5931ec087c
8 changed files with 54 additions and 29 deletions

View File

@ -13,7 +13,8 @@ test:
functional_test:
@echo Starting Amulet tests...
@tests/setup/00-setup
@juju test -v -p AMULET_HTTP_PROXY,AMULET_OS_VIP --timeout 2700
@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
bin/charm_helpers_sync.py:
@mkdir -p bin

View File

@ -1,5 +1,5 @@
#!/usr/bin/python
"""Amulet tests on a basic cisco-vpp deployment on trusty-icehouse."""
"""Amulet tests on a basic openvswitch ODL deployment on trusty-icehouse."""
from basic_deployment import OVSODLBasicDeployment

View File

@ -1,5 +1,5 @@
#!/usr/bin/python
"""Amulet tests on a basic cisco-vpp deployment on trusty-icehouse."""
"""Amulet tests on a basic openvswitch ODL deployment on trusty-kilo."""
from basic_deployment import OVSODLBasicDeployment

2
tests/018-basic-trusty-liberty Normal file → Executable file
View File

@ -1,5 +1,5 @@
#!/usr/bin/python
"""Amulet tests on a basic cisco-vpp deployment on trusty-icehouse."""
"""Amulet tests on a basic openvswitch ODL deployment on trusty-liberty."""
from basic_deployment import OVSODLBasicDeployment

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

@ -1,5 +1,5 @@
#!/usr/bin/python
"""Amulet tests on a basic cisco-vpp deployment on trusty-icehouse."""
"""Amulet tests on a basic openvswitch ODL deployment on trusty-mitaka."""
from basic_deployment import OVSODLBasicDeployment

2
tests/020-basic-wily-liberty Normal file → Executable file
View File

@ -1,5 +1,5 @@
#!/usr/bin/python
"""Amulet tests on a basic cisco-vpp deployment on wily-liberty."""
"""Amulet tests on a basic openvswitch ODL deployment on wily-liberty."""
from basic_deployment import OVSODLBasicDeployment

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

@ -1,8 +1,9 @@
#!/usr/bin/python
"""Amulet tests on a basic cisco-vpp deployment on xenial-mitaka."""
"""Amulet tests on a basic openvswitch ODL deployment on xenial-mitaka."""
from basic_deployment import OVSODLBasicDeployment
if __name__ == '__main__':
deployment = OVSODLBasicDeployment(series='xenial')
deployment = OVSODLBasicDeployment(series='xenial',
odl_version='beryllium')
deployment.run_tests()

View File

@ -17,16 +17,27 @@ from charmhelpers.contrib.openstack.amulet.utils import (
u = OpenStackAmuletUtils(DEBUG)
ODL_QUERY_PATH = '/restconf/operational/opendaylight-inventory:nodes/'
ODL_PROFILES = {
'helium': {
'location': 'AMULET_ODL_LOCATION',
'profile': 'openvswitch-odl'
},
'beryllium': {
'location': 'AMULET_ODL_BE_LOCATION',
'profile': 'openvswitch-odl-beryllium'
},
}
class OVSODLBasicDeployment(OpenStackAmuletDeployment):
"""Amulet tests on a basic neutron-openvswtich deployment."""
def __init__(self, series, openstack=None, source=None, git=False,
stable=False):
stable=False, odl_version='helium'):
"""Deploy the entire test environment."""
super(OVSODLBasicDeployment, self).__init__(series, openstack,
source, stable)
self.odl_version = odl_version
self._add_services()
self._add_relations()
self._configure_services()
@ -105,12 +116,10 @@ class OVSODLBasicDeployment(OpenStackAmuletDeployment):
def _configure_services(self):
"""Configure all of the services."""
neutron_api = {
'manage-neutron-plugin-legacy-mode': False,
'neutron-security-groups': False,
}
nova_compute = {
'enable-live-migration': False,
'manage-neutron-plugin-legacy-mode': False,
}
keystone = {
'admin-password': 'openstack',
@ -119,11 +128,18 @@ class OVSODLBasicDeployment(OpenStackAmuletDeployment):
mysql = {
'dataset-size': '50%',
}
odl_controller = {
'install-url': os.environ.get('AMULET_ODL_LOCATION'),
'http-proxy': os.environ.get('AMULET_HTTP_PROXY'),
'https-proxy': os.environ.get('AMULET_HTTP_PROXY'),
}
odl_controller = {}
if os.environ.get(ODL_PROFILES[self.odl_version]['location']):
odl_controller['install-url'] = \
os.environ.get(ODL_PROFILES[self.odl_version]['location'])
if os.environ.get('AMULET_HTTP_PROXY'):
odl_controller['http-proxy'] = \
os.environ['AMULET_HTTP_PROXY']
if os.environ.get('AMULET_HTTP_PROXY'):
odl_controller['https-proxy'] = \
os.environ['AMULET_HTTP_PROXY']
odl_controller['profile'] = \
ODL_PROFILES[self.odl_version]['profile']
neutron_gateway = {
'plugin': 'ovs-odl'
}
@ -176,19 +192,19 @@ class OVSODLBasicDeployment(OpenStackAmuletDeployment):
service units."""
commands = {
self.compute_sentry: ['status nova-compute',
'status openvswitch-switch'],
self.gateway_sentry: ['status openvswitch-switch',
'status neutron-dhcp-agent',
'status neutron-l3-agent',
'status neutron-metadata-agent',
'status neutron-metering-agent',
'status neutron-lbaas-agent',
'status nova-api-metadata'],
self.odl_controller_sentry: ['status odl-controller'],
self.compute_sentry: ['nova-compute',
'openvswitch-switch'],
self.gateway_sentry: ['openvswitch-switch',
'neutron-dhcp-agent',
'neutron-l3-agent',
'neutron-metadata-agent',
'neutron-metering-agent',
'neutron-lbaas-agent',
'nova-api-metadata'],
self.odl_controller_sentry: ['odl-controller'],
}
ret = u.validate_services(commands)
ret = u.validate_services_by_name(commands)
if ret:
amulet.raise_status(amulet.FAIL, msg=ret)
@ -199,11 +215,18 @@ class OVSODLBasicDeployment(OpenStackAmuletDeployment):
'ovsdb-manager',
'openvswitch-odl:ovsdb-manager'
)['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'
output, _ = self.gateway_sentry.run(cmd)
bridges = output.split()
for bridge in ['br-int', 'br-ex', 'br-data']:
for bridge in check_bridges:
if bridge not in bridges:
amulet.raise_status(
amulet.FAIL,