1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
require 'spec_helper_acceptance'
describe 'basic vswitch' do
context 'default parameters' do
it 'should work with no errors' do
pp= <<-EOS
include openstack_integration
include openstack_integration::repos
include vswitch::ovs
vs_bridge { 'br-ci1':
ensure => present,
}
vs_bridge { 'br-ci2':
ensure => present,
external_ids => 'bridge-id=br-ci2'
}
vs_bridge { 'br-ci3':
ensure => present,
mac_table_size => 50000,
}
vs_bridge { 'br-ci4':
ensure => present,
external_ids => {'bridge-id' => 'br-ci4'},
mac_table_size => 50000,
}
~> exec { 'create_loop1_port':
path => '/usr/bin:/bin:/usr/sbin:/sbin',
provider => shell,
command => 'ip link add name loop1 type dummy && ip addr add 127.2.0.1/24 dev loop1',
before => Vs_port['loop1'],
refreshonly => true,
}
-> vs_port { 'loop1':
ensure => present,
bridge => 'br-ci4',
}
vs_bridge { 'br-ci5':
ensure => present,
external_ids => 'bridge-id=br-ci5',
mac_table_size => 50000,
}
vs_config { 'external_ids:ovn-remote':
ensure => present,
value => 'tcp:127.0.0.1:2300',
}
vs_config { 'external_ids:ovn-cms-options':
ensure => present,
value => 'enable-chassis-as-gw,availability-zones=nova',
}
vs_config { 'other_config:thisshouldexist':
ensure => present,
value => 'customvalue',
}
vs_config { 'other_config:thisshouldnotexist':
ensure => present,
value => undef,
}
vs_config { 'other_config:thisshouldnotexist2':
ensure => present,
value => '',
}
vs_config { 'other_config:thisshouldnotexist3':
ensure => present,
value => [],
}
EOS
# Run it twice and test for idempotency
apply_manifest(pp, :catch_failures => true)
apply_manifest(pp, :catch_changes => true)
end
it 'should have br-ci1 bridge' do
command('ovs-vsctl show') do |r|
expect(r.stdout).to match(/br-ci1/)
end
end
it 'should have br-ci2 bridge' do
command('ovs-vsctl show') do |r|
expect(r.stdout).to match(/br-ci2/)
end
end
it 'should have external_ids on br-ci2 bridge' do
command('ovs-vsctl br-get-external-id br-ci2') do |r|
expect(r.stdout).to match(/bridge-id=br-ci2/)
end
end
it 'should have br-ci3 bridge' do
command('ovs-vsctl show') do |r|
expect(r.stdout).to match(/br-ci3/)
end
end
it 'should have mac-table-size on br-ci3 bridge' do
command('ovs-vsctl get Bridge br-ci3 other-config:mac-table-size') do |r|
expect(r.stdout).to match(/\"50000\"/)
end
end
it 'should have br-ci4 bridge' do
command('ovs-vsctl show') do |r|
expect(r.stdout).to match(/br-ci4/)
end
end
it 'should have external_ids on br-ci4 bridge' do
command('ovs-vsctl br-get-external-id br-ci4') do |r|
expect(r.stdout).to match(/bridge-id=br-ci4/)
end
end
it 'should have external_ids on br-ci5 bridge' do
command('ovs-vsctl br-get-external-id br-ci5') do |r|
expect(r.stdout).to match(/bridge-id=br-ci5/)
end
end
it 'should have mac-table-size on br-ci4 bridge' do
command('ovs-vsctl get Bridge br-ci4 other-config:mac-table-size') do |r|
expect(r.stdout).to match(/\"50000\"/)
end
end
it 'should get ovn remote addr' do
command('ovs-vsctl get Open_vSwitch . external_ids:ovn-remote') do |r|
expect(r.stdout).to match(/\"tcp:127.0.0.1:2300\"/)
end
end
it 'should get ovn cms options' do
command('ovs-vsctl get Open_vSwitch . external_ids:ovn-cms-options') do |r|
expect(r.stdout).to match(/\"enable-chassis-as-gw,availability-zones=nova\"/)
end
end
it 'should get other config' do
command('sudo ovs-vsctl get Open_Vswitch . other_config') do |r|
expect(r.stdout).to match(/\"{thishshouldexist=customvalue}"/)
end
end
end
end
|