Add Solaris support
This patch adds Solaris support for configuration of openvswitch. Change-Id: I9372eae6d084443f8e6bc7110b566e69b92d2a99
This commit is contained in:
parent
bec7a21324
commit
1794f54fbe
@ -4,6 +4,8 @@ Puppet::Type.type(:vs_bridge).provide(:ovs) do
|
|||||||
commands :vsctl => 'ovs-vsctl'
|
commands :vsctl => 'ovs-vsctl'
|
||||||
if Facter.value(:operatingsystem) == 'FreeBSD'
|
if Facter.value(:operatingsystem) == 'FreeBSD'
|
||||||
commands :ifconfig => 'ifconfig'
|
commands :ifconfig => 'ifconfig'
|
||||||
|
elsif Facter.value(:operatingsystem) == 'Solaris'
|
||||||
|
commands :ipadm => '/usr/sbin/ipadm'
|
||||||
else
|
else
|
||||||
commands :ip => 'ip'
|
commands :ip => 'ip'
|
||||||
end
|
end
|
||||||
@ -19,6 +21,8 @@ Puppet::Type.type(:vs_bridge).provide(:ovs) do
|
|||||||
if Facter.value(:operatingsystem) == 'FreeBSD'
|
if Facter.value(:operatingsystem) == 'FreeBSD'
|
||||||
vsctl('set','bridge',@resource[:name],'datapath_type=netdev')
|
vsctl('set','bridge',@resource[:name],'datapath_type=netdev')
|
||||||
ifconfig(@resource[:name],'up')
|
ifconfig(@resource[:name],'up')
|
||||||
|
elsif Facter.value(:operatingsystem) == 'Solaris'
|
||||||
|
ipadm('create-ip', @resource[:name])
|
||||||
else
|
else
|
||||||
ip('link', 'set', @resource[:name], 'up')
|
ip('link', 'set', @resource[:name], 'up')
|
||||||
end
|
end
|
||||||
|
@ -98,6 +98,21 @@ class vswitch::ovs(
|
|||||||
status => $::vswitch::params::ovs_status,
|
status => $::vswitch::params::ovs_status,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
'Solaris': {
|
||||||
|
service { 'ovsdb-server':
|
||||||
|
ensure => true,
|
||||||
|
enable => true,
|
||||||
|
name => $::vswitch::params::ovsdb_service_name,
|
||||||
|
status => $::vswitch::params::ovsdb_status,
|
||||||
|
}
|
||||||
|
~>
|
||||||
|
service { 'openvswitch':
|
||||||
|
ensure => true,
|
||||||
|
enable => true,
|
||||||
|
name => $::vswitch::params::ovs_service_name,
|
||||||
|
status => $::vswitch::params::ovs_status,
|
||||||
|
}
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
fail( "${::osfamily} not yet supported by puppet-vswitch")
|
fail( "${::osfamily} not yet supported by puppet-vswitch")
|
||||||
}
|
}
|
||||||
|
@ -23,6 +23,13 @@ class vswitch::params {
|
|||||||
$ovs_status = "/usr/sbin/service ${ovs_service_name} onestatus"
|
$ovs_status = "/usr/sbin/service ${ovs_service_name} onestatus"
|
||||||
$ovsdb_status = "/usr/sbin/service ${ovsdb_service_name} onestatus"
|
$ovsdb_status = "/usr/sbin/service ${ovsdb_service_name} onestatus"
|
||||||
}
|
}
|
||||||
|
'Solaris': {
|
||||||
|
$ovs_package_name = 'service/network/openvswitch'
|
||||||
|
$ovs_service_name = 'application/openvswitch/vswitch-server:default'
|
||||||
|
$ovsdb_service_name = 'application/openvswitch/ovsdb-server:default'
|
||||||
|
$ovs_status = "/usr/bin/svcs -H -o state ${ovs_service_name} | grep online"
|
||||||
|
$ovsdb_status = "/usr/bin/svcs -H -o state ${ovsdb_service_name} | grep online"
|
||||||
|
}
|
||||||
default: {
|
default: {
|
||||||
fail " Osfamily ${::osfamily} not supported yet"
|
fail " Osfamily ${::osfamily} not supported yet"
|
||||||
}
|
}
|
||||||
|
@ -31,6 +31,10 @@
|
|||||||
{
|
{
|
||||||
"operatingsystem":"FreeBSD",
|
"operatingsystem":"FreeBSD",
|
||||||
"operatingsystemrelease": [ "10.0", "11.0" ]
|
"operatingsystemrelease": [ "10.0", "11.0" ]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"operatingsystem":"Solaris",
|
||||||
|
"operatingsystemrelease": [ "11.3", "12.0" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"requirements": [
|
"requirements": [
|
||||||
|
@ -47,6 +47,18 @@ describe 'vswitch::ovs' do
|
|||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let :solaris_platform_params do {
|
||||||
|
:ovs_package_name => 'service/network/openvswitch',
|
||||||
|
:ovs_service_name => 'application/openvswitch/vswitch-server:default',
|
||||||
|
:ovsdb_service_name => 'application/openvswitch/ovsdb-server:default',
|
||||||
|
:provider => 'ovs',
|
||||||
|
:service_hasstatus => nil,
|
||||||
|
:ovsdb_hasstatus => nil,
|
||||||
|
:service_status => '/usr/bin/svcs -H -o state application/openvswitch/vswitch-server:default | grep online',
|
||||||
|
:ovsdb_status => '/usr/bin/svcs -H -o state application/openvswitch/ovsdb-server:default | grep online',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
shared_examples_for 'vswitch ovs' do
|
shared_examples_for 'vswitch ovs' do
|
||||||
it 'contains params' do
|
it 'contains params' do
|
||||||
is_expected.to contain_class('vswitch::params')
|
is_expected.to contain_class('vswitch::params')
|
||||||
@ -250,4 +262,57 @@ describe 'vswitch::ovs' do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'on Solaris with default parameters' do
|
||||||
|
let :params do default_params end
|
||||||
|
|
||||||
|
let :facts do
|
||||||
|
{:osfamily => 'Solaris',
|
||||||
|
:operatingsystem => 'Solaris',
|
||||||
|
:ovs_version => '2.3.1',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
let :platform_params do solaris_platform_params end
|
||||||
|
|
||||||
|
it_configures 'vswitch ovs'
|
||||||
|
it_configures 'do not install dkms'
|
||||||
|
|
||||||
|
it 'configures ovsdb service' do
|
||||||
|
is_expected.to contain_service('ovsdb-server').with(
|
||||||
|
:ensure => true,
|
||||||
|
:enable => true,
|
||||||
|
:name => platform_params[:ovsdb_service_name],
|
||||||
|
:hasstatus => platform_params[:ovsdb_hasstatus],
|
||||||
|
:status => platform_params[:ovsdb_status],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'on Solaris with parameters' do
|
||||||
|
let :params do {
|
||||||
|
:package_ensure => 'latest',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
let :facts do
|
||||||
|
{:osfamily => 'Solaris',
|
||||||
|
:operatingsystem => 'Solaris',
|
||||||
|
:ovs_version => '2.3.1',
|
||||||
|
}
|
||||||
|
end
|
||||||
|
let :platform_params do solaris_platform_params end
|
||||||
|
|
||||||
|
it_configures 'vswitch ovs'
|
||||||
|
it_configures 'do not install dkms'
|
||||||
|
|
||||||
|
it 'configures ovsdb service' do
|
||||||
|
is_expected.to contain_service('ovsdb-server').with(
|
||||||
|
:ensure => true,
|
||||||
|
:enable => true,
|
||||||
|
:name => platform_params[:ovsdb_service_name],
|
||||||
|
:hasstatus => platform_params[:ovsdb_hasstatus],
|
||||||
|
:status => platform_params[:ovsdb_status],
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user