Enforce correct value for encapsulation type
The ovn-encap-type option accepts vxlan, geneve and stt. Ensure that only supported values are given. Note: stt is already deprecated and is not quote popular in OpenStack deployments so is not accepted at this moment. Change-Id: I9365504a7b444b5f06c44aeda2cbb131f9c8aa0a
This commit is contained in:
@@ -147,7 +147,7 @@ class ovn::controller(
|
||||
String $ovn_remote,
|
||||
Stdlib::IP::Address $ovn_encap_ip,
|
||||
String $package_ensure = 'present',
|
||||
Variant[String[1], Array[String[1]]] $ovn_encap_type = 'geneve',
|
||||
Variant[Ovn::EncapType, Array[Ovn::EncapType]] $ovn_encap_type = 'geneve',
|
||||
Optional[Variant[String, Integer]] $ovn_encap_tos = undef,
|
||||
Ovn::BridgeMappings $ovn_bridge_mappings = [],
|
||||
Array[String[1]] $bridge_interface_mappings = [],
|
||||
|
||||
35
spec/type_aliases/encaptype_spec.rb
Normal file
35
spec/type_aliases/encaptype_spec.rb
Normal file
@@ -0,0 +1,35 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe 'Ovn::EncapType' do
|
||||
describe 'valid types' do
|
||||
context 'with valid types' do
|
||||
[
|
||||
'geneve',
|
||||
'vxlan'
|
||||
].each do |value|
|
||||
describe value.inspect do
|
||||
it { is_expected.to allow_value(value) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe 'invalid types' do
|
||||
context 'with garbage inputs' do
|
||||
[
|
||||
'',
|
||||
'vlan',
|
||||
true,
|
||||
false,
|
||||
1,
|
||||
['vxlan'],
|
||||
{'' => 'vxlan'},
|
||||
{'vxlan' => ''}
|
||||
].each do |value|
|
||||
describe value.inspect do
|
||||
it { is_expected.not_to allow_value(value) }
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
1
types/encaptype.pp
Normal file
1
types/encaptype.pp
Normal file
@@ -0,0 +1 @@
|
||||
type Ovn::EncapType = Enum['geneve', 'vxlan']
|
||||
Reference in New Issue
Block a user