arista-eos 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +41 -0
- data/.rubocop.yml +21 -0
- data/Gemfile +57 -0
- data/Guardfile +21 -0
- data/LICENSE +28 -0
- data/README.md +178 -0
- data/Rakefile +46 -0
- data/eos.gemspec +36 -0
- data/guide/.gitignore +2 -0
- data/guide/Makefile +177 -0
- data/guide/_static/arista_logo_jpg-11.jpg +0 -0
- data/guide/_static/favicon.ico +0 -0
- data/guide/conf.py +282 -0
- data/guide/cookbook.rst +135 -0
- data/guide/developing.rst +55 -0
- data/guide/faq.rst +30 -0
- data/guide/index.rst +25 -0
- data/guide/installation.rst +174 -0
- data/guide/license.rst +5 -0
- data/guide/overview.rst +35 -0
- data/guide/quickstart.rst +184 -0
- data/guide/release-notes-1.0.rst +37 -0
- data/guide/release-notes-1.1.rst +25 -0
- data/guide/release-notes.rst +10 -0
- data/guide/testing.rst +8 -0
- data/guide/troubleshooting.rst +26 -0
- data/guide/typedoc.rst +928 -0
- data/guide/types.rst +44 -0
- data/lib/eos.rb +8 -0
- data/lib/eos/version.rb +5 -0
- data/lib/puppet/provider/eos_acl_entry/default.rb +122 -0
- data/lib/puppet/provider/eos_command/default.rb +61 -0
- data/lib/puppet/provider/eos_ethernet/default.rb +96 -0
- data/lib/puppet/provider/eos_interface/default.rb +89 -0
- data/lib/puppet/provider/eos_ipinterface/default.rb +89 -0
- data/lib/puppet/provider/eos_mlag/default.rb +86 -0
- data/lib/puppet/provider/eos_mlag_interface/default.rb +90 -0
- data/lib/puppet/provider/eos_ntp_config/default.rb +68 -0
- data/lib/puppet/provider/eos_ntp_server/default.rb +69 -0
- data/lib/puppet/provider/eos_portchannel/default.rb +117 -0
- data/lib/puppet/provider/eos_snmp/default.rb +77 -0
- data/lib/puppet/provider/eos_stp_interface/default.rb +73 -0
- data/lib/puppet/provider/eos_switchport/default.rb +100 -0
- data/lib/puppet/provider/eos_system/default.rb +63 -0
- data/lib/puppet/provider/eos_vlan/default.rb +93 -0
- data/lib/puppet/provider/eos_vxlan/default.rb +104 -0
- data/lib/puppet/provider/eos_vxlan_vlan/default.rb +89 -0
- data/lib/puppet/provider/eos_vxlan_vtep/default.rb +70 -0
- data/lib/puppet/type/eos_acl_entry.rb +126 -0
- data/lib/puppet/type/eos_command.rb +75 -0
- data/lib/puppet/type/eos_ethernet.rb +101 -0
- data/lib/puppet/type/eos_interface.rb +79 -0
- data/lib/puppet/type/eos_ipinterface.rb +116 -0
- data/lib/puppet/type/eos_mlag.rb +133 -0
- data/lib/puppet/type/eos_mlag_interface.rb +85 -0
- data/lib/puppet/type/eos_ntp_config.rb +70 -0
- data/lib/puppet/type/eos_ntp_server.rb +52 -0
- data/lib/puppet/type/eos_portchannel.rb +189 -0
- data/lib/puppet/type/eos_snmp.rb +127 -0
- data/lib/puppet/type/eos_stp_interface.rb +94 -0
- data/lib/puppet/type/eos_switchport.rb +150 -0
- data/lib/puppet/type/eos_system.rb +69 -0
- data/lib/puppet/type/eos_vlan.rb +130 -0
- data/lib/puppet/type/eos_vxlan.rb +150 -0
- data/lib/puppet/type/eos_vxlan_vlan.rb +78 -0
- data/lib/puppet/type/eos_vxlan_vtep.rb +62 -0
- data/lib/puppet_x/eos/provider.rb +86 -0
- data/lib/puppet_x/eos/utils/helpers.rb +34 -0
- data/metadata.json +20 -0
- data/spec/fixtures/README +61 -0
- data/spec/fixtures/ethernet.json +9 -0
- data/spec/fixtures/fixture_stp.yaml +11 -0
- data/spec/fixtures/fixture_vxlan_get.yaml +11 -0
- data/spec/fixtures/ospf.json +13 -0
- data/spec/fixtures/snmp.json +6 -0
- data/spec/fixtures/varp.json +11 -0
- data/spec/spec_helper.rb +27 -0
- data/spec/support/fixtures.rb +74 -0
- data/spec/support/shared_examples_for_providers.rb +7 -0
- data/spec/support/shared_examples_for_types.rb +451 -0
- data/spec/unit/puppet/provider/eos_acl_entry/default_spec.rb +226 -0
- data/spec/unit/puppet/provider/eos_acl_entry/fixture_acl_entry.yaml +20 -0
- data/spec/unit/puppet/provider/eos_ethernet/default_spec.rb +226 -0
- data/spec/unit/puppet/provider/eos_ethernet/fixture_ethernet.yaml +8 -0
- data/spec/unit/puppet/provider/eos_interface/default_spec.rb +176 -0
- data/spec/unit/puppet/provider/eos_interface/fixture_interfaces.yaml +5 -0
- data/spec/unit/puppet/provider/eos_ipinterface/default_spec.rb +223 -0
- data/spec/unit/puppet/provider/eos_ipinterface/fixture_ipinterfaces.yaml +5 -0
- data/spec/unit/puppet/provider/eos_mlag/default_spec.rb +203 -0
- data/spec/unit/puppet/provider/eos_mlag/fixture_mlag.yaml +11 -0
- data/spec/unit/puppet/provider/eos_mlag_interface/default_spec.rb +177 -0
- data/spec/unit/puppet/provider/eos_mlag_interface/fixture_mlag.yaml +11 -0
- data/spec/unit/puppet/provider/eos_ntp_config/default_spec.rb +150 -0
- data/spec/unit/puppet/provider/eos_ntp_config/fixture_ntp.yaml +3 -0
- data/spec/unit/puppet/provider/eos_ntp_server/default_spec.rb +152 -0
- data/spec/unit/puppet/provider/eos_ntp_server/fixture_ntp.yaml +3 -0
- data/spec/unit/puppet/provider/eos_portchannel/default_spec.rb +271 -0
- data/spec/unit/puppet/provider/eos_portchannel/fixture_portchannels.yaml +10 -0
- data/spec/unit/puppet/provider/eos_snmp/default_spec.rb +193 -0
- data/spec/unit/puppet/provider/eos_snmp/fixture_snmp.yaml +6 -0
- data/spec/unit/puppet/provider/eos_stp_interface/default_spec.rb +138 -0
- data/spec/unit/puppet/provider/eos_switchport/default_spec.rb +250 -0
- data/spec/unit/puppet/provider/eos_switchport/fixture_switchports.yaml +7 -0
- data/spec/unit/puppet/provider/eos_system/default_spec.rb +129 -0
- data/spec/unit/puppet/provider/eos_system/fixture_system.yaml +2 -0
- data/spec/unit/puppet/provider/eos_vlan/default_spec.rb +228 -0
- data/spec/unit/puppet/provider/eos_vlan/fixture_vlans.yaml +6 -0
- data/spec/unit/puppet/provider/eos_vxlan/default_spec.rb +229 -0
- data/spec/unit/puppet/provider/eos_vxlan/fixture_vxlan.yaml +9 -0
- data/spec/unit/puppet/provider/eos_vxlan_vlan/default_spec.rb +148 -0
- data/spec/unit/puppet/provider/eos_vxlan_vtep/default_spec.rb +140 -0
- data/spec/unit/puppet/type/eos_acl_entry_spec.rb +103 -0
- data/spec/unit/puppet/type/eos_command_spec.rb +67 -0
- data/spec/unit/puppet/type/eos_ethernet_spec.rb +87 -0
- data/spec/unit/puppet/type/eos_interface_spec.rb +67 -0
- data/spec/unit/puppet/type/eos_ipinterface_spec.rb +84 -0
- data/spec/unit/puppet/type/eos_mlag_interface_spec.rb +62 -0
- data/spec/unit/puppet/type/eos_mlag_spec.rb +98 -0
- data/spec/unit/puppet/type/eos_ntp_config_spec.rb +58 -0
- data/spec/unit/puppet/type/eos_ntp_server_spec.rb +51 -0
- data/spec/unit/puppet/type/eos_portchannel_spec.rb +99 -0
- data/spec/unit/puppet/type/eos_snmp_spec.rb +87 -0
- data/spec/unit/puppet/type/eos_stp_interface_spec.rb +77 -0
- data/spec/unit/puppet/type/eos_switchport_spec.rb +88 -0
- data/spec/unit/puppet/type/eos_system_spec.rb +57 -0
- data/spec/unit/puppet/type/eos_vlan_spec.rb +86 -0
- data/spec/unit/puppet/type/eos_vxlan_spec.rb +100 -0
- data/spec/unit/puppet/type/eos_vxlan_vlan_spec.rb +73 -0
- data/spec/unit/puppet/type/eos_vxlan_vtep_spec.rb +52 -0
- data/tests/init.pp +12 -0
- metadata +437 -0
@@ -0,0 +1,189 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2014, Arista Networks, Inc.
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without
|
6
|
+
# modification, are permitted provided that the following conditions are
|
7
|
+
# met:
|
8
|
+
#
|
9
|
+
# Redistributions of source code must retain the above copyright notice,
|
10
|
+
# this list of conditions and the following disclaimer.
|
11
|
+
#
|
12
|
+
# Redistributions in binary form must reproduce the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer in the
|
14
|
+
# documentation and/or other materials provided with the distribution.
|
15
|
+
#
|
16
|
+
# Neither the name of Arista Networks nor the names of its
|
17
|
+
# contributors may be used to endorse or promote products derived from
|
18
|
+
# this software without specific prior written permission.
|
19
|
+
#
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
21
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
22
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
23
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARISTA NETWORKS
|
24
|
+
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
25
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
27
|
+
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
28
|
+
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
29
|
+
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
30
|
+
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
#
|
32
|
+
|
33
|
+
Puppet::Type.newtype(:eos_portchannel) do
|
34
|
+
@doc = <<-EOS
|
35
|
+
This type manages Port-Channel interface instances on Arista
|
36
|
+
EOS nodes. It provides configuration resources for logical
|
37
|
+
Port-Channel instances and settings
|
38
|
+
EOS
|
39
|
+
|
40
|
+
ensurable
|
41
|
+
|
42
|
+
# Parameters
|
43
|
+
|
44
|
+
newparam(:name) do
|
45
|
+
desc <<-EOS
|
46
|
+
The name parameter specifies the name of the Port-Channel
|
47
|
+
interface to configure. The value must be the full
|
48
|
+
interface name identifier that corresponds to a valid
|
49
|
+
interface name in EOS.
|
50
|
+
EOS
|
51
|
+
|
52
|
+
validate do |value|
|
53
|
+
unless value =~ /^Port-Channel/
|
54
|
+
fail "value #{value.inspect} is invalid, must be a valid " \
|
55
|
+
'Port-Channel interface name'
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
# Properties (state management)
|
61
|
+
|
62
|
+
newproperty(:description) do
|
63
|
+
desc <<-EOS
|
64
|
+
The one line description to configure for the interface. The
|
65
|
+
description can be any valid alphanumeric string including symbols
|
66
|
+
and spaces.
|
67
|
+
|
68
|
+
The default value for description is ''
|
69
|
+
EOS
|
70
|
+
|
71
|
+
validate do |value|
|
72
|
+
case value
|
73
|
+
when String then super(value)
|
74
|
+
else fail "value #{value.inspect} is invalid, must be a String."
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
newproperty(:enable) do
|
80
|
+
desc <<-EOS
|
81
|
+
The enable value configures the administrative state of the
|
82
|
+
specified interface. Valid values for enable are:
|
83
|
+
|
84
|
+
* true - Administratively enables the interface
|
85
|
+
* false - Administratively disables the interface
|
86
|
+
|
87
|
+
The default value for enable is :true
|
88
|
+
EOS
|
89
|
+
newvalues(:true, :false)
|
90
|
+
end
|
91
|
+
|
92
|
+
newproperty(:lacp_mode) do
|
93
|
+
desc <<-EOS
|
94
|
+
The lacp_mode property configures the LACP operating mode of
|
95
|
+
the Port-Channel interface. The LACP mode supports the following
|
96
|
+
valid values
|
97
|
+
|
98
|
+
* active - Interface is an active LACP port that transmits and
|
99
|
+
receives LACP negotiation packets.
|
100
|
+
* passive - Interface is a passive LACP port that only responds
|
101
|
+
to LACP negotiation packets.
|
102
|
+
* on - Interface is a static port channel, LACP disabled.
|
103
|
+
|
104
|
+
The default value for lacp_mode is :on
|
105
|
+
EOS
|
106
|
+
|
107
|
+
newvalues(:active, :passive, :on)
|
108
|
+
end
|
109
|
+
|
110
|
+
newproperty(:members, array_matching: :all) do
|
111
|
+
desc <<-EOS
|
112
|
+
The members property manages the Array of physical interfaces
|
113
|
+
that comprise the logical Port-Channel interface. Each entry
|
114
|
+
in the members Array must be the full interface identifer of
|
115
|
+
a physical interface name.
|
116
|
+
|
117
|
+
The default value for members is []
|
118
|
+
EOS
|
119
|
+
|
120
|
+
validate do |value|
|
121
|
+
unless value =~ %r{^Ethernet\d(:\/\d+)?}
|
122
|
+
fail "value #{value.inspect} is invalid, must be an Ethernet interface"
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
newproperty(:minimum_links) do
|
128
|
+
desc <<-EOS
|
129
|
+
The minimum links property configures the port-channel min-links
|
130
|
+
value. This setting specifies the minimum number of physical
|
131
|
+
interfaces that must be operationally up for the Port-Channel
|
132
|
+
interface to be considered operationally up.
|
133
|
+
|
134
|
+
Valid range of values for the minimum_links property are from
|
135
|
+
0 to 16.
|
136
|
+
|
137
|
+
The default value for minimum_links is 0
|
138
|
+
EOS
|
139
|
+
|
140
|
+
munge { |value| Integer(value) }
|
141
|
+
|
142
|
+
validate do |value|
|
143
|
+
unless value.to_i.between?(0, 16)
|
144
|
+
fail "value #{value.inspect} is not between 0 and 16"
|
145
|
+
end
|
146
|
+
end
|
147
|
+
end
|
148
|
+
|
149
|
+
newproperty(:lacp_fallback) do
|
150
|
+
desc <<-EOS
|
151
|
+
The lacp_fallback property configures the port-channel lacp
|
152
|
+
fallback setting in EOS for the specified interface. This
|
153
|
+
setting accepts the following values
|
154
|
+
|
155
|
+
* static - Fallback to static LAG mode
|
156
|
+
* individual - Fallback to individual ports
|
157
|
+
* disabled - Disable LACP fallback
|
158
|
+
|
159
|
+
The default value for lacp_fallback is :disabled
|
160
|
+
EOS
|
161
|
+
|
162
|
+
newvalues(:static, :individual, :disabled)
|
163
|
+
end
|
164
|
+
|
165
|
+
newproperty(:lacp_timeout) do
|
166
|
+
desc <<-EOS
|
167
|
+
The lacp_timeout property configures the port-channel lacp
|
168
|
+
timeout value in EOS for the specified interface. The fallback
|
169
|
+
timeout configures the period an interface in fallback mode
|
170
|
+
remains in LACP mode without receiving a PDU.
|
171
|
+
|
172
|
+
The lacp_timeout value is configured in seconds with a valid
|
173
|
+
range betwee 1 and 100.
|
174
|
+
|
175
|
+
The default value is 90
|
176
|
+
EOS
|
177
|
+
|
178
|
+
munge do |value|
|
179
|
+
Integer(value)
|
180
|
+
end
|
181
|
+
|
182
|
+
# Validate each value is a valid timeout value
|
183
|
+
validate do |value|
|
184
|
+
unless value.to_i.between?(1, 100)
|
185
|
+
fail "value #{value.inspect} is not between 1 and 100"
|
186
|
+
end
|
187
|
+
end
|
188
|
+
end
|
189
|
+
end
|
@@ -0,0 +1,127 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2014, Arista Networks, Inc.
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without
|
6
|
+
# modification, are permitted provided that the following conditions are
|
7
|
+
# met:
|
8
|
+
#
|
9
|
+
# Redistributions of source code must retain the above copyright notice,
|
10
|
+
# this list of conditions and the following disclaimer.
|
11
|
+
#
|
12
|
+
# Redistributions in binary form must reproduce the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer in the
|
14
|
+
# documentation and/or other materials provided with the distribution.
|
15
|
+
#
|
16
|
+
# Neither the name of Arista Networks nor the names of its
|
17
|
+
# contributors may be used to endorse or promote products derived from
|
18
|
+
# this software without specific prior written permission.
|
19
|
+
#
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
21
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
22
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
23
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARISTA NETWORKS
|
24
|
+
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
25
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
27
|
+
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
28
|
+
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
29
|
+
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
30
|
+
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
#
|
32
|
+
|
33
|
+
Puppet::Type.newtype(:eos_snmp) do
|
34
|
+
@doc = <<-EOS
|
35
|
+
This type manages the global SNMP configuration instance on EOS
|
36
|
+
nodes. It provides configuration resources for global SNMP
|
37
|
+
settings.
|
38
|
+
EOS
|
39
|
+
|
40
|
+
# Parameters
|
41
|
+
|
42
|
+
newparam(:name) do
|
43
|
+
desc <<-EOS
|
44
|
+
The name parameter identifis the global SNMP instance for
|
45
|
+
configuration and should be configured as 'settings'. All
|
46
|
+
other values for name will be silently ignored by the eos_snmp
|
47
|
+
provider.
|
48
|
+
EOS
|
49
|
+
end
|
50
|
+
|
51
|
+
# Properties (state management)
|
52
|
+
|
53
|
+
newproperty(:contact) do
|
54
|
+
desc <<-EOS
|
55
|
+
The contact property provides configuration management of the
|
56
|
+
SNMP contact value. This setting provides informative text that
|
57
|
+
typically displays the name of a person or organization associated
|
58
|
+
with the SNMP agent.
|
59
|
+
|
60
|
+
The default value for contact is ''
|
61
|
+
EOS
|
62
|
+
|
63
|
+
validate do |value|
|
64
|
+
case value
|
65
|
+
when String
|
66
|
+
super(value)
|
67
|
+
validate_features_per_value(value)
|
68
|
+
else fail "value #{value.inspect} is invalid, must be a String."
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
newproperty(:location) do
|
74
|
+
desc <<-EOS
|
75
|
+
The location property provides configuration management of the
|
76
|
+
SNMP location value. This setting typcially provides information
|
77
|
+
about the physical lcoation of the SNMP agent.
|
78
|
+
|
79
|
+
The default value for location is ''
|
80
|
+
EOS
|
81
|
+
|
82
|
+
validate do |value|
|
83
|
+
case value
|
84
|
+
when String
|
85
|
+
super(value)
|
86
|
+
validate_features_per_value(value)
|
87
|
+
else fail "value #{value.inspect} is invalid, must be a string."
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
newproperty(:chassis_id) do
|
93
|
+
desc <<-EOS
|
94
|
+
The chassis id propperty provides configuration management of
|
95
|
+
the SNMP chassis-id value. This setting typically provides
|
96
|
+
information to uniquely identify the SNMP agent host.
|
97
|
+
|
98
|
+
The default value for chassis_id is ''
|
99
|
+
EOS
|
100
|
+
|
101
|
+
validate do |value|
|
102
|
+
case value
|
103
|
+
when String
|
104
|
+
super(value)
|
105
|
+
validate_features_per_value(value)
|
106
|
+
else fail "value #{value.inspect} is invalid, must be a string."
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
newproperty(:source_interface) do
|
112
|
+
desc <<-EOS
|
113
|
+
The source interface property provides configuration management
|
114
|
+
of the SNMP source-interface value. The source interface value
|
115
|
+
configures the interface address to use as the source address
|
116
|
+
when sending SNMP packets on the network.
|
117
|
+
|
118
|
+
The default value for source_interface is ''
|
119
|
+
EOS
|
120
|
+
|
121
|
+
validate do |value|
|
122
|
+
unless value =~ /^[EMPLV]/
|
123
|
+
fail "value #{value.inspect} is invalid, must be an interface name"
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,94 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2014, Arista Networks, Inc.
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without
|
6
|
+
# modification, are permitted provided that the following conditions are
|
7
|
+
# met:
|
8
|
+
#
|
9
|
+
# Redistributions of source code must retain the above copyright notice,
|
10
|
+
# this list of conditions and the following disclaimer.
|
11
|
+
#
|
12
|
+
# Redistributions in binary form must reproduce the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer in the
|
14
|
+
# documentation and/or other materials provided with the distribution.
|
15
|
+
#
|
16
|
+
# Neither the name of Arista Networks nor the names of its
|
17
|
+
# contributors may be used to endorse or promote products derived from
|
18
|
+
# this software without specific prior written permission.
|
19
|
+
#
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
21
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
22
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
23
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARISTA NETWORKS
|
24
|
+
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
25
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
27
|
+
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
28
|
+
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
29
|
+
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
30
|
+
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
#
|
32
|
+
# encoding: utf-8
|
33
|
+
|
34
|
+
Puppet::Type.newtype(:eos_stp_interface) do
|
35
|
+
@doc = <<-EOS
|
36
|
+
Manage Spanning Tree Protocol interface configuration.
|
37
|
+
EOS
|
38
|
+
|
39
|
+
# Parameters
|
40
|
+
|
41
|
+
newparam(:name) do
|
42
|
+
@doc = <<-EOS
|
43
|
+
The name parameter specifies the full interface identifier of
|
44
|
+
the Arista EOS interface to manage. This value must correspond
|
45
|
+
to a valid interface identifier in EOS and must be either an
|
46
|
+
Ethernet or Port Channel interface.
|
47
|
+
EOS
|
48
|
+
end
|
49
|
+
|
50
|
+
# Properties (state management)
|
51
|
+
|
52
|
+
newproperty(:portfast) do
|
53
|
+
@doc = <<-EOS
|
54
|
+
The portfast property programs an STP port to immediately enter
|
55
|
+
forwarding state when they establish a link. PortFast ports
|
56
|
+
are included in spanning tree topology calculations and can
|
57
|
+
enter blocking state. Valid portfast values:
|
58
|
+
|
59
|
+
* true - Enable portfast for the interface
|
60
|
+
* false - Disable portfast for the interface (default value)
|
61
|
+
EOS
|
62
|
+
newvalues(:true, :false)
|
63
|
+
end
|
64
|
+
|
65
|
+
newproperty(:portfast_type) do
|
66
|
+
@doc = <<-EOS
|
67
|
+
Specifies the STP portfast mode type for the interface. A port
|
68
|
+
with edge type connect to hosts and transition to the forwarding
|
69
|
+
state when the link is established. An edge port that receives a
|
70
|
+
BPDU becomes a normal port. A port with network type connect only
|
71
|
+
to switches or bridges and support bridge assurance. Network ports
|
72
|
+
that connect to hosts or other edge devices transition ot the
|
73
|
+
blocking state. Valid portfast mode types:
|
74
|
+
|
75
|
+
* edge - Set STP port mode type to edge.
|
76
|
+
* network - Set STP port mode type to network.
|
77
|
+
* normal - Set STP port mode type to normal (default value)
|
78
|
+
EOS
|
79
|
+
newvalues(:edge, :network, :normal)
|
80
|
+
end
|
81
|
+
|
82
|
+
newproperty(:bpduguard) do
|
83
|
+
@doc = <<-EOS
|
84
|
+
Enable or disable the BPDU guard on a port. A BPDU guard-enabled
|
85
|
+
port is disabled when it receives a BPDU packet. Disabled ports
|
86
|
+
differ from blocked ports in that they are re-enabled only
|
87
|
+
through manual intervention. Valid BPDU guard values:
|
88
|
+
|
89
|
+
* true - Enable the BPDU guard for the interface
|
90
|
+
* false - Disable the BPDU guard for the interface (default value)
|
91
|
+
EOS
|
92
|
+
newvalues(:true, :false)
|
93
|
+
end
|
94
|
+
end
|
@@ -0,0 +1,150 @@
|
|
1
|
+
#
|
2
|
+
# Copyright (c) 2014, Arista Networks, Inc.
|
3
|
+
# All rights reserved.
|
4
|
+
#
|
5
|
+
# Redistribution and use in source and binary forms, with or without
|
6
|
+
# modification, are permitted provided that the following conditions are
|
7
|
+
# met:
|
8
|
+
#
|
9
|
+
# Redistributions of source code must retain the above copyright notice,
|
10
|
+
# this list of conditions and the following disclaimer.
|
11
|
+
#
|
12
|
+
# Redistributions in binary form must reproduce the above copyright
|
13
|
+
# notice, this list of conditions and the following disclaimer in the
|
14
|
+
# documentation and/or other materials provided with the distribution.
|
15
|
+
#
|
16
|
+
# Neither the name of Arista Networks nor the names of its
|
17
|
+
# contributors may be used to endorse or promote products derived from
|
18
|
+
# this software without specific prior written permission.
|
19
|
+
#
|
20
|
+
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
21
|
+
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
22
|
+
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
23
|
+
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL ARISTA NETWORKS
|
24
|
+
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
25
|
+
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
26
|
+
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
|
27
|
+
# BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
|
28
|
+
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
29
|
+
# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
|
30
|
+
# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
31
|
+
#
|
32
|
+
|
33
|
+
Puppet::Type.newtype(:eos_switchport) do
|
34
|
+
@doc = <<-EOS
|
35
|
+
This type provides a resource for configuring logical layer 2
|
36
|
+
switchports in EOS. The resource provides configuration for both
|
37
|
+
access and trunk operating modes.
|
38
|
+
|
39
|
+
When creating a logical switchport interface, if the specified
|
40
|
+
physical interface was previously configured with an IP interface,
|
41
|
+
the logical IP interface will be removed.
|
42
|
+
EOS
|
43
|
+
|
44
|
+
ensurable
|
45
|
+
|
46
|
+
# Parameters
|
47
|
+
|
48
|
+
newparam(:name) do
|
49
|
+
desc <<-EOS
|
50
|
+
The name parameter specifies the full interface identifier of
|
51
|
+
the Arista EOS interface to manage. This value must correspond
|
52
|
+
to a valid interface identifier in EOS.
|
53
|
+
|
54
|
+
Only Ethernet and Port-Channel interfaces can be configured as
|
55
|
+
switchports.
|
56
|
+
EOS
|
57
|
+
|
58
|
+
validate do |value|
|
59
|
+
unless value =~ /^[Et|Po]/
|
60
|
+
fail 'value #{value.inspect} is invalid, must be of type ' \
|
61
|
+
'Ethernet or Port-Channel'
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Properties (state management)
|
67
|
+
|
68
|
+
newproperty(:mode) do
|
69
|
+
desc <<-EOS
|
70
|
+
The mode property configures the operating mode of the
|
71
|
+
logical switchport. Suppport modes of operation include
|
72
|
+
access port or trunk port. The default value for a new
|
73
|
+
switchport is access
|
74
|
+
|
75
|
+
* access - Configures the switchport mode to access
|
76
|
+
* trunk - Configures the switchport mode to trunk
|
77
|
+
|
78
|
+
EOS
|
79
|
+
newvalues(:access, :trunk)
|
80
|
+
end
|
81
|
+
|
82
|
+
newproperty(:trunk_allowed_vlans, array_matching: :all) do
|
83
|
+
desc <<-EOS
|
84
|
+
The trunk_allowed_vlans property configures the list of
|
85
|
+
VLAN IDs that are allowed to pass on the switchport operting
|
86
|
+
in trunk mode. If the switchport is configured for access
|
87
|
+
mode, this property is configured but has no effect.
|
88
|
+
|
89
|
+
The list of allowed VLANs must be configured as an Array with
|
90
|
+
each entry in the valid VLAN range of 1 to 4094.
|
91
|
+
|
92
|
+
The default value for a new switchport is to allow all valid
|
93
|
+
VLAN IDs (1-4094).
|
94
|
+
EOS
|
95
|
+
|
96
|
+
munge do |value|
|
97
|
+
Integer(value)
|
98
|
+
end
|
99
|
+
|
100
|
+
validate do |value|
|
101
|
+
unless value.to_i.between?(1, 4_094)
|
102
|
+
fail "value #{value.inspect} is not between 1 and 4094"
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
106
|
+
|
107
|
+
newproperty(:trunk_native_vlan) do
|
108
|
+
desc <<-EOS
|
109
|
+
The trunk_native_vlan property specifies the VLAN ID to
|
110
|
+
be used for untagged traffic that enters the switchport
|
111
|
+
in trunk mode. If the switchport is configured for access
|
112
|
+
mode, this value is configured but has no effect. The value
|
113
|
+
must be an integer in the valid VLAN ID range of 1 to 4094.
|
114
|
+
|
115
|
+
The default value for the trunk_natve_vlan is 1
|
116
|
+
EOS
|
117
|
+
|
118
|
+
munge do |value|
|
119
|
+
Integer(value)
|
120
|
+
end
|
121
|
+
|
122
|
+
validate do |value|
|
123
|
+
unless value.to_i.between?(1, 4_094)
|
124
|
+
fail "value #{value.inspect} is not between 1 and 4094"
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
newproperty(:access_vlan) do
|
130
|
+
desc <<-EOS
|
131
|
+
The access_vlan property specifies the VLAN ID to be used
|
132
|
+
for untagged traffic that enters the switchport when configured
|
133
|
+
in access mode. If the switchport is configured for trunk mode,
|
134
|
+
this value is configured but has no effect. The value must be
|
135
|
+
an integer in the valid VLAN ID range of 1 to 4094.
|
136
|
+
|
137
|
+
The default value for the access_vlan is 1
|
138
|
+
EOS
|
139
|
+
|
140
|
+
munge do |value|
|
141
|
+
Integer(value)
|
142
|
+
end
|
143
|
+
|
144
|
+
validate do |value|
|
145
|
+
unless value.to_i.between?(1, 4_094)
|
146
|
+
fail "value #{value.inspect} is not between 1 and 4094"
|
147
|
+
end
|
148
|
+
end
|
149
|
+
end
|
150
|
+
end
|