puppetmodule-netdev_stdlib 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (66) hide show
  1. data/.gitignore +27 -0
  2. data/.travis.yml +9 -0
  3. data/Gemfile +4 -0
  4. data/Guardfile +15 -0
  5. data/LICENSE +202 -0
  6. data/Modulefile +9 -0
  7. data/README.md +330 -0
  8. data/Rakefile +1 -0
  9. data/lib/netdev_stdlib.rb +4 -0
  10. data/lib/netdev_stdlib/version.rb +3 -0
  11. data/lib/puppet/type/domain_name.rb +17 -0
  12. data/lib/puppet/type/name_server.rb +17 -0
  13. data/lib/puppet/type/network_interface.rb +60 -0
  14. data/lib/puppet/type/network_trunk.rb +83 -0
  15. data/lib/puppet/type/network_vlan.rb +53 -0
  16. data/lib/puppet/type/ntp_config.rb +25 -0
  17. data/lib/puppet/type/ntp_server.rb +20 -0
  18. data/lib/puppet/type/port_channel.rb +82 -0
  19. data/lib/puppet/type/radius.rb +20 -0
  20. data/lib/puppet/type/radius_global.rb +40 -0
  21. data/lib/puppet/type/radius_server.rb +95 -0
  22. data/lib/puppet/type/radius_server_group.rb +25 -0
  23. data/lib/puppet/type/search_domain.rb +17 -0
  24. data/lib/puppet/type/snmp_community.rb +29 -0
  25. data/lib/puppet/type/snmp_contact.rb +17 -0
  26. data/lib/puppet/type/snmp_location.rb +17 -0
  27. data/lib/puppet/type/snmp_notification.rb +20 -0
  28. data/lib/puppet/type/snmp_notification_receiver.rb +77 -0
  29. data/lib/puppet/type/snmp_protocol.rb +20 -0
  30. data/lib/puppet/type/snmp_user.rb +77 -0
  31. data/lib/puppet/type/syslog_server.rb +42 -0
  32. data/lib/puppet/type/syslog_settings.rb +25 -0
  33. data/lib/puppet/type/tacacs.rb +20 -0
  34. data/lib/puppet/type/tacacs_global.rb +40 -0
  35. data/lib/puppet/type/tacacs_server.rb +50 -0
  36. data/lib/puppet/type/tacacs_server_group.rb +25 -0
  37. data/netdev_stdlib.gemspec +36 -0
  38. data/spec/spec_helper.rb +15 -0
  39. data/spec/support/shared_examples_for_types.rb +412 -0
  40. data/spec/unit/puppet/type/domain_name_spec.rb +8 -0
  41. data/spec/unit/puppet/type/name_server_spec.rb +8 -0
  42. data/spec/unit/puppet/type/network_interface_spec.rb +44 -0
  43. data/spec/unit/puppet/type/network_trunk_spec.rb +55 -0
  44. data/spec/unit/puppet/type/network_vlan_spec.rb +57 -0
  45. data/spec/unit/puppet/type/ntp_config_spec.rb +8 -0
  46. data/spec/unit/puppet/type/ntp_server_spec.rb +8 -0
  47. data/spec/unit/puppet/type/port_channel_spec.rb +87 -0
  48. data/spec/unit/puppet/type/radius_global_spec.rb +27 -0
  49. data/spec/unit/puppet/type/radius_server_group_spec.rb +12 -0
  50. data/spec/unit/puppet/type/radius_server_spec.rb +51 -0
  51. data/spec/unit/puppet/type/radius_spec.rb +8 -0
  52. data/spec/unit/puppet/type/search_domain_spec.rb +8 -0
  53. data/spec/unit/puppet/type/snmp_community_spec.rb +27 -0
  54. data/spec/unit/puppet/type/snmp_contact_spec.rb +8 -0
  55. data/spec/unit/puppet/type/snmp_location_spec.rb +8 -0
  56. data/spec/unit/puppet/type/snmp_notification_receiver_spec.rb +50 -0
  57. data/spec/unit/puppet/type/snmp_notification_spec.rb +8 -0
  58. data/spec/unit/puppet/type/snmp_protocol_spec.rb +8 -0
  59. data/spec/unit/puppet/type/snmp_user_spec.rb +63 -0
  60. data/spec/unit/puppet/type/syslog_server_spec.rb +20 -0
  61. data/spec/unit/puppet/type/syslog_settings_spec.rb +19 -0
  62. data/spec/unit/puppet/type/tacacs_global_spec.rb +27 -0
  63. data/spec/unit/puppet/type/tacacs_server_group_spec.rb +12 -0
  64. data/spec/unit/puppet/type/tacacs_server_spec.rb +25 -0
  65. data/spec/unit/puppet/type/tacacs_spec.rb +8 -0
  66. metadata +338 -0
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Type.type(:domain_name) do
6
+ it_behaves_like 'name is the namevar'
7
+ it_behaves_like 'an ensurable type'
8
+ end
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Type.type(:name_server) do
6
+ it_behaves_like 'name is the namevar'
7
+ it_behaves_like 'an ensurable type'
8
+ end
@@ -0,0 +1,44 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Type.type(:network_interface) do
6
+ let(:catalog) { Puppet::Resource::Catalog.new }
7
+ let(:type) do
8
+ described_class.new(name: 'Ethernet1', catalog: catalog)
9
+ end
10
+
11
+ subject { described_class.attrclass(attribute) }
12
+
13
+ it_behaves_like 'name is the namevar'
14
+ it_behaves_like 'enabled type'
15
+
16
+ describe 'description' do
17
+ let(:attribute) { :description }
18
+
19
+ include_examples 'description property'
20
+ end
21
+
22
+ describe 'mtu (e.g. 1500 | 9000)' do
23
+ let(:attribute) { :mtu }
24
+
25
+ include_examples 'property'
26
+ include_examples '#doc Documentation'
27
+ include_examples 'numeric parameter', min: 1, max: 65_536
28
+ include_examples 'rejected parameter values'
29
+ end
30
+
31
+ describe 'speed (auto*|10m|100m|1g|10g|40g|56g|100g)' do
32
+ let(:attribute) { :speed }
33
+
34
+ include_examples '#doc Documentation'
35
+ include_examples 'speed property'
36
+ end
37
+
38
+ describe 'duplex (auto | full | half)' do
39
+ let(:attribute) { :duplex }
40
+
41
+ include_examples '#doc Documentation'
42
+ include_examples 'duplex property'
43
+ end
44
+ end
@@ -0,0 +1,55 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Type.type(:network_trunk) do
6
+ it_behaves_like 'an ensurable type'
7
+ it_behaves_like 'name is the namevar'
8
+
9
+ let(:catalog) { Puppet::Resource::Catalog.new }
10
+ let(:type) { described_class.new(name: 'emanon', catalog: catalog) }
11
+
12
+ describe 'encapsulation' do
13
+ let(:attribute) { :encapsulation }
14
+ subject { described_class.attrclass(attribute) }
15
+
16
+ include_examples '#doc Documentation'
17
+ include_examples 'rejected parameter values'
18
+ include_examples 'accepts values', %w(dot1q isl negotiate none)
19
+ include_examples 'rejected parameter values'
20
+ end
21
+
22
+ describe 'mode' do
23
+ let(:attribute) { :mode }
24
+ subject { described_class.attrclass(attribute) }
25
+
26
+ include_examples '#doc Documentation'
27
+ values = %w(access trunk dynamic_auto dynamic_desirable)
28
+ include_examples 'accepts values', values
29
+ include_examples 'rejected parameter values'
30
+ end
31
+
32
+ describe 'untagged_vlan' do
33
+ let(:attribute) { :untagged_vlan }
34
+ subject { described_class.attrclass(attribute) }
35
+
36
+ include_examples '#doc Documentation'
37
+ include_examples 'vlan id value'
38
+ end
39
+
40
+ describe 'tagged_vlans' do
41
+ let(:attribute) { :tagged_vlans }
42
+ subject { described_class.attrclass(attribute) }
43
+
44
+ include_examples '#doc Documentation'
45
+ include_examples 'vlan range value'
46
+ end
47
+
48
+ describe 'pruned_vlans' do
49
+ let(:attribute) { :pruned_vlans }
50
+ subject { described_class.attrclass(attribute) }
51
+
52
+ include_examples '#doc Documentation'
53
+ include_examples 'vlan range value'
54
+ end
55
+ end
@@ -0,0 +1,57 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Type.type(:network_vlan) do
6
+ let(:catalog) { Puppet::Resource::Catalog.new }
7
+ let(:type) { described_class.new(name: '100', catalog: catalog) }
8
+
9
+ it_behaves_like 'an ensurable type', name: '100'
10
+
11
+ describe 'vlan_name' do
12
+ let(:attribute) { :vlan_name }
13
+ subject { described_class.attrclass(attribute) }
14
+
15
+ include_examples 'property'
16
+ include_examples '#doc Documentation'
17
+ include_examples 'accepts values without munging', %w(Engineering)
18
+ include_examples 'rejects values', [[1], { two: :three }]
19
+ end
20
+
21
+ describe 'description' do
22
+ let(:attribute) { :description }
23
+ subject { described_class.attrclass(attribute) }
24
+
25
+ include_examples 'property'
26
+ include_examples '#doc Documentation'
27
+ include_examples 'description property'
28
+ include_examples 'accepts values without munging', 'Engineering VLAN'
29
+ include_examples 'rejects values', [0, [1], { two: :three }]
30
+ end
31
+
32
+ describe 'id' do
33
+ let(:attribute) { :id }
34
+ subject { described_class.attrclass(attribute) }
35
+
36
+ include_examples 'parameter'
37
+ include_examples '#doc Documentation'
38
+ include_examples 'rejects values', [{ two: :three }, 'abc']
39
+
40
+ [100, '100'].each do |val|
41
+ it "validates #{val.inspect} as isomorphic to '100'" do
42
+ type[attribute] = val
43
+ expect(type[attribute]).to eq(val.to_s)
44
+ end
45
+ end
46
+ end
47
+
48
+ describe 'shutdown' do
49
+ let(:attribute) { :shutdown }
50
+ subject { described_class.attrclass(attribute) }
51
+
52
+ include_examples 'property'
53
+ include_examples '#doc Documentation'
54
+ include_examples 'boolean value'
55
+ include_examples 'rejects values', [0, [1], { two: :three }]
56
+ end
57
+ end
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Type.type(:ntp_config) do
6
+ it_behaves_like 'name is the namevar'
7
+ it_behaves_like 'string', attribute: :source_interface
8
+ end
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Type.type(:ntp_server) do
6
+ it_behaves_like 'name is the namevar'
7
+ it_behaves_like 'boolean', attribute: :prefer
8
+ end
@@ -0,0 +1,87 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Type.type(:port_channel) do
6
+ it_behaves_like 'an ensurable type'
7
+ it_behaves_like 'name is the namevar'
8
+
9
+ let(:catalog) { Puppet::Resource::Catalog.new }
10
+ let(:type) { described_class.new(name: 'emanon', catalog: catalog) }
11
+
12
+ subject { described_class.attrclass(attribute) }
13
+
14
+ describe 'force' do
15
+ let(:attribute) { :force }
16
+
17
+ include_examples '#doc Documentation'
18
+ include_examples 'boolean parameter'
19
+ end
20
+
21
+ describe 'id' do
22
+ let(:attribute) { :id }
23
+
24
+ include_examples '#doc Documentation'
25
+ include_examples 'rejected parameter values'
26
+ include_examples 'numeric parameter', min: 0, max: 4095
27
+ end
28
+
29
+ describe 'description' do
30
+ let(:attribute) { :description }
31
+
32
+ include_examples '#doc Documentation'
33
+ include_examples 'description property'
34
+ end
35
+
36
+ describe 'mode' do
37
+ let(:attribute) { :mode }
38
+
39
+ include_examples '#doc Documentation'
40
+ include_examples 'rejected parameter values'
41
+ include_examples 'accepts values', %w(active passive disabled)
42
+ include_examples 'rejects values', %w(foo bar baz)
43
+ end
44
+
45
+ describe 'minimum_links' do
46
+ let(:attribute) { :minimum_links }
47
+
48
+ include_examples '#doc Documentation'
49
+ include_examples 'rejected parameter values'
50
+ include_examples 'numeric parameter', min: 0, max: 4095
51
+ end
52
+
53
+ describe 'interfaces' do
54
+ let(:attribute) { :interfaces }
55
+
56
+ include_examples '#doc Documentation'
57
+ include_examples 'interface list value'
58
+ end
59
+
60
+ describe 'speed' do
61
+ let(:attribute) { :speed }
62
+
63
+ include_examples '#doc Documentation'
64
+ include_examples 'speed property'
65
+ end
66
+
67
+ describe 'duplex' do
68
+ let(:attribute) { :duplex }
69
+
70
+ include_examples '#doc Documentation'
71
+ include_examples 'duplex property'
72
+ end
73
+
74
+ describe 'flowcontrol_send' do
75
+ let(:attribute) { :flowcontrol_send }
76
+
77
+ include_examples '#doc Documentation'
78
+ include_examples 'flowcontrol property'
79
+ end
80
+
81
+ describe 'flowcontrol_receive' do
82
+ let(:attribute) { :flowcontrol_receive }
83
+
84
+ include_examples '#doc Documentation'
85
+ include_examples 'flowcontrol property'
86
+ end
87
+ end
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Type.type(:radius_global) do
6
+ let(:catalog) { Puppet::Resource::Catalog.new }
7
+ let(:type) { described_class.new(name: 'emanon', catalog: catalog) }
8
+ subject { described_class.attrclass(attribute) }
9
+
10
+ it_behaves_like 'name is the namevar'
11
+ it_behaves_like 'it has a string property', :key
12
+
13
+ describe 'key_format' do
14
+ let(:attribute) { :key_format }
15
+ include_examples 'numeric parameter', min: 0, max: 7
16
+ end
17
+
18
+ describe 'timeout' do
19
+ let(:attribute) { :timeout }
20
+ include_examples 'numeric parameter', min: 0, max: 604_800
21
+ end
22
+
23
+ describe 'retransmit_count' do
24
+ let(:attribute) { :retransmit_count }
25
+ include_examples 'numeric parameter', min: 0, max: 2048
26
+ end
27
+ end
@@ -0,0 +1,12 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Type.type(:radius_server_group) do
6
+ let(:catalog) { Puppet::Resource::Catalog.new }
7
+ let(:type) { described_class.new(name: 'emanon', catalog: catalog) }
8
+ subject { described_class.attrclass(attribute) }
9
+
10
+ it_behaves_like 'name is the namevar'
11
+ it_behaves_like 'array of strings property', attribute: :servers
12
+ end
@@ -0,0 +1,51 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Type.type(:radius_server) do
6
+ let(:catalog) { Puppet::Resource::Catalog.new }
7
+ let(:type) { described_class.new(name: 'emanon', catalog: catalog) }
8
+ subject { described_class.attrclass(attribute) }
9
+
10
+ it_behaves_like 'name is the namevar'
11
+ it_behaves_like 'it has a string property', :key
12
+
13
+ describe 'key_format' do
14
+ let(:attribute) { :key_format }
15
+ include_examples 'numeric parameter', min: 0, max: 7
16
+ end
17
+
18
+ it_behaves_like 'it has a string property', :group
19
+
20
+ describe 'deadtime' do
21
+ let(:attribute) { :deadtime }
22
+ include_examples 'numeric parameter', min: 0, max: 10_080
23
+ end
24
+
25
+ describe 'timeout' do
26
+ let(:attribute) { :timeout }
27
+ include_examples 'numeric parameter', min: 0, max: 604_800
28
+ end
29
+
30
+ it_behaves_like 'it has a string property', :vrf
31
+ it_behaves_like 'it has a string property', :source_interface
32
+
33
+ describe 'retransmit_count' do
34
+ let(:attribute) { :retransmit_count }
35
+ include_examples 'numeric parameter', min: 0, max: 2048
36
+ end
37
+
38
+ describe 'acct_port' do
39
+ let(:attribute) { :acct_port }
40
+ include_examples 'numeric parameter', min: 0, max: 65_535
41
+ end
42
+
43
+ it_behaves_like 'boolean', attribute: :accounting_only
44
+
45
+ describe 'auth_port' do
46
+ let(:attribute) { :auth_port }
47
+ include_examples 'numeric parameter', min: 0, max: 65_535
48
+ end
49
+
50
+ it_behaves_like 'boolean', attribute: :authentication_only
51
+ end
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Type.type(:radius) do
6
+ it_behaves_like 'enabled type'
7
+ it_behaves_like 'name is the namevar'
8
+ end
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Type.type(:search_domain) do
6
+ it_behaves_like 'name is the namevar'
7
+ it_behaves_like 'an ensurable type'
8
+ end
@@ -0,0 +1,27 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Type.type(:snmp_community) do
6
+ let(:catalog) { Puppet::Resource::Catalog.new }
7
+ let(:type) { described_class.new(name: 'emanon', catalog: catalog) }
8
+
9
+ subject { described_class.attrclass(attribute) }
10
+
11
+ it_behaves_like 'name is the namevar'
12
+
13
+ describe 'group' do
14
+ let(:attribute) { :group }
15
+ include_examples 'property'
16
+ include_examples '#doc Documentation'
17
+ include_examples 'accepts values', %w(ro rw)
18
+ include_examples 'rejects values', %w(foo bar baz)
19
+ end
20
+
21
+ describe 'acl' do
22
+ let(:attribute) { :acl }
23
+ include_examples '#doc Documentation'
24
+ include_examples 'property'
25
+ include_examples 'string value'
26
+ end
27
+ end
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Type.type(:snmp_contact) do
6
+ it_behaves_like 'an ensurable type'
7
+ it_behaves_like 'name is the namevar'
8
+ end
@@ -0,0 +1,8 @@
1
+ # encoding: utf-8
2
+
3
+ require 'spec_helper'
4
+
5
+ describe Puppet::Type.type(:snmp_location) do
6
+ it_behaves_like 'an ensurable type'
7
+ it_behaves_like 'name is the namevar'
8
+ end