From 83478a42afee01d992bfdb40235507f3f7ebf078 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Mon, 11 Apr 2022 17:42:21 +0900 Subject: [PATCH] networking-sfc: Support [quota] parameters This change adds support for additional quota parameters, which are used by the networking-sfc plugin. Change-Id: Ibc2f650a6672ee3b2625af31c37f9bfe69d4cac1 --- manifests/quota/sfc.pp | 44 +++++++++++++ .../notes/sfc-quota-663ec80069132021.yaml | 5 ++ spec/classes/neutron_quota_sfc_pec.rb | 61 +++++++++++++++++++ 3 files changed, 110 insertions(+) create mode 100644 manifests/quota/sfc.pp create mode 100644 releasenotes/notes/sfc-quota-663ec80069132021.yaml create mode 100644 spec/classes/neutron_quota_sfc_pec.rb diff --git a/manifests/quota/sfc.pp b/manifests/quota/sfc.pp new file mode 100644 index 000000000..748e0d18f --- /dev/null +++ b/manifests/quota/sfc.pp @@ -0,0 +1,44 @@ +# == Class: neutron::quta::sfc +# +# Setups neutron quota for networking-sfc. +# +# === Parameters +# +# [*quota_port_chain*] +# (Optional) Maximum number of port chain per tenant. +# Defaults to $::os_service_default. +# +# [*quota_port_pair_group*] +# (Optional) Maximum number of port pair group per tenant. +# Defaults to $::os_service_default. +# +# [*quota_port_pair*] +# (Optional) Maximum number of port pair per tenant. +# Defaults to $::os_service_default. +# +# [*quota_service_graphs*] +# (Optional) Maximum number of Service Graphs per tenant. +# Defaults to $::os_service_default. +# +# [*quota_flow_classifier*] +# (Optional) Maximum number of Flow Classifiers per tenant. +# Defaults to $::os_service_default. +# +class neutron::quota::sfc ( + $quota_port_chain = $::os_service_default, + $quota_port_pair_group = $::os_service_default, + $quota_port_pair = $::os_service_default, + $quota_service_graphs = $::os_service_default, + $quota_flow_classifier = $::os_service_default +) { + + include neutron::deps + + neutron_config { + 'quota/quota_port_chain': value => $quota_port_chain; + 'quota/quota_port_pair_group': value => $quota_port_pair_group; + 'quota/quota_port_pair': value => $quota_port_pair; + 'quota/quota_service_graphs': value => $quota_service_graphs; + 'quota/quota_flow_classifier': value => $quota_flow_classifier; + } +} diff --git a/releasenotes/notes/sfc-quota-663ec80069132021.yaml b/releasenotes/notes/sfc-quota-663ec80069132021.yaml new file mode 100644 index 000000000..8d1a6b743 --- /dev/null +++ b/releasenotes/notes/sfc-quota-663ec80069132021.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + The new ``neutron::quota::sfc`` class has been added. This class manages + the ``[quota]`` parameters for the ``networking-sfc`` plugin. diff --git a/spec/classes/neutron_quota_sfc_pec.rb b/spec/classes/neutron_quota_sfc_pec.rb new file mode 100644 index 000000000..bb002ead0 --- /dev/null +++ b/spec/classes/neutron_quota_sfc_pec.rb @@ -0,0 +1,61 @@ +require 'spec_helper' + +describe 'neutron::quota::sfc' do + let :params do + {} + end + + let :default_params do + { + :quota_port_chain => '', + :quota_port_pair_group => '', + :quota_port_pair => '', + :quota_service_graphs => '', + :quota_flow_classifier => '', + } + end + + shared_examples 'neutron::quota::sfc test' do + let :params_hash do + default_params.merge(params) + end + + it 'configures quota in neutron.conf' do + params_hash.each_pair do |config,value| + should contain_neutron_config("quotas/#{config}").with_value( value ) + end + end + end + + shared_examples 'neutron::quota::sfc' do + context 'with default' do + it_behaves_like 'neutron::quota::sfc test' + end + + context 'with provided parameters' do + before do + params.merge!({ + :quota_port_chain => 10, + :quota_port_pair_group => 11, + :quota_port_pair => 100, + :quota_service_graphs => 12, + :quota_flow_classifier => 101, + }) + end + + it_behaves_like 'neutron::quota::sfc test' + end + end + + on_supported_os({ + :supported_os => OSDefaults.get_supported_os + }).each do |os,facts| + context "on #{os}" do + let (:facts) do + facts.merge!(OSDefaults.get_facts()) + end + + it_behaves_like 'neutron::quota::sfc' + end + end +end