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,25 @@
1
+ # encoding: utf-8
2
+
3
+ Puppet::Type.newtype(:radius_server_group) do
4
+ @doc = 'Configure a radius server group'
5
+
6
+ newparam(:name, namevar: true) do
7
+ desc 'The name of the radius server group'
8
+
9
+ validate do |value|
10
+ if value.is_a? String then super(value)
11
+ else fail "value #{value.inspect} is invalid, must be a String."
12
+ end
13
+ end
14
+ end
15
+
16
+ newproperty(:servers, array_matching: :all) do
17
+ desc 'Array of servers associated with this group'
18
+
19
+ validate do |value|
20
+ if value.is_a? String then super(value)
21
+ else fail "value #{value.inspect} is invalid, must be a String."
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+
3
+ Puppet::Type.newtype(:search_domain) do
4
+ @doc = 'Configure the resolver to use the specified search domain'
5
+
6
+ ensurable
7
+
8
+ newparam(:name, namevar: true) do
9
+ desc 'The search domain to configure in the resolver'
10
+
11
+ validate do |value|
12
+ if value.is_a? String then super(value)
13
+ else fail "value #{value.inspect} is invalid, must be a String."
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,29 @@
1
+ # encoding: utf-8
2
+
3
+ Puppet::Type.newtype(:snmp_community) do
4
+ @doc = 'Manage the SNMP community'
5
+
6
+ newparam(:name, namevar: true) do
7
+ desc 'The name of the community, e.g. "public" or "private"'
8
+
9
+ validate do |value|
10
+ if value.is_a? String then super(value)
11
+ else fail "value #{value.inspect} is invalid, must be a String."
12
+ end
13
+ end
14
+ end
15
+
16
+ newproperty(:group) do
17
+ desc 'The SNMP group for this community [rw|ro]'
18
+ newvalues(:rw, :ro)
19
+ end
20
+
21
+ newproperty(:acl) do
22
+ desc 'The ACL name to associate with this community string'
23
+ validate do |value|
24
+ if value.is_a? String then super(value)
25
+ else fail "value #{value.inspect} is invalid, must be a String."
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+
3
+ Puppet::Type.newtype(:snmp_contact) do
4
+ @doc = 'Set the SNMP contact name'
5
+
6
+ ensurable
7
+
8
+ newparam(:name, namevar: true) do
9
+ desc 'The name of the SNMP contact'
10
+
11
+ validate do |value|
12
+ if value.is_a? String then super(value)
13
+ else fail "value #{value.inspect} is invalid, must be a String."
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # encoding: utf-8
2
+
3
+ Puppet::Type.newtype(:snmp_location) do
4
+ @doc = 'Set the SNMP location string'
5
+
6
+ ensurable
7
+
8
+ newparam(:name, namevar: true) do
9
+ desc 'The name of the device location'
10
+
11
+ validate do |value|
12
+ if value.is_a? String then super(value)
13
+ else fail "value #{value.inspect} is invalid, must be a String."
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+
3
+ Puppet::Type.newtype(:snmp_notification) do
4
+ @doc = 'Enable or disable notification groups and events'
5
+
6
+ newparam(:name, namevar: true) do
7
+ desc 'The notification name or "all" for all notifications'
8
+
9
+ validate do |value|
10
+ if value.is_a? String then super(value)
11
+ else fail "value #{value.inspect} is invalid, must be a String."
12
+ end
13
+ end
14
+ end
15
+
16
+ newproperty(:enable) do
17
+ desc 'Enable or disable the notification [true|false]'
18
+ newvalues(:true, :false)
19
+ end
20
+ end
@@ -0,0 +1,77 @@
1
+ # encoding: utf-8
2
+
3
+ Puppet::Type.newtype(:snmp_notification_receiver) do
4
+ @doc = 'Manage an SNMP notification receiver'
5
+
6
+ ensurable
7
+
8
+ newparam(:name, namevar: true) do
9
+ desc 'Hostname or IP address of the receiver'
10
+
11
+ validate do |value|
12
+ if value.is_a? String then super(value)
13
+ else fail "value #{value.inspect} is invalid, must be a String."
14
+ end
15
+ end
16
+ end
17
+
18
+ newproperty(:type) do
19
+ desc 'The type of receiver [traps|informs]'
20
+ newvalues(:traps, :informs)
21
+ end
22
+
23
+ newproperty(:version) do
24
+ desc 'SNMP version [v1|v2|v3]'
25
+ newvalues(:v1, :v2, :v3)
26
+ end
27
+
28
+ newproperty(:username) do
29
+ desc 'Username to use for SNMPv3 privacy and authentication'
30
+
31
+ validate do |value|
32
+ if value.is_a? String then super(value)
33
+ else fail "value #{value.inspect} is invalid, must be a String."
34
+ end
35
+ end
36
+ end
37
+
38
+ newproperty(:security) do
39
+ desc 'SNMPv3 security mode'
40
+ newvalues(:auth, :noauth, :priv)
41
+ end
42
+
43
+ newproperty(:port) do
44
+ desc 'SNMP UDP port number'
45
+ munge { |v| Integer(v) }
46
+ end
47
+
48
+ newproperty(:community) do
49
+ desc 'SNMPv1 and v2 community string'
50
+
51
+ validate do |value|
52
+ if value.is_a? String then super(value)
53
+ else fail "value #{value.inspect} is invalid, must be a String."
54
+ end
55
+ end
56
+ end
57
+
58
+ newproperty(:vrf) do
59
+ desc 'Interface to send SNMP data from, e.g. "management"'
60
+
61
+ validate do |value|
62
+ if value.is_a? String then super(value)
63
+ else fail "value #{value.inspect} is invalid, must be a String."
64
+ end
65
+ end
66
+ end
67
+
68
+ newproperty(:source_interface) do
69
+ desc 'Source interface to send SNMP data from, e.g. "ethernet 2/1"'
70
+
71
+ validate do |value|
72
+ if value.is_a? String then super(value)
73
+ else fail "value #{value.inspect} is invalid, must be a String."
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+
3
+ Puppet::Type.newtype(:snmp_protocol) do
4
+ @doc = 'Enable or disable the SNMP protocol'
5
+
6
+ newparam(:name, namevar: true) do
7
+ desc 'Resource name, not used to manage the device'
8
+
9
+ validate do |value|
10
+ if value.is_a? String then super(value)
11
+ else fail "value #{value.inspect} is invalid, must be a String."
12
+ end
13
+ end
14
+ end
15
+
16
+ newproperty(:enable) do
17
+ desc 'Enable or disable the SNMP protocol [true|false]'
18
+ newvalues(:true, :false)
19
+ end
20
+ end
@@ -0,0 +1,77 @@
1
+ # encoding: utf-8
2
+
3
+ Puppet::Type.newtype(:snmp_user) do
4
+ @doc = 'Set the SNMP contact name'
5
+
6
+ ensurable
7
+
8
+ newparam(:name, namevar: true) do
9
+ desc 'The name of the SNMP user'
10
+
11
+ validate do |value|
12
+ if value.is_a? String then super(value)
13
+ else fail "value #{value.inspect} is invalid, must be a String."
14
+ end
15
+ end
16
+ end
17
+
18
+ newproperty(:roles, array_matching: :all) do
19
+ desc 'A list of roles associated with this SNMP user'
20
+
21
+ validate do |value|
22
+ if value.is_a? String then super(value)
23
+ else fail "value #{value.inspect} is invalid, must be a String."
24
+ end
25
+ end
26
+ end
27
+
28
+ newproperty(:auth) do
29
+ desc 'Authentication mode [md5|sha]'
30
+ newvalues(:md5, :sha)
31
+ end
32
+
33
+ newproperty(:password) do
34
+ desc 'Cleartext password for the user'
35
+
36
+ validate do |value|
37
+ if value.is_a? String then super(value)
38
+ else fail "value #{value.inspect} is invalid, must be a String."
39
+ end
40
+ end
41
+ end
42
+
43
+ newproperty(:privacy) do
44
+ desc 'Privacy encryption method [aes128|des]'
45
+ newvalues(:aes128, :des)
46
+ end
47
+
48
+ newproperty(:private_key) do
49
+ desc 'Private key in hexadecimal string'
50
+
51
+ validate do |value|
52
+ if value.is_a? String then super(value)
53
+ else fail "value #{value.inspect} is invalid, must be a String."
54
+ end
55
+ end
56
+ end
57
+
58
+ newparam(:localized_key) do
59
+ desc 'If true, password needs to be a hexadecimal value'
60
+ newvalues(:true, :false)
61
+ end
62
+
63
+ newparam(:enforce_privacy) do
64
+ desc 'If true, message encryption is enforced'
65
+ newvalues(:true, :false)
66
+ end
67
+
68
+ newproperty(:engine_id) do
69
+ desc 'Necessary if the SNMP engine is encrypting data'
70
+
71
+ validate do |value|
72
+ if value.is_a? String then super(value)
73
+ else fail "value #{value.inspect} is invalid, must be a String."
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,42 @@
1
+ # encoding: utf-8
2
+
3
+ Puppet::Type.newtype(:syslog_server) do
4
+ @doc = 'Configure a remote syslog server for logging'
5
+
6
+ ensurable
7
+
8
+ newparam(:name, namevar: true) do
9
+ desc 'The hostname or address of the NTP server'
10
+
11
+ validate do |value|
12
+ if value.is_a? String then super(value)
13
+ else fail "value #{value.inspect} is invalid, must be a String."
14
+ end
15
+ end
16
+ end
17
+
18
+ newproperty(:severity_level) do
19
+ desc 'Syslog severity level to log'
20
+ munge { |v| Integer(v) }
21
+ end
22
+
23
+ newproperty(:vrf) do
24
+ desc 'Interface to send syslog data from, e.g. "management"'
25
+
26
+ validate do |value|
27
+ if value.is_a? String then super(value)
28
+ else fail "value #{value.inspect} is invalid, must be a String."
29
+ end
30
+ end
31
+ end
32
+
33
+ newproperty(:source_interface) do
34
+ desc 'Source interface to send syslog data from, e.g. "ethernet 2/1"'
35
+
36
+ validate do |value|
37
+ if value.is_a? String then super(value)
38
+ else fail "value #{value.inspect} is invalid, must be a String."
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,25 @@
1
+ # encoding: utf-8
2
+
3
+ Puppet::Type.newtype(:syslog_settings) do
4
+ @doc = 'Configure global syslog settings'
5
+
6
+ newparam(:name, namevar: true) do
7
+ desc 'The hostname or address of the NTP server'
8
+
9
+ validate do |value|
10
+ if value.is_a? String then super(value)
11
+ else fail "value #{value.inspect} is invalid, must be a String."
12
+ end
13
+ end
14
+ end
15
+
16
+ newproperty(:enable) do
17
+ desc 'Enable or disable syslog logging [true|false]'
18
+ newvalues(:true, :false)
19
+ end
20
+
21
+ newproperty(:time_stamp_units) do
22
+ desc 'The unit to log time values in'
23
+ newvalues(:seconds, :milliseconds)
24
+ end
25
+ end
@@ -0,0 +1,20 @@
1
+ # encoding: utf-8
2
+
3
+ Puppet::Type.newtype(:tacacs) do
4
+ @doc = 'Enable or disable tacacs functionality'
5
+
6
+ newparam(:name, namevar: true) do
7
+ desc 'Resource name, not used to manage the device'
8
+
9
+ validate do |value|
10
+ if value.is_a? String then super(value)
11
+ else fail "value #{value.inspect} is invalid, must be a String."
12
+ end
13
+ end
14
+ end
15
+
16
+ newproperty(:enable) do
17
+ desc 'Enable or disable tacacs functionality [true|false]'
18
+ newvalues(:true, :false)
19
+ end
20
+ end
@@ -0,0 +1,40 @@
1
+ # encoding: utf-8
2
+
3
+ Puppet::Type.newtype(:tacacs_global) do
4
+ @doc = 'Configure global tacacs settings'
5
+
6
+ newparam(:name, namevar: true) do
7
+ desc 'Resource identifier, not used to manage the device'
8
+
9
+ validate do |value|
10
+ if value.is_a? String then super(value)
11
+ else fail "value #{value.inspect} is invalid, must be a String."
12
+ end
13
+ end
14
+ end
15
+
16
+ newproperty(:key) do
17
+ desc 'Encryption key (plaintext or in hash form depending on key_format)'
18
+
19
+ validate do |value|
20
+ if value.is_a? String then super(value)
21
+ else fail "value #{value.inspect} is invalid, must be a String."
22
+ end
23
+ end
24
+ end
25
+
26
+ newproperty(:key_format) do
27
+ desc 'Encryption key format [0-7]'
28
+ munge { |v| Integer(v) }
29
+ end
30
+
31
+ newproperty(:timeout) do
32
+ desc 'Number of seconds before the timeout period ends'
33
+ munge { |v| Integer(v) }
34
+ end
35
+
36
+ newproperty(:retransmit_count) do
37
+ desc 'How many times to retransmit'
38
+ munge { |v| Integer(v) }
39
+ end
40
+ end
@@ -0,0 +1,50 @@
1
+ # encoding: utf-8
2
+
3
+ Puppet::Type.newtype(:tacacs_server) do
4
+ @doc = 'Configure a tacacs server'
5
+
6
+ newparam(:name, namevar: true) do
7
+ desc 'The name of the tacacs server group'
8
+
9
+ validate do |value|
10
+ if value.is_a? String then super(value)
11
+ else fail "value #{value.inspect} is invalid, must be a String."
12
+ end
13
+ end
14
+ end
15
+
16
+ newproperty(:key) do
17
+ desc 'Encryption key (plaintext or in hash form depending on key_format)'
18
+
19
+ validate do |value|
20
+ if value.is_a? String then super(value)
21
+ else fail "value #{value.inspect} is invalid, must be a String."
22
+ end
23
+ end
24
+ end
25
+
26
+ newproperty(:key_format) do
27
+ desc 'Encryption key format [0-7]'
28
+ munge { |v| Integer(v) }
29
+ end
30
+
31
+ newproperty(:timeout) do
32
+ desc 'Number of seconds before the timeout period ends'
33
+ munge { |v| Integer(v) }
34
+ end
35
+
36
+ newproperty(:single_connection) do
37
+ desc 'Enable or disable session multiplexing [true|false]'
38
+ newvalues(:true, :false)
39
+ end
40
+
41
+ newproperty(:group) do
42
+ desc 'Server group associated with this server'
43
+
44
+ validate do |value|
45
+ if value.is_a? String then super(value)
46
+ else fail "value #{value.inspect} is invalid, must be a String."
47
+ end
48
+ end
49
+ end
50
+ end