Ubuntu acceptance tests and status workarounds

This change adds beaker acceptance testing for Ubuntu and addresses the
bad service status commands for the services running under Ubuntu.

Also change the way we test of ovn is running by listing the virtual
ports, instead of trying to start the service again.
Also improve the doc about controller.

Change-Id: I6edb2363c196ae4a24cda800e59690eefb223384
Co-Authored-By: Alex Schultz <aschultz@mirantis.com>
This commit is contained in:
Emilien Macchi 2016-04-22 14:10:18 -04:00
parent c9dacb2c20
commit df267d25fc
6 changed files with 70 additions and 53 deletions

View File

@ -6,20 +6,20 @@
# === Parameters:
#
# [*ovn_remote*]
# URL of the remote ovsdb-server that manages ovn-nb and ovn-sb dbs
# (Required) URL of the remote ovsdb-server that manages ovn-nb and ovn-sb dbs
#
# [*ovn_encap_type*]
# (Optional) The encapsulation type to be used
# Defaults to 'geneve'
#
# [*ovn_encap_ip*]
# IP address of the hypervisor(in which this module is installed) to which
# (Required) IP address of the hypervisor(in which this module is installed) to which
# the other controllers would use to create a tunnel to this controller
#
class ovn::controller(
$ovn_remote = undef,
$ovn_remote,
$ovn_encap_ip,
$ovn_encap_type = 'geneve',
$ovn_encap_ip = undef
) {
include ::ovn::params
include ::vswitch::ovs
@ -29,12 +29,14 @@ class ovn::controller(
validate_string($ovn_encap_ip)
service { 'controller':
ensure => true,
name => $::ovn::params::ovn_controller_service_name,
enable => true,
require => [Vs_config['external_ids:ovn-remote'],
Vs_config['external_ids:ovn-encap-type'],
Vs_config['external_ids:ovn-encap-ip']]
ensure => true,
name => $::ovn::params::ovn_controller_service_name,
hasstatus => $::ovn::params::ovn_controller_service_status,
pattern => $::ovn::params::ovn_controller_service_pattern,
enable => true,
require => [Vs_config['external_ids:ovn-remote'],
Vs_config['external_ids:ovn-encap-type'],
Vs_config['external_ids:ovn-encap-ip']]
}
package { $::ovn::params::ovn_controller_package_name:

View File

@ -5,10 +5,13 @@
#
class ovn::northd() {
include ::ovn::params
service { 'northd':
ensure => true,
enable => true,
name => $::ovn::params::ovn_northd_service_name
ensure => true,
enable => true,
name => $::ovn::params::ovn_northd_service_name,
hasstatus => $::ovn::params::ovn_northd_service_status,
pattern => $::ovn::params::ovn_northd_service_pattern,
}
package { $::ovn::params::ovn_northd_package_name:

View File

@ -2,20 +2,28 @@
# == Class: ovn::params
#
# This class defines the variable like
#
class ovn::params {
case $::osfamily {
'Redhat': {
$ovn_northd_package_name = 'openvswitch-ovn-central'
$ovn_controller_package_name = 'openvswitch-ovn-host'
$ovn_northd_service_name = 'ovn-northd'
$ovn_controller_service_name = 'ovn-controller'
$ovn_northd_package_name = 'openvswitch-ovn-central'
$ovn_controller_package_name = 'openvswitch-ovn-host'
$ovn_northd_service_name = 'ovn-northd'
$ovn_northd_service_status = true
$ovn_northd_service_pattern = undef
$ovn_controller_service_name = 'ovn-controller'
$ovn_controller_service_status = true
$ovn_controller_service_pattern = undef
}
'Debian': {
$ovn_northd_package_name = 'ovn-central'
$ovn_controller_package_name = 'ovn-host'
$ovn_northd_service_name = 'ovn-central'
$ovn_controller_service_name = 'ovn-host'
$ovn_northd_package_name = 'ovn-central'
$ovn_controller_package_name = 'ovn-host'
$ovn_northd_service_name = 'ovn-central'
$ovn_northd_service_status = false # status broken in UCA
$ovn_northd_service_pattern = 'ovn-northd'
$ovn_controller_service_name = 'ovn-host'
$ovn_controller_service_status = false # status broken in UCA
$ovn_controller_service_pattern = 'ovn-controller'
}
default: {
fail " Osfamily ${::osfamily} not supported yet"

View File

@ -18,13 +18,11 @@ describe 'basic ovn deployment' do
gpgkey => 'https://copr-be.cloud.fedoraproject.org/results/pmatilai/dpdk-snapshot/pubkey.gpg',
notify => Exec[yum_refresh],
}
# TODO: see if packaging is available in Ubuntu Trusty
# otherwise, add conditional to test only on Red Hat.
include ::ovn::northd
class { '::ovn::controller':
ovn_remote => '127.0.0.1',
ovn_encap_ip => '127.0.0.1',
}
}
include ::ovn::northd
class { '::ovn::controller':
ovn_remote => 'tcp:127.0.0.1:6642',
ovn_encap_ip => '127.0.0.1',
}
EOS
@ -34,17 +32,11 @@ describe 'basic ovn deployment' do
apply_manifest(pp, :catch_changes => true)
end
if os[:family].casecmp('RedHat') == 0
describe 'test openvswitch-ovn-host' do
it 'should start northd process' do
expect(shell('/usr/share/openvswitch/scripts/ovn-ctl start_northd').exit_code).to be_zero
end
end
describe 'test openvswitch-ovn-central' do
it 'should start controller process' do
expect(shell('/usr/share/openvswitch/scripts/ovn-ctl start_controller').exit_code).to be_zero
end
describe 'test openvswitch-ovn CLI' do
it 'list virtual ports' do
expect(shell('ovn-nbctl show').exit_code).to be_zero
end
end
end
end

View File

@ -20,9 +20,11 @@ describe 'ovn::controller' do
it 'starts controller' do
is_expected.to contain_service('controller').with(
:ensure => true,
:name => platform_params[:ovn_controller_service_name],
:enable => true,
:ensure => true,
:name => platform_params[:ovn_controller_service_name],
:enable => true,
:hasstatus => platform_params[:ovn_controller_service_status],
:pattern => platform_params[:ovn_controller_service_pattern],
)
end
@ -68,16 +70,20 @@ describe 'ovn::controller' do
when 'Debian'
let :platform_params do
{
:ovn_controller_package_name => 'ovn-host',
:ovn_controller_service_name => 'ovn-host'
:ovn_controller_package_name => 'ovn-host',
:ovn_controller_service_name => 'ovn-host',
:ovn_controller_service_status => false,
:ovn_controller_service_pattern => 'ovn-controller'
}
end
it_behaves_like 'ovn controller'
when 'Redhat'
let :platform_params do
{
:ovn_controller_package_name => 'openvswitch-ovn-host',
:ovn_controller_service_name => 'ovn-controller'
:ovn_controller_package_name => 'openvswitch-ovn-host',
:ovn_controller_service_name => 'ovn-controller',
:ovn_controller_service_status => true,
:ovn_controller_service_pattern => 'undef'
}
end
it_behaves_like 'ovn controller'

View File

@ -9,9 +9,11 @@ describe 'ovn::northd' do
it 'starts northd' do
is_expected.to contain_service('northd').with(
:ensure => true,
:name => platform_params[:ovn_northd_service_name],
:enable => true,
:ensure => true,
:name => platform_params[:ovn_northd_service_name],
:enable => true,
:hasstatus => platform_params[:ovn_northd_service_status],
:pattern => platform_params[:ovn_northd_service_pattern],
)
end
@ -37,16 +39,20 @@ describe 'ovn::northd' do
when 'Debian'
let(:platform_params) do
{
:ovn_northd_package_name => 'ovn-central',
:ovn_northd_service_name => 'ovn-central'
:ovn_northd_package_name => 'ovn-central',
:ovn_northd_service_name => 'ovn-central',
:ovn_northd_service_status => false,
:ovn_northd_service_pattern => 'ovn-northd'
}
end
it_behaves_like 'ovn northd'
when 'Redhat'
let(:platform_params) do
{
:ovn_northd_package_name => 'openvswitch-ovn-central',
:ovn_northd_service_name => 'ovn-northd'
:ovn_northd_package_name => 'openvswitch-ovn-central',
:ovn_northd_service_name => 'ovn-northd',
:ovn_northd_service_status => true,
:ovn_northd_service_pattern => 'undef'
}
end
it_behaves_like 'ovn northd'