Skip to content

Instantly share code, notes, and snippets.

@michaeltchapman
Created July 18, 2013 06:16
Show Gist options
  • Save michaeltchapman/6027055 to your computer and use it in GitHub Desktop.
Save michaeltchapman/6027055 to your computer and use it in GitHub Desktop.
puppet=quantum cisco plugin spec
require 'spec_helper'
describe 'quantum::plugins::cisco' do
let :pre_condition do
"class { 'quantum::server': auth_password => 'password'}"
end
let (:params_required) {
{ :keystone_username => 'quantum',
:keystone_password => 'quantum_pass',
:keystone_auth_url => 'http://127.0.0.1:35357/v2.0/',
:keystone_tenant => 'tenant',
:database_name => 'quantum',
:database_pass => 'dbpass',
:database_host => 'localhost',
:database_user => 'quantum'}
}
shared_examples_for 'default cisco plugin' do
before do
params.merge!(params_required)
end
it 'should perform default l2 configuration' do
should contain_quantum_plugin_cisco_l2network('VLANS/vlan_start').\
with_value(params[:vlan_start])
should contain_quantum_plugin_cisco_l2network('VLANS/vlan_end').\
with_value(params[:vlan_start])
should contain_quantum_plugin_cisco_l2network('VLANS/vlan_name_prefix').\
with_value(params[:vlan_name_prefix])
should contain_quantum_plugin_cisco_l2network('MODEL/model_class').\
with_value(params[:model_class])
should contain_quantum_plugin_cisco_l2network('PORTS/max_ports').\
with_value(params[:max_ports])
should contain_quantum_plugin_cisco_l2network('PORTPROFILES/max_port_profiles').\
with_value(params[:max_port_profiles])
should contain_quantum_plugin_cisco_l2network('NETWORKS/max_networks').\
with_value(params[:max_networks])
should contain_quantum_plugin_cisco_l2network('SEGMENTATION/manager_class').\
with_value(params[:manager_class])
end
it 'should create a dummy inventory item' do
should contain_quantum_plugin_cisco('INVENTORY/dummy').\
with_value('dummy').with_require(/Service\[quantum-server\]/)
end
it 'should configure the db connection' do
should contain_quantum_plugin_cisco_db_conn('DATABASE/name').\
with_value(params[:database_name])
should contain_quantum_plugin_cisco_db_conn('DATABASE/user').\
with_value(params[:database_user])
should contain_quantum_plugin_cisco_db_conn('DATABASE/pass').\
with_value(params[:database_pass])
should contain_quantum_plugin_cisco_db_conn('DATABASE/host').\
with_value(params[:database_host])
end
it 'should configure the admin credentials' do
should contain_quantum_plugin_cisco_credentials('keystone/username').\
with_value(params[:keystone_username])
should contain_quantum_plugin_cisco_credentials('keystone/password').\
with_value(params[:keystone_password])
should contain_quantum_plugin_cisco_credentials('keystone/auth_url').\
with_value(params[:keystone_auth_url])
should contain_quantum_plugin_cisco_credentials('keystone/tenant').\
with_value(params[:keystone_tenant])
end
context 'with nexus plugin' do
let :each do
params.merge!(:nexus_plugin => 'quantum.plugins.cisco.nexus.cisco_nexus_plugin_v2.NexusPlugin')
end
it 'should perform nexus plugin configuration' do
should contain_quantum_plugin_cisco('PLUGINS/nexus_plugin').\
with_ensure('quantum.plugins.cisco.nexus.cisco_nexus_plugin_v2.NexusPlugin')
end
end
context 'with vswitch plugin' do
before :each do
params.merge!(:vswitch_plugin => 'quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2')
end
it 'should perform vswitch plugin configuration' do
should contain_quantum_plugin_cisco('PLUGINS/vswitch_plugin').\
with_ensure('quantum.plugins.openvswitch.ovs_quantum_plugin.OVSQuantumPluginV2')
end
end
end
context 'on Debian platforms' do
let :facts do
{ :osfamily => 'Debian' }
end
it_configures 'default cisco plugin'
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment