├── .gitignore
├── .project
├── .rubocop.yml
├── .travis.yml
├── CHANGELOG.md
├── Gemfile
├── LICENSE
├── README.markdown
├── Rakefile
├── files
├── NaElement.patch
└── NaServer.patch
├── lib
├── puppet
│ ├── netapp_sdk.rb
│ ├── netapp_sdk
│ │ └── .gitignore
│ ├── provider
│ │ ├── netapp.rb
│ │ ├── netapp_aggregate
│ │ │ └── cmode.rb
│ │ ├── netapp_cifs
│ │ │ └── cmode.rb
│ │ ├── netapp_cluster_id
│ │ │ └── cmode.rb
│ │ ├── netapp_cluster_peer
│ │ │ └── cmode.rb
│ │ ├── netapp_cmode.rb
│ │ ├── netapp_export_policy
│ │ │ └── cmode.rb
│ │ ├── netapp_export_rule
│ │ │ └── cmode.rb
│ │ ├── netapp_igroup
│ │ │ └── cmode.rb
│ │ ├── netapp_iscsi
│ │ │ └── cmode.rb
│ │ ├── netapp_iscsi_interface_accesslist
│ │ │ └── cmode.rb
│ │ ├── netapp_iscsi_security
│ │ │ └── cmode.rb
│ │ ├── netapp_kerberos_config
│ │ │ └── cmode.rb
│ │ ├── netapp_kerberos_realm
│ │ │ └── cmode.rb
│ │ ├── netapp_ldap_client
│ │ │ └── cmode.rb
│ │ ├── netapp_ldap_config
│ │ │ └── cmode.rb
│ │ ├── netapp_license
│ │ │ └── cmode.rb
│ │ ├── netapp_lif
│ │ │ └── cmode.rb
│ │ ├── netapp_lun
│ │ │ └── cmode.rb
│ │ ├── netapp_lun_map
│ │ │ └── cmode.rb
│ │ ├── netapp_net_dns
│ │ │ └── cmode.rb
│ │ ├── netapp_net_port
│ │ │ └── cmode.rb
│ │ ├── netapp_nfs
│ │ │ └── cmode.rb
│ │ ├── netapp_qtree
│ │ │ └── cmode.rb
│ │ ├── netapp_quota
│ │ │ └── cmode.rb
│ │ ├── netapp_security_login
│ │ │ └── cmode.rb
│ │ ├── netapp_security_login_role
│ │ │ └── cmode.rb
│ │ ├── netapp_sevenmode.rb
│ │ ├── netapp_sis_config
│ │ │ └── cmode.rb
│ │ ├── netapp_sis_policy
│ │ │ └── cmode.rb
│ │ ├── netapp_snapmirror
│ │ │ └── cmode.rb
│ │ ├── netapp_storage_array
│ │ │ └── cmode.rb
│ │ ├── netapp_storage_failover
│ │ │ └── cmode.rb
│ │ ├── netapp_system_node_autosupport
│ │ │ └── cmode.rb
│ │ ├── netapp_user
│ │ │ ├── cmode.rb
│ │ │ └── sevenmode.rb
│ │ ├── netapp_volume
│ │ │ └── cmode.rb
│ │ ├── netapp_vserver
│ │ │ └── cmode.rb
│ │ ├── netapp_vserver_cifs_domain_password_schedule
│ │ │ └── cmode.rb
│ │ ├── netapp_vserver_cifs_options
│ │ │ └── cmode.rb
│ │ ├── netapp_vserver_option
│ │ │ └── cmode.rb
│ │ └── netapp_vserver_peer
│ │ │ └── cmode.rb
│ ├── type
│ │ ├── netapp_aggregate.rb
│ │ ├── netapp_cifs.rb
│ │ ├── netapp_cluster_id.rb
│ │ ├── netapp_cluster_peer.rb
│ │ ├── netapp_export_policy.rb
│ │ ├── netapp_export_rule.rb
│ │ ├── netapp_igroup.rb
│ │ ├── netapp_iscsi.rb
│ │ ├── netapp_iscsi_interface_accesslist.rb
│ │ ├── netapp_iscsi_security.rb
│ │ ├── netapp_kerberos_config.rb
│ │ ├── netapp_kerberos_realm.rb
│ │ ├── netapp_ldap_client.rb
│ │ ├── netapp_ldap_config.rb
│ │ ├── netapp_license.rb
│ │ ├── netapp_lif.rb
│ │ ├── netapp_lun.rb
│ │ ├── netapp_lun_map.rb
│ │ ├── netapp_net_dns.rb
│ │ ├── netapp_net_port.rb
│ │ ├── netapp_nfs.rb
│ │ ├── netapp_notify.rb
│ │ ├── netapp_qtree.rb
│ │ ├── netapp_quota.rb
│ │ ├── netapp_security_login.rb
│ │ ├── netapp_security_login_role.rb
│ │ ├── netapp_sis_config.rb
│ │ ├── netapp_sis_policy.rb
│ │ ├── netapp_snapmirror.rb
│ │ ├── netapp_storage_array.rb
│ │ ├── netapp_storage_failover.rb
│ │ ├── netapp_system_node_autosupport.rb
│ │ ├── netapp_user.rb
│ │ ├── netapp_volume.rb
│ │ ├── netapp_vserver.rb
│ │ ├── netapp_vserver_cifs_domain_password_schedule.rb
│ │ ├── netapp_vserver_cifs_options.rb
│ │ ├── netapp_vserver_option.rb
│ │ └── netapp_vserver_peer.rb
│ └── util
│ │ └── network_device
│ │ ├── netapp.rb
│ │ └── netapp
│ │ ├── device.rb
│ │ └── facts.rb
└── puppet_x
│ └── puppetlabs
│ └── netapp
│ └── property
│ └── netapp_truthy.rb
├── manifests
├── init.pp
├── iscsi.pp
├── nfs.pp
├── svm.pp
└── vqe.pp
├── metadata.json
├── required_apis.txt
└── spec
├── acceptance
├── netapp_aggregate_spec.rb
├── netapp_cifs_spec.rb
├── netapp_cluster_id_spec.rb
├── netapp_export_policy_spec.rb
├── netapp_export_rule_spec.rb
├── netapp_igroup_spec.rb
├── netapp_iscsi_interface_accesslist_spec.rb
├── netapp_iscsi_spec.rb
├── netapp_kerberos_config_spec.rb
├── netapp_kerberos_realm_spec.rb
├── netapp_ldap_client_spec.rb
├── netapp_ldap_config.rb
├── netapp_license.rb
├── netapp_lif_spec.rb
├── netapp_lun_spec.rb
├── netapp_net_dns_spec.rb
├── netapp_net_port_spec.rb
├── netapp_nfs_spec.rb
├── netapp_security_login_role_spec.rb
├── netapp_security_login_spec.rb
├── netapp_sis_policy_spec.rb
├── netapp_snapmirror_spec.rb
├── netapp_storage_array_spec.rb
├── netapp_storage_failover_spec.rb
├── netapp_system_node_autosupport_spec.rb
├── netapp_volume_spec.rb
├── netapp_vserver_cifs_domain_password_schedule_spec.rb
├── netapp_vserver_cifs_options_spec.rb
├── netapp_vserver_option_spec.rb
├── netapp_vserver_peer_spec.rb
├── netapp_vserver_spec.rb
└── nodesets
│ └── default.yml
├── fixtures
├── integration
│ └── puppet
│ │ └── provider
│ │ └── netapp_quota
│ │ └── netapp_quota
│ │ ├── quota-list-entries.yml
│ │ ├── quota-status-result-off.yml
│ │ └── quota-status-result-on.yml
└── unit
│ └── puppet
│ ├── provider
│ ├── netapp_cifs
│ │ └── cmode
│ │ │ └── cifs-list.yml
│ ├── netapp_group
│ │ └── sevenmode
│ │ │ └── group-list.yml
│ ├── netapp_net_dns
│ │ └── cmode
│ │ │ ├── net-dns-list.yml
│ │ │ └── net-dns-response.yml
│ ├── netapp_net_port
│ │ └── cmode
│ │ │ └── net-port-list.yml
│ ├── netapp_nfs_export
│ │ └── sevenmode
│ │ │ ├── export-failed-response.yml
│ │ │ ├── export-list.yml
│ │ │ ├── export-qtree-response.yml
│ │ │ └── export-volume-response.yml
│ ├── netapp_qtree
│ │ └── sevenmode
│ │ │ └── qtree-list.yml
│ ├── netapp_quota
│ │ └── sevenmode
│ │ │ ├── quota-list-entries.yml
│ │ │ ├── quota-status-result-off.yml
│ │ │ └── quota-status-result-on.yml
│ ├── netapp_role
│ │ └── sevenmode
│ │ │ └── role-list.yml
│ ├── netapp_storage_failover
│ │ └── cmode
│ │ │ └── storage-failover-list.yml
│ ├── netapp_system_node_autosupport
│ │ └── cmode
│ │ │ └── system-node-autosupport-list.yml
│ ├── netapp_user
│ │ └── sevenmode
│ │ │ └── user-list.yml
│ ├── netapp_volume
│ │ └── sevenmode
│ │ │ ├── volume-list-offline.yml
│ │ │ ├── volume-list-online.yml
│ │ │ ├── volume-list-restricted.yml
│ │ │ ├── volume-list.yml
│ │ │ ├── volume-options-list.yml
│ │ │ └── volume-snapsched-list.yml
│ ├── netapp_vserver_cifs_domain_password_schedule
│ │ └── cmode
│ │ │ └── vserver-cifs-domain-password-schedule-list.yml
│ ├── netapp_vserver_cifs_options
│ │ └── cmode
│ │ │ └── cifs-options-list.yml
│ └── storage-array-list.yml
│ └── util
│ └── network_device
│ └── netapp
│ ├── device
│ └── system-get-version.yml
│ └── facts
│ ├── network-iface-get.yml
│ ├── options-get-dns.domainname.yml
│ ├── system-get-info.yml
│ ├── system-get-info2.yml
│ └── system-get-version.yml
├── integration
└── puppet
│ └── provider
│ └── netapp_quota
│ └── netapp_quota_spec.rb
├── spec_helper.rb
├── spec_helper_acceptance.rb
├── support
└── shared_type_examples_spec.rb
└── unit
└── puppet
├── provider
├── cmode_spec.rb
├── netapp_cifs
│ └── cmode_spec.rb
├── netapp_group
│ └── sevenmode_spec.rb
├── netapp_net_dns
│ └── cmode_spec.rb
├── netapp_net_port
│ └── cmode_spec.rb
├── netapp_nfs_export
│ └── sevenmode_spec.rb
├── netapp_qtree
│ └── sevenmode_spec.rb
├── netapp_quota
│ └── sevenmode_spec.rb
├── netapp_role
│ └── sevenmode_spec.rb
├── netapp_spec.rb
├── netapp_storage_failover
│ └── cmode_spec.rb
├── netapp_system_node_autosupport
│ └── cmode_spec.rb
├── netapp_user
│ └── sevenmode_spec.rb
├── netapp_volume
│ └── sevenmode_spec.rb
├── netapp_vserver_cifs_domain_password_schedule
│ └── cmode_spec.rb
└── netapp_vserver_cifs_options
│ └── cmode_spec.rb
├── type
├── netapp_cifs_spec.rb
├── netapp_export_spec.rb
├── netapp_group_spec.rb
├── netapp_net_dns_spec.rb
├── netapp_net_port_spec.rb
├── netapp_nfs_export_spec.rb
├── netapp_qtree_spec.rb
├── netapp_quota_spec.rb
├── netapp_role_spec.rb
├── netapp_storage_array_spec.rb
├── netapp_storage_failover_spec.rb
├── netapp_system_node_autosupport_spec.rb
├── netapp_user_spec.rb
├── netapp_volume_spec.rb
├── netapp_vserver_cifs_domain_password_schedule_spec.rb
└── netapp_vserver_cifs_options_spec.rb
└── util
└── network_device
└── netapp
├── device_spec.rb
└── facts_spec.rb
/.gitignore:
--------------------------------------------------------------------------------
1 | pkg/
2 | /metadata.json
3 | coverage/
4 | .rvmrc
5 | Gemfile.lock
6 | .coveralls.yml
7 | *.swp
8 | spec/fixtures/manifests/
9 | .bundle/
10 | log/
11 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | puppetlabs-netapp
4 |
5 |
6 |
7 |
8 |
9 | com.puppetlabs.geppetto.pp.dsl.ui.modulefileBuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.xtext.ui.shared.xtextBuilder
15 |
16 |
17 |
18 |
19 |
20 | com.puppetlabs.geppetto.pp.dsl.ui.puppetNature
21 | org.eclipse.xtext.ui.shared.xtextNature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | ---
2 | language: ruby
3 | rvm:
4 | - 2.3.1
5 |
--------------------------------------------------------------------------------
/Gemfile:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env ruby
2 |
3 | source "https://rubygems.org"
4 |
5 |
6 | gem 'rake'
7 |
8 | group :test do
9 | gem 'puppet'
10 | gem 'rspec-puppet', '>=1.0.1'
11 | gem 'puppetlabs_spec_helper', '~>0.4.0'
12 | gem 'puppet-lint'
13 | gem 'puppet-syntax'
14 | gem 'librarian-puppet'
15 | gem 'beaker-rspec'
16 | gem 'beaker-puppet_install_helper'
17 | gem 'simplecov', :require => false, :platforms => [:ruby_19, :ruby_20]
18 | #gem 'pry'
19 | #gem 'pry-byebug'
20 | #if ENV.key?('TEAMCITY_VERSION')
21 | # gem 'simplecov-teamcity-summary', :require => false, :platforms => [:ruby_19, :ruby_20]
22 | #end
23 | end
24 |
--------------------------------------------------------------------------------
/Rakefile:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 | require 'puppetlabs_spec_helper/rake_tasks'
3 |
--------------------------------------------------------------------------------
/files/NaElement.patch:
--------------------------------------------------------------------------------
1 | --- lib/puppet/util/network_device/netapp/NaElement.rb.orig 2014-10-03 10:59:42.797113116 +0100
2 | +++ lib/puppet/util/network_device/netapp/NaElement.rb 2014-10-03 10:20:06.525428440 +0100
3 | @@ -105,6 +105,11 @@
4 | @content = content
5 | end
6 |
7 | + #Get the elements value from 'content'.
8 | +
9 | + def get_content()
10 | + @content
11 | + end
12 |
13 | #Add the element's value to 'content'. This is
14 | #not needed in normal development.
15 |
--------------------------------------------------------------------------------
/files/NaServer.patch:
--------------------------------------------------------------------------------
1 | --- lib/puppet/util/network_device/netapp/NaServer.rb.orig 2013-07-22 08:49:06.878678638 +0000
2 | +++ lib/puppet/util/network_device/netapp/NaServer.rb 2013-07-22 08:49:13.902571339 +0000
3 | @@ -18,7 +18,7 @@
4 | include REXML
5 | require 'stringio'
6 | include StreamListener
7 | -require 'NaElement'
8 | +require File.dirname(__FILE__) + "/NaElement"
9 |
10 |
11 | # Class for managing Network Appliance(r) Storage System
12 | @@ -425,18 +425,24 @@
13 | #
14 |
15 | def invoke(api, *args)
16 | - num_parms = args.length
17 | + num_parms = args.length
18 | if ((num_parms & 1) != 0)
19 | return self.fail_response(13001, "in Zapi::invoke, invalid number of parameters")
20 | - end
21 | + end
22 | xi = NaElement.new(api)
23 | i = 0
24 | while(i < num_parms)
25 | - key = args[i]
26 | - i = i + 1
27 | - value = args[i]
28 | - i = i + 1
29 | - xi.child_add(NaElement.new(key, value))
30 | + key = args[i]
31 | + i = i + 1
32 | + value = args[i]
33 | + i = i + 1
34 | + if value.class == NaElement
35 | + x = NaElement.new(key)
36 | + x.child_add(value)
37 | + xi.child_add(x)
38 | + else
39 | + xi.child_add(NaElement.new(key, value))
40 | + end
41 | end
42 | return invoke_elem(xi)
43 | end
--------------------------------------------------------------------------------
/lib/puppet/netapp_sdk.rb:
--------------------------------------------------------------------------------
1 | # hax: add lib/puppet/netapp_sdk to RUBYLIB
2 | $:.unshift File.join(File.dirname(__FILE__), 'netapp_sdk')
3 | require 'NaServer'
4 |
--------------------------------------------------------------------------------
/lib/puppet/netapp_sdk/.gitignore:
--------------------------------------------------------------------------------
1 | /DfmErrno.rb
2 | /NaElement.rb
3 | /NaErrno.rb
4 | /NaServer.rb
5 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_cifs/cmode.rb:
--------------------------------------------------------------------------------
1 | require_relative '../netapp_cmode'
2 |
3 | Puppet::Type.type(:netapp_cifs).provide(:cmode, :parent => Puppet::Provider::NetappCmode) do
4 | @doc = "Manage Netapp CIFS server. [Family: vserver]"
5 |
6 | confine :feature => :posix
7 | defaultfor :feature => :posix
8 |
9 | netapp_commands :cifslist => {:api => 'cifs-server-get-iter', :iter => true, :result_element => 'attributes-list'}
10 | netapp_commands :cifscreate => 'cifs-server-create'
11 | netapp_commands :cifsdelete => 'cifs-server-delete'
12 |
13 | mk_resource_methods
14 |
15 | def self.instances
16 | Puppet.debug("Puppet::Provider::Netapp_cifs.cmode self.instances: Got to self.instances.")
17 |
18 | cifs_infos = []
19 | results = cifslist() || []
20 |
21 | results.each do |result|
22 | cifs_info_hash = {
23 | :name => result.child_get_string('cifs-server'),
24 | :domain => result.child_get_string('domain'),
25 | :ensure => :present
26 | }
27 | cifs_infos << new(cifs_info_hash)
28 | end
29 | cifs_infos
30 | end
31 |
32 | def self.prefetch(resources)
33 | Puppet.debug("Puppet::Provider::Netapp_cifs.cMode: Got to self.prefetch.")
34 | instances.each do |prov|
35 | key = prov.name
36 | k = resources.keys.find{|k| k.downcase == key.downcase}
37 | if resource = (resources[k])
38 | resource.provider = prov
39 | end
40 | end
41 | end
42 |
43 | def flush
44 | Puppet.debug("Puppet::Provider::Netapp_cifs.cMode flush: Got to flush for resource #{@resource[:name]}.")
45 | if @property_hash[:ensure] == :absent
46 | cifsdelete('admin-username', @resource[:admin_username], 'admin-password', @resource[:admin_password])
47 | end
48 | end
49 |
50 | def create
51 | Puppet.debug("Puppet::Provider::Netapp_cifs.comde: creating resource.")
52 | result = cifscreate('cifs-server', @resource[:name], 'domain', @resource[:domain], 'admin-username', @resource[:admin_username], 'admin-password', @resource[:admin_password])
53 | return true
54 | end
55 |
56 | def destroy
57 | Puppet.debug("Puppet::Provider::Netapp_cifs.cmode: destroy resource.")
58 | @property_hash[:ensure] = :absent
59 | end
60 |
61 | def exists?
62 | Puppet.debug("Puppet::Provider::Netapp_cifs.cmode: checking existance.")
63 | @property_hash[:ensure] == :present
64 | end
65 | end
66 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_cluster_id/cmode.rb:
--------------------------------------------------------------------------------
1 | require_relative '../netapp_cmode'
2 |
3 | Puppet::Type.type(:netapp_cluster_id).provide(:cmode, :parent => Puppet::Provider::NetappCmode) do
4 | @doc = "Manage Netapp Cluster ID management. [Family: cluster]"
5 |
6 | confine :feature => :posix
7 | defaultfor :feature => :posix
8 |
9 | netapp_commands :clusteridget => 'cluster-identity-get'
10 | netapp_commands :clusteridmod => 'cluster-identity-modify'
11 |
12 | mk_resource_methods
13 |
14 | def self.instances
15 | Puppet.debug("Puppet::Provider::Netapp_cluster_id.cmode self.instances: Got to self.instances.")
16 |
17 | clusters = []
18 |
19 | # Get the cluster ID
20 | result = clusteridget()
21 |
22 | if result
23 | #Puppet.debug("Result looks like #{result.sprintf()}")
24 | # Pull out relevant fields
25 | cluster_id = result.child_get('attributes').child_get('cluster-identity-info')
26 | cluster_name = cluster_id.child_get_string('cluster-name')
27 | cluster_location = cluster_id.child_get_string('cluster-location')
28 | cluster_contact = cluster_id.child_get_string('cluster-contact')
29 |
30 | # Construct the cluster_info hash
31 | cluster_info = {
32 | :name => cluster_name,
33 | :ensure => :present,
34 | :location => cluster_location,
35 | :contact => cluster_contact
36 | }
37 |
38 | Puppet.debug("Puppet::Provider::Netapp_cluster_id.cmode self.instances: cluster_info = #{cluster_info}.")
39 | clusters << new(cluster_info)
40 | end
41 |
42 | clusters
43 | end
44 |
45 | def self.prefetch(resources)
46 | Puppet.debug("Puppet::Provider::Netapp_cluster_id.cMode: Got to self.prefetch.")
47 | # Iterate instances and match provider where relevant.
48 | instances.each do |prov|
49 | Puppet.debug("Prov.name = #{resources[prov.name]}. ")
50 | if resource = resources[prov.name]
51 | resource.provider = prov
52 | end
53 | end
54 | end
55 |
56 | def flush
57 | Puppet.debug("Puppet::Provider::Netapp_cluster_id.cMode: Got to flush for resource #{@resource[:name]}.")
58 |
59 | # Update cluster ID details
60 | result = clusteridmod('cluster-name', @resource[:name], 'cluster-location', @resource[:location], 'cluster-contact', @resource[:contact])
61 |
62 | end
63 |
64 | def create
65 | Puppet.debug("Puppet::Provider::Netapp_cluster_id.cmode create: Nothing to create....")
66 | fail('Cluster_id create not supported, and no matching existing cluster found.')
67 | end
68 |
69 | def destroy
70 | Puppet.debug("Puppet::Provider::Netapp_cluster_id.cmode: Nothing to destroy...")
71 | notice('Destroy not supported.')
72 | end
73 |
74 | def exists?
75 | Puppet.debug("Puppet::Provider::Netapp_cluster_id.cmode exists?: checking existance of Netapp Cluster ID #{@resource[:name]}")
76 | @property_hash[:ensure] == :present
77 | end
78 |
79 | end
80 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_cmode.rb:
--------------------------------------------------------------------------------
1 | require_relative 'netapp'
2 | class Puppet::Provider::NetappCmode < Puppet::Provider::Netapp
3 | def initialize(value={})
4 | super(value)
5 | if value.is_a? Hash
6 | @original_values = value.clone
7 | else
8 | @original_values = Hash.new
9 | end
10 | @create_elements = false
11 | end
12 |
13 | # Restrict to cMode
14 | def self.inherited(klass)
15 | klass.confine :true => begin
16 | transport && transport.get_application_name == 'puppet_netapp_cmode'
17 | rescue Exception
18 | false
19 | end
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_export_policy/cmode.rb:
--------------------------------------------------------------------------------
1 | require_relative '../netapp_cmode'
2 |
3 | Puppet::Type.type(:netapp_export_policy).provide(:cmode, :parent => Puppet::Provider::NetappCmode) do
4 | @doc = "Manage Netapp CMode export policy creation and deletion. [Family: vserver]"
5 |
6 | confine :feature => :posix
7 | defaultfor :feature => :posix
8 |
9 | netapp_commands :eplist => {:api => 'export-policy-get-iter', :iter => true, :result_element => 'attributes-list' }
10 | netapp_commands :epadd => 'export-policy-create'
11 | netapp_commands :epdel => 'export-policy-destroy'
12 |
13 | mk_resource_methods
14 |
15 | def self.instances
16 | Puppet.debug("Puppet::Provider::Netapp_export_policy.cmode: got to self.instances.")
17 | export_policies = []
18 |
19 | # Get a list of all export policies
20 | result = eplist || []
21 |
22 | # Itterate through each 'export-policy-info' block.
23 | result.each do |policy|
24 | name = policy.child_get_string("policy-name")
25 | Puppet.debug("Puppet::Provider::Netapp_export_policy.cmode.prefetch: Got export policy #{name}. \n")
26 |
27 | # Construct an export policy hash for policy
28 | export_policy = { :name => name,
29 | :ensure => :present }
30 |
31 | # Create the instance and add to export_policies array.
32 | Puppet.debug("Creating instance for #{name}. \n")
33 | export_policies << new(export_policy)
34 | end
35 |
36 | # Return the final export_policies array.
37 | Puppet.debug("Returning export_policiess array. ")
38 | export_policies
39 | end
40 |
41 | def self.prefetch(resources)
42 | Puppet.debug("Puppet::Provider::Netapp_export_policy.cmode: Got to self.prefetch.")
43 | # Itterate instances and match provider where relevant.
44 | instances.each do |prov|
45 | Puppet.debug("Prov.name = #{resources[prov.name]}. ")
46 | if resource = resources[prov.name]
47 | resource.provider = prov
48 | end
49 | end
50 | end
51 |
52 | def flush
53 | Puppet.debug("Puppet::Provider::Netapp_export_policy.cmode: Got to flush for resource #{@resource[:name]}.")
54 |
55 | # Check required resource state
56 | Puppet.debug("Property_hash ensure = #{@property_hash[:ensure]}")
57 | case @property_hash[:ensure]
58 | when :absent
59 | Puppet.debug("Puppet::Provider::Netapp_export_policy.cmode: Ensure is absent.")
60 |
61 | # Remove the export policy
62 | result = epdel('policy-name', @resource[:name])
63 |
64 | Puppet.debug("Puppet::Provider::Netapp_export_policy.cmode: export policy #{@resource[:name]} destroyed successfully. \n")
65 | return true
66 |
67 | end #EOC
68 | end
69 |
70 | def create
71 | Puppet.debug("Puppet::Provider::Netapp_export_policy.cmode: creating Netapp export policy #{@resource[:name]}.")
72 |
73 | # Create the export policy
74 | result = epadd('policy-name', @resource[:name])
75 |
76 | Puppet.debug("Puppet::Provider::Netapp_export_policy.cmode: export policy #{@resource[:name]} created successfully.")
77 | return true
78 | end
79 |
80 | def destroy
81 | Puppet.debug("Puppet::Provider::Netapp_export_policy.cmode: destroying Netapp export policy #{@resource[:name]}.")
82 | @property_hash[:ensure] = :absent
83 | end
84 |
85 | def exists?
86 | Puppet.debug("Puppet::Provider::Netapp_export_policy.cmode: checking existance of Netapp export policy #{@resource[:name]}.")
87 | @property_hash[:ensure] == :present
88 | end
89 |
90 |
91 | end
92 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_iscsi/cmode.rb:
--------------------------------------------------------------------------------
1 | require_relative '../netapp_cmode'
2 |
3 | Puppet::Type.type(:netapp_iscsi).provide(:cmode, :parent => Puppet::Provider::NetappCmode) do
4 | @doc = "Manage Netapp iscsi service. [Family: vserver]"
5 |
6 | confine :feature => :posix
7 | defaultfor :feature => :posix
8 |
9 | netapp_commands :iscsilist => {:api => 'iscsi-service-get-iter', :iter => true, :result_element => 'attributes-list'}
10 | netapp_commands :iscsicreate => 'iscsi-service-create'
11 | netapp_commands :iscsidestroy => 'iscsi-service-destroy'
12 | netapp_commands :iscsimodify => 'iscsi-service-modify'
13 | netapp_commands :iscsistart => 'iscsi-service-start'
14 | netapp_commands :iscsistop => 'iscsi-service-stop'
15 |
16 | mk_resource_methods
17 |
18 | def self.instances
19 | iscsis = []
20 | results = iscsilist() || []
21 | results.each do |iscsi|
22 | vserver = iscsi.child_get_string('vserver')
23 | target_alias = iscsi.child_get_string('alias-name')
24 | iscsi_hash = {
25 | :name => vserver,
26 | :ensure => :present,
27 | :target_alias => target_alias,
28 | }
29 |
30 | iscsi_state = iscsi.child_get_string('is-available')
31 | if iscsi_state == 'true'
32 | iscsi_hash[:state] = 'on'
33 | else
34 | iscsi_hash[:state] = 'off'
35 | end
36 |
37 | iscsis << new(iscsi_hash)
38 | end
39 | iscsis
40 | end
41 |
42 | def self.prefetch(resources)
43 | instances.each do |prov|
44 | if resource = resources[prov.name]
45 | resource.provider = prov
46 | end
47 | end
48 | end
49 |
50 | def flush
51 | if @property_hash[:ensure] == :absent
52 | iscsistop()
53 | iscsidestroy()
54 | elsif ! @property_hash.empty?
55 | [:target_alias].each do |property|
56 | if @property_hash[property] and @property_hash[property] != @original_values[property]
57 | fail ArgumentError, "Cannot change #{property} after creation"
58 | end
59 | end
60 | iscsimodify(*get_args('modify'))
61 | end
62 | end
63 |
64 | def state=(value)
65 | case resource[:state]
66 | when :on
67 | iscsistart()
68 | when :off
69 | iscsistop()
70 | end
71 | end
72 |
73 | def create
74 | iscsicreate(*get_args('create'))
75 | @property_hash.clear
76 | end
77 |
78 | def destroy
79 | @property_hash[:ensure] = :absent
80 | end
81 |
82 | def exists?
83 | @property_hash[:ensure] == :present
84 | end
85 |
86 | def get_args(method)
87 | args = Array.new
88 | # Alias-name is only settable on create
89 | if method == 'create'
90 | args += ['alias-name', resource[:target_alias]] if resource[:target_alias]
91 | end
92 | args
93 | end
94 | end
95 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_iscsi_interface_accesslist/cmode.rb:
--------------------------------------------------------------------------------
1 | require_relative '../netapp_cmode'
2 |
3 | Puppet::Type.type(:netapp_iscsi_interface_accesslist).provide(:cmode, :parent => Puppet::Provider::NetappCmode) do
4 | @doc = "Add / Remove the iSCSI LIFs to the accesslist of the specified initiator. [Family: vserver]"
5 |
6 | confine :feature => :posix
7 | defaultfor :feature => :posix
8 |
9 | netapp_commands :iscsiinterfaceaccesslistlist => {:api => 'iscsi-interface-accesslist-get-iter', :iter => true, :result_element => 'attributes-list'}
10 | netapp_commands :iscsiinterfaceaccesslistadd => 'iscsi-interface-accesslist-add'
11 | netapp_commands :iscsiinterfaceaccesslistremove => 'iscsi-interface-accesslist-remove'
12 |
13 | mk_resource_methods
14 |
15 | def self.instances
16 | iscsiinterfaceaccesslists = []
17 | results = iscsiinterfaceaccesslistlist() || []
18 | results.each do |iscsiinterfaceaccesslist|
19 | iscsiinterfaceaccesslist_hash = {
20 | :name => "#{iscsiinterfaceaccesslist.child_get_string('interface-name')}/#{iscsiinterfaceaccesslist.child_get_string('initiator')}",
21 | :ensure => :present,
22 | }
23 | iscsiinterfaceaccesslists << new(iscsiinterfaceaccesslist_hash)
24 | end
25 | iscsiinterfaceaccesslists
26 | end
27 |
28 | def self.prefetch(resources)
29 | instances.each do |prov|
30 | if resource = resources[prov.name]
31 | resource.provider = prov
32 | end
33 | end
34 | end
35 |
36 | def flush
37 | case @property_hash[:ensure]
38 | when :absent
39 | iscsiinterfaceaccesslistremove(*get_args)
40 | end
41 | end
42 |
43 | def create
44 | iscsiinterfaceaccesslistadd(*get_args)
45 | @property_hash.clear
46 | end
47 |
48 | def destroy
49 | @property_hash[:ensure] = :absent
50 | end
51 |
52 | def exists?
53 | @property_hash[:ensure] == :present
54 | end
55 |
56 | def get_args
57 | interface_name, initiator = resource[:name].split('/')
58 | args = Array.new
59 | args += ['interface-name', interface_name]
60 | args += ['initiator', initiator]
61 | args
62 | end
63 | end
64 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_iscsi_security/cmode.rb:
--------------------------------------------------------------------------------
1 | require_relative '../netapp_cmode'
2 |
3 | Puppet::Type.type(:netapp_iscsi_security).provide(:cmode, :parent => Puppet::Provider::NetappCmode) do
4 | @doc = "Manage Netap ISCSI initiator (client) authentication. [Family: vserver]"
5 |
6 | confine :feature => :posix
7 | defaultfor :feature => :posix
8 |
9 | netapp_commands :initauthlist => {:api => 'iscsi-initiator-auth-get-iter', :iter => true, :result_element => 'attributes-list'}
10 | netapp_commands :initauthadd => 'iscsi-initiator-add-auth'
11 | netapp_commands :initauthdelete => 'iscsi-initiator-delete-auth'
12 |
13 | mk_resource_methods
14 |
15 | def self.instances
16 | initauths = []
17 | results = initauthlist() || []
18 | results.each do |initauth|
19 | initauth_hash = {
20 | :name => initauth.child_get_string('initiator'),
21 | :ensure => :present,
22 | :auth_type => initauth.child_get_string('auth-type'),
23 | :radius => initauth.child_get_string('radius'),
24 | :username => initauth.child_get_string('user-name'),
25 | :outbound_username => initauth.child_get_string('outbound-user-name'),
26 | }
27 |
28 | initauths << new(initauth_hash)
29 | end
30 | initauths
31 | end
32 |
33 | def self.prefetch(resources)
34 | instances.each do |prov|
35 | if resource = resources[prov.name]
36 | resource.provider = prov
37 | end
38 | end
39 | end
40 |
41 | def flush
42 | if @property_hash[:ensure] == :absent
43 | initauthdelete("initiator",resource[:name])
44 | elsif ! @property_hash.empty?
45 | initauthdelete("initiator",resource[:name])
46 | initauthadd(*get_args)
47 | end
48 | end
49 |
50 | def create
51 | initauthadd(*get_args)
52 | @property_hash.clear
53 | end
54 |
55 | def destroy
56 | @property_hash[:ensure] = :absent
57 | end
58 |
59 | def exists?
60 | @property_hash[:ensure] == :present
61 | end
62 |
63 | def get_args
64 | args = Array.new
65 | args += ['initiator', resource[:name]]
66 | args += ['auth-type', resource[:auth_type]] if resource[:auth_type]
67 | args += ['radius', resource[:radius]] if resource[:radius]
68 | args += ['user-name', resource[:username]] if resource[:username]
69 | args += ['password', resource[:password]] if resource[:password]
70 | args += ['outbound-user-name', resource[:outbound_username]] if resource[:outbound_username]
71 | args += ['outbound-password', resource[:outbound_password]] if resource[:outbound_password]
72 | args
73 | end
74 | end
75 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_kerberos_config/cmode.rb:
--------------------------------------------------------------------------------
1 | require_relative '../netapp_cmode'
2 |
3 | Puppet::Type.type(:netapp_kerberos_config).provide(:cmode, :parent => Puppet::Provider::NetappCmode) do
4 | @doc = "Manage Netapp kerberos config. [Family: vserver]"
5 |
6 | confine :feature => :posix
7 | defaultfor :feature => :posix
8 |
9 | netapp_commands :kerberosconfiglist => {:api => 'kerberos-config-get-iter', :iter => true, :result_element => 'attributes-list'}
10 | netapp_commands :kerberosconfigmodify => 'kerberos-config-modify'
11 |
12 | mk_resource_methods
13 |
14 | def self.instances
15 | kerberosconfigs = []
16 | results = kerberosconfiglist() || []
17 | results.each do |kerberosconfig|
18 | kerberosconfig_hash = {
19 | :name => kerberosconfig.child_get_string('interface-name'),
20 | :admin_password => kerberosconfig.child_get_string('admin-password'),
21 | :admin_user_name => kerberosconfig.child_get_string('admin-user-name'),
22 | :force => kerberosconfig.child_get_string('force'),
23 | :is_kerberos_enabled => kerberosconfig.child_get_string('is-kerberos-enabled'),
24 | :keytab_uri => kerberosconfig.child_get_string('keytab-uri'),
25 | :organizational_unit => kerberosconfig.child_get_string('organizational-unit'),
26 | :service_principal_name => kerberosconfig.child_get_string('service-principal-name'),
27 | :ensure => :present,
28 | }
29 | kerberosconfigs << new(kerberosconfig_hash)
30 | end
31 | kerberosconfigs
32 | end
33 |
34 | def self.prefetch(resources)
35 | instances.each do |prov|
36 | if resource = resources[prov.name]
37 | resource.provider = prov
38 | end
39 | end
40 | end
41 |
42 | def flush
43 | case @property_hash[:ensure]
44 | when :present
45 | kerberosconfigmodify(*get_args)
46 | end
47 | end
48 |
49 | def create
50 | @property_hash.clear
51 | end
52 |
53 | def destroy
54 | @property_hash[:ensure] = :absent
55 | end
56 |
57 | def exists?
58 | @property_hash[:ensure] == :present
59 | end
60 |
61 | def get_args
62 | args = Array.new
63 | args += ['interface-name', resource[:name]]
64 | args += ['admin-password', resource[:admin_password]] unless @resource[:admin_password].nil?
65 | args += ['admin-user-name', resource[:admin_user_name]] unless @resource[:admin_user_name].nil?
66 | args += ['force', resource[:force]] unless @resource[:force].nil?
67 | args += ['is-kerberos-enabled', resource[:is_kerberos_enabled]] unless @resource[:is_kerberos_enabled].nil?
68 | args += ['keytab-uri', resource[:keytab_uri]] unless @resource[:keytab_uri].nil?
69 | args += ['organizational-unit', resource[:organizational_unit]] unless @resource[:organizational_unit].nil?
70 | args += ['service-principal-name', resource[:service_principal_name]] unless @resource[:service_principal_name].nil?
71 | args
72 | end
73 | end
74 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_ldap_config/cmode.rb:
--------------------------------------------------------------------------------
1 | require_relative '../netapp_cmode'
2 |
3 | Puppet::Type.type(:netapp_ldap_config).provide(:cmode, :parent => Puppet::Provider::NetappCmode) do
4 | @doc = "Manage Netapp LDAP config. [Family: vserver]"
5 |
6 | confine :feature => :posix
7 | defaultfor :feature => :posix
8 |
9 | netapp_commands :ldapconfiglist => {:api => 'ldap-config-get-iter', :iter => true, :result_element => 'attributes-list'}
10 | netapp_commands :ldapconfigcreate => 'ldap-config-create'
11 | netapp_commands :ldapconfigdestroy => 'ldap-config-delete'
12 | netapp_commands :ldapconfigmodify => 'ldap-config-modify'
13 |
14 | mk_resource_methods
15 |
16 | def self.instances
17 | ldapconfigs = []
18 | results = ldapconfiglist() || []
19 | results.each do |ldapconfig|
20 | ldapconfig_hash = {
21 | :name => ldapconfig.child_get_string('client-config'),
22 | :client_enabled => ldapconfig.child_get_string('client-enabled'),
23 | :ensure => :present,
24 | }
25 | ldapconfigs << new(ldapconfig_hash)
26 | end
27 | ldapconfigs
28 | end
29 |
30 | def self.prefetch(resources)
31 | instances.each do |prov|
32 | if resource = resources[prov.name]
33 | resource.provider = prov
34 | end
35 | end
36 | end
37 |
38 | def flush
39 | case @property_hash[:ensure]
40 | when :absent
41 | ldapconfigdestroy()
42 | when :present
43 | ldapconfigmodify(*get_args)
44 | end
45 | end
46 |
47 | def create
48 | ldapconfigcreate(*get_args)
49 | @property_hash.clear
50 | end
51 |
52 | def destroy
53 | @property_hash[:ensure] = :absent
54 | end
55 |
56 | def exists?
57 | @property_hash[:ensure] == :present
58 | end
59 |
60 | def get_args
61 | args = Array.new
62 | args += ['client-config', resource[:name]]
63 | args += ['client-enabled', resource[:client_enabled]]
64 | args
65 | end
66 | end
67 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_license/cmode.rb:
--------------------------------------------------------------------------------
1 | require_relative '../netapp_cmode'
2 |
3 | Puppet::Type.type(:netapp_license).provide(:cmode, :parent => Puppet::Provider::NetappCmode) do
4 | @doc = "Manage Netapp license management. Only supported by ONTAP 8.2 and newer. [Family: cluster]"
5 |
6 | confine :feature => :posix
7 | defaultfor :feature => :posix
8 |
9 | netapp_commands :licenseget => 'license-v2-list-info'
10 | netapp_commands :licenseadd => 'license-v2-add'
11 | netapp_commands :licensedelete => 'license-v2-delete'
12 |
13 | mk_resource_methods
14 |
15 | def self.instances
16 | Puppet.debug("Puppet::Provider::Netapp_license self.instances: Got to self.instances.")
17 |
18 | licenses = []
19 | results = licenseget()
20 |
21 | licenses_info = results.child_get("licenses").children_get()
22 | licenses_info.each do |license_info|
23 | # Construct the license hash
24 | license_hash = {
25 | :name => license_info.child_get('package').content,
26 | :ensure => :present,
27 | }
28 |
29 | Puppet.debug("Puppet::Provider::Netapp_license self.instances: license_info = #{license_hash}.")
30 | licenses << new(license_hash)
31 | end
32 | licenses
33 | end
34 |
35 | def self.prefetch(resources)
36 | Puppet.debug("Puppet::Provider::Netapp_license: Got to self.prefetch.")
37 | # Iterate instances and match provider where relevant.
38 | instances.each do |prov|
39 | Puppet.debug("Prov.name = #{resources[prov.name]}. ")
40 | key = prov.name
41 | k = resources.keys.find{|k| k.downcase == key.downcase}
42 | if resource = (resources[k])
43 | resource.provider = prov
44 | end
45 | end
46 | end
47 |
48 | def flush
49 | Puppet.debug("Puppet::Provider::Netapp_license: Got to flush for resource #{@resource[:name]}.")
50 | case @property_hash[:ensure]
51 | when :absent
52 | licensedelete('package', @resource[:package])
53 | end
54 | end
55 |
56 | def create
57 | Puppet.debug("Puppet::Provider::Netapp_license create: ....")
58 | args = NaElement.new("license-v2-add")
59 | element = NaElement.new('codes')
60 | element.child_add_string('license-code-v2', @resource[:codes])
61 | args.child_add(element)
62 | results = licenseadd(args)
63 | records = results.children_get()
64 | records.each do |record|
65 | if(record.name == 'license-v2-failure-list' and record.children_get().count > 0)
66 | raise Puppet::Error, "Adding license for a Data ONTAP service failed."
67 | end
68 | end
69 | end
70 |
71 | def destroy
72 | Puppet.debug("Puppet::Provider::Netapp_license: Nothing to destroy...")
73 | @property_hash[:ensure] = :absent
74 | end
75 |
76 | def exists?
77 | Puppet.debug("Puppet::Provider::Netapp_license exists?: checking existance of Netapp license package #{@resource[:name]}")
78 | @property_hash[:ensure] == :present
79 | end
80 |
81 | end
82 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_net_port/cmode.rb:
--------------------------------------------------------------------------------
1 | require_relative '../netapp_cmode'
2 |
3 | Puppet::Type.type(:netapp_net_port).provide(:cmode, :parent => Puppet::Provider::NetappCmode) do
4 | @doc = "Manage Netapp network port. [Family: cluster]"
5 |
6 | confine :feature => :posix
7 | defaultfor :feature => :posix
8 |
9 | netapp_commands :netportlist => {:api => 'net-port-get-iter', :iter => true, :result_element => 'attributes-list'}
10 | netapp_commands :netportmdfy => 'net-port-modify'
11 |
12 | mk_resource_methods
13 |
14 | def self.instances
15 | Puppet.debug("Puppet::Provider::Netapp_net_port.cmode self.instances: Got to self.instances.")
16 | results = netportlist() || []
17 | netportinfos = []
18 |
19 | results.each do |result|
20 | node_name1 = result.child_get_string('node')
21 | port_name1 = result.child_get_string('port')
22 | node_port_name = node_name1 + "@" + port_name1
23 |
24 | net_port_info_hash = {
25 | :name => node_port_name,
26 | :flowcontrol_admin => result.child_get_string('administrative-flowcontrol'),
27 | :ensure => :present
28 | }
29 | netportinfos << new(net_port_info_hash)
30 | end
31 | netportinfos
32 | end
33 |
34 | def self.prefetch(resources)
35 | Puppet.debug("Puppet::Provider::Netapp_net_port.cmode: Got to self.prefetch.")
36 | instances.each do |prov|
37 | if resource = resources[prov.name]
38 | resource.provider = prov
39 | end
40 | end
41 | end
42 |
43 | def flush
44 | nodeport_name = @resource[:node_port_name]
45 | nodeport = nodeport_name.split("@")
46 | node = nodeport[0]
47 | port = nodeport[1]
48 | Puppet.debug("Puppet::Provider::Netapp_net_port.cmode: Got to flush for port #{port} on node #{node}.")
49 | netportmdfy("node", node, "port", port, "administrative-flowcontrol", @resource[:flowcontrol_admin])
50 | end
51 | end
52 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_nfs/cmode.rb:
--------------------------------------------------------------------------------
1 | require_relative '../netapp_cmode'
2 |
3 | Puppet::Type.type(:netapp_nfs).provide(:cmode, :parent => Puppet::Provider::NetappCmode) do
4 | @doc = "Manage Netapp nfs service. [Family: vserver]"
5 |
6 | confine :feature => :posix
7 | defaultfor :feature => :posix
8 |
9 | netapp_commands :nfslist => {:api => 'nfs-service-get-iter', :iter => true, :result_element => 'attributes-list'}
10 | netapp_commands :nfscreate => 'nfs-service-create'
11 | netapp_commands :nfsdestroy => 'nfs-service-destroy'
12 | netapp_commands :nfsmodify => 'nfs-service-modify'
13 | netapp_commands :nfsenable => 'nfs-enable'
14 | netapp_commands :nfsdisable => 'nfs-disable'
15 |
16 | mk_resource_methods
17 |
18 | def self.instances
19 | nfss = []
20 | results = nfslist() || []
21 | results.each do |nfs|
22 | vserver = nfs.child_get_string('vserver')
23 | nfs_hash = {
24 | :name => vserver,
25 | :ensure => :present,
26 | :v3 => nfs.child_get_string('is-nfsv3-enabled') == 'true' ? 'enabled' : 'disabled',
27 | :v40 => nfs.child_get_string('is-nfsv40-enabled') == 'true' ? 'enabled' : 'disabled',
28 | :v41 => nfs.child_get_string('is-nfsv41-enabled') == 'true' ? 'enabled' : 'disabled',
29 | :auth_sys_extended_groups => nfs.child_get_string('auth-sys-extended-groups') == 'true' ? 'enabled' : 'disabled',
30 | :enable_ejukebox => nfs.child_get_string('enable-ejukebox'),
31 |
32 | }
33 |
34 | nfs_state = nfs.child_get_string('is-nfs-access-enabled')
35 | if nfs_state == 'true'
36 | nfs_hash[:state] = 'on'
37 | else
38 | nfs_hash[:state] = 'off'
39 | end
40 |
41 | nfss << new(nfs_hash)
42 | end
43 | nfss
44 | end
45 |
46 | def self.prefetch(resources)
47 | instances.each do |prov|
48 | if resource = resources[prov.name]
49 | resource.provider = prov
50 | end
51 | end
52 | end
53 |
54 | def flush
55 | if @property_hash[:ensure] == :absent
56 | nfsdestroy()
57 | elsif ! @property_hash.empty?
58 | nfsmodify(*get_args)
59 | end
60 | end
61 |
62 | def state=(value)
63 | case resource[:state]
64 | when :on
65 | nfsenable()
66 | when :off
67 | nfsdisable()
68 | end
69 | end
70 |
71 | def create
72 | nfscreate(*get_args)
73 | @property_hash.clear
74 | end
75 |
76 | def destroy
77 | @property_hash[:ensure] = :absent
78 | end
79 |
80 | def exists?
81 | @property_hash[:ensure] == :present
82 | end
83 |
84 | def get_args
85 | args = Array.new
86 | args += ['is-nfsv3-enabled', resource[:v3] == :enabled ? 'true' : 'false'] if resource[:v3]
87 | args += ['is-nfsv40-enabled', resource[:v40] == :enabled ? 'true' : 'false'] if resource[:v40]
88 | args += ['is-nfsv41-enabled', resource[:v41] == :enabled ? 'true' : 'false'] if resource[:v41]
89 | args += ['auth-sys-extended-groups', resource[:auth_sys_extended_groups] == :enabled ? 'true' : 'false'] if resource[:auth_sys_extended_groups]
90 | args += ['enable-ejukebox', resource[:enable_ejukebox]] if resource[:enable_ejukebox]
91 | args
92 | end
93 | end
94 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_security_login_role/cmode.rb:
--------------------------------------------------------------------------------
1 | require_relative '../netapp_cmode'
2 |
3 | Puppet::Type.type(:netapp_security_login_role).provide(:cmode, :parent => Puppet::Provider::NetappCmode) do
4 | @doc = "Manage Netapp security login roles. [Family: cluster]"
5 |
6 | confine :feature => :posix
7 | defaultfor :feature => :posix
8 |
9 | netapp_commands :securityloginrolelist => {:api => 'security-login-role-get-iter', :iter => true, :result_element => 'attributes-list'}
10 | netapp_commands :securityloginrolecreate => 'security-login-role-create'
11 | netapp_commands :securityloginroledestroy => 'security-login-role-delete'
12 | netapp_commands :securityloginrolemodify => 'security-login-role-modify'
13 |
14 | mk_resource_methods
15 |
16 | def self.instances
17 | securityloginroles = []
18 | results = securityloginrolelist() || []
19 | results.each do |securityloginrole|
20 | command_directory_name = securityloginrole.child_get_string('command-directory-name')
21 | rolename = securityloginrole.child_get_string('role-name')
22 | vserver = securityloginrole.child_get_string('vserver')
23 | securityloginrole_hash = {
24 | :name => "#{command_directory_name}:#{rolename}:#{vserver}",
25 | :access_level => securityloginrole.child_get_string('access-level'),
26 | :role_query => securityloginrole.child_get_string('role-query'),
27 | :ensure => :present,
28 | }
29 | securityloginroles << new(securityloginrole_hash)
30 | end
31 | securityloginroles
32 | end
33 |
34 | def self.prefetch(resources)
35 | instances.each do |prov|
36 | if resource = resources[prov.name]
37 | resource.provider = prov
38 | end
39 | end
40 | end
41 |
42 | def flush
43 | case @property_hash[:ensure]
44 | when :absent
45 | command_directory_name, rolename, vserver = resource[:name].split(':')
46 | args = Array.new
47 | args += ['command-directory-name', command_directory_name]
48 | args += ['role-name', rolename]
49 | args += ['vserver', vserver]
50 |
51 | securityloginroledestroy(*args)
52 | when :present
53 | securityloginrolemodify(*get_args)
54 | end
55 | end
56 |
57 | def create
58 | securityloginrolecreate(*get_args)
59 | @property_hash.clear
60 | end
61 |
62 | def destroy
63 | @property_hash[:ensure] = :absent
64 | end
65 |
66 | def exists?
67 | @property_hash[:ensure] == :present
68 | end
69 |
70 | def get_args
71 | command_directory_name, rolename, vserver = resource[:name].split(':')
72 | args = Array.new
73 | args += ['command-directory-name', command_directory_name]
74 | args += ['role-name', rolename]
75 | args += ['vserver', vserver]
76 | args += ['access-level', resource[:access_level]] if @resource[:access_level]
77 | args += ['role-query', resource[:role_query]] if @resource[:role_query]
78 | args
79 | end
80 | end
81 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_sevenmode.rb:
--------------------------------------------------------------------------------
1 | require_relative 'netapp'
2 | class Puppet::Provider::NetappSevenmode < Puppet::Provider::Netapp
3 | # Only run in 7Mode
4 | def self.inherited(klass)
5 | klass.confine :true => begin
6 | transport && transport.get_application_name == 'puppet_netapp_sevenmode'
7 | rescue Exception
8 | false
9 | end
10 | end
11 | end
12 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_storage_array/cmode.rb:
--------------------------------------------------------------------------------
1 | require_relative '../netapp_cmode'
2 |
3 | Puppet::Type.type(:netapp_storage_array).provide(:cmode, :parent => Puppet::Provider::NetappCmode) do
4 | @doc = "Manage storage array. [Family: cluster]"
5 |
6 | confine :feature => :posix
7 | defaultfor :feature => :posix
8 |
9 | netapp_commands :strgarrayshow => 'storage-array-list-info'
10 | netapp_commands :strgarraymdfy => 'storage-array-modify'
11 | mk_resource_methods
12 |
13 | def self.instances
14 | Puppet.debug("Puppet::Provider::Netapp_storage_array.cmode: Got to self.instances")
15 | strgarrayinfos = []
16 | results = strgarrayshow() || []
17 | storage_arrays = results.child_get('array-profiles').children_get()
18 |
19 | storage_arrays.each do |storage_array|
20 | storage_array_name = storage_array.child_get_string('name')
21 | max_queue_depth = storage_array.child_get_string('max-queue-depth')
22 | strg_array_info_hash = {
23 | :name => storage_array_name,
24 | :max_queue_depth => max_queue_depth,
25 | :ensure => :present
26 | }
27 | strgarrayinfos << new(strg_array_info_hash)
28 | end
29 | strgarrayinfos
30 | end
31 |
32 | def self.prefetch(resources)
33 | Puppet.debug("Puppet::Provider::Netapp_storage_array.cmode: Got to prefetch")
34 | instances.each do |prov|
35 | if resource = resources[prov.name]
36 | resource.provider = prov
37 | end
38 | end
39 | end
40 |
41 | def flush
42 | Puppet.debug("Puppet::Provider::Netapp_storage_array.cmode: Got to flush for resource #{@resource[:name]}.")
43 | result = strgarraymdfy('array-name', @resource[:name], 'max-queue-depth', @resource[:max_queue_depth])
44 | end
45 | end
46 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_system_node_autosupport/cmode.rb:
--------------------------------------------------------------------------------
1 | require_relative '../netapp_cmode'
2 |
3 | Puppet::Type.type(:netapp_system_node_autosupport).provide(:cmode, :parent => Puppet::Provider::NetappCmode) do
4 | @doc = "Manage Netapp system node autosupport configuration. [Family: cluster]"
5 |
6 | confine :feature => :posix
7 | defaultfor :feature => :posix
8 |
9 | netapp_commands :autosupportcnfglist => {:api => 'autosupport-config-get-iter', :iter => true, :result_element => 'attributes-list'}
10 | netapp_commands :autosupportcnfgmdfy => 'autosupport-config-modify'
11 | mk_resource_methods
12 |
13 | def self.instances
14 | Puppet.debug("Puppet::Provider::Netapp_system_node_autosupport.cmode: Got to self.instances")
15 | autosupportcnfginfos = []
16 | results = autosupportcnfglist() || []
17 |
18 | results.each do |result|
19 | auto_support_config_info_hash = {
20 | :name => result.child_get_string('node-name'),
21 | :periodic_tx_window => result.child_get_string('periodic-tx-window'),
22 | :ensure => :present
23 | }
24 | autosupportcnfginfos << new(auto_support_config_info_hash)
25 | end
26 | autosupportcnfginfos
27 | end
28 |
29 | def self.prefetch(resources)
30 | Puppet.debug("Puppet::Provider::Netapp_system_node_autosupport.cmode: Got to prefetch")
31 | instances.each do |prov|
32 | if resource = resources[prov.name]
33 | resource.provider = prov
34 | end
35 | end
36 | end
37 |
38 | def flush
39 | Puppet.debug("Puppet::Provider::Netapp_system_node_autosupport.cmode: Got to flush for node #{@resource[:name]}")
40 | autosupportcnfgmdfy("node-name", @resource[:name], "periodic-tx-window", @resource[:periodic_tx_window])
41 | end
42 | end
43 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_vserver_cifs_domain_password_schedule/cmode.rb:
--------------------------------------------------------------------------------
1 | require_relative '../netapp_cmode'
2 |
3 | Puppet::Type.type(:netapp_vserver_cifs_domain_password_schedule).provide(:cmode, :parent => Puppet::Provider::NetappCmode) do
4 | @doc = "Manage Netapp vserver cifs domain password schedule. [Family: vserver]"
5 |
6 | confine :feature => :posix
7 | defaultfor :feature => :posix
8 |
9 | netapp_commands :cifs_domain_password_schedulelist => {:api => 'cifs-domain-password-schedule-get-iter ', :iter => true, :result_element => 'attributes-list'}
10 | netapp_commands :cifs_domain_password_schedulemodify => 'cifs-domain-password-schedule-modify'
11 | mk_resource_methods
12 |
13 | def self.instances
14 | Puppet.debug("Puppet::Provider::Netapp_vserver_cifs_domain_password_schedule.cmode self.instances: Got to self.instances.")
15 | cifs_domain_password_schedules = []
16 | results = cifs_domain_password_schedulelist() || []
17 |
18 | results.each do |result|
19 | cifs_domain_password_schedule_info = {
20 | :name => result.child_get_string('vserver'),
21 | :schedule_randomized_minute => result.child_get_string('schedule-randomized-minute'),
22 | :ensure => :present
23 | }
24 | cifs_domain_password_schedules << new(cifs_domain_password_schedule_info)
25 | end
26 | cifs_domain_password_schedules
27 | end
28 |
29 | def self.prefetch(resources)
30 | Puppet.debug("Puppet::Provider::Netapp_vserver_cifs_domain_password_schedule.cMode: Got to self.prefetch.")
31 | instances.each do |prov|
32 | if resource = resources[prov.name]
33 | resource.provider = prov
34 | end
35 | end
36 | end
37 |
38 | def flush
39 | Puppet.debug("Puppet::Provider::Netapp_vserver_cifs_domain_password_schedule.cMode flush: Got to flush for resource #{@resource[:name]}.")
40 | result = cifs_domain_password_schedulemodify('schedule-randomized-minute', @resource[:schedule_randomized_minute])
41 | end
42 | end
43 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_vserver_cifs_options/cmode.rb:
--------------------------------------------------------------------------------
1 | require_relative '../netapp_cmode'
2 |
3 | Puppet::Type.type(:netapp_vserver_cifs_options).provide(:cmode, :parent => Puppet::Provider::NetappCmode) do
4 | @doc = "Manage Netapp vserver CIFS options. [Family: vserver]"
5 |
6 | confine :feature => :posix
7 | defaultfor :feature => :posix
8 |
9 | netapp_commands :vsrvcifsoptlist => {:api => 'cifs-options-get-iter', :iter => true, :result_element => 'attributes-list'}
10 | netapp_commands :vsrvcifsoptmdfy => 'cifs-options-modify'
11 |
12 | mk_resource_methods
13 |
14 | def self.instances
15 | Puppet.debug("Puppet::Provider::Netapp_vserver_cifs_options.cmode self.instances: Got to self.instances.")
16 |
17 | vserver_cifs_infos = []
18 | results = vsrvcifsoptlist() || []
19 |
20 | results.each do |result|
21 | vserver_cifs_info_hash = {
22 | :name => result.child_get_string('vserver'),
23 | :max_mpx => result.child_get_string('max-mpx'),
24 | :smb2_enabled => result.child_get_string('is-smb2-enabled')
25 | }
26 |
27 | vserver_cifs_infos << new(vserver_cifs_info_hash)
28 | end
29 | vserver_cifs_infos
30 | end
31 |
32 | def self.prefetch(resources)
33 | Puppet.debug("Puppet::Provider::Netapp_vserver_cifs_options.cMode: Got to self.prefetch.")
34 | instances.each do |prov|
35 | if resource = resources[prov.name]
36 | resource.provider = prov
37 | end
38 | end
39 | end
40 |
41 | def flush
42 | Puppet.debug("Puppet::Provider::Netapp_vserver_cifs_options.cMode flush: Got to flush for resource #{@resource[:name]}.")
43 | vsrvcifsoptmdfy('max-mpx', @resource[:max_mpx], 'is-smb2-enabled', @resource[:smb2_enabled])
44 | Puppet.debug("CIFS options modified successfully for vserver #{@resource[:name]}")
45 | end
46 | end
47 |
--------------------------------------------------------------------------------
/lib/puppet/provider/netapp_vserver_peer/cmode.rb:
--------------------------------------------------------------------------------
1 | require_relative '../netapp_cmode'
2 |
3 | Puppet::Type.type(:netapp_vserver_peer).provide(:cmode, :parent => Puppet::Provider::NetappCmode) do
4 | @doc = "Manage Netapp Vapplication Peering. [Family: cluster]"
5 |
6 | confine :feature => :posix
7 | defaultfor :feature => :posix
8 |
9 | netapp_commands :vserverpeerlist => {:api => 'vserver-peer-get-iter', :iter => true, :result_element => 'attributes-list'}
10 | netapp_commands :vserverpeercreate => 'vserver-peer-create'
11 | netapp_commands :vserverpeerdestroy => 'vserver-peer-delete'
12 | netapp_commands :vserverpeermodify => 'vserver-peer-modify'
13 |
14 | mk_resource_methods
15 |
16 | def initialize(value={})
17 | super(value)
18 | @property_flush = {}
19 | end
20 |
21 | def self.instances
22 | vserverpeers = []
23 | results = vserverpeerlist() || []
24 | results.each do |vserverpeer|
25 | # Servers
26 | applications = []
27 | unless vserverpeer.child_get("applications").nil?
28 | applications_info = vserverpeer.child_get("applications").children_get()
29 | applications_info.each do |application|
30 | applications << application.content()
31 | end unless applications_info.nil?
32 | end
33 | vserverpeer_hash = {
34 | :name => "#{vserverpeer.child_get_string('vserver')}:#{vserverpeer.child_get_string('peer-vserver')}",
35 | :peer_cluster => vserverpeer.child_get_string('peer-cluster'),
36 | :applications => applications,
37 | :ensure => :present,
38 | }
39 | vserverpeers << new(vserverpeer_hash)
40 | end
41 | vserverpeers
42 | end
43 |
44 | def self.prefetch(resources)
45 | instances.each do |prov|
46 | if resource = resources[prov.name]
47 | resource.provider = prov
48 | end
49 | end
50 | end
51 |
52 | def flush
53 | case @property_hash[:ensure]
54 | when :absent
55 | vserver, peer_vserver = @resource[:name].split(':')
56 | vserverpeerdestroy('vserver', vserver, 'peer-vserver', peer_vserver)
57 | when :present
58 | vserverpeermodify(*get_args('modify'))
59 | end
60 | end
61 |
62 | def create
63 | vserverpeercreate(*get_args('create'))
64 | end
65 |
66 | def destroy
67 | @property_hash[:ensure] = :absent
68 | end
69 |
70 | def exists?
71 | @property_hash[:ensure] == :present
72 | end
73 |
74 | def get_args (method)
75 | args = NaElement.new("vserver-peer-#{method}")
76 | vserver, peer_vserver = @resource[:name].split(':')
77 | args.child_add_string('vserver', vserver)
78 | args.child_add_string('peer-vserver', peer_vserver)
79 | if method == 'create'
80 | args.child_add_string('peer-cluster', @resource[:peer_cluster]) unless @resource[:peer_cluster].nil?
81 | end
82 |
83 | unless @resource[:applications].nil?
84 | element = NaElement.new('applications')
85 | Array(@resource[:applications]).each do |application|
86 | element.child_add_string('vserver-peer-application', application)
87 | end
88 | args.child_add(element)
89 | end
90 | args
91 | end
92 | end
93 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_cifs.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_cifs) do
2 | @doc = 'Manage Netapp CIFS server. [Family: vserver]'
3 | apply_to_device
4 |
5 | ensurable
6 |
7 | newparam(:name) do
8 | desc 'cifs server name'
9 | isnamevar
10 | validate do |value|
11 | raise ArgumentError, '%s is an invalid cifs server name.' % value unless value =~ /^[a-zA-Z0-9\-_.]+$/
12 | end
13 | end
14 |
15 | newproperty(:domain) do
16 | desc 'Fully qualified domain name of the Windows Active Directory this CIFS server belongs to.'
17 | end
18 |
19 | newproperty(:admin_username) do
20 | desc 'Username for the account used to add this CIFS server to the Active Directory.'
21 | end
22 |
23 | newproperty(:admin_password) do
24 | desc 'Password for the account used to add this CIFS server to the Active Directory.'
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_cluster_id.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_cluster_id) do
2 | @doc = "Manage Netapp Cluster ID. [Family: cluster]"
3 |
4 | apply_to_device
5 |
6 | ensurable
7 |
8 | newparam(:name) do
9 | desc "The cluster name"
10 | isnamevar
11 | end
12 |
13 | newproperty(:location) do
14 | desc "The cluster location"
15 | end
16 |
17 | newproperty(:contact) do
18 | desc "The cluster contact"
19 | end
20 |
21 | end
22 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_cluster_peer.rb:
--------------------------------------------------------------------------------
1 | require 'ipaddr'
2 |
3 | Puppet::Type.newtype(:netapp_cluster_peer) do
4 | @doc = "Manage Netapp Cluster Peering. [Family: cluster]"
5 |
6 | apply_to_device
7 |
8 | ensurable
9 |
10 | newparam(:name) do
11 | desc "The cluster peer name. Must match the remote cluster name."
12 | isnamevar
13 | end
14 |
15 | newproperty(:peeraddresses, :array_matching => :all) do
16 | desc "Cluster peer address array"
17 |
18 | validate do |value|
19 | begin
20 | valid = IPAddr.new(value)
21 | rescue ArgumentError
22 | raise ArgumentError, "#{value} is an invalid IP address"
23 | end
24 | end
25 |
26 | def insync?(is)
27 | # Check that is is an array
28 | return false unless is.is_a? Array
29 |
30 | # If they were different lengths, they are not equal.
31 | return false unless is.length == @should.length
32 |
33 | # Check that is and @should are the same...
34 | return (is == @should or is == @should.map(&:to_s))
35 | end
36 |
37 | def should_to_s(newvalue)
38 | newvalue.inspect
39 | end
40 |
41 | def is_to_s(currentvalue)
42 | currentvalue.inspect
43 | end
44 | end
45 |
46 | newparam(:username) do
47 | desc "Cluster peer username."
48 |
49 | validate do |value|
50 | raise ArgumentError, "#{value} is an invalid username" unless value =~ /\w*/
51 | end
52 | end
53 |
54 | newparam(:password) do
55 | desc "Cluster peer password."
56 |
57 | validate do |value|
58 | raise ArgumentError, "#{value} is an invalid password" unless value =~ /\w*/
59 | end
60 | end
61 |
62 | newproperty(:timeout) do
63 | desc "Cluster operation timeout. Must be between 25 and 180. Defaults to: 25."
64 | defaultto('25')
65 |
66 | validate do |value|
67 | raise ArgumentError, "#{value} must be between 0 and 180" unless value.to_i.between?(25,180)
68 | end
69 | end
70 |
71 | # Validate required params
72 | validate do
73 | raise ArgumentError, "Peer address must be an array." unless self[:peeraddresses].is_a?Array
74 | raise ArgumentError, "Username is required." if self[:username].nil?
75 | raise ArgumentError, "Password is required." if self[:password].nil?
76 | end
77 |
78 | end
79 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_export_policy.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_export_policy) do
2 | @doc = "Manage Netapp CMode Export Policy creation and deletion. [Family: vserver]"
3 |
4 | apply_to_device
5 |
6 | ensurable
7 |
8 | newparam(:name) do
9 | desc "The export policy name."
10 | isnamevar
11 | end
12 | end
13 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_igroup.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_igroup) do
2 | @doc = "Manage Netapp ISCSI initiator groups [Family: vserver]"
3 |
4 | apply_to_device
5 |
6 | ensurable
7 |
8 | newparam(:name) do
9 | desc "initiator group name"
10 | isnamevar
11 | end
12 |
13 | newproperty(:group_type) do
14 | desc "initiator group type"
15 | newvalues(:fcp,:iscsi,:mixed)
16 | end
17 |
18 | newproperty(:os_type) do
19 | desc "OS type of the initiators within the group. The os type applies to all initiators within the group and governs the finer details of SCSI protocol interaction with these initiators. Required."
20 | newvalues(:solaris,:windows,:hpux,:aix,:linux,:netware,:vmware,:openvms,:xen,:hyper_v)
21 | end
22 |
23 | newproperty(:members,:array_matching => :all) do
24 | desc "An array of WWPN or Alias initiator members of the group"
25 | def insync?(is)
26 | is = [] if is == :absent
27 | @should.sort == is.sort
28 | end
29 | end
30 |
31 | newproperty(:portset) do
32 | desc "portset that is bound to the initiator group A value of `false` will unbind the portset. Valid values are a string or `false`"
33 | end
34 |
35 | newproperty(:force) do
36 | desc "Forcibly remove the initiator even if there are existing LUNs mapped to this initiator group. Best practice is to attempt to unmap all the luns associated with a group before removing the initiator. Default to false"
37 | newvalues(:false, :true)
38 | end
39 | end
40 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_iscsi.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_iscsi) do
2 | @doc = "Manage Netap ISCSI service. [Family: vserver]"
3 |
4 | apply_to_device
5 |
6 | ensurable
7 |
8 | newparam(:svm) do
9 | desc "ISCSI service SVM"
10 | isnamevar
11 | end
12 |
13 | newproperty(:target_alias) do
14 | desc "ISCSI WWPN Alias"
15 | end
16 |
17 | newproperty(:state) do
18 | desc "ISCSI service state."
19 | newvalues(:on, :off)
20 | end
21 | end
22 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_iscsi_interface_accesslist.rb:
--------------------------------------------------------------------------------
1 | require 'puppet/parameter/boolean'
2 |
3 | Puppet::Type.newtype(:netapp_iscsi_interface_accesslist) do
4 | @doc = "Add / Remove the iSCSI LIFs to the accesslist of the specified initiator. [Family: vserver]"
5 |
6 | apply_to_device
7 |
8 | ensurable
9 |
10 | newparam(:name) do
11 | desc "iSCSI LIF Name and Initiator that can access the iSCSI LIFs. Separated by a /
12 | eg iscsilif/iqn.1995-08.com.example:string"
13 | isnamevar
14 | end
15 | end
16 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_iscsi_security.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_iscsi_security) do
2 | @doc = "Manage Netap ISCSI initiator (client) authentication. [Family: vserver]"
3 |
4 | apply_to_device
5 |
6 | ensurable
7 |
8 | newparam(:initiator) do
9 | desc "ISCSI initiator name"
10 | isnamevar
11 | end
12 |
13 | newproperty(:auth_type) do
14 | desc "ISCSI initiator authentication type."
15 | newvalues(:chap, :none, :deny)
16 | end
17 |
18 | newproperty(:radius) do
19 | desc "ISCSI radius CHAP"
20 | newvalues(:true,:false)
21 | end
22 |
23 | newproperty(:username) do
24 | desc "ISCSI CHAP username"
25 | end
26 |
27 | newparam(:password) do
28 | desc "ISCSI CHAP password. Valid values are 12-16 hexidecimal digits."
29 | validate do |value|
30 | if ! value.to_s.match(%r{^\h{12,16}$})
31 | err "Password must be 12-16 hexidecimal digits"
32 | end
33 | end
34 | munge do |value|
35 | value.to_s
36 | end
37 | end
38 |
39 | newproperty(:outbound_username) do
40 | desc "ISCSI CHAP outbound username"
41 | end
42 |
43 | newparam(:outbound_password) do
44 | desc "ISCSI CHAP outbound password. Valid values are 12-16 hexidecimal digits."
45 | validate do |value|
46 | if ! value.to_s.match(%r{^\h{12,16}$})
47 | err "Outbound password must be 12-16 hexidecimal digits"
48 | end
49 | end
50 | munge do |value|
51 | value.to_s
52 | end
53 | end
54 | end
55 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_kerberos_config.rb:
--------------------------------------------------------------------------------
1 | require 'puppet/parameter/boolean'
2 |
3 | Puppet::Type.newtype(:netapp_kerberos_config) do
4 | @doc = "Kerberos configuration information for a LIF. [Family: vserver]"
5 |
6 | apply_to_device
7 |
8 | ensurable
9 |
10 | newparam(:name) do
11 | desc "Logical interface."
12 | isnamevar
13 | end
14 |
15 | newproperty(:admin_password) do
16 | desc "Administrator password for the Key Distribution Center"
17 | end
18 |
19 | newproperty(:admin_user_name) do
20 | desc "Administrator password for the Key Distribution Center"
21 | end
22 |
23 | newproperty(:force) do
24 | desc "Force option to disable Kerberos security on a LIF (default:false). If set to true, any errors encountered when deleting the corresponding account on the KDC are ignored in which case the account should be deleted manually."
25 | end
26 |
27 | newproperty(:is_kerberos_enabled, :boolean => true) do
28 | desc "If 'true', Kerberos security is enabled by creating an account in the Key Distribution Center using the Service Principal Name. If another logical interface uses the same Service Principal Name, the account is shared.
29 | If 'false', Kerberos security is disabled and the associated account is deleted when it is not used by any logical interface. Attributes: non-creatable, modifiable"
30 | newvalues(:true, :false)
31 | defaultto(:false)
32 | end
33 |
34 | newproperty(:keytab_uri) do
35 | desc "Load Keytab from URI. This field should not be specified when disabling Kerberos."
36 | end
37 |
38 | newproperty(:organizational_unit) do
39 | desc "Organization Unit. This option is available for a Microsoft AD KDC only."
40 | end
41 |
42 | newproperty(:service_principal_name) do
43 | desc "Kerberos service principal name. This is a required input for enabling Kerberos. This input should not be specified when disabling Kerberos. "
44 | end
45 | end
46 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_kerberos_realm.rb:
--------------------------------------------------------------------------------
1 | require 'puppet/parameter/boolean'
2 |
3 | Puppet::Type.newtype(:netapp_kerberos_realm) do
4 | @doc = "Kerberos realm configuration specifies the locations of Key Distribution Center (KDC) servers and administration daemons for the Kerberos realms of interest. When returned as part of the output, all elements of this typedef are reported, unless limited by a set of desired attributes specified by the caller. [Family: vserver]"
5 |
6 | apply_to_device
7 |
8 | ensurable
9 |
10 | newparam(:name) do
11 | desc "Kerberos realm name."
12 | isnamevar
13 | end
14 |
15 | newproperty(:ad_server_ip) do
16 | desc "IP Address of the Active Directory Domain Controller (DC). This is a mandatory parameter if the kdc-vendor is 'microsoft'."
17 | end
18 |
19 | newproperty(:ad_server_name) do
20 | desc "Host name of the Active Directory Domain Controller (DC). This is a mandatory parameter if the kdc-vendor is 'microsoft'"
21 | end
22 |
23 | newproperty(:admin_server_ip) do
24 | desc "IP address of the host where the Kerberos administration daemon is running. This is usually the master KDC. If this parameter is omitted, the IP address specified in kdc-ip is used. If specified, this should be the same as the kdc-ip if the kdc-vendor is 'microsoft'."
25 | end
26 |
27 | newproperty(:admin_server_port) do
28 | desc "The TCP port on the Kerberos administration server where the Kerberos administration service is running. The default for this parmater is 749."
29 |
30 | defaultto(749)
31 | end
32 |
33 | newproperty(:clock_skew) do
34 | desc "The clock skew in minutes is the tolerance for accepting tickets with time stamps that do not exactly match the host's system clock. The default for this parameter is 5 minutes."
35 |
36 | defaultto(5)
37 | end
38 |
39 | newproperty(:comment) do
40 | desc "Comment"
41 | end
42 |
43 | newproperty(:config_name) do
44 | desc "Kerberos configuration name."
45 | end
46 |
47 | newproperty(:kdc_ip) do
48 | desc "The vendor of the Key Distribution Centre (KDC) server. If the configuration uses a Microsoft Active Directory (AD) domain for authentication, this field should be 'microsoft'."
49 | end
50 |
51 | newproperty(:kdc_port) do
52 | desc "TCP port on the KDC to be used for Kerberos communication. The default for this parameter is 88."
53 |
54 | defaultto(88)
55 | end
56 |
57 | newproperty(:kdc_vendor) do
58 | desc "The vendor of the Key Distribution Centre (KDC) server. If the configuration uses a Microsoft Active Directory (AD) domain for authentication, this field should be 'microsoft'."
59 | end
60 |
61 | newproperty(:password_server_ip) do
62 | desc "IP address of the host where the Kerberos password-changing server is running. Typically, this is the same as the host indicated in the adminserver-ip. If this parameter is omitted, the IP address in kdc-ip is used."
63 | end
64 |
65 | newproperty(:password_server_port) do
66 | desc "The TCP port on the Kerberos password-changing server where the Kerberos password-changing service is running. The default for this parameter is 464."
67 |
68 | defaultto(464)
69 | end
70 | end
71 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_ldap_config.rb:
--------------------------------------------------------------------------------
1 | require 'puppet/parameter/boolean'
2 |
3 | Puppet::Type.newtype(:netapp_ldap_config) do
4 | @doc = "Create a new association between a Lightweight Directory Access Protocol (LDAP) client configuration and a Vserver. A Vserver can have only one client configuration associated with it. [Family: vserver]"
5 |
6 | apply_to_device
7 |
8 | ensurable
9 |
10 | newparam(:name) do
11 | desc "The name of an existing Lightweight Directory Access Protocol (LDAP) client configuration. The LDAP client configuration can be created using the ldap-client-create API. The ldap-client-get-iter API can be used to retrieve the list of available LDAP client configurations for the cluster."
12 | isnamevar
13 | end
14 |
15 | newproperty(:client_enabled, :boolean => true) do
16 | desc "If true, the corresponding Lightweight Directory Access Protocol (LDAP) configuration is enabled for this Vserver."
17 | newvalues(:true, :false)
18 | defaultto(:false)
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_license.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_license) do
2 | @doc = "Manage Netapp Licenses. Only supported by ONTAP 8.2 and newer. [Family: cluster]"
3 |
4 | apply_to_device
5 |
6 | ensurable
7 |
8 | newparam(:package) do
9 | desc "Package Possible values:
10 | 'base' - Cluster Base License,
11 | 'nfs' - NFS License,
12 | 'cifs' - CIFS License,
13 | 'iscsi' - iSCSI License,
14 | 'fcp' - FCP License,
15 | 'snaprestore' - SnapRestore License,
16 | 'snapmirror' - SnapMirror License,
17 | 'flexclone' - FlexClone License,
18 | 'snapvault' - SnapVault License,
19 | 'snaplock' - SnapLock License,
20 | 'snapmanagersuite' - SnapManagerSuite License,
21 | 'snapprotectapps' - SnapProtectApp License,
22 | 'v_storageattach' - Virtual Attached Storage License"
23 | isnamevar
24 | end
25 |
26 | newparam(:codes) do
27 | desc "The license code"
28 | end
29 | end
30 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_lun_map.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_lun_map) do
2 | @doc = "Manage Netap Lun map creation and deletion. [Family: vserver]"
3 |
4 | apply_to_device
5 |
6 | ensurable
7 |
8 | newparam(:lunmap) do
9 | desc "Lun map - Composite key of format {path}:{lun-id}."
10 | isnamevar
11 |
12 | validate do |value|
13 | raise ArgumentError, "#{value} is an invalid Lun map." unless value =~ /(\/\w+){3,4}:\d{1,4}/
14 | lun_id = value.split(':').last
15 | raise ArgumentError, "#{lun_id} is an invalid lun ID" unless lun_id.to_i.between?(1,4095)
16 | end
17 | end
18 |
19 | newparam(:initiatorgroup) do
20 | desc "Initiator group to map to."
21 | end
22 |
23 | ## Validate params
24 | validate do
25 | raise ArgumentError, 'Initiatorgroup is required' if self[:initiatorgroup].nil?
26 | end
27 |
28 | ## Autorequire resources
29 | # Netapp_lun resources
30 | autorequire(:netapp_lun) do
31 | path = self[:lunmap].split(':').first
32 | end
33 |
34 | end
35 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_net_dns.rb:
--------------------------------------------------------------------------------
1 | require 'resolv'
2 |
3 | Puppet::Type.newtype(:netapp_net_dns) do
4 | @doc = 'Manage Netapp DNS server mapping. [Family: vserver]'
5 |
6 | apply_to_device
7 |
8 | ensurable
9 |
10 | newparam(:name) do
11 | desc 'vserver name'
12 | isnamevar
13 | validate do |value|
14 | raise ArgumentError, 'A Vserver name can only contain alphanumeric characters and ".", "-" or "_"' unless value =~ /^[a-zA-Z0-9\-_.]+$/
15 | end
16 | end
17 |
18 | newproperty(:domains, :array_matching => :all) do
19 | desc 'Domain for the Vserver.'
20 | def insync?(is)
21 | is = [] if is == :absent
22 | @should.sort == is.sort
23 | end
24 | end
25 |
26 | newproperty(:name_servers, :array_matching => :all) do
27 | desc 'IPv4 addresses of name servers.'
28 | validate do |value|
29 | raise ArgumentError, '%s is an invalid value for field name-servers' % value unless value =~ Resolv::IPv4::Regex
30 | end
31 | def insync?(is)
32 | is = [] if is == :absent
33 | @should.sort == is.sort
34 | end
35 | end
36 |
37 | newproperty(:state) do
38 | desc 'The state of the DNS server mapping'
39 | newvalues(:enabled, :disabled)
40 | end
41 | end
42 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_net_port.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_net_port) do
2 | @doc = 'Manage Netapp network port. [Family: cluster]'
3 |
4 | apply_to_device
5 |
6 | newparam(:node_port_name) do
7 | desc 'The node and port name concatenated with @'
8 | isnamevar
9 | validate do |value|
10 | raise ArgumentError, '%s is an invalid node_port name. Please note: node and port name should follow format node@port.' % value unless value =~ /^[a-zA-Z\-_.0-9]+(?:@[0-9a-zA-Z]+)$/
11 | end
12 | end
13 |
14 | newproperty(:flowcontrol_admin) do
15 | desc 'The administrative flow control setting of the port'
16 | newvalues(:none, :receive, :send, :full)
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_nfs.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_nfs) do
2 | @doc = "Manage Netap NFS service. [Family: vserver]"
3 |
4 | apply_to_device
5 |
6 | ensurable
7 |
8 | newparam(:vserver) do
9 | desc "NFS service SVM"
10 | isnamevar
11 | validate do |value|
12 | raise ArgumentError, 'A Vserver name can only contain alphanumeric characters and ".", "-" or "_"' unless value =~ /^[a-zA-Z0-9\-_.]+$/
13 | end
14 | end
15 |
16 | newproperty(:state) do
17 | desc "NFS service state."
18 | newvalues(:on, :off)
19 | end
20 |
21 | newproperty(:v3) do
22 | desc "Control NFS v3 access."
23 | newvalues(:enabled, :disabled)
24 | end
25 |
26 | newproperty(:v40) do
27 | desc "Control NFS v4.0 access."
28 | newvalues(:enabled, :disabled)
29 | end
30 |
31 | newproperty(:v41) do
32 | desc "Control NFS v4.1 access."
33 | newvalues(:enabled, :disabled)
34 | end
35 |
36 | newproperty(:auth_sys_extended_groups) do
37 | desc "AUTH_SYS Extended Groups enabled."
38 | newvalues(:enabled, :disabled)
39 | end
40 |
41 | newproperty(:enable_ejukebox) do
42 | desc "Enable NFSv3 EJUKEBOX error."
43 | defaultto :false
44 | newvalues(:true, :false)
45 | end
46 |
47 | #newproperty(:udp) do
48 | # desc "Control NFS v4.1 access."
49 | # newvalues(:enabled, :disabled)
50 | #end
51 |
52 | #newproperty(:tcp) do
53 | # desc "Control NFS v4.1 access."
54 | # newvalues(:enabled, :disabled)
55 | #end
56 |
57 | #newproperty(:default_win_user) do
58 | # desc "The default windows user for CIFS access."
59 | #end
60 |
61 | #newproperty(:default_win_group) do
62 | # desc "The default windows group for CIFS access."
63 | #end
64 | end
65 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_notify.rb:
--------------------------------------------------------------------------------
1 | #
2 | # Simple module for logging messages on the client-side
3 | #
4 |
5 | Puppet::Type.newtype(:netapp_notify) do
6 | @doc = "Sends an arbitrary message to the agent run-time log."
7 |
8 | apply_to_device
9 |
10 | newproperty(:message) do
11 | desc "The message to be sent to the log."
12 | def sync
13 | case @resource["withpath"]
14 | when :true
15 | send(@resource[:loglevel], self.should)
16 | else
17 | Puppet.send(@resource[:loglevel], self.should)
18 | end
19 | return
20 | end
21 |
22 | def retrieve
23 | :absent
24 | end
25 |
26 | def insync?(is)
27 | false
28 | end
29 |
30 | defaultto { @resource[:name] }
31 | end
32 |
33 | newparam(:withpath) do
34 | desc "Whether to show the full object path. Defaults to false."
35 | defaultto :false
36 |
37 | newvalues(:true, :false)
38 | end
39 |
40 | newparam(:name) do
41 | desc "An arbitrary tag for your own reference; the name of the message."
42 | isnamevar
43 | end
44 | end
45 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_qtree.rb:
--------------------------------------------------------------------------------
1 | require 'puppet/util/network_device'
2 |
3 | Puppet::Type.newtype(:netapp_qtree) do
4 | @doc = "Manage Netapp Qtree creation, modification and deletion. [Family: vserver]"
5 |
6 | apply_to_device
7 |
8 | ensurable
9 |
10 | newparam(:name) do
11 | desc "The qtree name."
12 | validate do |value|
13 | unless (value =~ /^[\w\-]+$/) or (value =~ /^\/\w+\/\w+$/)
14 | raise ArgumentError, "%s is not a valid qtree name." % value
15 | end
16 | end
17 | end
18 |
19 | newproperty(:volume) do
20 | isnamevar
21 | desc "The volume to create qtree against."
22 | defaultto do
23 | if @resource[:name].count('/') == 2
24 | @resource[:name].split('/')[1]
25 | else
26 | ""
27 | end
28 | end
29 | validate do |value|
30 | unless value =~ /^\w+$/
31 | raise ArgumentError, "%s is not a valid volume name." % value
32 | end
33 | end
34 | end
35 |
36 | newproperty(:qtname) do
37 | isnamevar
38 | desc "The qtname to create."
39 | defaultto do
40 | if @resource[:name].count('/') == 2
41 | @resource[:name].split('/')[2]
42 | else
43 | @resource[:name]
44 | end
45 | end
46 | validate do |value|
47 | unless value =~ /^[\w\-]+$/
48 | raise ArgumentError, "%s is not a valid qtname name." % value
49 | end
50 | end
51 | end
52 |
53 | newproperty(:exportpolicy) do
54 | desc "The export policy with which the qtree is associated."
55 | end
56 |
57 | autorequire(:netapp_volume) do
58 | self[:volume]
59 | end
60 | autorequire(:netapp_export_policy) do
61 | self[:exportpolicy]
62 | end
63 | end
64 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_security_login.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_security_login) do
2 | @doc = "A user account associated with the specified application and authentication method. A new user account can be created with user name as the Active Directory group name. This user account gives access to users belonging to the specified Active Directory group. [Family: cluster]"
3 |
4 | apply_to_device
5 |
6 | ensurable
7 |
8 | newparam(:name) do
9 | desc "A composite key made up from application:authentication_method:username:vserver eg ssh:password:vsadmin:vserver01"
10 | isnamevar
11 | end
12 |
13 | newparam(:password) do
14 | desc "Password for the user account. This is ignored for creating snmp users. This is required for creating non-snmp users."
15 | end
16 |
17 | newproperty(:comment) do
18 | desc "Comments for the user account. The length of comment should be less than or equal to 128 charaters."
19 | end
20 |
21 | newproperty(:role_name) do
22 | desc "The default value is 'admin' for Admin vserver and 'vsadmin' for data vserver. This field is required."
23 | end
24 |
25 | newproperty(:is_locked) do
26 | desc "Whether the login is locked, The valid values for are true or false"
27 | end
28 |
29 | validate do
30 | if self[:ensure] == :present and ! self[:role_name]
31 | raise ArgumentError, "role_name is required"
32 | end
33 | end
34 | end
35 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_security_login_role.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_security_login_role) do
2 | @doc = "A login role [Family: cluster]"
3 |
4 | apply_to_device
5 |
6 | ensurable
7 |
8 | newparam(:name) do
9 | desc "A composite key made up from command_directory_name:role_name:vserver eg ssh:password:vsadmin:vserver01"
10 | isnamevar
11 | end
12 |
13 | newproperty(:access_level) do
14 | desc "Access level for the role. Possible values: 'none', 'readonly', 'all'. The default value is 'all'."
15 | end
16 |
17 | newproperty(:role_query) do
18 | desc "A query for the role. The query must apply to the specified command or directory name. Example: The command is 'volume show' and the query is '-volume vol1'. The query is applied to the command resulting in populating only the volumes with name vol1."
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_sis_config.rb:
--------------------------------------------------------------------------------
1 | require_relative '../../puppet_x/puppetlabs/netapp/property/netapp_truthy'
2 |
3 | Puppet::Type.newtype(:netapp_sis_config) do
4 | @doc = "Manage Netapp sis config modification. [Family: vserver]"
5 |
6 | apply_to_device
7 |
8 | ensurable
9 |
10 | newparam(:path) do
11 | desc "The full path of the sis volume, /vol/."
12 | isnamevar
13 | end
14 |
15 | newproperty(:enabled, :parent => Puppet::Property::NetappTruthy) do
16 | truthy_property("Enable sis on a volume.")
17 | end
18 | newproperty(:compression, :parent => Puppet::Property::NetappTruthy) do
19 | truthy_property("Enable compression on the sis volume.")
20 | end
21 |
22 | #newproperty(:compression_type, :parent => Puppet::Property::NetappTruthy) do
23 | # truthy_property("Specifies the compression type on the volume.")
24 | #end
25 |
26 | newproperty(:inline_compression, :parent => Puppet::Property::NetappTruthy) do
27 | truthy_property("Enable inline compression on the sis volume.")
28 | end
29 |
30 | newproperty(:idd, :parent => Puppet::Property::NetappTruthy) do
31 | truthy_property("Enables file level incompressible data detection and quick check incompressible data detection for large files.")
32 | end
33 |
34 | newproperty(:quick_check_fsize) do
35 | desc "Quick check file size for Incompressible Data Detection. Accepts integers"
36 |
37 | newvalues(/^\d+$/)
38 | end
39 |
40 | newproperty(:policy) do
41 | desc "The sis policy name to be attached to the volume."
42 | end
43 |
44 | newproperty(:sis_schedule) do
45 | desc "The schedule string for the sis operation.
46 | The format of the schedule:
47 |
48 | day_list[@hour_list] or hour_list[@day_list] or - or auto or manual"
49 | end
50 |
51 | validate do
52 | if self[:policy] and self[:sis_schedule]
53 | raise ArgumentError, "Cannot specify both sis_schedule and policy for a sis config resource"
54 | end
55 | end
56 |
57 | autorequire(:netapp_sis_policy) do
58 | [self[:policy]]
59 | end
60 |
61 | autorequire(:netapp_volume) do
62 | [File.basename(self[:path])]
63 | end
64 | end
65 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_sis_policy.rb:
--------------------------------------------------------------------------------
1 | require_relative '../../puppet_x/puppetlabs/netapp/property/netapp_truthy'
2 |
3 | Puppet::Type.newtype(:netapp_sis_policy) do
4 | @doc = "Manage Netapp sis policy modification. [Family: vserver]"
5 |
6 | apply_to_device
7 |
8 | ensurable
9 |
10 | newparam(:name) do
11 | desc "The efficiency policy name"
12 | isnamevar
13 | end
14 |
15 | newproperty(:type) do
16 | desc "Policy type."
17 | newvalues(:threshold, :scheduled)
18 | end
19 |
20 | newproperty(:job_schedule) do
21 | desc "Job schedule name. Eg: 'daily'"
22 | end
23 |
24 | newproperty(:duration) do
25 | desc "Job duration in hours."
26 | end
27 |
28 | newproperty(:enabled, :parent => Puppet::Property::NetappTruthy) do
29 | truthy_property("Manage whether the sis policy is enabled.")
30 | end
31 |
32 | newproperty(:comment) do
33 | desc "Comment for the policy"
34 | end
35 |
36 | newproperty(:changelog_threshold_percent) do
37 | desc "Percentage at which the changelog will be processed for a threshold type of policy, tested once each hour"
38 | end
39 |
40 | newproperty(:qos_policy) do
41 | desc "QoS Policy Name. Eg: 'best_effort'"
42 | end
43 | end
44 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_snapmirror.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_snapmirror) do
2 | @doc = "Manage Netapp Snapmirror creation, modification and deletion. [Family: cluster, vserver]"
3 |
4 | apply_to_device
5 |
6 | ensurable do
7 | desc "Netapp Snapmirror resource state. Valid values are: present, absent."
8 |
9 | defaultto(:present)
10 |
11 | newvalue(:present) do
12 | provider.create
13 | end
14 |
15 | newvalue(:absent) do
16 | provider.destroy
17 | end
18 | end
19 |
20 | newproperty(:source_location) do
21 | desc "The source location."
22 | end
23 |
24 | newparam(:source_snapshot) do
25 | desc "The source snapshot name"
26 | end
27 |
28 | newparam(:destination_location) do
29 | desc "The destination location."
30 | isnamevar
31 | end
32 |
33 | newparam(:destination_snapshot) do
34 | desc "The destination snapshot."
35 | end
36 |
37 | newproperty(:max_transfer_rate) do
38 | desc "The max transfer rate, in KB/s. Defaults to unlimited."
39 | defaultto(0)
40 | end
41 |
42 | newproperty(:relationship_type) do
43 | desc "Specifies the type of the SnapMirror relationship. An extended data protection relationship with a policy of type vault is equivalent to a 'vault' relationship. On Data ONTAP 8.3.1 or later, in the case of a Vserver SnapMirror relationship the type of the relationship is always data_protection. Possible values:
44 | data_protection ,
45 | load_sharing ,
46 | vault ,
47 | restore ,
48 | transition_data_protection ,
49 | extended_data_protection"
50 | end
51 |
52 | newproperty(:snapmirror_policy) do
53 | desc "Specifies the name of the snapmirror policy for the relationship. For SnapMirror relationships of type 'vault' or 'extended data protection', the policy will also have rules to select snapshot copies that must be transferred. If no policy is specified, a default policy will be applied depending on the type of the SnapMirror relationship. This parameter is only available on Data ONTAP 8.2 or later operating in Cluster-Mode if the relationship control plane is 'v2'."
54 | end
55 |
56 | newproperty(:snapmirror_schedule) do
57 | desc "Specifies the name of the cron schedule, which is used to update the SnapMirror relationship."
58 | end
59 | end
60 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_storage_array.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_storage_array) do
2 | @doc = 'Manage storage array. [Family: cluster]'
3 |
4 | apply_to_device
5 |
6 | newparam(:name) do
7 | desc 'The storage array name'
8 | isnamevar
9 | validate do |value|
10 | raise ArgumentError, '%s is an invalid storage array name.' % value unless value =~ /^\w{1,28}+$/
11 | end
12 | end
13 |
14 | newproperty(:max_queue_depth) do
15 | desc 'The target port queue depth for all target ports on this array'
16 | validate do |value|
17 | raise ArgumentError, '%s is not a valid max-queue-depth.' % value unless value =~ /^\d+$/
18 | raise ArgumentError, 'max-queue-depth must be between 8 and 2048.' unless value.to_i.between?(8, 2048)
19 | end
20 |
21 | munge do |value|
22 | case value
23 | when String
24 | if value =~ /^[0-9]+$/
25 | value = Integer(value)
26 | end
27 | end
28 |
29 | return value
30 | end
31 |
32 | end
33 | end
34 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_storage_failover.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_storage_failover) do
2 | @doc = 'Manage Netapp storage failover. [Family: cluster]'
3 |
4 | apply_to_device
5 |
6 | newparam(:name) do
7 | desc 'The node name'
8 | isnamevar
9 | validate do |value|
10 | raise ArgumentError, '%s is a invalid node name' % value unless value =~ /^[a-zA-Z0-9\-_.]+$/
11 | end
12 | end
13 |
14 | newproperty(:auto_giveback) do
15 | desc 'Auto Giveback Enabled'
16 | newvalues(:true, :false)
17 | end
18 |
19 | newproperty(:auto_giveback_after_panic) do
20 | desc 'Auto giveback after takeover on panic'
21 | newvalues(:true, :false)
22 | end
23 |
24 | newproperty(:auto_giveback_override_vetoes) do
25 | desc 'Auto-giveback Override Vetoes Enabled'
26 | newvalues(:true, :false)
27 | end
28 | end
29 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_system_node_autosupport.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_system_node_autosupport) do
2 | @doc = 'Manage Netapp system node autosupport configuration. [Family: cluster]'
3 |
4 | apply_to_device
5 |
6 | newparam(:name) do
7 | desc 'The node name.'
8 | isnamevar
9 | validate do |value|
10 | raise ArgumentError, '%s is a invalid node name' % value unless value =~ /^[a-zA-Z0-9\-_.]+$/
11 | end
12 | end
13 |
14 | newproperty(:periodic_tx_window) do
15 | desc 'The transmission window in format [h][m][s]'
16 | end
17 | end
18 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_vserver_cifs_domain_password_schedule.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_vserver_cifs_domain_password_schedule) do
2 | @doc = 'Manage Netapp vserver cifs domain password schedule. [Family: vserver]'
3 |
4 | apply_to_device
5 |
6 | newparam(:name) do
7 | desc 'The Vserver name'
8 | isnamevar
9 | validate do |value|
10 | raise ArgumentError, 'A Vserver name can only contain alphanumeric characters and ".", "-" or "_"' unless value =~ /^[a-zA-Z0-9\-_.]+$/
11 | end
12 | end
13 |
14 | newproperty(:schedule_randomized_minute) do
15 | desc 'Minutes within which schedule start can be randomized'
16 | validate do |value|
17 | raise ArgumentError, '%s is not a valid schedule randomized minute.' % value unless value =~ /^\d+$/
18 | raise ArgumentError, 'Schedule randomized minute value must be in between 1 and 180.' unless value.to_i.between?(1, 180)
19 | end
20 |
21 | munge do |value|
22 | case value
23 | when String
24 | if value =~ /^[0-9]+$/
25 | value = Integer(value)
26 | end
27 | end
28 |
29 | return value
30 | end
31 | end
32 | end
33 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_vserver_cifs_options.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_vserver_cifs_options) do
2 | @doc = 'Manage Netapp Vserver CIFS options. [Family: vserver]'
3 |
4 | apply_to_device
5 |
6 | newparam(:name) do
7 | desc 'vserver name'
8 | isnamevar
9 | validate do |value|
10 | raise ArgumentError, 'A Vserver name can only contain alphanumeric characters and ".", "-" or "_"' unless value =~ /^[a-zA-Z0-9\-_.]+$/
11 | end
12 | end
13 |
14 | newproperty(:max_mpx) do
15 | desc 'Maximum simultaneous operations per TCP connection. Defaults to 255.'
16 | defaultto '255'
17 | validate do |value|
18 | raise ArgumentError, '%s is not a valid max-queue-depth.' % value unless value =~ /^\d+$/
19 | raise ArgumentError, 'The value for maximum simultaneous operations per TCP connection must be in between 2 to 65535.' unless value.to_i.between?(2, 65535)
20 | end
21 |
22 | munge do |value|
23 | case value
24 | when String
25 | if value =~ /^[0-9]+$/
26 | value = Integer(value)
27 | end
28 | end
29 |
30 | return value
31 | end
32 |
33 | end
34 |
35 | newproperty(:smb2_enabled) do
36 | desc 'Enable all SMB2 Protocols. Defaults to true.'
37 | defaultto 'true'
38 | newvalues(:true, :false)
39 | end
40 | end
41 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_vserver_option.rb:
--------------------------------------------------------------------------------
1 | Puppet::Type.newtype(:netapp_vserver_option) do
2 | @doc = "Manage Netapp Vserver option modification. [Family: cluster, vserver]"
3 |
4 | apply_to_device
5 |
6 | ensurable
7 |
8 | newparam(:name) do
9 | desc "The vserver option name"
10 | isnamevar
11 |
12 | validate do |value|
13 | raise ArgumentError, "#{value} is an invalid option name format." unless value =~ /((?:[\w_]*.?){2,3})/
14 | end
15 | end
16 |
17 | newproperty(:value) do
18 | desc "The vserver option value"
19 |
20 | validate do |value|
21 | raise ArgumentError, "#{value} is an invalid option value." unless value =~ /\w*/
22 | end
23 | end
24 |
25 | end
26 |
--------------------------------------------------------------------------------
/lib/puppet/type/netapp_vserver_peer.rb:
--------------------------------------------------------------------------------
1 | require 'ipaddr'
2 |
3 | Puppet::Type.newtype(:netapp_vserver_peer) do
4 | @doc = "Manage Netapp Vserver Peering. [Family: cluster]"
5 |
6 | apply_to_device
7 |
8 | ensurable
9 |
10 | newparam(:name) do
11 | desc "The local vserver name. and peer_vserver eg vs0:vs1"
12 | isnamevar
13 | end
14 |
15 | newproperty(:peer_cluster) do
16 | desc "Specifies name of the peer Cluster. If peer Cluster is not given, it considers local Cluster."
17 | end
18 |
19 | newproperty(:applications, :array_matching => :all) do
20 | desc "Applications which can make use of the peering relationship. Possible values: 'snapmirror', 'file_copy', 'lun_copy'."
21 | def insync?(is)
22 | is = [] if is == :absent
23 | @should.sort == is.sort
24 | end
25 | end
26 | end
27 |
--------------------------------------------------------------------------------
/lib/puppet/util/network_device/netapp.rb:
--------------------------------------------------------------------------------
1 |
2 | module Puppet::Util::NetworkDevice::Netapp
3 |
4 |
5 | end
6 |
--------------------------------------------------------------------------------
/lib/puppet/util/network_device/netapp/device.rb:
--------------------------------------------------------------------------------
1 | require 'puppet/util/network_device'
2 | require_relative 'facts'
3 | require_relative '../../../netapp_sdk'
4 | require 'uri'
5 |
6 | #require 'addressable/uri'
7 |
8 | class Puppet::Util::NetworkDevice::Netapp::Device
9 |
10 | attr_accessor :url, :transport
11 | def initialize(url, option = {})
12 | @url = URI.parse(url)
13 | redacted_url = @url.dup
14 | redacted_url.password = "****" if redacted_url.password
15 |
16 | Puppet.debug("Puppet::Device::Netapp: connecting to Netapp device #{redacted_url}")
17 |
18 | raise ArgumentError, "Invalid scheme #{@url.scheme}. Must be https" unless @url.scheme == 'https'
19 | raise ArgumentError, "no user specified" unless @url.user
20 | raise ArgumentError, "no password specified" unless @url.password
21 |
22 | @transport ||= NaServer.new(@url.host, 1, 15)
23 | @transport.set_admin_user(@url.user, @url.password)
24 | @transport.set_transport_type(@url.scheme.upcase)
25 | @transport.set_port(@url.port)
26 |
27 | # Get Vserver/Vfiler component
28 | if match = %r{/([^/]+)}.match(@url.path)
29 | @v = match.captures[0]
30 | end
31 |
32 | result = @transport.invoke("system-get-version")
33 | if(result.results_errno != 0)
34 | r = result.results_reason
35 | raise Puppet::Error, "invoke system-get-version failed: #{r}"
36 | else
37 | version = result.child_get_string("version")
38 | Puppet.debug("Puppet::Device::Netapp: Version = #{version}")
39 | end
40 |
41 | # Vserver or vfiler based on if clustered?
42 | if result.child_get_string("is-clustered") == "true"
43 | clustered = true
44 | else
45 | clustered = false
46 | end
47 |
48 | Puppet.debug("Clustered = #{clustered}.")
49 |
50 | if clustered
51 | @transport.set_application_name("puppet_netapp_cmode")
52 | else
53 | @transport.set_application_name("puppet_netapp_sevenmode")
54 | end
55 |
56 | if @v
57 | if clustered
58 | Puppet.debug("Puppet::Device::Netapp: Setting vserver context to #{@v}")
59 | @transport.set_vserver(@v)
60 | else
61 | Puppet.debug("Puppet::Device::Netapp: Setting vfiler context to #{@v}")
62 | @transport.set_vfiler(@v)
63 | end
64 | end
65 |
66 | # report existence of Puppet to ASUP service
67 | ems_log = NaElement.new('ems-autosupport-log')
68 |
69 | # Start adding values
70 | ems_log.child_add_string('computer-name', Facter.value(:fqdn))
71 | ems_log.child_add_string('event-id', '0')
72 | ems_log.child_add_string('event-source', 'Puppet::Device::NetApp')
73 | ems_log.child_add_string('app-version', Facter.value(:puppetversion))
74 | ems_log.child_add_string('category', 'provisioning')
75 | ems_log.child_add_string('event-description', "Puppet module managing #{redacted_url}")
76 | ems_log.child_add_string('log-level', '6')
77 | ems_log.child_add_string('auto-support', 'false')
78 |
79 | Puppet.debug("Puppet::Device::Netapp: Adding usage log to EMS service")
80 | @transport.invoke_elem(ems_log)
81 | end
82 |
83 | def facts
84 | @facts ||= Puppet::Util::NetworkDevice::Netapp::Facts.new(@transport)
85 | facts = @facts.retrieve(@url.host)
86 |
87 | facts
88 | end
89 | end
90 |
--------------------------------------------------------------------------------
/lib/puppet_x/puppetlabs/netapp/property/netapp_truthy.rb:
--------------------------------------------------------------------------------
1 | require 'puppet/property'
2 |
3 | class Puppet::Property::NetappTruthy < Puppet::Property
4 | def self.truthy_property(desc=nil, trueval=:true, falseval=:false)
5 | options = [:true, :false]
6 | desc "#{desc or 'Undocumented attribute.'}
7 | Valid options: <#{options.join('|')}>"
8 |
9 | validate do |value|
10 | unless options.include?(value.to_s.to_sym)
11 | raise ArgumentError, "#{name} must be one of: #{options.join(', ')}."
12 | end
13 | end
14 | munge do |value|
15 | case value.to_s.to_sym
16 | when :true, :enabled, :yes, :ENABLED, :YES, :ON, :on
17 | trueval
18 | when :false, :disabled, :no, :DISABLED, :NO, :OFF, :off
19 | falseval
20 | end
21 | end
22 | end
23 | end
24 |
--------------------------------------------------------------------------------
/manifests/init.pp:
--------------------------------------------------------------------------------
1 | # Class: netapp
2 | #
3 | # This module manages netapp
4 | #
5 | # Parameters:
6 | #
7 | # Actions:
8 | #
9 | # Requires:
10 | #
11 | # Sample Usage:
12 | #
13 | # [Remember: No empty lines between comments and class definition]
14 | class netapp {
15 |
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/manifests/iscsi.pp:
--------------------------------------------------------------------------------
1 | # == Define: netapp:iscsi
2 | #
3 | # Utility for provisioning a LUN
4 | #
5 | #
6 | # ===Parameters:
7 | #
8 | # [*size*]
9 | # The size of the LUN to be created
10 | #
11 | # [*initiator*]
12 | # An array of initiators
13 | #
14 | # [*ostype*]
15 | # A host OS to which LUN is attached
16 | #
17 | # [*lunid*]
18 | # LUN id of the mapping
19 | #
20 | # [*vol_name*]
21 | # The FlexVol for the LUN
22 | #
23 | # ==Sample usage:
24 | #
25 | # Make sure that there is a SVM 'vserver01' which allows iscsi data protocol
26 | #
27 | # node "vserver01.localdomain" {
28 | # netapp::iscsi {'host_lun':
29 | # size => "500mb",
30 | # lunid => "1",
31 | # initiator => ["iqn.1991-05.com.microsoft:cis-jump85.cis.netapp.com"],
32 | # ostype => "windows"
33 | # }
34 | # }
35 | #
36 | #
37 | define netapp::iscsi (
38 | $size,
39 | $lunid,
40 | $initiator,
41 | $ostype,
42 | $svm = 'vserver01',
43 | $aggr = 'aggr02_node01',
44 | $vol_name = 'vol1_iscsi',
45 | $vol_size = '1g',
46 | $grouptype = 'iscsi',
47 | $ensure = 'present',
48 | $snapreserve = '10',
49 | $spaceres = 'volume',
50 | $spacereserve = '0',
51 | $spaceresenabled = false,
52 | $state = 'on',
53 | $igroup = "iscsi_igroup_${name}"
54 | ) {
55 |
56 |
57 |
58 | netapp_volume { $vol_name:
59 | ensure => $ensure,
60 | aggregate => $aggr,
61 | initsize => $vol_size,
62 | spaceres => $spaceres,
63 | snapreserve => $snapreserve
64 | }
65 |
66 | -> netapp_lun {"/vol/${vol_name}/${name}":
67 | ensure => $ensure,
68 | ostype => $ostype,
69 | size => $size,
70 | spaceresenabled => $spaceresenabled
71 | }
72 |
73 | -> netapp_iscsi { $svm:
74 | ensure => $ensure,
75 | }
76 |
77 | -> netapp_igroup { $igroup:
78 | ensure => $ensure,
79 | group_type => $grouptype,
80 | members => $initiator,
81 | os_type => $ostype,
82 | name => $igroup
83 | }
84 |
85 | -> netapp_lun_map {"/vol/${vol_name}/${name}:${lunid}":
86 | ensure => $ensure,
87 | initiatorgroup => $igroup
88 |
89 | }
90 | }
91 |
92 |
--------------------------------------------------------------------------------
/manifests/nfs.pp:
--------------------------------------------------------------------------------
1 | # == Define: netapp:nfs
2 | #
3 | # Utility for provisoning NFS Share
4 | #
5 | # ===Parameters:
6 | #
7 | # [*size*]
8 | # The size of the NFS Share to be created
9 | #
10 | # [*client*]
11 | # The CIDR of the clients that would be accessing the share
12 | #
13 | # [*path*]
14 | # The export path to access the share
15 | #
16 | # ==Sample usage:
17 | #
18 | # Make sure there is an SVM "SVM3" exists which allows NFS data protocol
19 | #
20 | # node "svm3.localdomain" {
21 | # netapp::nfs {"TestVol":
22 | # size => "1g",
23 | # client => "172.0.0.0/8",
24 | # path => '/svm3testvol1'
25 | # }
26 | # }
27 |
28 | define netapp::nfs (
29 | $size,
30 | $client,
31 | $path,
32 | $svm = 'svm3',
33 | $svm_root = 'rootdir',
34 | $aggr = 'aggr01_node02',
35 | $exp_policy = 'exp_svm3',
36 | $root_policy = 'default',
37 | $root_policy_rule = '1',
38 | $root_policy_match = '0.0.0.0/0',
39 | $rule = '1',
40 | $ensure = 'present',
41 | $snapreserve = '10',
42 | $spaceres = 'volume',
43 | $spacereserve = '0',
44 | $protocol = ['nfs'],
45 | $rorule = ['sys','none'],
46 | $rwrule = ['sys', 'none'],
47 | $superusersecurity = 'none',
48 | $state = 'on'
49 | ) {
50 |
51 | netapp_export_policy {"${exp_policy}_${name}":
52 | ensure => $ensure
53 | }
54 |
55 | netapp_export_rule { "${exp_policy}_${name}:${rule}":
56 | ensure => $ensure,
57 | clientmatch => $client,
58 | protocol => $protocol,
59 | superusersecurity => $superusersecurity,
60 | rorule => $rorule,
61 | rwrule => $rwrule
62 | }
63 |
64 | -> netapp_export_rule { "${root_policy}:${root_policy_rule}":
65 | ensure => $ensure,
66 | clientmatch => $root_policy_match,
67 | superusersecurity => $superusersecurity,
68 | rorule => $rorule,
69 | rwrule => $rwrule
70 | }
71 | -> netapp_nfs { $svm:
72 | ensure => $ensure,
73 | }
74 |
75 | -> netapp_volume { $svm_root:
76 | ensure => $ensure,
77 | exportpolicy => $root_policy,
78 | }
79 |
80 | -> netapp_volume { "nfs_${name}":
81 | ensure => $ensure,
82 | aggregate => $aggr,
83 | initsize => $size,
84 | exportpolicy => "${exp_policy}_${name}",
85 | spaceres => $spaceres,
86 | junctionpath => $path,
87 | snapreserve => $snapreserve
88 | }
89 |
90 | }
91 |
--------------------------------------------------------------------------------
/manifests/svm.pp:
--------------------------------------------------------------------------------
1 | # ==Define: netapp:svm
2 | #
3 | # Utility for creating a SVM and corresponding LIFs
4 | #
5 | # === Parameters:
6 | #
7 | # [*allowedprotos*]
8 | # The data protocols allowed by the SVM (E.g. ["iscsi","nfs"]
9 | #
10 | # [*address_mgmt*]
11 | # The IP address for management LIF
12 | #
13 | # [*mask_mgmt*]
14 | # The netmask of IP address for management LIF
15 | #
16 | # [*address_data*]
17 | # The IP address for data LIF
18 | #
19 | # [*mask_data*]
20 | # The netmask of IP address for data LIF
21 | #
22 | # [*homenode*]
23 | # Node in the cluster acting as home node for the LIF
24 | #
25 | # [*homeport*]
26 | # Port of node in the cluster acting as home port for the LIF
27 | #
28 | # [*aggr*]
29 | # Name of the aggregate to be created
30 | #
31 | # [*aggrlist*]
32 | # aggregate list for the SVM
33 | #
34 | # === Sample usage
35 | #
36 | # Some variables need to be adjusted according to your environment.
37 | #
38 | # node "puppet-dev" {
39 | # netapp::svm {"svm_test":
40 | # allowedprotos => ["iscsi"],
41 | # address_mgmt => "172.21.11.132",
42 | # mask_mgmt => "255.255.255.0",
43 | # address_data => "172.21.11.133",
44 | # mask_data => "255.255.255.0",
45 | # }
46 | # }
47 | #
48 | #
49 | define netapp::svm (
50 | $allowedprotos,
51 | $address_mgmt,
52 | $mask_mgmt,
53 | $address_data,
54 | $mask_data,
55 | $ensure = 'present',
56 | $homenode = 'puppet-dev-01',
57 | $homeport = 'e0c',
58 | $aggr = 'aggr01_node02',
59 | $aggrlist = ['aggr01_node02'],
60 | $firewallpolicy_mgmt = 'mgmt',
61 | $firewallpolicy_data = 'data',
62 | $svm_root = 'rootdir',
63 | $rootvol = 'rootdir',
64 | $role = 'data',
65 | $status = 'up',
66 | $failoverpolicy = 'disabled'
67 | ) {
68 |
69 |
70 | #Creates SVM
71 | netapp_vserver { $name:
72 | ensure => $ensure,
73 | rootvol => $rootvol,
74 | rootvolaggr => $aggr,
75 | aggregatelist => $aggrlist,
76 | allowedprotos => $allowedprotos
77 | }
78 |
79 |
80 | #Creates Management LIF
81 | -> netapp_lif { "${name}_mgmt":
82 | ensure => $ensure,
83 | vserver => $name,
84 | role => $role,
85 | administrativestatus => $status,
86 | address => $address_mgmt,
87 | homenode => $homenode,
88 | homeport => $homeport,
89 | netmask => $mask_data,
90 | failoverpolicy => $failoverpolicy,
91 | firewallpolicy => $firewallpolicy_mgmt
92 | }
93 |
94 | #Creates Data LIF
95 | -> netapp_lif { "${name}_data":
96 | ensure => $ensure,
97 | vserver => $name,
98 | role => $role,
99 | administrativestatus => $status,
100 | dataprotocols => $allowedprotos,
101 | address => $address_data,
102 | homenode => $homenode,
103 | homeport => $homeport,
104 | netmask => $mask_data,
105 | failoverpolicy => $failoverpolicy,
106 | firewallpolicy => $firewallpolicy_data
107 | }
108 |
109 | }
110 |
111 |
112 |
--------------------------------------------------------------------------------
/manifests/vqe.pp:
--------------------------------------------------------------------------------
1 | # == Define: netapp::vqe
2 | #
3 | # Utility class for creation of a NetApp Volume, Qtree and NFS export.
4 | #
5 | # === Parameters:
6 | #
7 | # [*ensure*]
8 | # The resource state.
9 | #
10 | # [*size*]
11 | # The volume size to create/set.
12 | #
13 | # [*aggr*]
14 | # The aggregate to contain the volume.
15 | #
16 | # [*spaceres*]
17 | # Space reservation mode. Valid options are: none, file and volume.
18 | #
19 | # [*snapresv*]
20 | # The amount of space to reserve for snapshots, in percent.
21 | #
22 | # [*autosize*]
23 | # Should the volume auto-increment? grow/grow_shrink/off.
24 | #
25 | # [*options*]
26 | # Hash of options to set on volume. Keyshould match option name.
27 | #
28 | # [*snapschedule*]
29 | # Hash of snapschedule to set on volume.
30 | #
31 | # [*persistent*]
32 | # Should the export be persistent? True/False.
33 | #
34 | # === Actions:
35 | #
36 | # === Requires:
37 | #
38 | # === Sample Usage:
39 | #
40 | # Make sure there is a volume called `v_test_volume`, a qtree
41 | # called `q_test_volume` and there is an NFS Export. The initial
42 | # size will be 1 TeraByte.
43 | #
44 | # netapp::vqe { 'test_volume':
45 | # size => "1t",
46 | # aggr => "aggr1",
47 | # spaceres => "file",
48 | # snapresv => 20,
49 | # autosize => false,
50 | # persistent => false
51 | # }
52 | #
53 | #
54 | define netapp::vqe (
55 | $size,
56 | $ensure = 'present',
57 | $aggr = 'aggr1',
58 | $spaceres = 'none',
59 | $snapresv = 0,
60 | $autosize = true,
61 | $options = {
62 | 'convert_ucode' => 'on',
63 | 'no_atime_update' => 'on',
64 | 'try_first' => 'volume_grow'
65 | },
66 | $snapschedule = {
67 | 'minutes' => 0,
68 | 'hours' => 0,
69 | 'days' => 0,
70 | 'weeks' => 0,
71 | 'which-hours' => 0,
72 | 'which-minutes' => 0
73 | },
74 | $persistent = true
75 | ) {
76 |
77 |
78 | netapp_volume { "v_${name}":
79 | ensure => $ensure,
80 | initsize => $size,
81 | aggregate => $aggr,
82 | spaceres => $spaceres,
83 | snapreserve => $snapresv,
84 | autosize => $autosize,
85 | options => $options,
86 | snapschedule => $snapschedule,
87 | }
88 |
89 | netapp_qtree { "q_${name}":
90 | ensure => $ensure,
91 | volume => "v_${name}",
92 | }
93 |
94 | netapp_export { "/vol/v_${name}/q_${name}":
95 | ensure => $ensure,
96 | persistent => $persistent,
97 | }
98 |
99 | if $ensure == 'absent' {
100 | Netapp_export["/vol/v_${name}/q_${name}"]
101 | -> Netapp_qtree["q_${name}"]
102 | -> Netapp_volume["v_${name}"]
103 | }
104 | else {
105 | Netapp_volume["v_${name}"]
106 | -> Netapp_qtree["q_${name}"]
107 | -> Netapp_export["/vol/v_${name}/q_${name}"]
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/metadata.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "puppetlabs-netapp",
3 | "version": "1.3.0",
4 | "author": "Puppet Labs",
5 | "summary": "Manages resources on NetApp Cluster Data ONTAP devices.",
6 | "license": "Apache-2.0",
7 | "source": "https://github.com/puppetlabs/puppetlabs-netapp.git",
8 | "project_page": "https://github.com/puppetlabs/puppetlabs-netapp",
9 | "issues_url": "https://github.com/puppetlabs/puppetlabs-netapp/issues",
10 | "dependencies": [
11 |
12 | ],
13 | "data_provider": null
14 | }
15 |
--------------------------------------------------------------------------------
/required_apis.txt:
--------------------------------------------------------------------------------
1 | 'aggr-get-iter'
2 | 'aggr-create'
3 | 'aggr-add'
4 | 'aggr-modify'
5 | 'aggr-destroy'
6 | 'aggr-online'
7 | 'aggr-offline'
8 | 'cluster-identity-get'
9 | 'cluster-identity-modify'
10 | 'cluster-peer-get-iter'
11 | 'cluster-peer-create'
12 | 'cluster-peer-modify'
13 | 'cluster-peer-delete'
14 | 'export-policy-get-iter'
15 | 'export-policy-create'
16 | 'export-policy-destroy'
17 | 'export-rule-get-iter'
18 | 'export-rule-create'
19 | 'export-rule-destroy'
20 | 'export-rule-modify'
21 | 'igroup-get-iter'
22 | 'igroup-create'
23 | 'igroup-destroy'
24 | 'license-v2-list-info'
25 | 'license-v2-add'
26 | 'net-interface-get-iter'
27 | 'net-interface-create'
28 | 'net-interface-delete'
29 | 'net-interface-modify'
30 | 'lun-get-iter'
31 | 'lun-create-by-size'
32 | 'lun-destroy'
33 | 'lun-resize'
34 | 'lun-online'
35 | 'lun-offline'
36 | 'lun-map-get-iter'
37 | 'lun-map'
38 | 'lun-unmap'
39 | 'qtree-list-iter'
40 | 'qtree-create'
41 | 'qtree-delete'
42 | 'quota-list-entries-iter'
43 | 'quota-add-entry'
44 | 'quota-delete-entry'
45 | 'quota-modify-entry'
46 | 'quota-resize'
47 | 'quota-off'
48 | 'quota-on'
49 | 'quota-status'
50 | 'security-login-get-iter'
51 | 'useradmin-user-delete'
52 | 'useradmin-user-add'
53 | 'useradmin-user-modify'
54 | 'volume-get-iter'
55 | 'volume-options-list-info'
56 | 'snapshot-get-schedule'
57 | 'snapshot-set-schedule'
58 | 'volume-size'
59 | 'snapshot-set-reserve'
60 | 'volume-autosize-set'
61 | 'volume-set-option'
62 | 'volume-create'
63 | 'volume-restrict'
64 | 'volume-offline'
65 | 'volume-online'
66 | 'volume-destroy'
67 | 'vserver-get-iter'
68 | 'vserver-create'
69 | 'vserver-destroy'
70 | 'vserver-modify'
71 | 'vserver-start'
72 | 'vserver-stop'
73 | 'options-get-iter'
74 | 'options-set'
75 | 'options-modify-iter'
76 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_aggregate_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'aggregate' do
4 | it 'makes an aggregate' do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | netapp_aggregate {'aggr3':
8 | ensure => 'present',
9 | blocktype => '64_bit',
10 | checksumstyle => 'block',
11 | diskcount => '3',
12 | option_free_space_realloc => 'off',
13 | nodes => ['VSIM-01']
14 | }
15 | }
16 | node 'vserver-01' {
17 | }
18 | EOS
19 | make_site_pp(pp)
20 | run_device(:allow_changes => true)
21 | run_device(:allow_changes => false)
22 | end
23 |
24 | it 'offline an aggregate' do
25 | pp=<<-EOS
26 | node 'vsim-01' {
27 | netapp_aggregate {'aggr3':
28 | ensure => 'present',
29 | blocktype => '64_bit',
30 | checksumstyle => 'block',
31 | diskcount => '3',
32 | state => 'offline',
33 | nodes => ['VSIM-01']
34 | }
35 | }
36 | node 'vserver-01' {
37 | }
38 | EOS
39 | make_site_pp(pp)
40 | run_device(:allow_changes => true)
41 | run_device(:allow_changes => false)
42 | end
43 |
44 | it 'online an aggregate' do
45 | pp=<<-EOS
46 | node 'vsim-01' {
47 | netapp_aggregate {'aggr3':
48 | ensure => 'present',
49 | blocktype => '64_bit',
50 | checksumstyle => 'block',
51 | diskcount => '3',
52 | state => 'online',
53 | nodes => ['VSIM-01']
54 | }
55 | }
56 | node 'vserver-01' {
57 | }
58 | EOS
59 | make_site_pp(pp)
60 | run_device(:allow_changes => true)
61 | run_device(:allow_changes => false)
62 | end
63 |
64 | it 'set an option on an aggregate' do
65 | pp=<<-EOS
66 | node 'vsim-01' {
67 | netapp_aggregate {'aggr3':
68 | ensure => 'present',
69 | blocktype => '64_bit',
70 | checksumstyle => 'block',
71 | diskcount => '3',
72 | option_free_space_realloc => 'on',
73 | nodes => ['VSIM-01']
74 | }
75 | }
76 | node 'vserver-01' {
77 | }
78 | EOS
79 | make_site_pp(pp)
80 | run_device(:allow_changes => true)
81 | run_device(:allow_changes => false)
82 | end
83 |
84 | it 'deletes an aggregate' do
85 | pp=<<-EOS
86 | node 'vsim-01' {
87 | netapp_aggregate {'aggr3':
88 | ensure => 'absent',
89 | blocktype => '64_bit',
90 | checksumstyle => 'block',
91 | diskcount => '3',
92 | nodes => ['VSIM-01']
93 | }
94 | }
95 | node 'vserver-01' {
96 | }
97 | EOS
98 | make_site_pp(pp)
99 | run_device(:allow_changes => true)
100 | run_device(:allow_changes => false)
101 | end
102 |
103 | end
104 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_cifs_spec.rb:
--------------------------------------------------------------------------------
1 | require_relative '../spec_helper_acceptance.rb'
2 |
3 | describe "cifs" do
4 | it 'make a cifs server' do
5 | pp=<<-EOS
6 | node "vsim-01"{
7 | }
8 | node "vserver-01" {
9 | netapp_cifs { 'WIPRO_CIFS':
10 | domain => 'NTAP.LOCAL',
11 | admin_username => 'Administrator',
12 | admin_password => 'P@ssw0rd21',
13 | ensure => 'present'
14 | }
15 | }
16 | EOS
17 | make_site_pp(pp)
18 | run_device(:allow_changes => true)
19 | end
20 | it 'delete a cifs server' do
21 | pp=<<-EOS
22 | node "vsim-01"{
23 | }
24 | node "vserver-01" {
25 | netapp_cifs { 'WIPRO_CIFS':
26 | domain => 'NTAP.LOCAL',
27 | admin_username => 'Administrator',
28 | admin_password => 'P@ssw0rd21',
29 | ensure => 'absent'
30 | }
31 | }
32 | EOS
33 | make_site_pp(pp)
34 | run_device(:allow_changes => true)
35 | run_device(:allow_changes => false)
36 | end
37 | end
38 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_cluster_id_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'cluster identity' do
4 | it 'modify netapp_cluster_id' do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | netapp_cluster_id { 'VSIM':
8 | ensure => 'present',
9 | contact => 'bill',
10 | location => 'france',
11 | }
12 | }
13 | node 'vserver-01' {
14 | }
15 | EOS
16 | make_site_pp(pp)
17 | run_device(:allow_changes => true)
18 | run_device(:allow_changes => false)
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_export_policy_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'export_policy' do
4 | it 'makes a export_policy' do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | }
8 | node 'vserver-01' {
9 | netapp_export_policy { 'export_policy-test' :
10 | ensure => present,
11 | }
12 | }
13 | EOS
14 | make_site_pp(pp)
15 | run_device(:allow_changes => true)
16 | run_device(:allow_changes => false)
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_export_rule_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'export_rule' do
4 | it 'makes an export_rule' do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | }
8 | node 'vserver-01' {
9 | netapp_export_policy { 'export_rule_test' :
10 | ensure => present,
11 | }
12 | netapp_export_rule { 'export_rule_test:1' :
13 | ensure => present,
14 | clientmatch => '10.0.0.0/8',
15 | protocol => ['nfs'],
16 | superusersecurity => 'none',
17 | rorule => ['none', 'sys'],
18 | rwrule => ['none', 'sys'],
19 | }
20 | netapp_export_rule { 'export_rule_test:2' :
21 | ensure => present,
22 | clientmatch => '192.168.0.0/16',
23 | protocol => ['nfs'],
24 | superusersecurity => 'none',
25 | rorule => ['none', 'sys'],
26 | rwrule => ['none', 'sys'],
27 | }
28 | }
29 | EOS
30 | make_site_pp(pp)
31 | run_device(:allow_changes => true)
32 | run_device(:allow_changes => false)
33 | end
34 |
35 | it 'modifies an export_rule' do
36 | pp=<<-EOS
37 | node 'vsim-01' {
38 | }
39 | node 'vserver-01' {
40 | netapp_export_policy { 'export_rule_test' :
41 | ensure => present,
42 | }
43 | netapp_export_policy { 'export_rule_test2' :
44 | ensure => present,
45 | }
46 | netapp_export_rule { 'export_rule_test2:2' :
47 | ensure => present,
48 | clientmatch => '10.0.0.0/8',
49 | protocol => ['nfs'],
50 | superusersecurity => 'none',
51 | rorule => ['any'],
52 | rwrule => ['none', 'sys'],
53 | }
54 | }
55 | EOS
56 | make_site_pp(pp)
57 | run_device(:allow_changes => true)
58 | run_device(:allow_changes => false)
59 | end
60 |
61 | it 'deletes an export_rule' do
62 | pp=<<-EOS
63 | node 'vsim-01' {
64 | }
65 | node 'vserver-01' {
66 | netapp_export_policy { 'export_rule_test' :
67 | ensure => absent,
68 | }
69 | netapp_export_rule { 'export_rule_test:1' :
70 | ensure => absent,
71 | }
72 | netapp_export_rule { 'export_rule_test:2' :
73 | ensure => absent,
74 | }
75 | }
76 | EOS
77 | make_site_pp(pp)
78 | run_device(:allow_changes => true)
79 | run_device(:allow_changes => false)
80 | end
81 | end
82 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_igroup_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'igroup' do
4 | it 'makes a igroup' do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | netapp_vserver { 'vserver-01':
8 | ensure => present,
9 | rootvol => 'vserver_01_root',
10 | rootvolaggr => 'aggr1',
11 | rootvolsecstyle => 'unix',
12 | }
13 | }
14 | node 'vserver-01' {
15 | netapp_igroup { 'test_igroup':
16 | ensure => 'present',
17 | group_type => 'mixed',
18 | os_type => 'linux',
19 | }
20 | }
21 | EOS
22 | make_site_pp(pp)
23 | run_device(:allow_changes => true)
24 | run_device(:allow_changes => false)
25 | end
26 |
27 | it 'adds initiator to an igroup' do
28 | pp=<<-EOS
29 | node 'vsim-01' {
30 | }
31 | node 'vserver-01' {
32 | netapp_igroup { 'test_igroup':
33 | ensure => 'present',
34 | group_type => 'mixed',
35 | os_type => 'linux',
36 | members => ['eui.0123456789abcdef'],
37 | }
38 | }
39 | EOS
40 | make_site_pp(pp)
41 | run_device(:allow_changes => true)
42 | run_device(:allow_changes => false)
43 | end
44 |
45 | it 'removes initiator from an igroup' do
46 | pp=<<-EOS
47 | node 'vsim-01' {
48 | }
49 | node 'vserver-01' {
50 | netapp_igroup { 'test_igroup':
51 | ensure => 'present',
52 | group_type => 'mixed',
53 | os_type => 'linux',
54 | members => [],
55 | }
56 | }
57 | EOS
58 | make_site_pp(pp)
59 | run_device(:allow_changes => true)
60 | run_device(:allow_changes => false)
61 | end
62 |
63 | it 'binds an igroup to a portset' do
64 | pp=<<-EOS
65 | node 'vsim-01' {
66 | }
67 | node 'vserver-01' {
68 | netapp_igroup { 'test_igroup':
69 | ensure => 'present',
70 | group_type => 'mixed',
71 | os_type => 'linux',
72 | portset => 'wipro_portset'
73 | }
74 | }
75 | EOS
76 | make_site_pp(pp)
77 | run_device(:allow_changes => true)
78 | run_device(:allow_changes => false)
79 | end
80 |
81 | it 'unbind an igroup from a portset' do
82 | pp=<<-EOS
83 | node 'vsim-01' {
84 | }
85 | node 'vserver-01' {
86 | netapp_igroup { 'test_igroup':
87 | ensure => 'present',
88 | group_type => 'mixed',
89 | os_type => 'linux',
90 | portset => 'false'
91 | }
92 | }
93 | EOS
94 | make_site_pp(pp)
95 | run_device(:allow_changes => true)
96 | run_device(:allow_changes => false)
97 | end
98 |
99 | it 'deletes an igroup' do
100 | pp=<<-EOS
101 | node 'vsim-01' {
102 | }
103 | node 'vserver-01' {
104 | netapp_igroup { 'test_igroup':
105 | ensure => 'absent',
106 | group_type => 'mixed',
107 | os_type => 'linux',
108 | portset => 'false',
109 | force => 'true',
110 | }
111 | }
112 | EOS
113 | make_site_pp(pp)
114 | run_device(:allow_changes => true)
115 | run_device(:allow_changes => false)
116 | end
117 |
118 | end
119 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_iscsi_interface_accesslist_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'iscsi_interface_accesslist' do
4 | it 'makes a iscsi_interface_accesslist' do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | netapp_lif { 'iscsilif':
8 | ensure => 'present',
9 | address => '1.1.1.1',
10 | administrativestatus => 'up',
11 | comment => '-',
12 | dataprotocols => ['iscsi'],
13 | dnsdomainname => 'none',
14 | failoverpolicy => 'disabled',
15 | homenode => 'VSIM-01',
16 | homeport => 'e0a',
17 | isautorevert => 'false',
18 | netmask => '255.255.255.0',
19 | routinggroupname => 'd1.1.1.0/24',
20 | vserver => 'vserver-01',
21 | }
22 | }
23 | node 'vserver-01' {
24 | netapp_iscsi { 'vserver-01':
25 | ensure => 'present',
26 | state => 'on',
27 | target_alias => 'vserver-01',
28 | }
29 | netapp_iscsi_interface_accesslist { 'iscsilif/iqn.1995-08.com.example:string':
30 | ensure => 'present',
31 | }
32 | }
33 | EOS
34 | make_site_pp(pp)
35 | run_device(:allow_changes => true)
36 | run_device(:allow_changes => false)
37 | end
38 |
39 | it 'delete a iscsi_interface_accesslist' do
40 | pp=<<-EOS
41 | node 'vsim-01' {
42 | }
43 | node 'vserver-01' {
44 | netapp_iscsi_interface_accesslist { 'iscsilif/iqn.1995-08.com.example:string':
45 | ensure => 'absent',
46 | }
47 | }
48 | EOS
49 | make_site_pp(pp)
50 | run_device(:allow_changes => true)
51 | run_device(:allow_changes => false)
52 | end
53 | end
54 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_iscsi_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'iscsi' do
4 | it 'makes a iscsi' do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | netapp_vserver { 'vserver-iscsi':
8 | ensure => present,
9 | rootvol => 'vserver_01_root',
10 | rootvolaggr => 'aggr1',
11 | rootvolsecstyle => 'unix',
12 | }
13 | }
14 | node 'vserver-01' {
15 | }
16 | node 'vserver-iscsi' {
17 | netapp_iscsi { 'vserver-iscsi':
18 | ensure => 'present',
19 | state => 'on',
20 | target_alias => 'vserver-iscsi',
21 | }
22 | }
23 | EOS
24 | make_site_pp(pp)
25 | run_device(:allow_changes => true)
26 | run_device(:allow_changes => false)
27 | end
28 |
29 | it 'edit a iscsi' do
30 | pp=<<-EOS
31 | node 'vsim-01' {
32 | }
33 | node 'vserver-01' {
34 | }
35 | node 'vserver-iscsi' {
36 | netapp_iscsi { 'vserver-iscsi':
37 | ensure => 'present',
38 | state => 'off',
39 | target_alias => 'vserver-iscsi',
40 | }
41 | }
42 | EOS
43 | make_site_pp(pp)
44 | run_device(:allow_changes => true)
45 | run_device(:allow_changes => false)
46 | end
47 |
48 | it 'start a vserveriscsi' do
49 | pp=<<-EOS
50 | node 'vsim-01' {
51 | }
52 | node 'vserver-01' {
53 | }
54 | node 'vserver-iscsi' {
55 | netapp_iscsi { 'vserver-iscsi':
56 | ensure => 'present',
57 | state => 'on',
58 | target_alias => 'vserver-iscsi',
59 | }
60 | }
61 | EOS
62 | make_site_pp(pp)
63 | run_device(:allow_changes => true)
64 | run_device(:allow_changes => false)
65 | end
66 |
67 | it 'delete a vserveriscsi' do
68 | pp=<<-EOS
69 | node 'vsim-01' {
70 | }
71 | node 'vserver-01' {
72 | }
73 | node 'vserver-iscsi' {
74 | netapp_iscsi { 'vserver-iscsi':
75 | ensure => 'absent',
76 | state => 'off',
77 | target_alias => 'vserver-iscsi',
78 | }
79 | }
80 | EOS
81 | make_site_pp(pp)
82 | run_device(:allow_changes => true)
83 | run_device(:allow_changes => false)
84 | end
85 | end
86 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_kerberos_config_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'kerberos_config' do
4 | it 'modify a kerberos_config' do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | netapp_aggregate {'aggr1':
8 | ensure => 'present',
9 | blocktype => '64_bit',
10 | checksumstyle => 'block',
11 | diskcount => '3',
12 | option_free_space_realloc => 'off',
13 | nodes => ['VSIM-01']
14 | }
15 | netapp_vserver { 'vserver-01':
16 | ensure => present,
17 | rootvol => 'vserver_01_root',
18 | rootvolaggr => 'aggr1',
19 | rootvolsecstyle => 'unix',
20 | }
21 | netapp_lif { 'nfs_lif':
22 | ensure => present,
23 | homeport => 'e0c',
24 | homenode => 'VSIM-01',
25 | address => '10.0.207.5',
26 | vserver => 'vserver-01',
27 | netmask => '255.255.255.0',
28 | dataprotocols => ['nfs','cifs'],
29 | }
30 | netapp_lif { 'iscsi_lif':
31 | ensure => present,
32 | homeport => 'e0c',
33 | homenode => 'VSIM-01',
34 | address => '10.0.207.6',
35 | vserver => 'vserver-01',
36 | netmask => '255.255.255.0',
37 | dataprotocols => 'iscsi',
38 | }
39 | }
40 | node 'vserver-01' {
41 | netapp_nfs { 'vserver-01':
42 | ensure => 'present',
43 | state => 'on',
44 | v3 => 'enabled',
45 | v40 => 'disabled',
46 | v41 => 'disabled',
47 | }
48 | netapp_kerberos_config { 'nfs_lif':
49 | ensure => 'present',
50 | is_kerberos_enabled => 'false',
51 | #it is not possible to test the following attributes in an automated fashion
52 | #is_kerberos_enabled => 'true',
53 | #keytab_uri => 'http://127.0.0.1',
54 | #service_principal_name => 'nfs/sec.example.com@AUTH.SEC.EXAMPLE.COM',
55 | }
56 | }
57 | EOS
58 | make_site_pp(pp)
59 | run_device(:allow_changes => true)
60 | run_device(:allow_changes => false)
61 | end
62 | end
63 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_kerberos_realm_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'kerberos_realm' do
4 | it 'makes a kerberos_realm' do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | netapp_vserver { 'vserver-01':
8 | ensure => present,
9 | rootvol => 'vserver_01_root',
10 | rootvolaggr => 'aggr1',
11 | rootvolsecstyle => 'unix',
12 | }
13 | netapp_lif { 'nfs_lif':
14 | ensure => present,
15 | homeport => 'e0c',
16 | homenode => 'VSIM-01',
17 | address => '10.0.207.5',
18 | vserver => 'vserver-01',
19 | netmask => '255.255.255.0',
20 | dataprotocols => ['nfs','cifs'],
21 | }
22 | netapp_lif { 'iscsi_lif':
23 | ensure => present,
24 | homeport => 'e0c',
25 | homenode => 'VSIM-01',
26 | address => '10.0.207.6',
27 | vserver => 'vserver-01',
28 | netmask => '255.255.255.0',
29 | dataprotocols => 'iscsi',
30 | }
31 | }
32 | node 'vserver-01' {
33 | netapp_kerberos_realm { 'kerberosrealm1':
34 | ensure => 'present',
35 | admin_server_ip => '2.2.2.2',
36 | kdc_ip => '2.2.2.2',
37 | kdc_vendor => 'other',
38 | password_server_ip => '2.2.2.2',
39 | }
40 | }
41 | EOS
42 | make_site_pp(pp)
43 | run_device(:allow_changes => true)
44 | run_device(:allow_changes => false)
45 | end
46 |
47 | it 'edit a kerberos_realm' do
48 | pp=<<-EOS
49 | node 'vsim-01' {
50 | }
51 | node 'vserver-01' {
52 | netapp_kerberos_realm { 'kerberosrealm1':
53 | ensure => 'present',
54 | admin_server_ip => '2.2.2.2',
55 | kdc_ip => '2.2.2.2',
56 | kdc_vendor => 'other',
57 | password_server_ip => '2.2.2.2',
58 | }
59 | }
60 | EOS
61 | make_site_pp(pp)
62 | run_device(:allow_changes => true)
63 | run_device(:allow_changes => false)
64 | end
65 |
66 | it 'delete a kerberos_realm' do
67 | pp=<<-EOS
68 | node 'vsim-01' {
69 | }
70 | node 'vserver-01' {
71 | netapp_kerberos_realm { 'kerberosrealm1':
72 | ensure => 'absent',
73 | admin_server_ip => '2.2.2.2',
74 | kdc_ip => '2.2.2.2',
75 | kdc_vendor => 'other',
76 | password_server_ip => '2.2.2.2',
77 | }
78 | }
79 | EOS
80 | make_site_pp(pp)
81 | run_device(:allow_changes => true)
82 | run_device(:allow_changes => false)
83 | end
84 | end
85 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_ldap_config.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'ldap_config' do
4 | # this requires an extra step of setting up a cifs service on the vserver
5 | # commented out, as it should only run as part of a manual test
6 |
7 | # it 'makes a ldap_config' do
8 | # pp=<<-EOS
9 | #node 'vsim-01' {
10 | # netapp_vserver { 'vserver-01':
11 | # ensure => present,
12 | # rootvol => 'vserver_01_root',
13 | # rootvolaggr => 'aggr1',
14 | # rootvolsecstyle => 'unix',
15 | # }
16 | # netapp_lif { 'nfs_lif':
17 | # ensure => present,
18 | # homeport => 'e0c',
19 | # homenode => 'VSIM-01',
20 | # address => '10.0.207.5',
21 | # vserver => 'vserver-01',
22 | # netmask => '255.255.255.0',
23 | # dataprotocols => ['nfs','cifs'],
24 | # }
25 | # netapp_lif { 'iscsi_lif':
26 | # ensure => present,
27 | # homeport => 'e0c',
28 | # homenode => 'VSIM-01',
29 | # address => '10.0.207.6',
30 | # vserver => 'vserver-01',
31 | # netmask => '255.255.255.0',
32 | # dataprotocols => 'iscsi',
33 | # }
34 | #}
35 | #node 'vserver-01' {
36 | # netapp_ldap_client { 'ldapclient2':
37 | # ensure => 'present',
38 | # base_dn => 'DC=',
39 | # base_scope => 'subtree',
40 | # bind_as_cifs_server => 'true',
41 | # group_scope => 'subtree',
42 | # min_bind_level => 'sasl',
43 | # netgroup_byhost_scope => 'subtree',
44 | # is_netgroup_byhost_enabled => 'false',
45 | # netgroup_scope => 'subtree',
46 | # query_timeout => '3',
47 | # schema => 'RFC-2307',
48 | # servers => ['1.1.1.1', '2.2.2.2', '3.3.3.3'],
49 | # tcp_port => '389',
50 | # use_start_tls => 'false',
51 | # user_scope => 'subtree',
52 | # }
53 | # netapp_ldap_config { 'ldapclient2':
54 | # ensure => 'present',
55 | # client_enabled => 'true',
56 | # }
57 | #}
58 | # EOS
59 | # make_site_pp(pp)
60 | # run_device(:allow_changes => true)
61 | # run_device(:allow_changes => false)
62 | # end
63 | #
64 | # it 'edit a ldap_config' do
65 | # pp=<<-EOS
66 | #netapp_ldap_config { 'ldapclient2':
67 | # ensure => 'present',
68 | # client_enabled => 'false',
69 | #}
70 | # EOS
71 | # make_site_pp(pp)
72 | # run_device(:allow_changes => true)
73 | # run_device(:allow_changes => false)
74 | # end
75 | #
76 | # it 'delete a ldap_config' do
77 | # pp=<<-EOS
78 | #netapp_ldap_config { 'ldapclient2':
79 | # ensure => 'absent',
80 | # client_enabled => 'false',
81 | #}
82 | # EOS
83 | # make_site_pp(pp)
84 | # run_device(:allow_changes => true)
85 | # run_device(:allow_changes => false)
86 | # end
87 | end
88 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_license.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'netapp_license' do
4 | # it is not possible to test a secret license key in a public test
5 | # it 'add a netapp_license' do
6 | # pp=<<-EOS
7 | #node 'vsim-01' {
8 | # netapp_license { 'snaprestore' :
9 | # ensure => present,
10 | # codes => "saiufbaisubfiuasbfiuabs",
11 | # }
12 | #}
13 | #node 'vserver-01' {
14 | #}
15 | # EOS
16 | # make_site_pp(pp)
17 | # run_device(:allow_changes => true)
18 | # run_device(:allow_changes => false)
19 | # end
20 | #
21 | # it 'deletes a netapp_license' do
22 | # pp=<<-EOS
23 | #node 'vsim-01' {
24 | # netapp_license { 'snaprestore' :
25 | # ensure => absent,
26 | # codes => "saiufbaisubfiuasbfiuabs",
27 | # }
28 | #}
29 | #node 'vserver-01' {
30 | #}
31 | # EOS
32 | # make_site_pp(pp)
33 | # run_device(:allow_changes => true)
34 | # run_device(:allow_changes => false)
35 | # end
36 | end
37 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_lif_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'netapp_lif' do
4 | it 'makes a netapp_lif' do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | netapp_lif { 'vserver-01_liftest' :
8 | ensure => present,
9 | homeport => 'e0c',
10 | homenode => 'VSIM-01',
11 | address => '192.168.0.1',
12 | vserver => 'vserver-01',
13 | netmask => '255.255.255.0',
14 | firewallpolicy => 'mgmt',
15 | dataprotocols => ['nfs'],
16 | }
17 | }
18 | node 'vserver-01' {
19 | }
20 | EOS
21 | make_site_pp(pp)
22 | run_device(:allow_changes => true)
23 | run_device(:allow_changes => false)
24 | end
25 |
26 | it 'modifies a netapp_lif' do
27 | pp=<<-EOS
28 | node 'vsim-01' {
29 | netapp_lif { 'vserver-01_liftest' :
30 | ensure => present,
31 | homeport => 'e0c',
32 | homenode => 'VSIM-01',
33 | address => '192.168.0.2',
34 | vserver => 'vserver-01',
35 | netmask => '255.255.255.0',
36 | firewallpolicy => 'mgmt',
37 | dataprotocols => ['nfs'],
38 | }
39 | }
40 | node 'vserver-01' {
41 | }
42 | EOS
43 | make_site_pp(pp)
44 | run_device(:allow_changes => true)
45 | run_device(:allow_changes => false)
46 | end
47 |
48 | it 'deletes a netapp_lif' do
49 | pp=<<-EOS
50 | node 'vsim-01' {
51 | netapp_lif { 'vserver-01_liftest' :
52 | ensure => absent,
53 | homeport => 'e0c',
54 | homenode => 'VSIM-01',
55 | address => '192.168.0.2',
56 | vserver => 'vserver-01',
57 | netmask => '255.255.255.0',
58 | firewallpolicy => 'mgmt',
59 | dataprotocols => ['nfs'],
60 | }
61 | }
62 | node 'vserver-01' {
63 | }
64 | EOS
65 | make_site_pp(pp)
66 | run_device(:allow_changes => true)
67 | run_device(:allow_changes => false)
68 | end
69 | end
70 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_net_dns_spec.rb:
--------------------------------------------------------------------------------
1 | require_relative '../spec_helper_acceptance.rb'
2 |
3 | describe "netapp_net_dns" do
4 | it 'makes a net DNS server' do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | }
8 | node 'vserver-01' {
9 | netapp_net_dns {'vserver-01':
10 | domains => ["abc.com", "xyz.com"],
11 | state => 'enabled',
12 | name_servers => '10.193.0.250'
13 | }
14 | }
15 | EOS
16 | make_site_pp(pp)
17 | run_device(:allow_changes => true)
18 | run_device(:allow_changes => false)
19 | end
20 | it "modify a net DNS server" do
21 | pp=<<-EOS
22 | node 'vsim-01' {
23 | }
24 | node 'vserver-01' {
25 | netapp_net_dns {'vserver-01':
26 | domains => ["wipro.com", "netapp.com"],
27 | state => 'enabled',
28 | name_servers => ['10.193.0.150', '10.193.0.160']
29 | }
30 | }
31 | EOS
32 | make_site_pp(pp)
33 | run_device(:allow_changes => true)
34 | run_device(:allow_changes => false)
35 | end
36 | end
37 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_net_port_spec.rb:
--------------------------------------------------------------------------------
1 | require_relative '../spec_helper_acceptance.rb'
2 |
3 | describe "net_port" do
4 | it "modify a port" do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | netapp_net_port{'vsim-01@e0a':
8 | flowcontrol_admin => 'none'
9 | }
10 | }
11 | node 'vserver-01' {
12 | }
13 | EOS
14 | make_site_pp(pp)
15 | run_device(:allow_changes => true)
16 | run_device(:allow_changes => false)
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_nfs_spec.rb:
--------------------------------------------------------------------------------
1 | require_relative '../spec_helper_acceptance.rb'
2 |
3 | describe "nfs" do
4 | it "make a nfs server" do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | }
8 | node 'vserver-01' {
9 | netapp_nfs {'vserver-01':
10 | ensure => 'present',
11 | v3 => 'enabled',
12 | v40 => 'disabled',
13 | v41 => 'disabled',
14 | enable_ejukebox => 'true',
15 | auth_sys_extended_groups => 'disabled'
16 | }
17 | }
18 | EOS
19 | make_site_pp(pp)
20 | run_device(:allow_changes => true)
21 | run_device(:allow_changes => false)
22 | end
23 | it "modify a nfs server" do
24 | pp=<<-EOS
25 | node 'vsim-01' {
26 | }
27 | node 'vserver-01' {
28 | netapp_nfs {'vserver-01':
29 | enable_ejukebox => 'false',
30 | auth_sys_extended_groups => 'enabled'
31 | }
32 | }
33 | EOS
34 | make_site_pp(pp)
35 | run_device(:allow_changes => true)
36 | run_device(:allow_changes => false)
37 | end
38 | it "stop a nfs server" do
39 | pp=<<-EOS
40 | node 'vsim-01' {
41 | }
42 | node 'vserver-01' {
43 | netapp_nfs {'vserver-01':
44 | ensure => 'present',
45 | state => 'off'
46 | }
47 | }
48 | EOS
49 | make_site_pp(pp)
50 | run_device(:allow_changes => true)
51 | run_device(:allow_changes => false)
52 | end
53 | it "start a nfs server" do
54 | pp=<<-EOS
55 | node 'vsim-01' {
56 | }
57 | node 'vserver-01' {
58 | netapp_nfs {'vserver-01':
59 | ensure => 'present',
60 | state => 'on'
61 | }
62 | }
63 | EOS
64 | make_site_pp(pp)
65 | run_device(:allow_changes => true)
66 | run_device(:allow_changes => false)
67 | end
68 | it "delete a nfs server" do
69 | pp=<<-EOS
70 | node 'vsim-01' {
71 | }
72 | node 'vserver-01' {
73 | netapp_nfs {'vserver-01':
74 | ensure => 'absent'
75 | }
76 | }
77 | EOS
78 | make_site_pp(pp)
79 | run_device(:allow_changes => true)
80 | run_device(:allow_changes => false)
81 | end
82 | end
83 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_security_login_role_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'security_login_role' do
4 | it 'makes a security_login_role' do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | netapp_vserver { 'vserver-01':
8 | ensure => present,
9 | rootvol => 'vserver_01_root',
10 | rootvolaggr => 'aggr1',
11 | rootvolsecstyle => 'unix',
12 | }
13 | netapp_lif { 'nfs_lif':
14 | ensure => present,
15 | homeport => 'e0c',
16 | homenode => 'VSIM-01',
17 | address => '10.0.207.5',
18 | vserver => 'vserver-01',
19 | netmask => '255.255.255.0',
20 | dataprotocols => ['nfs','cifs'],
21 | }
22 | netapp_lif { 'iscsi_lif':
23 | ensure => present,
24 | homeport => 'e0c',
25 | homenode => 'VSIM-01',
26 | address => '10.0.207.6',
27 | vserver => 'vserver-01',
28 | netmask => '255.255.255.0',
29 | dataprotocols => 'iscsi',
30 | }
31 | netapp_security_login_role { 'vserver:roller:vserver-01':
32 | ensure => 'present',
33 | }
34 | }
35 | node 'vserver-01' {
36 | }
37 | EOS
38 | make_site_pp(pp)
39 | run_device(:allow_changes => true)
40 | run_device(:allow_changes => false)
41 | end
42 |
43 | it 'edit a security_login_role' do
44 | pp=<<-EOS
45 | node 'vsim-01' {
46 | netapp_security_login_role { 'vserver:roller:vserver-01':
47 | ensure => 'present',
48 | access_level => 'all',
49 | }
50 | }
51 | node 'vserver-01' {
52 | }
53 | EOS
54 | make_site_pp(pp)
55 | run_device(:allow_changes => true)
56 | run_device(:allow_changes => false)
57 | end
58 |
59 | it 'delete a security_login_role' do
60 | pp=<<-EOS
61 | node 'vsim-01' {
62 | netapp_security_login_role { 'vserver:roller:vserver-01':
63 | ensure => 'absent',
64 | access_level => 'all',
65 | }
66 | }
67 | node 'vserver-01' {
68 | }
69 | EOS
70 | make_site_pp(pp)
71 | run_device(:allow_changes => true)
72 | run_device(:allow_changes => false)
73 | end
74 | end
75 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_security_login_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'security_login' do
4 | it 'makes a security_login' do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | netapp_vserver { 'vserver-01':
8 | ensure => present,
9 | rootvol => 'vserver_01_root',
10 | rootvolaggr => 'aggr1',
11 | rootvolsecstyle => 'unix',
12 | }
13 | netapp_lif { 'nfs_lif':
14 | ensure => present,
15 | homeport => 'e0c',
16 | homenode => 'VSIM-01',
17 | address => '10.0.207.5',
18 | vserver => 'vserver-01',
19 | netmask => '255.255.255.0',
20 | dataprotocols => ['nfs','cifs'],
21 | }
22 | netapp_lif { 'iscsi_lif':
23 | ensure => present,
24 | homeport => 'e0c',
25 | homenode => 'VSIM-01',
26 | address => '10.0.207.6',
27 | vserver => 'vserver-01',
28 | netmask => '255.255.255.0',
29 | dataprotocols => 'iscsi',
30 | }
31 | netapp_security_login {'ontapi:password:cat:VSIM':
32 | ensure => present,
33 | role_name => 'admin',
34 | password => 'sadasd1G!',
35 | comment => 'adiasdasdasdadasd',
36 | }
37 | }
38 | node 'vserver-01' {
39 | }
40 | EOS
41 | make_site_pp(pp)
42 | run_device(:allow_changes => true)
43 | run_device(:allow_changes => false)
44 | end
45 |
46 | it 'edit a security_login' do
47 | pp=<<-EOS
48 | node 'vsim-01' {
49 | netapp_security_login {'ontapi:password:cat:VSIM':
50 | ensure => present,
51 | role_name => 'admin',
52 | comment => 'comment2',
53 | is_locked => 'true',
54 | }
55 | }
56 | node 'vserver-01' {
57 | }
58 | EOS
59 | make_site_pp(pp)
60 | run_device(:allow_changes => true)
61 | run_device(:allow_changes => false)
62 | end
63 |
64 | it 'unlock a security_login' do
65 | pp=<<-EOS
66 | node 'vsim-01' {
67 | netapp_security_login {'ontapi:password:cat:VSIM':
68 | ensure => present,
69 | role_name => 'admin',
70 | comment => 'comment2',
71 | is_locked => 'false',
72 | }
73 | }
74 | node 'vserver-01' {
75 | }
76 | EOS
77 | make_site_pp(pp)
78 | run_device(:allow_changes => true)
79 | run_device(:allow_changes => false)
80 | end
81 |
82 | #lock a login
83 |
84 | #change a password
85 |
86 | it 'delete a security_login' do
87 | pp=<<-EOS
88 | node 'vsim-01' {
89 | netapp_security_login {'ontapi:password:cat:VSIM':
90 | ensure => absent,
91 | role_name => 'admin',
92 | comment => 'comment2',
93 | }
94 | }
95 | node 'vserver-01' {
96 | }
97 | EOS
98 | make_site_pp(pp)
99 | run_device(:allow_changes => true)
100 | run_device(:allow_changes => false)
101 | end
102 | end
103 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_sis_policy_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'netapp_sis_policy' do
4 | it 'makes a netapp_sis_policy' do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | }
8 | node 'vserver-01' {
9 | netapp_sis_policy { 'default':
10 | ensure => 'present',
11 | comment => 'Default policy',
12 | enabled => 'true',
13 | qos_policy => 'best_effort',
14 | type => 'threshold',
15 | changelog_threshold_percent => '20',
16 | }
17 | }
18 | EOS
19 | make_site_pp(pp)
20 | run_device(:allow_changes => true)
21 | run_device(:allow_changes => false)
22 | end
23 |
24 | it 'edit a netapp_sis_policy' do
25 | pp=<<-EOS
26 | node 'vsim-01' {
27 | }
28 | node 'vserver-01' {
29 | netapp_sis_policy { 'default':
30 | ensure => 'present',
31 | comment => 'Default policy',
32 | enabled => 'true',
33 | qos_policy => 'best_effort',
34 | type => 'threshold',
35 | changelog_threshold_percent => '10',
36 | }
37 | }
38 | EOS
39 | make_site_pp(pp)
40 | run_device(:allow_changes => true)
41 | run_device(:allow_changes => false)
42 | end
43 |
44 | it 'deletes a netapp_sis_policy' do
45 | pp=<<-EOS
46 | node 'vsim-01' {
47 | }
48 | node 'vserver-01' {
49 | netapp_sis_policy { 'default':
50 | ensure => 'absent',
51 | comment => 'Default policy',
52 | enabled => 'true',
53 | qos_policy => 'best_effort',
54 | type => 'threshold',
55 | changelog_threshold_percent => '10',
56 | }
57 | }
58 | EOS
59 | make_site_pp(pp)
60 | run_device(:allow_changes => true)
61 | run_device(:allow_changes => false)
62 | end
63 |
64 | end
65 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_snapmirror_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'snapmirror' do
4 | it 'makes a snapmirror' do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | netapp_vserver { 'vserver-01':
8 | ensure => present,
9 | rootvol => 'vserver_01_root',
10 | rootvolaggr => 'aggr1',
11 | rootvolsecstyle => 'unix',
12 | }
13 | netapp_lif { 'nfs_lif':
14 | ensure => present,
15 | homeport => 'e0c',
16 | homenode => 'VSIM-01',
17 | address => '10.0.207.5',
18 | vserver => 'vserver-01',
19 | netmask => '255.255.255.0',
20 | dataprotocols => ['nfs','cifs'],
21 | }
22 | netapp_lif { 'iscsi_lif':
23 | ensure => present,
24 | homeport => 'e0c',
25 | homenode => 'VSIM-01',
26 | address => '10.0.207.6',
27 | vserver => 'vserver-01',
28 | netmask => '255.255.255.0',
29 | dataprotocols => 'iscsi',
30 | }
31 | netapp_vserver { 'vs0':
32 | ensure => present,
33 | rootvol => 'vs0_root',
34 | rootvolaggr => 'aggr1',
35 | rootvolsecstyle => 'unix',
36 | }
37 | netapp_vserver { 'vs4':
38 | ensure => present,
39 | rootvol => 'vs4_root',
40 | rootvolaggr => 'aggr1',
41 | rootvolsecstyle => 'unix',
42 | }
43 | netapp_vserver_peer { 'vs0:vs4':
44 | ensure => 'present',
45 | applications => ['snapmirror'],
46 | peer_cluster => 'VSIM',
47 | }
48 | netapp_snapmirror { 'vs4:vs4_root':
49 | ensure => 'present',
50 | relationship_type => 'data_protection',
51 | source_location => 'vs0:vs0_root',
52 | snapmirror_policy => 'DPDefault',
53 | snapmirror_schedule => 'daily',
54 | }
55 | }
56 | node 'vserver-01' {
57 | }
58 | EOS
59 | make_site_pp(pp)
60 | run_device(:allow_changes => true)
61 | run_device(:allow_changes => false)
62 | end
63 |
64 | it 'edit a snapmirror' do
65 | pp=<<-EOS
66 | node 'vsim-01' {
67 | netapp_snapmirror { 'vs4:vs4_root':
68 | ensure => 'present',
69 | max_transfer_rate => '0',
70 | relationship_type => 'data_protection',
71 | source_location => 'vs0:vs0_root',
72 | }
73 | }
74 | node 'vserver-01' {
75 | }
76 | EOS
77 | make_site_pp(pp)
78 | run_device(:allow_changes => true)
79 | run_device(:allow_changes => false)
80 | end
81 |
82 | it 'delete a snapmirror' do
83 | pp=<<-EOS
84 | node 'vsim-01' {
85 | netapp_snapmirror { 'vs4:vs4_root':
86 | ensure => 'absent',
87 | max_transfer_rate => '0',
88 | relationship_type => 'data_protection',
89 | source_location => 'vs0:vs0_root',
90 | }
91 | }
92 | node 'vserver-01' {
93 | }
94 | EOS
95 | make_site_pp(pp)
96 | run_device(:allow_changes => true)
97 | run_device(:allow_changes => false)
98 | end
99 | end
100 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_storage_array_spec.rb:
--------------------------------------------------------------------------------
1 | require_relative '../spec_helper_acceptance.rb'
2 |
3 | describe "storage_array" do
4 | it "modify a storage array" do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | netapp_storage_array{ 'VMware_Virtualdisk_1':
8 | max_queue_depth => '256'
9 | }
10 | }
11 | node 'vserver-01' {
12 | }
13 | EOS
14 | make_site_pp(pp)
15 | run_device(:allow_changes => true)
16 | run_device(:allow_changes => false)
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_storage_failover_spec.rb:
--------------------------------------------------------------------------------
1 | require_relative '../spec_helper_acceptance.rb'
2 |
3 | describe "storage_failover" do
4 | it "modify storage failover" do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | netapp_storage_failover{'vsim-01':
8 | auto_giveback => 'false',
9 | auto_giveback_after_panic => 'false',
10 | auto_giveback_override_vetoes => 'false'
11 | }
12 | }
13 | node "vserver-01" {
14 | }
15 | EOS
16 | make_site_pp(pp)
17 | run_device(:allow_changes => true)
18 | run_device(:allow_changes => false)
19 | end
20 | end
21 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_system_node_autosupport_spec.rb:
--------------------------------------------------------------------------------
1 | require_relative '../spec_helper_acceptance.rb'
2 |
3 | describe "system_node_autosupport" do
4 | it "modify autosupport configuration" do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | netapp_system_node_autosupport{'vsim-01':
8 | periodic_tx_window => '1h'
9 | }
10 | }
11 | node 'vserver-01' {
12 | }
13 | EOS
14 | make_site_pp(pp)
15 | run_device(:allow_changes => true)
16 | run_device(:allow_changes => false)
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_vserver_cifs_domain_password_schedule_spec.rb:
--------------------------------------------------------------------------------
1 | require_relative '../spec_helper_acceptance.rb'
2 |
3 | describe "vserver_cifs_domain_password_schedule" do
4 | it "modify cifs domain password schedule" do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | }
8 | node 'vserver-01' {
9 | netapp_vserver_cifs_domain_password_schedule {'vserver-01':
10 | schedule_randomized_minute => '100'
11 | }
12 | }
13 | EOS
14 | make_site_pp(pp)
15 | run_device(:allow_changes => true)
16 | run_device(:allow_changes => false)
17 | end
18 | end
19 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_vserver_cifs_options_spec.rb:
--------------------------------------------------------------------------------
1 | require_relative '../spec_helper_acceptance.rb'
2 |
3 | describe "vserver_cifs_options" do
4 | it "modify vserver cifs options" do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | }
8 | node 'vserver-01' {
9 | netapp_vserver_cifs_options {'vserver-01':
10 | max_mpx => '512',
11 | smb2_enabled => 'true'
12 | }
13 | }
14 | EOS
15 | make_site_pp(pp)
16 | run_device(:allow_changes => true)
17 | run_device(:allow_changes => false)
18 | end
19 | end
20 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_vserver_option_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'vserver option' do
4 | it 'set a vserver option' do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | netapp_vserver_option { 'flexscale.rewarm':
8 | ensure => 'present',
9 | value => 'off',
10 | }
11 | }
12 | node 'vserver-01' {
13 | }
14 | EOS
15 | make_site_pp(pp)
16 | run_device(:allow_changes => true)
17 | run_device(:allow_changes => false)
18 | end
19 |
20 | it 'set the option back' do
21 | pp=<<-EOS
22 | node 'vsim-01' {
23 | netapp_vserver_option { 'flexscale.rewarm':
24 | ensure => 'present',
25 | value => 'on',
26 | }
27 | }
28 | node 'vserver-01' {
29 | }
30 | EOS
31 | make_site_pp(pp)
32 | run_device(:allow_changes => true)
33 | run_device(:allow_changes => false)
34 | end
35 |
36 | end
37 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_vserver_peer_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'vserver_peer' do
4 | it 'makes a vserver_peer' do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | netapp_vserver { 'vserver-01':
8 | ensure => present,
9 | rootvol => 'vserver_01_root',
10 | rootvolaggr => 'aggr1',
11 | rootvolsecstyle => 'unix',
12 | }
13 | netapp_lif { 'nfs_lif':
14 | ensure => present,
15 | homeport => 'e0c',
16 | homenode => 'VSIM-01',
17 | address => '10.0.207.5',
18 | vserver => 'vserver-01',
19 | netmask => '255.255.255.0',
20 | dataprotocols => ['nfs','cifs'],
21 | }
22 | netapp_lif { 'iscsi_lif':
23 | ensure => present,
24 | homeport => 'e0c',
25 | homenode => 'VSIM-01',
26 | address => '10.0.207.6',
27 | vserver => 'vserver-01',
28 | netmask => '255.255.255.0',
29 | dataprotocols => 'iscsi',
30 | }
31 | netapp_vserver { 'bs0':
32 | ensure => present,
33 | rootvol => 'bs0_root',
34 | rootvolaggr => 'aggr1',
35 | rootvolsecstyle => 'unix',
36 | }
37 | netapp_vserver { 'bs4':
38 | ensure => present,
39 | rootvol => 'bs4_root',
40 | rootvolaggr => 'aggr1',
41 | rootvolsecstyle => 'unix',
42 | }
43 | netapp_vserver_peer { 'bs0:bs4':
44 | ensure => 'present',
45 | applications => ['snapmirror'],
46 | peer_cluster => 'VSIM',
47 | }
48 | }
49 | node 'vserver-01' {
50 | }
51 | EOS
52 | make_site_pp(pp)
53 | run_device(:allow_changes => true)
54 | run_device(:allow_changes => false)
55 | end
56 |
57 | it 'edit a vserver_peer' do
58 | pp=<<-EOS
59 | node 'vsim-01' {
60 | netapp_vserver_peer { 'bs0:bs4':
61 | ensure => 'present',
62 | applications => ['file_copy'],
63 | }
64 | }
65 | node 'vserver-01' {
66 | }
67 | EOS
68 | make_site_pp(pp)
69 | run_device(:allow_changes => true)
70 | run_device(:allow_changes => false)
71 | end
72 |
73 | it 'delete a vserver_peer' do
74 | pp=<<-EOS
75 | node 'vsim-01' {
76 | netapp_vserver_peer { 'bs0:bs4':
77 | ensure => 'absent',
78 | applications => ['snapmirror'],
79 | peer_cluster => 'VSIM',
80 | }
81 | }
82 | node 'vserver-01' {
83 | }
84 | EOS
85 | make_site_pp(pp)
86 | run_device(:allow_changes => true)
87 | run_device(:allow_changes => false)
88 | end
89 | end
90 |
--------------------------------------------------------------------------------
/spec/acceptance/netapp_vserver_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper_acceptance'
2 |
3 | describe 'vserver' do
4 | it 'makes a vserver' do
5 | pp=<<-EOS
6 | node 'vsim-01' {
7 | netapp_aggregate {'aggr1':
8 | ensure => 'present',
9 | blocktype => '64_bit',
10 | checksumstyle => 'block',
11 | diskcount => '3',
12 | option_free_space_realloc => 'off',
13 | nodes => ['VSIM-01']
14 | }
15 | netapp_vserver { 'test_vserver':
16 | ensure => present,
17 | rootvol => 'test_vserver_root',
18 | rootvolaggr => 'aggr1',
19 | rootvolsecstyle => 'unix',
20 | comment => 'hey',
21 | ipspace => 'Default',
22 | }
23 | }
24 | node 'vserver-01' {
25 | }
26 | EOS
27 | make_site_pp(pp)
28 | run_device(:allow_changes => true)
29 | run_device(:allow_changes => false)
30 | end
31 |
32 | it 'edit a vserver' do
33 | pp=<<-EOS
34 | node 'vsim-01' {
35 | netapp_vserver { 'test_vserver':
36 | ensure => 'present',
37 | comment => 'new comment',
38 | }
39 | }
40 | node 'vserver-01' {
41 | }
42 | EOS
43 | make_site_pp(pp)
44 | run_device(:allow_changes => true)
45 | run_device(:allow_changes => false)
46 | end
47 |
48 | it 'stop a vserver' do
49 | pp=<<-EOS
50 | node 'vsim-01' {
51 | netapp_vserver { 'test_vserver':
52 | ensure => 'present',
53 | comment => 'new comment',
54 | state => 'stopped',
55 | }
56 | }
57 | node 'vserver-01' {
58 | }
59 | EOS
60 | make_site_pp(pp)
61 | run_device(:allow_changes => true)
62 | run_device(:allow_changes => false)
63 | end
64 |
65 | end
66 |
--------------------------------------------------------------------------------
/spec/acceptance/nodesets/default.yml:
--------------------------------------------------------------------------------
1 | HOSTS:
2 | "servicevm":
3 | roles:
4 | - "master"
5 | - "dashboard"
6 | - "database"
7 | - "default"
8 | platform: "debian-7-amd64"
9 | hypervisor: "none"
10 | template: "debian-7-x86_64"
11 | ip: '10.0.207.253'
12 | ssh:
13 | auth_methods:
14 | - 'password'
15 | password: 'vagrant'
16 | CONFIG:
17 | type: "foss"
18 |
--------------------------------------------------------------------------------
/spec/fixtures/integration/puppet/provider/netapp_quota/netapp_quota/quota-status-result-off.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | attrkeys:
3 | - status
4 | attrvals:
5 | - passed
6 | children:
7 | - !ruby/object:NaElement
8 | attrkeys: []
9 |
10 | attrvals: []
11 |
12 | children: []
13 |
14 | content: "off"
15 | name: status
16 | - !ruby/object:NaElement
17 | attrkeys: []
18 |
19 | attrvals: []
20 |
21 | children: []
22 |
23 | content: none
24 | name: substatus
25 | content: ""
26 | name: results
27 |
--------------------------------------------------------------------------------
/spec/fixtures/integration/puppet/provider/netapp_quota/netapp_quota/quota-status-result-on.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | attrkeys:
3 | - status
4 | attrvals:
5 | - passed
6 | children:
7 | - !ruby/object:NaElement
8 | attrkeys: []
9 |
10 | attrvals: []
11 |
12 | children: []
13 |
14 | content: "on"
15 | name: status
16 | - !ruby/object:NaElement
17 | attrkeys: []
18 |
19 | attrvals: []
20 |
21 | children: []
22 |
23 | content: none
24 | name: substatus
25 | - !ruby/object:NaElement
26 | attrkeys: []
27 |
28 | attrvals: []
29 |
30 | children: []
31 |
32 | content: "[quota: warning]: Total tree disk quota limit from /etc/quotas (3087360 MB) exceeds size of volume vol1 (2097152 MB)"
33 | name: reason
34 | - !ruby/object:NaElement
35 | attrkeys: []
36 |
37 | attrvals: []
38 |
39 | children: []
40 |
41 | content: "[quota: warning]: Total tree disk quota limit from /etc/quotas (3087360 MB) exceeds size of volume vol1 (2097152 MB)"
42 | name: quota-errors
43 | content: ""
44 | name: results
45 |
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/netapp_cifs/cmode/cifs-list.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | - !ruby/object:NaElement
3 | name: result
4 | content: ""
5 | children:
6 | - !ruby/object:NaElement
7 | name: cifs-server
8 | content: "cifs01"
9 | - !ruby/object:NaElement
10 | name: domain
11 | content: "abc.local"
12 | - !ruby/object:NaElement
13 | name: result
14 | content: ""
15 | children:
16 | - !ruby/object:NaElement
17 | name: cifs-server
18 | content: "cifs02"
19 | - !ruby/object:NaElement
20 | name: domain
21 | content: "xyz.local"
22 |
23 |
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/netapp_group/sevenmode/group-list.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | name: results
3 | content: ""
4 | children:
5 | - !ruby/object:NaElement
6 | name: useradmin-groups
7 | content: ""
8 | children:
9 | - !ruby/object:NaElement
10 | name: useradmin-group-info
11 | content: ""
12 | children:
13 | - !ruby/object:NaElement
14 | name: name
15 | content: group
16 | children: []
17 | attrkeys: []
18 | attrvals: []
19 | - !ruby/object:NaElement
20 | name: comment
21 | content: test group
22 | children: []
23 | attrkeys: []
24 | attrvals: []
25 | - !ruby/object:NaElement
26 | name: rid
27 | content: '131076'
28 | children: []
29 | attrkeys: []
30 | attrvals: []
31 | - !ruby/object:NaElement
32 | name: useradmin-roles
33 | content: ""
34 | children:
35 | - !ruby/object:NaElement
36 | name: useradmin-role-info
37 | content: ""
38 | children:
39 | - !ruby/object:NaElement
40 | name: name
41 | content: role1
42 | children: []
43 | attrkeys: []
44 | attrvals: []
45 | attrkeys: []
46 | attrvals: []
47 | - !ruby/object:NaElement
48 | name: useradmin-role-info
49 | content: ""
50 | children:
51 | - !ruby/object:NaElement
52 | name: name
53 | content: role2
54 | children: []
55 | attrkeys: []
56 | attrvals: []
57 | attrkeys: []
58 | attrvals: []
59 | attrkeys: []
60 | attrvals: []
61 | attrkeys: []
62 | attrvals: []
63 | attrkeys: []
64 | attrvals: []
65 | attrkeys:
66 | - status
67 | attrvals:
68 | - passed
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/netapp_net_dns/cmode/net-dns-list.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | - !ruby/object:NaElement
3 | name: result
4 | content: ""
5 | children:
6 | - !ruby/object:NaElement
7 | name: domains
8 | content: ""
9 | children:
10 | - !ruby/object:NaElement
11 | name: string
12 | content: "domain1.com"
13 | attrkeys: []
14 | attrvals: []
15 | - !ruby/object:NaElement
16 | name: string
17 | content: "domain2.com"
18 | attrkeys: []
19 | attrvals: []
20 | - !ruby/object:NaElement
21 | name: string
22 | content: "domain3.com"
23 | attrkeys: []
24 | attrvals: []
25 | - !ruby/object:NaElement
26 | name: name-servers
27 | content: ""
28 | children:
29 | - !ruby/object:NaElement
30 | name: ip_address
31 | content: "10.10.10.10"
32 | attrkeys: []
33 | attrvals: []
34 | - !ruby/object:NaElement
35 | name: ip_address
36 | content: "10.10.10.11"
37 | attrkeys: []
38 | attrvals: []
39 | - !ruby/object:NaElement
40 | name: ip_address
41 | content: "10.10.10.12"
42 | attrkeys: []
43 | attrvals: []
44 | - !ruby/object:NaElement
45 | name: vserver-name
46 | content: "vserver01"
47 | - !ruby/object:NaElement
48 | name: dns-state
49 | content: "enabled"
50 |
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/netapp_net_dns/cmode/net-dns-response.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | name: results
3 | content: ""
4 | children:
5 | - !ruby/object:NaElement
6 | name: domains
7 | content: ""
8 | children:
9 | - !ruby/object:NaElement
10 | name: string
11 | content: "domain1.com"
12 | attrkeys: []
13 | attrvals: []
14 | - !ruby/object:NaElement
15 | name: string
16 | content: "domain2.com"
17 | attrkeys: []
18 | attrvals: []
19 | - !ruby/object:NaElement
20 | name: string
21 | content: "domain3.com"
22 | attrkeys: []
23 | attrvals: []
24 | - !ruby/object:NaElement
25 | name: name-servers
26 | content: ""
27 | children:
28 | - !ruby/object:NaElement
29 | name: ip_address
30 | content: "10.10.10.10"
31 | attrkeys: []
32 | attrvals: []
33 | - !ruby/object:NaElement
34 | name: ip_address
35 | content: "10.10.10.11"
36 | attrkeys: []
37 | attrvals: []
38 | - !ruby/object:NaElement
39 | name: ip_address
40 | content: "10.10.10.12"
41 | attrkeys: []
42 | attrvals: []
43 | - !ruby/object:NaElement
44 | name: vserver-name
45 | content: "vserver01"
46 | - !ruby/object:NaElement
47 | name: dns-state
48 | content: "enabled"
49 |
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/netapp_net_port/cmode/net-port-list.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | - !ruby/object:NaElement
3 | name: net_port
4 | content: ""
5 | children:
6 | - !ruby/object:NaElement
7 | name: node
8 | content: node_name1
9 | children: []
10 | attrkeys: []
11 | attrvals: []
12 | - !ruby/object:NaElement
13 | name: port
14 | content: port1
15 | children: []
16 | attrkeys: []
17 | attrvals: []
18 | - !ruby/object:NaElement
19 | name: administrative-flowcontrol
20 | content: full
21 | children: []
22 | attrkeys: []
23 | attrvals: []
24 | - !ruby/object:NaElement
25 | name: net_port
26 | content: ""
27 | children:
28 | - !ruby/object:NaElement
29 | name: node
30 | content: node_name2
31 | children: []
32 | attrkeys: []
33 | attrvals: []
34 | - !ruby/object:NaElement
35 | name: port
36 | content: port2
37 | children: []
38 | attrkeys: []
39 | attrvals: []
40 | - !ruby/object:NaElement
41 | name: administrative-flowcontrol
42 | content: full
43 | children: []
44 | attrkeys: []
45 | attrvals: []
46 |
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/netapp_nfs_export/sevenmode/export-failed-response.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | name: results
3 | content: ""
4 | children:
5 | - !ruby/object:NaElement
6 | name: loaded-pathnames
7 | content: ""
8 | children: []
9 | attrkeys: []
10 | attrvals: []
11 | - !ruby/object:NaElement
12 | name: exported-pathnames
13 | content: ""
14 | children:
15 | - !ruby/object:NaElement
16 | name: pathname-info
17 | content: ""
18 | children:
19 | - !ruby/object:NaElement
20 | name: name
21 | content: /vol/volume
22 | children: []
23 | attrkeys: []
24 | attrvals: []
25 | attrkeys: []
26 | attrvals: []
27 | attrkeys: []
28 | attrvals: []
29 | attrkeys:
30 | - status
31 | attrvals:
32 | - passed
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/netapp_nfs_export/sevenmode/export-qtree-response.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | name: results
3 | content: ""
4 | children:
5 | - !ruby/object:NaElement
6 | name: loaded-pathnames
7 | content: ""
8 | children:
9 | - !ruby/object:NaElement
10 | name: pathname-info
11 | content: ""
12 | children:
13 | - !ruby/object:NaElement
14 | name: name
15 | content: /vol/othervolume2/otherqtree
16 | children: []
17 | attrkeys: []
18 | attrvals: []
19 | attrkeys: []
20 | attrvals: []
21 | attrkeys: []
22 | attrvals: []
23 | - !ruby/object:NaElement
24 | name: exported-pathnames
25 | content: ""
26 | children:
27 | - !ruby/object:NaElement
28 | name: pathname-info
29 | content: ""
30 | children:
31 | - !ruby/object:NaElement
32 | name: name
33 | content: /vol/volume/qtree
34 | children: []
35 | attrkeys: []
36 | attrvals: []
37 | attrkeys: []
38 | attrvals: []
39 | attrkeys: []
40 | attrvals: []
41 | attrkeys:
42 | - status
43 | attrvals:
44 | - passed
45 |
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/netapp_nfs_export/sevenmode/export-volume-response.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | name: results
3 | content: ""
4 | children:
5 | - !ruby/object:NaElement
6 | name: loaded-pathnames
7 | content: ""
8 | children:
9 | - !ruby/object:NaElement
10 | name: pathname-info
11 | content: ""
12 | children:
13 | - !ruby/object:NaElement
14 | name: name
15 | content: /vol/volume
16 | children: []
17 | attrkeys: []
18 | attrvals: []
19 | attrkeys: []
20 | attrvals: []
21 | attrkeys: []
22 | attrvals: []
23 | - !ruby/object:NaElement
24 | name: exported-pathnames
25 | content: ""
26 | children:
27 | - !ruby/object:NaElement
28 | name: pathname-info
29 | content: ""
30 | children:
31 | - !ruby/object:NaElement
32 | name: name
33 | content: /vol/volume
34 | children: []
35 | attrkeys: []
36 | attrvals: []
37 | attrkeys: []
38 | attrvals: []
39 | attrkeys: []
40 | attrvals: []
41 | attrkeys:
42 | - status
43 | attrvals:
44 | - passed
45 |
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/netapp_qtree/sevenmode/qtree-list.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | name: results
3 | content: ""
4 | children:
5 | - !ruby/object:NaElement
6 | name: qtrees
7 | content: ""
8 | children:
9 | - !ruby/object:NaElement
10 | name: qtree-info
11 | content: ""
12 | children:
13 | - !ruby/object:NaElement
14 | name: volume
15 | content: volume
16 | children: []
17 | attrkeys: []
18 | attrvals: []
19 | - !ruby/object:NaElement
20 | name: qtree
21 | content: qtree
22 | children: []
23 | attrkeys: []
24 | attrvals: []
25 | - !ruby/object:NaElement
26 | name: id
27 | content: '1'
28 | children: []
29 | attrkeys: []
30 | attrvals: []
31 | - !ruby/object:NaElement
32 | name: oplocks
33 | content: enabled
34 | children: []
35 | attrkeys: []
36 | attrvals: []
37 | - !ruby/object:NaElement
38 | name: security-style
39 | content: unix
40 | children: []
41 | attrkeys: []
42 | attrvals: []
43 | - !ruby/object:NaElement
44 | name: status
45 | content: normal
46 | children: []
47 | attrkeys: []
48 | attrvals: []
49 | attrkeys: []
50 | attrvals: []
51 | attrkeys: []
52 | attrvals: []
53 | attrkeys:
54 | - status
55 | attrvals:
56 | - passed
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/netapp_quota/sevenmode/quota-status-result-off.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | attrkeys:
3 | - status
4 | attrvals:
5 | - passed
6 | children:
7 | - !ruby/object:NaElement
8 | attrkeys: []
9 |
10 | attrvals: []
11 |
12 | children: []
13 |
14 | content: "off"
15 | name: status
16 | - !ruby/object:NaElement
17 | attrkeys: []
18 |
19 | attrvals: []
20 |
21 | children: []
22 |
23 | content: none
24 | name: substatus
25 | content: ""
26 | name: results
27 |
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/netapp_quota/sevenmode/quota-status-result-on.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | attrkeys:
3 | - status
4 | attrvals:
5 | - passed
6 | children:
7 | - !ruby/object:NaElement
8 | attrkeys: []
9 |
10 | attrvals: []
11 |
12 | children: []
13 |
14 | content: "on"
15 | name: status
16 | - !ruby/object:NaElement
17 | attrkeys: []
18 |
19 | attrvals: []
20 |
21 | children: []
22 |
23 | content: none
24 | name: substatus
25 | - !ruby/object:NaElement
26 | attrkeys: []
27 |
28 | attrvals: []
29 |
30 | children: []
31 |
32 | content: "[quota: warning]: Total tree disk quota limit from /etc/quotas (3087360 MB) exceeds size of volume vol1 (2097152 MB)"
33 | name: reason
34 | - !ruby/object:NaElement
35 | attrkeys: []
36 |
37 | attrvals: []
38 |
39 | children: []
40 |
41 | content: "[quota: warning]: Total tree disk quota limit from /etc/quotas (3087360 MB) exceeds size of volume vol1 (2097152 MB)"
42 | name: quota-errors
43 | content: ""
44 | name: results
45 |
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/netapp_role/sevenmode/role-list.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | name: results
3 | content: ""
4 | children:
5 | - !ruby/object:NaElement
6 | name: useradmin-roles
7 | content: ""
8 | children:
9 | - !ruby/object:NaElement
10 | name: useradmin-role-info
11 | content: ""
12 | children:
13 | - !ruby/object:NaElement
14 | name: name
15 | content: role
16 | children: []
17 | attrkeys: []
18 | attrvals: []
19 | - !ruby/object:NaElement
20 | name: comment
21 | content: "test role"
22 | children: []
23 | attrkeys: []
24 | attrvals: []
25 | - !ruby/object:NaElement
26 | name: allowed-capabilities
27 | content: ""
28 | children:
29 | - !ruby/object:NaElement
30 | name: useradmin-capability-info
31 | content: ""
32 | children:
33 | - !ruby/object:NaElement
34 | name: name
35 | content: login-*
36 | children: []
37 | attrkeys: []
38 | attrvals: []
39 | attrkeys: []
40 | attrvals: []
41 | - !ruby/object:NaElement
42 | name: useradmin-capability-info
43 | content: ""
44 | children:
45 | - !ruby/object:NaElement
46 | name: name
47 | content: cli-*
48 | children: []
49 | attrkeys: []
50 | attrvals: []
51 | attrkeys: []
52 | attrvals: []
53 | - !ruby/object:NaElement
54 | name: useradmin-capability-info
55 | content: ""
56 | children:
57 | - !ruby/object:NaElement
58 | name: name
59 | content: api-*
60 | children: []
61 | attrkeys: []
62 | attrvals: []
63 | attrkeys: []
64 | attrvals: []
65 | - !ruby/object:NaElement
66 | name: useradmin-capability-info
67 | content: ""
68 | children:
69 | - !ruby/object:NaElement
70 | name: name
71 | content: security-*
72 | children: []
73 | attrkeys: []
74 | attrvals: []
75 | attrkeys: []
76 | attrvals: []
77 | attrkeys: []
78 | attrvals: []
79 | attrkeys: []
80 | attrvals: []
81 | attrkeys: []
82 | attrvals: []
83 | attrkeys:
84 | - status
85 | attrvals:
86 | - passed
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/netapp_storage_failover/cmode/storage-failover-list.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | - !ruby/object:NaElement
3 | name: storage_failover_info
4 | content: ""
5 | children:
6 | - !ruby/object:NaElement
7 | name: sfo-options-info
8 | content: ""
9 | attrkeys: []
10 | attrvals: []
11 | children:
12 | - !ruby/object:NaElement
13 | name: options-related-info
14 | content: "options-related-info-content"
15 | children:
16 | - !ruby/object:NaElement
17 | name: sfo-giveback-options-info
18 | content: "sfo_giveback_content"
19 | children:
20 | - !ruby/object:NaElement
21 | name: giveback-options
22 | content: "giveback_options_content"
23 | children:
24 | - !ruby/object:NaElement
25 | name: auto-giveback-after-panic-enabled
26 | content: "true"
27 | attrkeys: []
28 | attrvals: []
29 | - !ruby/object:NaElement
30 | name: auto-giveback-enabled
31 | content: "true"
32 | attrkeys: []
33 | attrvals: []
34 | - !ruby/object:NaElement
35 | name: auto-giveback-override-vetoes-enabled
36 | content: "true"
37 | attrkeys: []
38 | attrvals: []
39 | - !ruby/object:NaElement
40 | name: sfo-node-info
41 | content: "JKL"
42 | children:
43 | - !ruby/object:NaElement
44 | name: node-related-info
45 | content: "enabled"
46 | children:
47 | - !ruby/object:NaElement
48 | name: node
49 | content: "nodeA"
50 |
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/netapp_system_node_autosupport/cmode/system-node-autosupport-list.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | - !ruby/object:NaElement
3 | name: result
4 | content: ""
5 | children:
6 | - !ruby/object:NaElement
7 | name: node-name
8 | content: "nodeA"
9 | attrkeys: []
10 | attrvals: []
11 | - !ruby/object:NaElement
12 | name: periodic-tx-window
13 | content: "1h"
14 | - !ruby/object:NaElement
15 | name: result
16 | content: ""
17 | children:
18 | - !ruby/object:NaElement
19 | name: node-name
20 | content: "nodeB"
21 | attrkeys: []
22 | attrvals: []
23 | - !ruby/object:NaElement
24 | name: periodic-tx-window
25 | content: "2h"
26 |
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/netapp_user/sevenmode/user-list.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | name: results
3 | content: ""
4 | children:
5 | - !ruby/object:NaElement
6 | name: useradmin-users
7 | content: ""
8 | children:
9 | - !ruby/object:NaElement
10 | name: useradmin-user-info
11 | content: ""
12 | children:
13 | - !ruby/object:NaElement
14 | name: name
15 | content: user
16 | children: []
17 | attrkeys: []
18 | attrvals: []
19 | - !ruby/object:NaElement
20 | name: comment
21 | content: test user
22 | children: []
23 | attrkeys: []
24 | attrvals: []
25 | - !ruby/object:NaElement
26 | name: useradmin-groups
27 | content: ""
28 | children:
29 | - !ruby/object:NaElement
30 | name: useradmin-group-info
31 | content: ""
32 | children:
33 | - !ruby/object:NaElement
34 | name: name
35 | content: group1
36 | children: []
37 | attrkeys: []
38 | attrvals: []
39 | attrkeys: []
40 | attrvals: []
41 | - !ruby/object:NaElement
42 | name: useradmin-group-info
43 | content: ""
44 | children:
45 | - !ruby/object:NaElement
46 | name: name
47 | content: group2
48 | children: []
49 | attrkeys: []
50 | attrvals: []
51 | attrkeys: []
52 | attrvals: []
53 | attrkeys: []
54 | attrvals: []
55 | attrkeys: []
56 | attrvals: []
57 | attrkeys: []
58 | attrvals: []
59 | attrkeys:
60 | - status
61 | attrvals:
62 | - passed
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/netapp_volume/sevenmode/volume-snapsched-list.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | name: results
3 | content: ""
4 | children:
5 | - !ruby/object:NaElement
6 | name: weeks
7 | content: '0'
8 | children: []
9 | attrkeys: []
10 | attrvals: []
11 | - !ruby/object:NaElement
12 | name: days
13 | content: '0'
14 | children: []
15 | attrkeys: []
16 | attrvals: []
17 | - !ruby/object:NaElement
18 | name: hours
19 | content: '0'
20 | children: []
21 | attrkeys: []
22 | attrvals: []
23 | - !ruby/object:NaElement
24 | name: minutes
25 | content: '0'
26 | children: []
27 | attrkeys: []
28 | attrvals: []
29 | - !ruby/object:NaElement
30 | name: which-hours
31 | content: ! ' '
32 | children: []
33 | attrkeys: []
34 | attrvals: []
35 | - !ruby/object:NaElement
36 | name: which-minutes
37 | content: ! ' '
38 | children: []
39 | attrkeys: []
40 | attrvals: []
41 | attrkeys:
42 | - status
43 | attrvals:
44 | - passed
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/netapp_vserver_cifs_domain_password_schedule/cmode/vserver-cifs-domain-password-schedule-list.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | - !ruby/object:NaElement
3 | name: result
4 | content: ""
5 | children:
6 | - !ruby/object:NaElement
7 | name: vserver
8 | content: "vserverA"
9 | attrkeys: []
10 | attrvals: []
11 | - !ruby/object:NaElement
12 | name: schedule-randomized-minute
13 | content: "100"
14 | - !ruby/object:NaElement
15 | name: result
16 | content: ""
17 | children:
18 | - !ruby/object:NaElement
19 | name: vserver
20 | content: "vserverB"
21 | - !ruby/object:NaElement
22 | name: schedule-randomized-minute
23 | content: "150"
24 |
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/netapp_vserver_cifs_options/cmode/cifs-options-list.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | - !ruby/object:NaElement
3 | name: result
4 | content: ""
5 | children:
6 | - !ruby/object:NaElement
7 | name: vserver
8 | content: "vserver1"
9 | attrkeys: []
10 | attrvals: []
11 | - !ruby/object:NaElement
12 | name: max-mpx
13 | content: "10"
14 | - !ruby/object:NaElement
15 | name: is-smb2-enabled
16 | content: "true"
17 | - !ruby/object:NaElement
18 | name: result
19 | content: ""
20 | children:
21 | - !ruby/object:NaElement
22 | name: vserver
23 | content: "vserver2"
24 | attrkeys: []
25 | attrvals: []
26 | - !ruby/object:NaElement
27 | name: max-mpx
28 | content: "20"
29 | - !ruby/object:NaElement
30 | name: is-smb2-enabled
31 | content: "false"
32 |
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/provider/storage-array-list.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | name: results
3 | content: ""
4 | children:
5 | - !ruby/object:NaElement
6 | name: array-profiles
7 | content: ""
8 | children:
9 | - !ruby/object:NaElement
10 | name: storage-array
11 | content: ""
12 | children:
13 | - !ruby/object:NaElement
14 | name: name
15 | content: storage_array_name1
16 | children: []
17 | attrkeys: []
18 | attrvals: []
19 | - !ruby/object:NaElement
20 | name: max-queue-depth
21 | content: 100
22 | children: []
23 | attrkeys: []
24 | attrvals: []
25 | - !ruby/object:NaElement
26 | name: storage-array
27 | content: ""
28 | children:
29 | - !ruby/object:NaElement
30 | name: name
31 | content: storage_array_name2
32 | children: []
33 | attrkeys: []
34 | attrvals: []
35 | - !ruby/object:NaElement
36 | name: max-queue-depth
37 | content: 100
38 | children: []
39 | attrkeys: []
40 | attrvals: []
41 |
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/util/network_device/netapp/device/system-get-version.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | attrkeys:
3 | - status
4 | attrvals:
5 | - passed
6 | children:
7 | - !ruby/object:NaElement
8 | attrkeys: []
9 |
10 | attrvals: []
11 |
12 | children: []
13 |
14 | content: "NetApp Release 8.1P2 7-Mode: Tue Jun 12 17:53:00 PDT 2012 Multistore"
15 | name: version
16 | - !ruby/object:NaElement
17 | attrkeys: []
18 |
19 | attrvals: []
20 |
21 | children: []
22 |
23 | content: "false"
24 | name: is-clustered
25 | content: ""
26 | name: results
27 |
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/util/network_device/netapp/facts/options-get-dns.domainname.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | attrkeys:
3 | - status
4 | attrvals:
5 | - passed
6 | children:
7 | - !ruby/object:NaElement
8 | attrkeys: []
9 |
10 | attrvals: []
11 |
12 | children: []
13 |
14 | content: "example.com"
15 | name: value
16 | content: ""
17 | name: results
18 |
--------------------------------------------------------------------------------
/spec/fixtures/unit/puppet/util/network_device/netapp/facts/system-get-version.yml:
--------------------------------------------------------------------------------
1 | --- !ruby/object:NaElement
2 | attrkeys:
3 | - status
4 | attrvals:
5 | - passed
6 | children:
7 | - !ruby/object:NaElement
8 | attrkeys: []
9 |
10 | attrvals: []
11 |
12 | children: []
13 |
14 | content: "NetApp Release 8.1P2 7-Mode: Tue Jun 12 17:53:00 PDT 2012 Multistore"
15 | name: version
16 | - !ruby/object:NaElement
17 | attrkeys: []
18 |
19 | attrvals: []
20 |
21 | children: []
22 |
23 | content: "false"
24 | name: is-clustered
25 | content: ""
26 | name: results
27 |
--------------------------------------------------------------------------------
/spec/spec_helper.rb:
--------------------------------------------------------------------------------
1 | require 'rubygems'
2 | require 'puppetlabs_spec_helper/module_spec_helper'
3 |
4 | Dir[File.join(File.dirname(__FILE__), 'support', '*.rb')].each do |support_file|
5 | require support_file
6 | end
7 |
8 | class Object
9 | alias :must :should
10 | alias :must_not :should_not
11 | end
12 |
13 | # Simplecov for Teamcity
14 | begin
15 | require 'simplecov'
16 | SimpleCov.start do
17 | add_filter '/spec/'
18 | add_filter '/lib/puppet/util/network_device/netapp/Na'
19 | #at_exit do
20 | # SimpleCov::Formatter::TeamcitySummaryFormatter.new.format(SimpleCov.result) if ENV['TEAMCITY_VERSION']
21 | #end
22 | end
23 | rescue Exception => e
24 | warn "Simplecov disabled"
25 | end
26 |
--------------------------------------------------------------------------------
/spec/spec_helper_acceptance.rb:
--------------------------------------------------------------------------------
1 | require 'beaker-rspec'
2 | require 'beaker/puppet_install_helper'
3 |
4 | run_puppet_install_helper
5 |
6 | RSpec.configure do |c|
7 | proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))
8 | c.before :suite do
9 | # Install module and dependencies
10 | copy_module_to(master, :source => proj_root, :module_name => 'netapp')
11 | device_conf=<<-EOS
12 | [vsim-01]
13 | type netapp
14 | url https://vagrant:netapp123@vsim-01
15 | [vserver-01]
16 | type netapp
17 | url https://vagrant:netapp123@vsim-01/vserver-01
18 | EOS
19 | create_remote_file(master, File.join(master[:puppetpath], "device.conf"), device_conf)
20 | on master, puppet('plugin','download','--server',master.to_s)
21 | on master, puppet('device','--user','root','-v','--waitforcert','0','--server',master.to_s), {:acceptable_exit_codes => [0,1] }
22 | on master, puppet('cert','sign','vsim-01'), {:acceptable_exit_codes => [0,24] }
23 | on master, puppet('device','--user','root','-v','--waitforcert','0','--server',master.to_s), {:acceptable_exit_codes => [0,1] }
24 | on master, puppet('cert','sign','vserver-01'), {:acceptable_exit_codes => [0,24] }
25 | on master, puppet('device','--user','root','-v','--waitforcert','0','--server',master.to_s), {:acceptable_exit_codes => [0,1] }
26 | end
27 | end
28 |
29 | def make_site_pp(pp, path = File.join(master['puppetpath'], 'manifests'))
30 | on master, "mkdir -p #{path}"
31 | create_remote_file(master, File.join(path, "site.pp"), pp)
32 | on master, "chown -R #{master['user']}:#{master['group']} #{path}"
33 | on master, "chmod -R 0755 #{path}"
34 | on master, "service #{master['puppetservice']} restart"
35 | end
36 |
37 | def run_device(options={:allow_changes => true})
38 | if options[:allow_changes] == false
39 | acceptable_exit_codes = 0
40 | else
41 | acceptable_exit_codes = [0,2]
42 | end
43 | on(master, puppet('device','--verbose','--color','false','--user','root','--trace','--server',master.to_s), { :acceptable_exit_codes => acceptable_exit_codes }) do |result|
44 | if options[:allow_changes] == false
45 | expect(result.stdout).to_not match(%r{^Notice: /Stage\[main\]})
46 | end
47 | expect(result.stderr).to_not match(%r{^Error:})
48 | expect(result.stderr).to_not match(%r{^Warning:})
49 | end
50 | end
51 |
52 | def run_resource_on(host, resource_type, resource_title=nil)
53 | options = {:ENV => {
54 | 'FACTER_url' => "https://vagrant:netapp123@#{host}"
55 | } }
56 | if resource_title
57 | on(master, puppet('resource', resource_type, resource_title, '--trace', options), { :acceptable_exit_codes => 0 }).stdout
58 | else
59 | on(master, puppet('resource', resource_type, '--trace', options), { :acceptable_exit_codes => 0 }).stdout
60 | end
61 | end
62 |
--------------------------------------------------------------------------------
/spec/support/shared_type_examples_spec.rb:
--------------------------------------------------------------------------------
1 | shared_examples "a puppet type" do |parameter_tests,res_type_name,res_name|
2 | res_type = Puppet::Type.type(res_type_name)
3 |
4 | let(:provider) {
5 | prov = stub 'provider'
6 | prov.stubs(:name).returns(res_type_name)
7 | prov
8 | }
9 | let(:type) {
10 | val = res_type
11 | val.stubs(:defaultprovider).returns provider
12 | val
13 | }
14 | let(:resource) {
15 | type.new({:name => res_name})
16 | }
17 |
18 | parameter_tests.each do |param, tests|
19 | describe "parameter #{param}" do
20 | it "should exist" do
21 | expect { resource[param] }.to_not raise_error
22 | end
23 |
24 | if tests.has_key?(:default) then
25 | it "should have a default of #{tests[:default]}" do
26 | resource[param].should == tests[:default]
27 | end
28 | else
29 | pending("should have a default")
30 | end
31 |
32 | if tests[:valid] then
33 | tests[:valid].each do |test_value|
34 | it "should allow a valid value, for example: #{test_value}" do
35 | expect { resource[param] = test_value }.to_not raise_error(Puppet::Error)
36 | resource[param].should == test_value
37 | end
38 | end
39 | else
40 | pending("should accept valid values")
41 | end
42 |
43 | if tests[:invalid] then
44 | tests[:invalid].each do |test_value|
45 | it "should throw an error for an invalid value, for example: #{test_value.inspect}" do
46 | expect { resource[param] = test_value }.to raise_error(Puppet::Error, /^Parameter #{param.to_s} failed/)
47 | end
48 | end
49 | else
50 | pending("should throw an error for invalid values")
51 | end
52 |
53 | if prop = res_type.propertybyname(param) then
54 | it "should have docs" do
55 | prop.doc.should_not == nil
56 | prop.doc.should_not == ""
57 | end
58 | end
59 | end
60 | end
61 | end
62 |
63 |
--------------------------------------------------------------------------------
/spec/unit/puppet/provider/cmode_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 | require 'yaml'
3 |
4 | describe Puppet::Type.type(:netapp_storage_array).provider(:cmode) do
5 |
6 | before :each do
7 | described_class.stubs(:suitable?).returns true
8 | Puppet::Type.type(:netapp_storage_array).stubs(:defaultprovider).returns described_class
9 | end
10 |
11 | let :netapp_storage_array do
12 | Puppet::Type.type(:netapp_storage_array).new(
13 | :name => 'storage1',
14 | :provider => provider
15 | )
16 | end
17 |
18 | let :provider do
19 | described_class.new(
20 | :name => 'storage1'
21 | )
22 | end
23 |
24 | describe "#instances" do
25 | it "should return an array of current storage arrays" do
26 | described_class.expects(:strgarrayshow).returns YAML.load_file(my_fixture('storage-array-list.yml'))
27 | instances = described_class.instances
28 | instances.size.should == 2
29 | instances.map do |prov|
30 | {
31 | :name => prov.get(:name),
32 | :max_queue_depth => prov.get(:max_queue_depth)
33 | }
34 | end.should == [
35 | {
36 | :name => 'storage_array_name1',
37 | :max_queue_depth => 100
38 | },
39 | {
40 | :name => 'storage_array_name2',
41 | :max_queue_depth => 100
42 | }
43 | ]
44 | end
45 | end
46 |
47 | describe "#prefetch" do
48 | it "exists" do
49 | described_class.expects(:strgarrayshow).returns YAML.load_file(my_fixture('storage-array-list.yml'))
50 | described_class.prefetch({})
51 | end
52 | end
53 |
54 | describe "when modifying a resource" do
55 | it "should be able to modify max queue depth of storage array" do
56 | netapp_storage_array.provider.set(:name => 'storage1',:max_queue_depth => '120')
57 | netapp_storage_array[:max_queue_depth] ='100'
58 | netapp_storage_array.provider.expects(:strgarraymdfy).with('array-name', 'storage1', 'max-queue-depth', 100)
59 | netapp_storage_array.provider.flush
60 | end
61 | end
62 | end
63 |
--------------------------------------------------------------------------------
/spec/unit/puppet/provider/netapp_cifs/cmode_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 | require 'yaml'
3 |
4 | describe Puppet::Type.type(:netapp_cifs).provider(:cmode) do
5 |
6 | before :each do
7 | described_class.stubs(:suitable?).returns true
8 | Puppet::Type.type(:netapp_cifs).stubs(:defaultprovider).returns described_class
9 | end
10 |
11 | let :cifs do
12 | Puppet::Type.type(:netapp_cifs).new(
13 | :name => 'cifs01',
14 | :ensure => 'present',
15 | :domain => 'domain.local',
16 | :admin_username => 'username',
17 | :admin_password => 'password',
18 | :provider => provider
19 | )
20 | end
21 |
22 | let :provider do
23 | described_class.new(
24 | :name => 'cifs01'
25 | )
26 | end
27 |
28 | describe "#instances" do
29 | it "should return an array of current cifs server" do
30 | described_class.expects(:cifslist).returns YAML.load_file(my_fixture('cifs-list.yml'))
31 | instances = described_class.instances
32 | instances.size.should == 2
33 | instances.map do |prov|
34 | {
35 | :name => prov.get(:name),
36 | :domain => prov.get(:domain),
37 | :ensure => prov.get(:ensure)
38 | }
39 | end.should == [
40 | {
41 | :name => 'cifs01',
42 | :domain => 'abc.local',
43 | :ensure => :present
44 | },
45 | {
46 | :name => 'cifs02',
47 | :domain => 'xyz.local',
48 | :ensure => :present
49 | }
50 | ]
51 | end
52 | end
53 |
54 | describe "#prefetch" do
55 | it "exists" do
56 | described_class.expects(:cifslist).returns YAML.load_file(my_fixture('cifs-list.yml'))
57 | described_class.prefetch({})
58 | end
59 | end
60 |
61 | describe "when asking exists?" do
62 | it "should return true if resource is present" do
63 | cifs.provider.set(:ensure => :present)
64 | cifs.provider.should be_exists
65 | end
66 |
67 | it "should return false if resource is absent" do
68 | cifs.provider.set(:ensure => :absent)
69 | cifs.provider.should_not be_exists
70 | end
71 | end
72 |
73 | describe "when creating a resource" do
74 | it "should be able to create a cifs server" do
75 | cifs.provider.expects(:cifscreate).with('cifs-server', 'cifs01', 'domain', 'domain.local', 'admin-username', 'username', 'admin-password', 'password')
76 | cifs.provider.create
77 | end
78 | end
79 |
80 | describe "when destroying a resource" do
81 | it "should be able to destroy a cifs server" do
82 | cifs.provider.expects(:cifsdelete).with('admin-username', 'username', 'admin-password', 'password')
83 | cifs.provider.destroy
84 | cifs.provider.flush
85 | end
86 | end
87 | end
88 |
--------------------------------------------------------------------------------
/spec/unit/puppet/provider/netapp_group/sevenmode_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby
2 |
3 | require 'spec_helper'
4 | require 'yaml'
5 | #require 'puppet/util/network_device/netapp/NaServer'
6 |
7 | describe Puppet::Type.type(:netapp_group).provider(:sevenmode) do
8 |
9 | before :each do
10 | described_class.stubs(:suitable?).returns true
11 | Puppet::Type.type(:netapp_group).stubs(:defaultprovider).returns described_class
12 | end
13 |
14 | let :group do
15 | Puppet::Type.type(:netapp_group).new(
16 | :groupname => 'group',
17 | :ensure => :present,
18 | :comment => 'test group',
19 | :roles => 'role1,role2',
20 | :provider => provider
21 | )
22 | end
23 |
24 | let :provider do
25 | described_class.new(
26 | :groupname => 'group'
27 | )
28 | end
29 |
30 | describe "#instances" do
31 | it "should return an array of current group entries" do
32 | described_class.expects(:glist).returns YAML.load_file(my_fixture('group-list.yml'))
33 | instances = described_class.instances
34 | instances.size.should == 1
35 | instances.map do |prov|
36 | {
37 | :groupname => prov.get(:groupname),
38 | :ensure => prov.get(:ensure),
39 | :comment => prov.get(:comment),
40 | :roles => prov.get(:roles)
41 | }
42 | end.should == [
43 | {
44 | :groupname => 'group',
45 | :ensure => :present,
46 | :comment => 'test group',
47 | :roles => 'role1,role2',
48 | }
49 | ]
50 | end
51 | end
52 |
53 | describe "#prefetch" do
54 | it "exists" do
55 | described_class.expects(:glist).returns YAML.load_file(my_fixture('group-list.yml'))
56 | described_class.prefetch({})
57 | end
58 | end
59 |
60 | describe "when asking exists?" do
61 | it "should return true if resource is present" do
62 | group.provider.set(:ensure => :present)
63 | group.provider.should be_exists
64 | end
65 |
66 | it "should return false if resource is absent" do
67 | group.provider.set(:ensure => :absent)
68 | group.provider.should_not be_exists
69 | end
70 | end
71 |
72 | describe "when creating a resource" do
73 | it "should be able to create a group" do
74 | group.provider.expects(:gadd).with('useradmin-group', is_a(NaElement))
75 | group.provider.create
76 | end
77 | end
78 |
79 | describe "when destroying a resource" do
80 | it "should be able to destroy a group" do
81 | # if we destroy a provider, we must have been present before so we must have values in @property_hash
82 | group.provider.set(:groupname => 'group')
83 | group.provider.expects(:gdel).with('group-name', 'group')
84 | group.provider.destroy
85 | group.provider.flush
86 | end
87 | end
88 |
89 | describe "when modifying a resource" do
90 | it "should be able to modify an existing group" do
91 | # Need to have a resource present that we can modify
92 | group.provider.set(:groupname => 'group', :ensure => :present, :roles => ['role1'])
93 | group.provider.expects(:gmodify).with('useradmin-group', is_a(NaElement))
94 | group.provider.flush
95 | end
96 | end
97 |
98 | end
99 |
--------------------------------------------------------------------------------
/spec/unit/puppet/provider/netapp_net_port/cmode_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 | require 'yaml'
3 |
4 | describe Puppet::Type.type(:netapp_net_port).provider(:cmode) do
5 |
6 | before :each do
7 | described_class.stubs(:suitable?).returns true
8 | Puppet::Type.type(:netapp_net_port).stubs(:defaultprovider).returns described_class
9 | end
10 |
11 | let :net_port do
12 | Puppet::Type.type(:netapp_net_port).new(
13 | :node_port_name => 'node@port',
14 | :provider => provider
15 | )
16 | end
17 |
18 | let :provider do
19 | described_class.new(
20 | :node_port_name => 'node@port'
21 | )
22 | end
23 |
24 | describe "#instances" do
25 | it "should return an array of current network ports" do
26 | described_class.expects(:netportlist).returns YAML.load_file(my_fixture('net-port-list.yml'))
27 | instances = described_class.instances
28 | instances.size.should == 2
29 | instances.map do |prov|
30 | {
31 | :name => prov.get(:name),
32 | :flowcontrol_admin => prov.get(:flowcontrol_admin)
33 | }
34 | end.should == [
35 | {
36 | :name => 'node_name1@port1',
37 | :flowcontrol_admin => "full"
38 | },
39 | {
40 | :name => 'node_name2@port2',
41 | :flowcontrol_admin => "full"
42 | }
43 | ]
44 | end
45 | end
46 |
47 | describe "#prefetch" do
48 | it "exists" do
49 | described_class.expects(:netportlist).returns YAML.load_file(my_fixture('net-port-list.yml'))
50 | described_class.prefetch({})
51 | end
52 | end
53 |
54 | describe "when modifying a resource" do
55 | it "should be able to modify the flowcontrol admin value of a port" do
56 | net_port.provider.set(:node_port_name => 'node@port', :flowcontrol_admin => 'full')
57 | net_port[:flowcontrol_admin] ='receive'
58 | net_port.provider.expects(:netportmdfy).with('node', 'node', 'port', 'port', 'administrative-flowcontrol', :receive)
59 | net_port.provider.flush
60 | end
61 | end
62 | end
63 |
--------------------------------------------------------------------------------
/spec/unit/puppet/provider/netapp_qtree/sevenmode_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby
2 |
3 | require 'spec_helper'
4 | require 'yaml'
5 | #require 'puppet/util/network_device/netapp/NaServer'
6 |
7 | describe Puppet::Type.type(:netapp_qtree).provider(:sevenmode) do
8 |
9 | before :each do
10 | described_class.stubs(:suitable?).returns true
11 | Puppet::Type.type(:netapp_qtree).stubs(:defaultprovider).returns described_class
12 | end
13 |
14 | let :volume_qtree do
15 | Puppet::Type.type(:netapp_qtree).new(
16 | :title => 'qtree',
17 | :ensure => :present,
18 | :volume => 'volume',
19 | :provider => provider
20 | )
21 | end
22 |
23 | let :provider do
24 | described_class.new(
25 | :title => 'qtree'
26 | )
27 | end
28 |
29 | describe "#instances" do
30 | it "should return an array of current qtree entries" do
31 | described_class.expects(:qlist).returns YAML.load_file(my_fixture('qtree-list.yml'))
32 | instances = described_class.instances
33 | instances.size.should == 1
34 | instances.map do |prov|
35 | {
36 | :title => prov.get(:name),
37 | :ensure => prov.get(:ensure),
38 | :volume => prov.get(:volume)
39 | }
40 | end.should == [
41 | {
42 | :title => 'qtree',
43 | :ensure => :present,
44 | :volume => 'volume'
45 | }
46 | ]
47 | end
48 | end
49 |
50 | describe "#prefetch" do
51 | it "exists" do
52 | described_class.expects(:qlist).returns YAML.load_file(my_fixture('qtree-list.yml'))
53 | described_class.prefetch({})
54 | end
55 | end
56 |
57 | describe "when asking exists?" do
58 | it "should return true if resource is present" do
59 | volume_qtree.provider.set(:ensure => :present)
60 | volume_qtree.provider.should be_exists
61 | end
62 |
63 | it "should return false if resource is absent" do
64 | volume_qtree.provider.set(:ensure => :absent)
65 | volume_qtree.provider.should_not be_exists
66 | end
67 | end
68 |
69 | describe "when creating a resource" do
70 | it "should be able to create a qtree" do
71 | volume_qtree.provider.expects(:qadd).with('qtree', 'qtree', 'volume', 'volume')
72 | volume_qtree.provider.create
73 | end
74 | end
75 |
76 | describe "when destroying a resource" do
77 | it "should be able to destroy a qtree" do
78 | # if we destroy a provider, we must have been present before so we must have values in @property_hash
79 | volume_qtree.provider.set(:title => 'qtree', :volume => 'volume')
80 | volume_qtree.provider.expects(:qdel).with('qtree', "/vol/volume/qtree")
81 | volume_qtree.provider.destroy
82 | volume_qtree.provider.flush
83 | end
84 | end
85 |
86 | end
87 |
--------------------------------------------------------------------------------
/spec/unit/puppet/provider/netapp_role/sevenmode_spec.rb:
--------------------------------------------------------------------------------
1 | #! /usr/bin/env ruby
2 |
3 | require 'spec_helper'
4 | require 'yaml'
5 | #require 'puppet/util/network_device/netapp/NaServer'
6 |
7 | describe Puppet::Type.type(:netapp_role).provider(:sevenmode) do
8 |
9 | before :each do
10 | described_class.stubs(:suitable?).returns true
11 | Puppet::Type.type(:netapp_role).stubs(:defaultprovider).returns described_class
12 | end
13 |
14 | let :role do
15 | Puppet::Type.type(:netapp_role).new(
16 | :rolename => 'role',
17 | :ensure => :present,
18 | :comment => 'test role',
19 | :capabilities => 'login-*,cli-*,api-*,security-*',
20 | :provider => provider
21 | )
22 | end
23 |
24 | let :provider do
25 | described_class.new(
26 | :rolename => 'role'
27 | )
28 | end
29 |
30 | describe "#instances" do
31 | it "should return an array of current role entries" do
32 | described_class.expects(:rlist).returns YAML.load_file(my_fixture('role-list.yml'))
33 | instances = described_class.instances
34 | instances.size.should == 1
35 | instances.map do |prov|
36 | {
37 | :rolename => prov.get(:rolename),
38 | :ensure => prov.get(:ensure),
39 | :comment => prov.get(:comment),
40 | :capabilities => prov.get(:capabilities)
41 | }
42 | end.should == [
43 | {
44 | :rolename => 'role',
45 | :ensure => :present,
46 | :comment => 'test role',
47 | :capabilities => 'login-*,cli-*,api-*,security-*',
48 | }
49 | ]
50 | end
51 | end
52 |
53 | describe "#prefetch" do
54 | it "exists" do
55 | described_class.expects(:rlist).returns YAML.load_file(my_fixture('role-list.yml'))
56 | described_class.prefetch({})
57 | end
58 | end
59 |
60 | describe "when asking exists?" do
61 | it "should return true if resource is present" do
62 | role.provider.set(:ensure => :present)
63 | role.provider.should be_exists
64 | end
65 |
66 | it "should return false if resource is absent" do
67 | role.provider.set(:ensure => :absent)
68 | role.provider.should_not be_exists
69 | end
70 | end
71 |
72 | describe "when creating a resource" do
73 | it "should be able to create a role" do
74 | role.provider.expects(:radd).with('useradmin-role', is_a(NaElement))
75 | role.provider.create
76 | end
77 | end
78 |
79 | describe "when destroying a resource" do
80 | it "should be able to destroy a role" do
81 | # if we destroy a provider, we must have been present before so we must have values in @property_hash
82 | role.provider.set(:rolename => 'role')
83 | role.provider.expects(:rdel).with('role-name', 'role')
84 | role.provider.destroy
85 | role.provider.flush
86 | end
87 | end
88 |
89 | describe "when modifying a resource" do
90 | it "should be able to modify an existing role" do
91 | # Need to have a resource present that we can modify
92 | role.provider.set(:rolename => 'role', :ensure => :present, :capabilities => ['login-*'])
93 | role.provider.expects(:rmodify).with('useradmin-role', is_a(NaElement))
94 | role.provider.flush
95 | end
96 | end
97 |
98 | end
99 |
--------------------------------------------------------------------------------
/spec/unit/puppet/provider/netapp_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 | require 'puppet/provider/netapp'
3 |
4 | describe Puppet::Provider::Netapp do
5 | let(:netapp_prov_obj) { described_class.new }
6 |
7 | let :result_success do
8 | n = NaElement.new("results")
9 | n.attr_set("status", "passed")
10 | n
11 | end
12 |
13 | let :result_failed do
14 | n = NaElement.new("results")
15 | n.attr_set("status", "failed")
16 | n.attr_set("reason", "Authorization failed")
17 | n.attr_set("errno", 13001)
18 | n
19 | end
20 |
21 | describe "transport method" do
22 | it "with uninitialized device and no url should return error" do
23 | expect { netapp_prov_obj.transport }.to(
24 | raise_error(Puppet::Error, /^Puppet::Util::NetworkDevice::Netapp: device not initialized/)
25 | )
26 | end
27 |
28 | it "with uninitialized device and a unresolvable url should return error" do
29 | # the NetApp Device expects a filer instead of a traditional url
30 | Facter.expects(:value).with(:url).twice.returns('filer.example.com')
31 | expect { netapp_prov_obj.transport }.to raise_error(ArgumentError)
32 | end
33 | end
34 |
35 | describe "netapp_commands" do
36 | let :provider do
37 | type = Puppet::Type.newtype(:netapp_dummy_type)
38 | provider = type.provide(:netapp_dummy_provider, :parent => described_class) do
39 | netapp_commands :qadd => 'qtree-create', :qdel => 'qtree-delete'
40 | def self.transport
41 | @transport ||= NaServer.new("test.example.com",1,12)
42 | end
43 | end
44 | end
45 |
46 | it "should create a class and an instance method" do
47 | provider.should respond_to(:qadd)
48 | provider.new.should respond_to(:qadd)
49 | end
50 |
51 | it "should execute the corresponding api call" do
52 | provider.transport.expects(:invoke).with("qtree-create").returns result_success
53 | provider.qadd.should == result_success
54 | end
55 |
56 | it "should pass all arguments to the api call" do
57 | provider.transport.expects(:invoke).with("qtree-create", 'qtree', 'q1', 'volume', 'vol1').returns result_success
58 | provider.qadd('qtree', 'q1', 'volume', 'vol1').should == result_success
59 | end
60 |
61 | it "should log the api call in debug mode" do
62 | provider.transport.expects(:invoke).with("qtree-create", 'qtree', 'q1').returns result_success
63 | provider.expects(:debug).with 'Executing api call qtree-create qtree q1'
64 | provider.qadd('qtree', 'q1').should == result_success
65 | end
66 |
67 | it "should raise an error if api call fails" do
68 | provider.transport.expects(:invoke).with("qtree-create", 'qtree', 'q1').returns result_failed
69 | expect { provider.qadd 'qtree', 'q1' }.to raise_error(Puppet::Error, 'Executing api call qtree-create qtree q1 failed: "Authorization failed"')
70 | end
71 | end
72 | end
73 |
--------------------------------------------------------------------------------
/spec/unit/puppet/provider/netapp_storage_failover/cmode_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 | require 'yaml'
3 |
4 | describe Puppet::Type.type(:netapp_storage_failover).provider(:cmode) do
5 |
6 | before :each do
7 | described_class.stubs(:suitable?).returns true
8 | Puppet::Type.type(:netapp_storage_failover).stubs(:defaultprovider).returns described_class
9 | end
10 |
11 | let :storage_array do
12 | Puppet::Type.type(:netapp_storage_failover).new(
13 | :name => 'nodeA',
14 | :provider => provider
15 | )
16 | end
17 |
18 | let :provider do
19 | described_class.new(
20 | :name => 'nodeA'
21 | )
22 | end
23 |
24 | describe "#instances" do
25 | it "should return an array of current cf objects" do
26 | described_class.expects(:strgfailovershow).returns YAML.load_file(my_fixture('storage-failover-list.yml'))
27 | instances = described_class.instances
28 | instances.size.should == 1
29 | instances.map do |prov|
30 | {
31 | :name => prov.get(:name),
32 | :auto_giveback => prov.get(:auto_giveback),
33 | :auto_giveback_after_panic => prov.get(:auto_giveback_after_panic),
34 | :auto_giveback_override_vetoes => prov.get(:auto_giveback_override_vetoes),
35 |
36 | }
37 | end.should == [
38 | {
39 | :name => 'nodeA',
40 | :auto_giveback => 'true',
41 | :auto_giveback_after_panic => 'true',
42 | :auto_giveback_override_vetoes => 'true'
43 | }
44 | ]
45 | end
46 | end
47 |
48 | describe "#prefetch" do
49 | it "exists" do
50 | described_class.expects(:strgfailovershow).returns YAML.load_file(my_fixture('storage-failover-list.yml'))
51 | described_class.prefetch({})
52 | end
53 | end
54 |
55 | describe "when modifying a resource" do
56 | it "should be able to modify auto_giveback option" do
57 | storage_array.provider.set(:name => 'nodeA', :auto_giveback => 'true')
58 | storage_array[:auto_giveback] = 'false'
59 | storage_array.provider.expects(:strgfailovermdfy).with(is_a(NaElement))
60 | storage_array.provider.flush
61 | end
62 |
63 | it "should be able to modify auto_giveback_after_panic option" do
64 | storage_array.provider.set(:name => 'nodeA', :auto_giveback_after_panic => 'true')
65 | storage_array[:auto_giveback_after_panic] = 'false'
66 | storage_array.provider.expects(:strgfailovermdfy).with(is_a(NaElement))
67 | storage_array.provider.flush
68 | end
69 |
70 | it "should be able to modify auto_giveback_override_vetoes option" do
71 | storage_array.provider.set(:name => 'nodeA', :auto_giveback_override_vetoes => 'true')
72 | storage_array[:auto_giveback_override_vetoes] = 'false'
73 | storage_array.provider.expects(:strgfailovermdfy).with(is_a(NaElement))
74 | storage_array.provider.flush
75 | end
76 | end
77 | end
78 |
--------------------------------------------------------------------------------
/spec/unit/puppet/provider/netapp_system_node_autosupport/cmode_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 | require 'yaml'
3 |
4 | describe Puppet::Type.type(:netapp_system_node_autosupport).provider(:cmode) do
5 |
6 | before :each do
7 | described_class.stubs(:suitable?).returns true
8 | Puppet::Type.type(:netapp_system_node_autosupport).stubs(:defaultprovider).returns described_class
9 | end
10 |
11 | let :system_node_autosupport do
12 | Puppet::Type.type(:netapp_system_node_autosupport).new(
13 | :name => 'nodeA',
14 | )
15 | end
16 |
17 | let :provider do
18 | described_class.new(
19 | :name => 'nodeA'
20 | )
21 | end
22 |
23 | describe "#instances" do
24 | it "should return an array of current autosupport-config objects" do
25 | described_class.expects(:autosupportcnfglist).returns YAML.load_file(my_fixture('system-node-autosupport-list.yml'))
26 | instances = described_class.instances
27 | instances.size.should == 2
28 | instances.map do |prov|
29 | {
30 | :name => prov.get(:name),
31 | :periodic_tx_window => prov.get(:periodic_tx_window),
32 | }
33 | end.should == [
34 | {
35 | :name => 'nodeA',
36 | :periodic_tx_window => '1h'
37 | },
38 | {
39 | :name => 'nodeB',
40 | :periodic_tx_window => '2h'
41 | }
42 | ]
43 | end
44 | end
45 |
46 | describe "#prefetch" do
47 | it "exists" do
48 | described_class.expects(:autosupportcnfglist).returns YAML.load_file(my_fixture('system-node-autosupport-list.yml'))
49 | described_class.prefetch({})
50 | end
51 | end
52 |
53 | describe "when modifying a resource" do
54 | it "should be able to modify periodic_tx_window" do
55 | system_node_autosupport.provider.set(:name => 'nodeA',:periodic_tx_window => '3h')
56 | system_node_autosupport[:periodic_tx_window] ='2h'
57 | system_node_autosupport.provider.expects(:autosupportcnfgmdfy).with('node-name', 'nodeA', 'periodic-tx-window', '2h')
58 | system_node_autosupport.provider.flush
59 | end
60 | end
61 | end
62 |
--------------------------------------------------------------------------------
/spec/unit/puppet/provider/netapp_vserver_cifs_domain_password_schedule/cmode_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 | require 'yaml'
3 |
4 | describe Puppet::Type.type(:netapp_vserver_cifs_domain_password_schedule).provider(:cmode) do
5 |
6 | before :each do
7 | described_class.stubs(:suitable?).returns true
8 | Puppet::Type.type(:netapp_vserver_cifs_domain_password_schedule).stubs(:defaultprovider).returns described_class
9 | end
10 |
11 | let :vserver_cifs_domain_password_schedule do
12 | Puppet::Type.type(:netapp_vserver_cifs_domain_password_schedule).new(
13 | :name => 'vserverA',
14 | :provider => provider
15 | )
16 | end
17 |
18 | let :provider do
19 | described_class.new(
20 | :name => 'vserverA'
21 | )
22 | end
23 |
24 | describe "#instances" do
25 | it "should return an array of current cifs-domain-password-schedule objects" do
26 | described_class.expects(:cifs_domain_password_schedulelist).returns YAML.load_file(my_fixture('vserver-cifs-domain-password-schedule-list.yml'))
27 | instances = described_class.instances
28 | instances.size.should == 2
29 | instances.map do |prov|
30 | {
31 | :name => prov.get(:name),
32 | :schedule_randomized_minute => prov.get(:schedule_randomized_minute)
33 | }
34 | end.should == [
35 | {
36 | :name => 'vserverA',
37 | :schedule_randomized_minute => '100'
38 | },
39 | {
40 | :name => 'vserverB',
41 | :schedule_randomized_minute => '150'
42 | }
43 | ]
44 | end
45 | end
46 |
47 | describe "#prefetch" do
48 | it "exists" do
49 | described_class.expects(:cifs_domain_password_schedulelist).returns YAML.load_file(my_fixture('vserver-cifs-domain-password-schedule-list.yml'))
50 | described_class.prefetch({})
51 | end
52 | end
53 |
54 | describe "when modifying a resource" do
55 | it "should be able to modify schedule randomized minute" do
56 | vserver_cifs_domain_password_schedule.provider.set(:name => 'vserverA',:schedule_randomized_minute=> '120')
57 | vserver_cifs_domain_password_schedule[:schedule_randomized_minute] ='100'
58 | vserver_cifs_domain_password_schedule.provider.expects(:cifs_domain_password_schedulemodify).with('schedule-randomized-minute', 100)
59 | vserver_cifs_domain_password_schedule.provider.flush
60 | end
61 | end
62 | end
63 |
--------------------------------------------------------------------------------
/spec/unit/puppet/provider/netapp_vserver_cifs_options/cmode_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 | require 'yaml'
3 |
4 | describe Puppet::Type.type(:netapp_vserver_cifs_options).provider(:cmode) do
5 |
6 | before :each do
7 | described_class.stubs(:suitable?).returns true
8 | Puppet::Type.type(:netapp_vserver_cifs_options).stubs(:defaultprovider).returns described_class
9 | end
10 |
11 | let :vserver_cifs_options do
12 | Puppet::Type.type(:netapp_vserver_cifs_options).new(
13 | :name => 'vserverA',
14 | :max_mpx => '10',
15 | :smb2_enabled => 'true'
16 | )
17 | end
18 |
19 | let :provider do
20 | described_class.new(
21 | :name => 'vserverA'
22 | )
23 | end
24 |
25 | describe "#instances" do
26 | it "should return an array of current cifs-options object" do
27 | described_class.expects(:vsrvcifsoptlist).returns YAML.load_file(my_fixture('cifs-options-list.yml'))
28 | instances = described_class.instances
29 | instances.size.should == 2
30 | instances.map do |prov|
31 | {
32 | :name => prov.get(:name),
33 | :max_mpx => prov.get(:max_mpx),
34 | :smb2_enabled => prov.get(:smb2_enabled)
35 | }
36 | end.should == [
37 | {
38 | :name => 'vserver1',
39 | :max_mpx => '10',
40 | :smb2_enabled => 'true'
41 | },
42 | {
43 | :name => 'vserver2',
44 | :max_mpx => '20',
45 | :smb2_enabled => 'false'
46 | }
47 | ]
48 | end
49 | end
50 |
51 | describe "#prefetch" do
52 | it "exists" do
53 | described_class.expects(:vsrvcifsoptlist).returns YAML.load_file(my_fixture('cifs-options-list.yml'))
54 | described_class.prefetch({})
55 | end
56 | end
57 |
58 | describe "when modifying a resource" do
59 | it "should be able to modify max_mpx" do
60 | vserver_cifs_options.provider.set(:name => 'vserverA', :max_mpx => '20', :smb2_enabled => 'true',)
61 | vserver_cifs_options[:max_mpx] = '10'
62 | vserver_cifs_options.provider.expects(:vsrvcifsoptmdfy).with('max-mpx', 10, 'is-smb2-enabled', :true)
63 | vserver_cifs_options.provider.flush
64 | end
65 |
66 | it "should be able to modify a smb2_enabled option" do
67 | vserver_cifs_options.provider.set(:name => 'vserverA', :max_mpx => '10', :smb2_enabled => 'false')
68 | vserver_cifs_options[:smb2_enabled] = 'true'
69 | vserver_cifs_options.provider.expects(:vsrvcifsoptmdfy).with('max-mpx', 10, 'is-smb2-enabled', :true)
70 | vserver_cifs_options.provider.flush
71 | end
72 | end
73 | end
74 |
--------------------------------------------------------------------------------
/spec/unit/puppet/type/netapp_cifs_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe Puppet::Type.type(:netapp_cifs) do
4 |
5 | before do
6 | @cifs_example = {
7 | :name => 'cifsA',
8 | :domain => 'abc.com',
9 | :admin_username => 'abc',
10 | :admin_password => 'xyz',
11 | :ensure => 'present'
12 | }
13 | described_class.provider(:cmode).new(@cifs_example)
14 | end
15 |
16 | let :cifs_resource do
17 | @cifs_example
18 | end
19 |
20 | it "should have :name be its namevar" do
21 | described_class.key_attributes.should == [:name]
22 | end
23 |
24 | describe "when validating attributes" do
25 | [:name].each do |param|
26 | it "should have a #{param} parameter" do
27 | described_class.attrtype(param).should == :param
28 | end
29 | end
30 |
31 | [:domain, :admin_username, :admin_password].each do |prop|
32 | it "should have a #{prop} property" do
33 | described_class.attrtype(prop).should == :property
34 | end
35 | end
36 | end
37 |
38 | describe "when validating values" do
39 | describe "for name" do
40 | it "should support a valid cifs server name" do
41 | described_class.new(:name => 'cifsA', :ensure => :present)[:name].should == 'cifsA'
42 | end
43 |
44 | it "should support underscores" do
45 | described_class.new(:name => 'cifs_A', :ensure => :present)[:name].should == 'cifs_A'
46 | end
47 |
48 | it "should support hyphens" do
49 | described_class.new(:name => 'cifs-A', :ensure => :present)[:name].should == 'cifs-A'
50 | end
51 |
52 | it "should support an alphanumerical name" do
53 | described_class.new(:name => 'cifs01', :ensure => :present)[:name].should == 'cifs01'
54 | end
55 |
56 | it "should not support spaces" do
57 | expect { described_class.new(:name => 'cifs A', :ensure => :present) }.to raise_error(Puppet::Error, /cifs A is an invalid cifs server name./)
58 | end
59 | end
60 | end
61 | end
62 |
--------------------------------------------------------------------------------
/spec/unit/puppet/type/netapp_storage_array_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe Puppet::Type.type(:netapp_storage_array) do
4 |
5 | before do
6 | @storage_array_example = {
7 | :name => 'VMware_Virtualdisk_1',
8 | :max_queue_depth => '256'
9 | }
10 | described_class.provider(:cmode).new(@storage_array_example)
11 | end
12 |
13 | let :storage_array_resource do
14 | @storage_array_example
15 | end
16 |
17 | it "should have :name be its namevar" do
18 | described_class.key_attributes.should == [:name]
19 | end
20 |
21 | describe "when validating attributes" do
22 | [:name].each do |param|
23 | it "should have a #{param} parameter" do
24 | described_class.attrtype(param).should == :param
25 | end
26 | end
27 |
28 | [:max_queue_depth].each do |prop|
29 | it "should have a #{prop} property" do
30 | described_class.attrtype(prop).should == :property
31 | end
32 | end
33 | end
34 |
35 | describe "when validating values" do
36 | describe "for name" do
37 | it "should support a valid storage array name" do
38 | described_class.new(:name => 'storage1')[:name].should == 'storage1'
39 | end
40 |
41 | it "should support underscores" do
42 | described_class.new(:name => 'storage_1')[:name].should == 'storage_1'
43 | end
44 |
45 | it "should not support hyphens" do
46 | expect { described_class.new(:name => 'storage-1') }.to raise_error(Puppet::Error, /storage-1 is an invalid storage array name./)
47 | end
48 |
49 | it "should not support spaces" do
50 | expect { described_class.new(:name => 'storage 1') }.to raise_error(Puppet::Error, /storage 1 is an invalid storage array name/)
51 | end
52 | end
53 |
54 | describe "for max queue depth" do
55 | it "should support 100" do
56 | described_class.new(:name => 'storage', :max_queue_depth => '100')[:max_queue_depth].should == 100
57 | end
58 |
59 | it "should not support a number greater than 2048" do
60 | expect { described_class.new(:name => 'storage', :max_queue_depth => '2049') }.to raise_error(Puppet::Error, /max-queue-depth must be between 8 and 2048./)
61 | end
62 |
63 | it "should not support a number less than 8" do
64 | expect { described_class.new(:name => 'storage', :max_queue_depth =>'7') }.to raise_error(Puppet::Error, /max-queue-depth must be between 8 and 2048./)
65 | end
66 |
67 | it "should not support a alphabet" do
68 | expect { described_class.new(:name => 'storage', :max_queue_depth => 'abc') }.to raise_error(Puppet::Error, /abc is not a valid max-queue-depth./)
69 | end
70 | end
71 | end
72 | end
73 |
--------------------------------------------------------------------------------
/spec/unit/puppet/type/netapp_system_node_autosupport_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe Puppet::Type.type(:netapp_system_node_autosupport) do
4 |
5 | before do
6 | @system_node_autosupport_example = {
7 | :name => 'nodeA',
8 | :periodic_tx_window => '3h'
9 | }
10 | described_class.provider(:cmode).new(@system_node_autosupport_example)
11 | end
12 |
13 | let :system_node_autosupport_resource do
14 | @system_node_autosupport_example
15 | end
16 |
17 | it "should have :name be its namevar" do
18 | described_class.key_attributes.should == [:name]
19 | end
20 |
21 | describe "when validating attributes" do
22 | [:name].each do |param|
23 | it "should have a #{param} parameter" do
24 | described_class.attrtype(param).should == :param
25 | end
26 | end
27 |
28 | [:periodic_tx_window].each do |prop|
29 | it "should have a #{prop} property" do
30 | described_class.attrtype(prop).should == :property
31 | end
32 | end
33 | end
34 |
35 | describe "when validating values" do
36 | describe "for name" do
37 | it "should support a valid node name" do
38 | described_class.new(:name => 'nodeA')[:name].should == 'nodeA'
39 | end
40 |
41 | it "should support underscores" do
42 | described_class.new(:name => 'node_A')[:name].should == 'node_A'
43 | end
44 |
45 | it "should support hyphens" do
46 | described_class.new(:name => 'node-A')[:name].should == 'node-A'
47 | end
48 |
49 | it "should support an alphanumerical node name" do
50 | described_class.new(:name => 'node01')[:name].should == 'node01'
51 | end
52 |
53 | it "should not support spaces" do
54 | expect { described_class.new(:name => 'node A') }.to raise_error(Puppet::Error, /node A is a invalid node name/)
55 | end
56 | end
57 | end
58 | end
59 |
--------------------------------------------------------------------------------
/spec/unit/puppet/type/netapp_vserver_cifs_domain_password_schedule_spec.rb:
--------------------------------------------------------------------------------
1 | require 'spec_helper'
2 |
3 | describe Puppet::Type.type(:netapp_vserver_cifs_domain_password_schedule) do
4 |
5 | before do
6 | @vserver_cifs_domain_password_schedule_example = {
7 | :name => 'vserverA',
8 | :schedule_randomized_minute => '100'
9 | }
10 | described_class.provider(:cmode).new(@vserver_cifs_domain_password_schedule_example)
11 | end
12 |
13 | let :vserver_cifs_domain_password_schedule_resource do
14 | @vserver_cifs_domain_password_schedule_example
15 | end
16 |
17 | it "should have :name be its namevar" do
18 | described_class.key_attributes.should == [:name]
19 | end
20 |
21 | describe "when validating attributes" do
22 | [:name].each do |param|
23 | it "should have a #{param} parameter" do
24 | described_class.attrtype(param).should == :param
25 | end
26 | end
27 |
28 | [:schedule_randomized_minute].each do |prop|
29 | it "should have a #{prop} property" do
30 | described_class.attrtype(prop).should == :property
31 | end
32 | end
33 | end
34 |
35 | describe "when validating values" do
36 | describe "for name" do
37 | it "should support a valid vserver name" do
38 | described_class.new(:name => 'vserverA')[:name].should == 'vserverA'
39 | end
40 |
41 | it "should support underscores" do
42 | described_class.new(:name => 'vserver_A')[:name].should == 'vserver_A'
43 | end
44 |
45 | it "should support hyphens" do
46 | described_class.new(:name => 'vserver-A')[:name].should == 'vserver-A'
47 | end
48 |
49 | it "should support an alphanumerical name" do
50 | described_class.new(:name => 'vserver01')[:name].should == 'vserver01'
51 | end
52 |
53 | it "should not support spaces" do
54 | expect { described_class.new(:name => 'vserver A') }.to raise_error(Puppet::Error, /A Vserver name can only contain alphanumeric characters and ".", "-" or "_"/)
55 | end
56 | end
57 |
58 | describe "for schedule_randomized_minute" do
59 | it "should support 100" do
60 | described_class.new(:name => 'vserverA', :schedule_randomized_minute => '100')[:schedule_randomized_minute].should == 100
61 | end
62 |
63 | it "should not support a number greater than 180" do
64 | expect { described_class.new(:name => 'vserverA', :schedule_randomized_minute => '181') }.to raise_error(Puppet::Error, /Schedule randomized minute value must be in between 1 and 180./)
65 | end
66 |
67 | it "should not support a number less than 1" do
68 | expect { described_class.new(:name => 'vserverA', :schedule_randomized_minute =>'0') }.to raise_error(Puppet::Error, /Schedule randomized minute value must be in between 1 and 180./)
69 | end
70 |
71 | it "should not support a alphabet" do
72 | expect { described_class.new(:name => 'vserverA', :schedule_randomized_minute => 'abc') }.to raise_error(Puppet::Error, /abc is not a valid schedule randomized minute./)
73 | end
74 | end
75 | end
76 | end
77 |
--------------------------------------------------------------------------------