Remove support for netwokring-odl
The networking-odl project was deprecated during 2023.2 cycle. Change-Id: I4ffbcecfde80791bde946fe6add006d1fd75c290
This commit is contained in:
@@ -1,19 +0,0 @@
|
||||
Puppet::Functions.create_function(:convert_cert_to_string) do
|
||||
dispatch :convert_cert_to_string do
|
||||
param 'String', :cert_file
|
||||
end
|
||||
|
||||
def convert_cert_to_string(cert_file)
|
||||
unless File.file?(cert_file)
|
||||
raise Puppet::ParseError, "Certificate file not found: #{cert_file}"
|
||||
end
|
||||
text=File.readlines(cert_file)
|
||||
cert_string = ''
|
||||
text.each do |line|
|
||||
unless line.include? '-----'
|
||||
cert_string += line.strip
|
||||
end
|
||||
end
|
||||
return cert_string
|
||||
end
|
||||
end
|
@@ -1,16 +0,0 @@
|
||||
Puppet::Functions.create_function(:convert_to_json_string) do
|
||||
def convert_to_json_string(*args)
|
||||
require 'json'
|
||||
value = args[0]
|
||||
if (value.kind_of? Array) && value.all? {|x| x.include? ":"}
|
||||
h = {}
|
||||
value.each do |s|
|
||||
k,v = s.split(/:/)
|
||||
h[k] = v
|
||||
end
|
||||
return h.to_json
|
||||
else
|
||||
return value.to_json
|
||||
end
|
||||
end
|
||||
end
|
@@ -29,7 +29,6 @@ class neutron::params {
|
||||
$user = 'neutron'
|
||||
$group = 'neutron'
|
||||
$arista_plugin_package = 'python3-networking-arista'
|
||||
$odl_plugin_package = 'python3-networking-odl'
|
||||
|
||||
case $facts['os']['family'] {
|
||||
'RedHat': {
|
||||
|
@@ -1,71 +0,0 @@
|
||||
#
|
||||
# DEPRECATED !!
|
||||
# Install the OpenDaylight and generate config file
|
||||
# from parameters in the other classes.
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*package_ensure*]
|
||||
# (optional) The intended state of the python-networking-odl
|
||||
# package, i.e. any of the possible values of the 'ensure'
|
||||
# property for a package resource type.
|
||||
# Defaults to 'present'
|
||||
#
|
||||
# [*odl_username*]
|
||||
# (optional) The opendaylight controller username
|
||||
# Defaults to $facts['os_service_default']
|
||||
# Example: 'admin'
|
||||
#
|
||||
# [*odl_password*]
|
||||
# (optional) The opendaylight controller password
|
||||
# Defaults to $facts['os_service_default']
|
||||
# Example: 'admin'
|
||||
#
|
||||
# [*odl_url*]
|
||||
# (optional) The opendaylight controller neutron URL
|
||||
# Defaults to $facts['os_service_default']
|
||||
# Example: 'http://127.0.0.1:8080/controller/nb/v2/neutron'
|
||||
#
|
||||
# [*port_binding_controller*]
|
||||
# (optional) Name of the controller to be used for port binding.
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*odl_hostconf_uri*]
|
||||
# (optional) Path for ODL host configuration REST interface.
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
# [*odl_features*]
|
||||
# (optional) List of ODL features to enable
|
||||
# Defaults to $facts['os_service_default']
|
||||
#
|
||||
class neutron::plugins::ml2::opendaylight (
|
||||
$package_ensure = 'present',
|
||||
$odl_username = $facts['os_service_default'],
|
||||
$odl_password = $facts['os_service_default'],
|
||||
$odl_url = $facts['os_service_default'],
|
||||
$port_binding_controller = $facts['os_service_default'],
|
||||
$odl_hostconf_uri = $facts['os_service_default'],
|
||||
$odl_features = $facts['os_service_default'],
|
||||
) {
|
||||
|
||||
include neutron::deps
|
||||
include neutron::params
|
||||
require neutron::plugins::ml2
|
||||
|
||||
warning('Support for networking-odl has been deprecated.')
|
||||
|
||||
package { 'python-networking-odl':
|
||||
ensure => $package_ensure,
|
||||
name => $::neutron::params::odl_plugin_package,
|
||||
tag => ['openstack', 'neutron-plugin-ml2-package']
|
||||
}
|
||||
|
||||
neutron_plugin_ml2 {
|
||||
'ml2_odl/username': value => $odl_username;
|
||||
'ml2_odl/password': value => $odl_password, secret => true;
|
||||
'ml2_odl/url': value => $odl_url;
|
||||
'ml2_odl/port_binding_controller': value => $port_binding_controller;
|
||||
'ml2_odl/odl_hostconf_uri': value => $odl_hostconf_uri;
|
||||
'ml2_odl/odl_features': value => join(any2array($odl_features), ',');
|
||||
}
|
||||
}
|
@@ -1,306 +0,0 @@
|
||||
#
|
||||
# DEPRECATED !!
|
||||
# Configure OVS to use OpenDaylight
|
||||
#
|
||||
# === Parameters
|
||||
#
|
||||
# [*tunnel_ip*]
|
||||
# (required) The IP of the host to use for tunneling tenant VXLAN/GRE over
|
||||
#
|
||||
# [*odl_username*]
|
||||
# (optional) The opendaylight controller username
|
||||
#
|
||||
# [*odl_password*]
|
||||
# (optional) The opendaylight controller password
|
||||
#
|
||||
# [*odl_check_url*]
|
||||
# (optional) The URL used to check ODL is available and ready
|
||||
# Defaults to 'http://127.0.0.1:8080/restconf/operational/network-topology:network-topology/topology/netvirt:1'
|
||||
#
|
||||
# [*odl_ovsdb_iface*]
|
||||
# (optional) The ODL southbound interface for OVSDB
|
||||
# Defaults to 'tcp:127.0.0.1:6640'
|
||||
#
|
||||
# [*ovsdb_server_iface*]
|
||||
# (optional) The interface for OVSDB local server to listen on
|
||||
# Defaults to 'ptcp:6639:127.0.0.1'
|
||||
#
|
||||
# [*provider_mappings*]
|
||||
# (optional) List of <physical_network>:<nic/bridge>
|
||||
# Required for VLAN provider networks.
|
||||
# Required for Flat provider networks when using new NetVirt
|
||||
# Defaults to empty list
|
||||
#
|
||||
# [*retry_interval*]
|
||||
# (optional) The time (in seconds) to wait between ODL availability checks
|
||||
# Defaults to 60
|
||||
#
|
||||
# [*retry_count*]
|
||||
# (optional) The number of ODL availability checks to run before failing
|
||||
# Defaults to 20
|
||||
#
|
||||
# [*host_id*]
|
||||
# (optional) The desired hostname for this node
|
||||
# Defaults to FQDN hostname of the server
|
||||
#
|
||||
# [*allowed_network_types*]
|
||||
# (optional) List of network_types to allocate as tenant networks.
|
||||
# The value 'local' is only useful for single-box testing
|
||||
# but provides no connectivity between hosts.
|
||||
# Should be an array that can have these elements:
|
||||
# local, flat, vlan, gre, vxlan
|
||||
# Defaults to ['local', 'flat', 'vlan', 'gre', 'vxlan']
|
||||
#
|
||||
# [*enable_dpdk*]
|
||||
# (optional) Enables vhostuser VIF host configuration for OVS DPDK.
|
||||
# Defaults to false.
|
||||
#
|
||||
# [*vhostuser_socket_dir*]
|
||||
# (optional) Specify the directory to use for vhostuser sockets.
|
||||
# Defaults to "/var/run/openvswitch"
|
||||
#
|
||||
# [*vhostuser_mode*]
|
||||
# (optional) Specify the mode for the VIF when creating vhostuser ports.
|
||||
# Valid values are 'client' or 'server'. In client mode, openvswitch
|
||||
# will be responsible for creating the vhostuser socket. In server mode,
|
||||
# the hypervisor will create the vhostuser socket.
|
||||
# Defaults to "server"
|
||||
#
|
||||
# [*enable_hw_offload*]
|
||||
# (optional) Configure OVS to use
|
||||
# Hardware Offload. This feature is
|
||||
# supported from ovs 2.8.0.
|
||||
# Defaults to False.
|
||||
#
|
||||
# [*enable_tls*]
|
||||
# (optional) Configure OVS to use SSL/TLS
|
||||
# Defaults to False.
|
||||
#
|
||||
# [*tls_key_file*]
|
||||
# (optional) Private key file path to use for TLS configuration
|
||||
# Defaults to False. Required if enabling TLS.
|
||||
#
|
||||
# [*tls_cert_file*]
|
||||
# (optional) Certificate file path to use for TLS configuration
|
||||
# Defaults to False. Required if enabling TLS.
|
||||
#
|
||||
# [*tls_ca_cert_file*]
|
||||
# (optional) CA Certificate file path to use for TLS configuration
|
||||
# Defaults to False.
|
||||
#
|
||||
# [*enable_ipv6*]
|
||||
# (optional) If we should enable ipv6.
|
||||
# Defaults to False.
|
||||
#
|
||||
class neutron::plugins::ovs::opendaylight (
|
||||
$tunnel_ip,
|
||||
$odl_username,
|
||||
$odl_password,
|
||||
$odl_check_url = 'http://127.0.0.1:8080/restconf/operational/network-topology:network-topology/topology/netvirt:1',
|
||||
$odl_ovsdb_iface = 'tcp:127.0.0.1:6640',
|
||||
$ovsdb_server_iface = 'ptcp:6639:127.0.0.1',
|
||||
$provider_mappings = [],
|
||||
$retry_interval = 60,
|
||||
$retry_count = 20,
|
||||
$host_id = $fqdn,
|
||||
$allowed_network_types = ['local', 'flat', 'vlan', 'vxlan', 'gre'],
|
||||
Boolean $enable_dpdk = false,
|
||||
$vhostuser_socket_dir = '/var/run/openvswitch',
|
||||
$vhostuser_mode = 'server',
|
||||
Boolean $enable_hw_offload = false,
|
||||
Boolean $enable_tls = false,
|
||||
$tls_key_file = undef,
|
||||
$tls_cert_file = undef,
|
||||
$tls_ca_cert_file = undef,
|
||||
Boolean $enable_ipv6 = false,
|
||||
) {
|
||||
|
||||
include neutron::deps
|
||||
|
||||
warning('Support for networking-odl has been deprecated.')
|
||||
|
||||
# Handle the case where ODL controller is also on this host
|
||||
Service<| title == 'opendaylight' |> -> Exec <| title == 'Wait for NetVirt OVSDB to come up' |>
|
||||
|
||||
if $enable_tls {
|
||||
if empty($tls_key_file) or empty($tls_cert_file) {
|
||||
fail('When enabling TLS, tls_key_file and tls_cert_file must be provided')
|
||||
}
|
||||
if ! empty($tls_ca_cert_file) {
|
||||
vs_ssl { 'system':
|
||||
ensure => present,
|
||||
key_file => $tls_key_file,
|
||||
cert_file => $tls_cert_file,
|
||||
ca_file => $tls_ca_cert_file,
|
||||
before => Exec['Set OVS Manager to OpenDaylight']
|
||||
}
|
||||
} else {
|
||||
vs_ssl { 'system':
|
||||
ensure => present,
|
||||
key_file => $tls_key_file,
|
||||
cert_file => $tls_cert_file,
|
||||
bootstrap => true,
|
||||
before => Exec['Set OVS Manager to OpenDaylight']
|
||||
}
|
||||
}
|
||||
|
||||
warning('TLS enabled, overriding all protocols')
|
||||
$odl_ovsdb_iface_proto = 'ssl'
|
||||
$ovsdb_server_iface_proto = 'pssl'
|
||||
$odl_check_url_proto = 'https'
|
||||
|
||||
$cert_data = convert_cert_to_string($tls_cert_file)
|
||||
$rest_data = @("END":json/L)
|
||||
{\
|
||||
"aaa-cert-rpc:input": {\
|
||||
"aaa-cert-rpc:node-alias": "${facts['networking']['hostname']}",\
|
||||
"aaa-cert-rpc:node-cert": "${cert_data}"\
|
||||
}\
|
||||
}
|
||||
|-END
|
||||
|
||||
$curl_post = "curl -k -X POST -o /dev/null --fail --silent -H 'Content-Type: application/json' -H 'Cache-Control: no-cache'"
|
||||
$curl_get = "curl -k -X POST --fail --silent -H 'Content-Type: application/json' -H 'Cache-Control: no-cache'"
|
||||
$rest_get_data = @("END":json/L)
|
||||
{\
|
||||
"aaa-cert-rpc:input": {\
|
||||
"aaa-cert-rpc:node-alias": "${facts['networking']['hostname']}"\
|
||||
}\
|
||||
}
|
||||
|-END
|
||||
|
||||
$ovsdb_arr = split($odl_ovsdb_iface, ' ')
|
||||
$odl_rest_port = regsubst($odl_check_url, '^.*:([0-9]+)/.*$', '\1')
|
||||
$ovsdb_arr.each |$ovsdb_uri| {
|
||||
|
||||
$odl_ip = regsubst($ovsdb_uri, 'ssl:(.+):[0-9]+', '\1')
|
||||
$odl_url_prefix = "https://${odl_ip}:${odl_rest_port}"
|
||||
$cert_rest_url = "${odl_url_prefix}/restconf/operations/aaa-cert-rpc:setNodeCertificate"
|
||||
$cert_rest_get = "${odl_url_prefix}/restconf/operations/aaa-cert-rpc:getNodeCertificate"
|
||||
exec { "Add trusted cert: ${tls_cert_file} to ${odl_url_prefix}":
|
||||
command => "${curl_post} -u ${odl_username}:${odl_password} -d '${rest_data}' ${cert_rest_url}",
|
||||
tries => 5,
|
||||
try_sleep => 30,
|
||||
unless => "${curl_get} -u ${odl_username}:${odl_password} -d '${rest_get_data}' ${cert_rest_get} | grep -q ${cert_data}",
|
||||
path => '/usr/sbin:/usr/bin:/sbin:/bin',
|
||||
before => Exec['Set OVS Manager to OpenDaylight'],
|
||||
require => Exec['Wait for NetVirt OVSDB to come up']
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$odl_ovsdb_iface_proto = 'tcp'
|
||||
$ovsdb_server_iface_proto = 'ptcp'
|
||||
$odl_check_url_proto = 'http'
|
||||
}
|
||||
|
||||
if $enable_ipv6 {
|
||||
$ovsdb_server_ip = '[::1]'
|
||||
}
|
||||
else {
|
||||
$ovsdb_server_ip = '127.0.0.1'
|
||||
}
|
||||
|
||||
$odl_ovsdb_iface_parsed = regsubst($odl_ovsdb_iface, 'tcp', $odl_ovsdb_iface_proto, 'G')
|
||||
$ovsdb_server_iface_parsed = "${ovsdb_server_iface_proto}:6639:${ovsdb_server_ip}"
|
||||
$odl_check_url_parsed = regsubst($odl_check_url, 'http', $odl_check_url_proto)
|
||||
|
||||
exec { 'Wait for NetVirt OVSDB to come up':
|
||||
command => "curl -g -k -o /dev/null --fail --silent --head -u ${odl_username}:${odl_password} ${odl_check_url_parsed}",
|
||||
tries => $retry_count,
|
||||
try_sleep => $retry_interval,
|
||||
path => '/usr/sbin:/usr/bin:/sbin:/bin',
|
||||
}
|
||||
# OVS manager
|
||||
-> exec { 'Set OVS Manager to OpenDaylight':
|
||||
command => "ovs-vsctl set-manager ${ovsdb_server_iface_parsed} ${odl_ovsdb_iface_parsed}",
|
||||
unless => "ovs-vsctl show | grep 'Manager \"${ovsdb_server_iface_parsed} ${odl_ovsdb_iface_parsed}\"'",
|
||||
path => '/usr/sbin:/usr/bin:/sbin:/bin',
|
||||
}
|
||||
|
||||
# local ip
|
||||
vs_config {'other_config:local_ip':
|
||||
value => $tunnel_ip,
|
||||
}
|
||||
|
||||
# set mappings for VLAN or Flat provider networks
|
||||
if $provider_mappings and ! empty($provider_mappings) {
|
||||
$pr_map_str = join(any2array($provider_mappings), ',')
|
||||
vs_config {'other_config:provider_mappings':
|
||||
value => $pr_map_str
|
||||
}
|
||||
}
|
||||
|
||||
# host config for pseudo agent binding type
|
||||
vs_config {'external_ids:odl_os_hostconfig_hostid':
|
||||
value => $host_id,
|
||||
}
|
||||
|
||||
# Set hostname to FQDN instead of default 'localhost'
|
||||
vs_config {'external_ids:hostname':
|
||||
value => $host_id,
|
||||
}
|
||||
|
||||
$json_network_types = convert_to_json_string($allowed_network_types)
|
||||
$json_bridge_mappings = convert_to_json_string($provider_mappings)
|
||||
|
||||
if $enable_hw_offload and $enable_dpdk {
|
||||
fail('Enabling hardware offload and DPDK is not allowed')
|
||||
}
|
||||
|
||||
if $enable_dpdk {
|
||||
$host_config = @("END":json/$L)
|
||||
{\
|
||||
"supported_vnic_types": [{\
|
||||
"vnic_type": "normal",\
|
||||
"vif_type": "vhostuser",\
|
||||
"vif_details": {\
|
||||
"uuid": "${facts['ovs_uuid']}",\
|
||||
"has_datapath_type_netdev": true,\
|
||||
"port_prefix": "vhu",\
|
||||
"vhostuser_socket_dir": "${vhostuser_socket_dir}",\
|
||||
"vhostuser_ovs_plug": true,\
|
||||
"vhostuser_mode": "${vhostuser_mode}",\
|
||||
"vhostuser_socket": "${vhostuser_socket_dir}/vhu\$PORT_ID"\
|
||||
}\
|
||||
}],\
|
||||
"allowed_network_types": ${json_network_types},\
|
||||
"bridge_mappings": ${json_bridge_mappings}\
|
||||
}
|
||||
|-END
|
||||
} elsif $enable_hw_offload {
|
||||
require vswitch::ovs
|
||||
$host_config = @("END":json/L)
|
||||
{\
|
||||
"supported_vnic_types": [{\
|
||||
"vnic_type": "normal",\
|
||||
"vif_type": "ovs",\
|
||||
"vif_details": {}\
|
||||
},{\
|
||||
"vnic_type": "direct",\
|
||||
"vif_type": "ovs",\
|
||||
"vif_details": {}\
|
||||
}],\
|
||||
"allowed_network_types": ${json_network_types},\
|
||||
"bridge_mappings": ${json_bridge_mappings}\
|
||||
}
|
||||
|-END
|
||||
|
||||
} else {
|
||||
$host_config = @("END":json/L)
|
||||
{\
|
||||
"supported_vnic_types": [{\
|
||||
"vnic_type": "normal",\
|
||||
"vif_type": "ovs",\
|
||||
"vif_details": {}\
|
||||
}],\
|
||||
"allowed_network_types": ${json_network_types},\
|
||||
"bridge_mappings": ${json_bridge_mappings}\
|
||||
}
|
||||
|-END
|
||||
}
|
||||
|
||||
vs_config {'external_ids:odl_os_hostconfig_config_odl_l2':
|
||||
value => $host_config
|
||||
}
|
||||
}
|
@@ -0,0 +1,4 @@
|
||||
---
|
||||
upgrade:
|
||||
- |
|
||||
Support for networking-odl has been removed.
|
@@ -1,65 +0,0 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'neutron::plugins::ml2::opendaylight' do
|
||||
let :pre_condition do
|
||||
"class { 'neutron::keystone::authtoken':
|
||||
password => 'passw0rd',
|
||||
}
|
||||
class { 'neutron::server': }
|
||||
class { 'neutron':
|
||||
core_plugin => 'ml2'
|
||||
}"
|
||||
end
|
||||
|
||||
let :default_params do
|
||||
{
|
||||
:package_ensure => 'present',
|
||||
:odl_url => '<SERVICE DEFAULT>',
|
||||
:port_binding_controller => '<SERVICE DEFAULT>',
|
||||
:odl_hostconf_uri => '<SERVICE DEFAULT>',
|
||||
:odl_features => '<SERVICE DEFAULT>',
|
||||
}
|
||||
end
|
||||
|
||||
let :params do
|
||||
{
|
||||
:odl_username => 'user',
|
||||
:odl_password => 'password',
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples 'neutron plugin opendaylight ml2' do
|
||||
before do
|
||||
params.merge!(default_params)
|
||||
end
|
||||
|
||||
it 'should have' do
|
||||
should contain_package('python-networking-odl').with(
|
||||
:ensure => params[:package_ensure],
|
||||
:name => 'python3-networking-odl',
|
||||
:tag => ['openstack', 'neutron-plugin-ml2-package']
|
||||
)
|
||||
end
|
||||
|
||||
it 'configures ml2_odl settings' do
|
||||
should contain_neutron_plugin_ml2('ml2_odl/password').with_value(params[:odl_password]).with_secret(true)
|
||||
should contain_neutron_plugin_ml2('ml2_odl/username').with_value(params[:odl_username])
|
||||
should contain_neutron_plugin_ml2('ml2_odl/url').with_value(params[:odl_url])
|
||||
should contain_neutron_plugin_ml2('ml2_odl/port_binding_controller').with_value(params[:port_binding_controller])
|
||||
should contain_neutron_plugin_ml2('ml2_odl/odl_hostconf_uri').with_value(params[:odl_hostconf_uri])
|
||||
should contain_neutron_plugin_ml2('ml2_odl/odl_features').with_value(params[:odl_features])
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_behaves_like 'neutron plugin opendaylight ml2'
|
||||
end
|
||||
end
|
||||
end
|
@@ -1,240 +0,0 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'neutron::plugins::ovs::opendaylight' do
|
||||
let :default_params do
|
||||
{
|
||||
:odl_check_url => 'http://127.0.0.1:8080/restconf/operational/network-topology:network-topology/topology/netvirt:1',
|
||||
:odl_ovsdb_iface => 'tcp:127.0.0.1:6640',
|
||||
:ovsdb_server_iface => 'ptcp:6639:127.0.0.1',
|
||||
:provider_mappings => [],
|
||||
:retry_interval => 60,
|
||||
:retry_count => 20,
|
||||
:host_id => "dummy_host",
|
||||
:allowed_network_types => ['local', 'flat', 'vlan', 'vxlan', 'gre'],
|
||||
:enable_dpdk => false,
|
||||
:vhostuser_socket_dir => '/var/run/openvswitch',
|
||||
:vhostuser_mode => 'server',
|
||||
:enable_hw_offload => false,
|
||||
:enable_tls => false,
|
||||
:enable_ipv6 => false,
|
||||
}
|
||||
end
|
||||
|
||||
let :params do
|
||||
{
|
||||
:tunnel_ip => '127.0.0.1',
|
||||
:odl_username => 'user',
|
||||
:odl_password => 'password',
|
||||
}
|
||||
end
|
||||
|
||||
shared_examples 'neutron plugin opendaylight ovs' do
|
||||
before do
|
||||
params.merge!(default_params)
|
||||
end
|
||||
|
||||
context 'with provider mappings' do
|
||||
before do
|
||||
params.merge!({ :provider_mappings => ['default:br-ex'] })
|
||||
end
|
||||
it_behaves_like 'with provider mappings'
|
||||
end
|
||||
|
||||
context 'with DPDK enabled' do
|
||||
before do
|
||||
params.merge!({ :enable_dpdk => true })
|
||||
end
|
||||
it_behaves_like 'with DPDK enabled'
|
||||
end
|
||||
|
||||
context 'with hw_offload and DPDK enabled' do
|
||||
before do
|
||||
params.merge!({ :enable_hw_offload => true, :enable_dpdk => true})
|
||||
end
|
||||
|
||||
it { should raise_error(Puppet::Error, /Enabling hardware offload and DPDK is not allowed/) }
|
||||
end
|
||||
|
||||
it_behaves_like 'with default parameters'
|
||||
|
||||
context 'with TLS and no key or certificates' do
|
||||
before do
|
||||
params.merge!({ :enable_tls => true })
|
||||
end
|
||||
|
||||
it { should raise_error(Puppet::Error, /When enabling TLS, tls_key_file and tls_cert_file must be provided/) }
|
||||
end
|
||||
|
||||
# TODO(tkajinam): The following test cases are now disabled to avoid
|
||||
# failures on Focal.
|
||||
# https://bugs.launchpad.net/puppet-neutron/+bug/1921450
|
||||
# context 'with TLS and no CA cert' do
|
||||
# before do
|
||||
# File.stubs(:file?).returns(true)
|
||||
# File.stubs(:readlines).returns(["MIIFGjCCBAKgAwIBAgICA"])
|
||||
# params.merge!({
|
||||
# :enable_tls => true,
|
||||
# :tls_key_file => 'dummy.pem',
|
||||
# :tls_cert_file => 'dummy.crt'})
|
||||
# end
|
||||
# it_behaves_like 'with TLS enabled'
|
||||
# it {should contain_vs_ssl('system').with(
|
||||
# 'ensure' => 'present',
|
||||
# 'key_file' => 'dummy.pem',
|
||||
# 'cert_file' => 'dummy.crt',
|
||||
# 'bootstrap' => true,
|
||||
# 'before' => 'Exec[Set OVS Manager to OpenDaylight]'
|
||||
# )}
|
||||
# end
|
||||
|
||||
# context 'with TLS and CA cert' do
|
||||
# before do
|
||||
# File.stubs(:file?).returns(true)
|
||||
# File.stubs(:readlines).returns(["MIIFGjCCBAKgAwIBAgICA"])
|
||||
# params.merge!({
|
||||
# :enable_tls => true,
|
||||
# :tls_key_file => 'dummy.pem',
|
||||
# :tls_cert_file => 'dummy.crt',
|
||||
# :tls_ca_cert_file => 'ca.crt'})
|
||||
# end
|
||||
# it_behaves_like 'with TLS enabled'
|
||||
# it {should contain_vs_ssl('system').with(
|
||||
# 'ensure' => 'present',
|
||||
# 'key_file' => 'dummy.pem',
|
||||
# 'cert_file' => 'dummy.crt',
|
||||
# 'ca_file' => 'ca.crt',
|
||||
# 'before' => 'Exec[Set OVS Manager to OpenDaylight]'
|
||||
# )}
|
||||
# end
|
||||
|
||||
# context 'with TLS and multiple ODLs' do
|
||||
# before do
|
||||
# File.stubs(:file?).returns(true)
|
||||
# File.stubs(:readlines).returns(["MIIFGjCCBAKgAwIBAgICA"])
|
||||
# params.merge!({
|
||||
# :enable_tls => true,
|
||||
# :tls_key_file => 'dummy.pem',
|
||||
# :tls_cert_file => 'dummy.crt',
|
||||
# :odl_ovsdb_iface => 'ssl:127.0.0.1:6640 ssl:172.0.0.1:6640'})
|
||||
# end
|
||||
#
|
||||
# it_behaves_like 'with TLS and ODL HA'
|
||||
# it {should contain_vs_ssl('system').with(
|
||||
# 'ensure' => 'present',
|
||||
# 'key_file' => 'dummy.pem',
|
||||
# 'cert_file' => 'dummy.crt',
|
||||
# 'bootstrap' => true,
|
||||
# 'before' => 'Exec[Set OVS Manager to OpenDaylight]'
|
||||
# )}
|
||||
# end
|
||||
|
||||
context 'with IPv6 enabled' do
|
||||
before do
|
||||
params.merge!({
|
||||
:enable_ipv6 => true,
|
||||
:odl_ovsdb_iface => 'tcp:[::1]:6640',
|
||||
})
|
||||
end
|
||||
|
||||
it_behaves_like 'with IPv6 enabled'
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'with default parameters' do
|
||||
it 'configures OVS for ODL' do
|
||||
should contain_exec('Wait for NetVirt OVSDB to come up')
|
||||
should contain_exec('Set OVS Manager to OpenDaylight')
|
||||
should contain_vs_config('other_config:local_ip')
|
||||
should_not contain_vs_config('other_config:provider_mappings')
|
||||
should contain_vs_config('external_ids:odl_os_hostconfig_hostid')
|
||||
should contain_vs_config('external_ids:hostname')
|
||||
should contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2')
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'with provider mappings' do
|
||||
it 'configures OVS for ODL' do
|
||||
should contain_exec('Wait for NetVirt OVSDB to come up')
|
||||
should contain_exec('Set OVS Manager to OpenDaylight')
|
||||
should contain_vs_config('other_config:local_ip')
|
||||
should contain_vs_config('other_config:provider_mappings')
|
||||
should contain_vs_config('external_ids:odl_os_hostconfig_hostid')
|
||||
should contain_vs_config('external_ids:hostname')
|
||||
should contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2').with(
|
||||
:value => /bridge_mappings\": {\"default\":\"br-ex\"}/
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'with DPDK enabled' do
|
||||
it 'configures OVS for ODL' do
|
||||
should contain_exec('Wait for NetVirt OVSDB to come up')
|
||||
should contain_exec('Set OVS Manager to OpenDaylight')
|
||||
should contain_vs_config('other_config:local_ip')
|
||||
should_not contain_vs_config('other_config:provider_mappings')
|
||||
should contain_vs_config('external_ids:odl_os_hostconfig_hostid')
|
||||
should contain_vs_config('external_ids:hostname')
|
||||
should contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2').with(
|
||||
:value => /vhostuser/,
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'with TLS enabled' do
|
||||
before do
|
||||
params.merge!({ :odl_ovsdb_iface => 'ssl:127.0.0.1:6640' })
|
||||
end
|
||||
it 'configures OVS for ODL' do
|
||||
should contain_exec('Add trusted cert: dummy.crt to https://127.0.0.1:8080')
|
||||
should contain_exec('Set OVS Manager to OpenDaylight').with(
|
||||
:command => "ovs-vsctl set-manager pssl:6639:127.0.0.1 ssl:127.0.0.1:6640"
|
||||
)
|
||||
should contain_vs_config('other_config:local_ip')
|
||||
should_not contain_vs_config('other_config:provider_mappings')
|
||||
should contain_vs_config('external_ids:odl_os_hostconfig_hostid')
|
||||
should contain_vs_config('external_ids:hostname')
|
||||
should contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2')
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'with TLS and ODL HA' do
|
||||
it 'configures OVS for ODL' do
|
||||
should contain_exec('Add trusted cert: dummy.crt to https://172.0.0.1:8080')
|
||||
should contain_exec('Add trusted cert: dummy.crt to https://127.0.0.1:8080')
|
||||
should contain_exec('Set OVS Manager to OpenDaylight').with(
|
||||
:command => "ovs-vsctl set-manager pssl:6639:127.0.0.1 ssl:127.0.0.1:6640 ssl:172.0.0.1:6640"
|
||||
)
|
||||
should contain_vs_config('other_config:local_ip')
|
||||
should_not contain_vs_config('other_config:provider_mappings')
|
||||
should contain_vs_config('external_ids:odl_os_hostconfig_hostid')
|
||||
should contain_vs_config('external_ids:hostname')
|
||||
should contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2')
|
||||
end
|
||||
end
|
||||
|
||||
shared_examples 'with IPv6 enabled' do
|
||||
it 'configures OVS for ODL' do
|
||||
should contain_exec('Wait for NetVirt OVSDB to come up')
|
||||
should contain_exec('Set OVS Manager to OpenDaylight').with(
|
||||
:command => "ovs-vsctl set-manager ptcp:6639:[::1] tcp:[::1]:6640"
|
||||
)
|
||||
should contain_vs_config('other_config:local_ip')
|
||||
should_not contain_vs_config('other_config:provider_mappings')
|
||||
should contain_vs_config('external_ids:odl_os_hostconfig_hostid')
|
||||
should contain_vs_config('external_ids:hostname')
|
||||
should contain_vs_config('external_ids:odl_os_hostconfig_config_odl_l2')
|
||||
end
|
||||
end
|
||||
|
||||
on_supported_os({
|
||||
:supported_os => OSDefaults.get_supported_os
|
||||
}).each do |os,facts|
|
||||
context "on #{os}" do
|
||||
let (:facts) do
|
||||
facts.merge!(OSDefaults.get_facts())
|
||||
end
|
||||
|
||||
it_behaves_like 'neutron plugin opendaylight ovs'
|
||||
end
|
||||
end
|
||||
end
|
@@ -1,39 +0,0 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'convert_cert_to_string' do
|
||||
it 'exists' do
|
||||
is_expected.not_to eq(nil)
|
||||
end
|
||||
|
||||
it 'fails with no arguments' do
|
||||
is_expected.to run.with_params.and_raise_error(ArgumentError)
|
||||
end
|
||||
|
||||
it 'fails when arg is not a string' do
|
||||
is_expected.to run.with_params(123).and_raise_error(ArgumentError)
|
||||
end
|
||||
|
||||
context 'when file does not exist' do
|
||||
it 'fails when cert file doesnt exist' do
|
||||
allow(File).to receive(:file?).with('/etc/ssl/certs/test.pem').and_return(false)
|
||||
is_expected.to run.with_params('/etc/ssl/certs/test.pem').and_raise_error(Puppet::ParseError)
|
||||
end
|
||||
end
|
||||
|
||||
context 'with certificate that doesnt need strip' do
|
||||
it 'should return proper value' do
|
||||
allow(File).to receive(:file?).with('/etc/ssl/certs/test.pem').and_return(true)
|
||||
allow(File).to receive(:readlines).with('/etc/ssl/certs/test.pem').and_return(['----- BEGIN CERTIFICATE -----', 'abc123data', '----- END CERTIFICATE -----'])
|
||||
is_expected.to run.with_params('/etc/ssl/certs/test.pem').and_return('abc123data')
|
||||
end
|
||||
end
|
||||
|
||||
context 'with certificate that requires strip' do
|
||||
it 'should return proper value' do
|
||||
allow(File).to receive(:file?).with('/etc/ssl/certs/test.pem').and_return(true)
|
||||
# NOTE(tobias-urdin): There is spacing in the return data here on purpose to test the ruby string strip.
|
||||
allow(File).to receive(:readlines).with('/etc/ssl/certs/test.pem').and_return(['----- BEGIN CERTIFICATE -----', ' abc321 ', '----- END CERTIFICATE -----'])
|
||||
is_expected.to run.with_params('/etc/ssl/certs/test.pem').and_return('abc321')
|
||||
end
|
||||
end
|
||||
end
|
@@ -1,22 +0,0 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'convert_to_json_string' do
|
||||
it 'exists' do
|
||||
is_expected.not_to eq(nil)
|
||||
end
|
||||
|
||||
it 'hash to json string' do
|
||||
data = {:some => "data"}
|
||||
is_expected.to run.with_params(data).and_return('{"some":"data"}')
|
||||
end
|
||||
|
||||
it 'array of strings with kv to json string' do
|
||||
data = ['mykey:myvalue', 'key2:val2']
|
||||
is_expected.to run.with_params(data).and_return('{"mykey":"myvalue","key2":"val2"}')
|
||||
end
|
||||
|
||||
it 'array of strings to json strings' do
|
||||
data = ['val1', 'val2']
|
||||
is_expected.to run.with_params(data).and_return('["val1","val2"]')
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user