Skip to content

Commit d2ce5cd

Browse files
committed
Add new classes ovs_driver and sriov_driver
Those classes handles ML2 plugin's configuration related to the OVS and SR-IOV mechanism drivers. Previously there was neutron::plugins::ml2::mech_driver function which was used by neutron::plugins::ml2 class but it isn't used at all currently and probably it will need to be deprecated and removed in follow up patch(es). Change-Id: I2a321fb780e789b7556d557e2170a3267049c432 (cherry picked from commit 0b8a90e)
1 parent 59d6074 commit d2ce5cd

File tree

5 files changed

+138
-0
lines changed

5 files changed

+138
-0
lines changed

manifests/plugins/ml2/ovs_driver.pp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
2+
# not use this file except in compliance with the License. You may obtain
3+
# a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations
11+
# under the License.
12+
#
13+
# neutron::plugins::ml2::ovs_driver
14+
#
15+
# === Parameters:
16+
#
17+
# [*vnic_type_blacklist*]
18+
# (optional) list of VNIC types for which support in Neutron is
19+
# administratively prohibited by the OVS mechanism driver
20+
# Defaults to []
21+
#
22+
class neutron::plugins::ml2::ovs_driver (
23+
$vnic_type_blacklist = [],
24+
){
25+
26+
if !empty($vnic_type_blacklist) {
27+
neutron_plugin_ml2 {
28+
'ovs_driver/vnic_type_blacklist': value => join(any2array($vnic_type_blacklist), ',');
29+
}
30+
}
31+
}

manifests/plugins/ml2/sriov_driver.pp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
2+
# not use this file except in compliance with the License. You may obtain
3+
# a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations
11+
# under the License.
12+
#
13+
# neutron::plugins::ml2::ovs_driver
14+
#
15+
# === Parameters:
16+
#
17+
# [*vnic_type_blacklist*]
18+
# (optional) list of VNIC types for which support in Neutron is
19+
# administratively prohibited by the OVS mechanism driver
20+
# Defaults to []
21+
#
22+
class neutron::plugins::ml2::sriov_driver (
23+
$vnic_type_blacklist= [],
24+
){
25+
26+
if !empty($vnic_type_blacklist) {
27+
neutron_plugin_ml2 {
28+
'sriov_driver/vnic_type_blacklist': value => join(any2array($vnic_type_blacklist), ',');
29+
}
30+
}
31+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
features:
3+
- |
4+
The following two new classes have been added, to set up parameters in
5+
ovs_driver and sriov_driver section.
6+
7+
- ``neutron::plugins::ml2::ovs_driver``
8+
- ``neutron::plugins::ml2::sriov_driver``
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
2+
# not use this file except in compliance with the License. You may obtain
3+
# a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations
11+
# under the License.
12+
#
13+
# Unit tests for neutron::plugins::ml2::ovs_driver class
14+
15+
required 'spec_helper'
16+
17+
describe 'neutron::plugins::ml2::ovs_driver' do
18+
19+
let :default_params do
20+
{
21+
:vnic_type_blacklist => []
22+
}
23+
end
24+
25+
context 'when vnic_type_blacklist is not empty list' do
26+
before :each do
27+
params.merge!(:vnic_type_blacklist => ['direct'])
28+
end
29+
30+
it 'should configure direct in vnic_type_blacklist' do
31+
shoud contain_neutron_plugin_ml2('ovs_driver/vnic_type_blacklist').with_value("direct")
32+
end
33+
end
34+
end
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Licensed under the Apache License, Version 2.0 (the "License"); you may
2+
# not use this file except in compliance with the License. You may obtain
3+
# a copy of the License at
4+
#
5+
# http://www.apache.org/licenses/LICENSE-2.0
6+
#
7+
# Unless required by applicable law or agreed to in writing, software
8+
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9+
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10+
# License for the specific language governing permissions and limitations
11+
# under the License.
12+
#
13+
# Unit tests for neutron::plugins::ml2::sriov_driver class
14+
15+
required 'spec_helper'
16+
17+
describe 'neutron::plugins::ml2::sriov_driver' do
18+
19+
let :default_params do
20+
{
21+
:vnic_type_blacklist => []
22+
}
23+
end
24+
25+
context 'when vnic_type_blacklist is not empty list' do
26+
before :each do
27+
params.merge!(:vnic_type_blacklist => ['direct'])
28+
end
29+
30+
it 'should configure direct in vnic_type_blacklist' do
31+
shoud contain_neutron_plugin_ml2('sriov_driver/vnic_type_blacklist').with_value("direct")
32+
end
33+
end
34+
end

0 commit comments

Comments
 (0)