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,86 @@
|
|
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
|
+
require 'puppet/type'
|
33
|
+
require 'pathname'
|
34
|
+
|
35
|
+
module_lib = Pathname.new(__FILE__).parent.parent.parent.parent
|
36
|
+
require File.join module_lib, 'puppet_x/eos/provider'
|
37
|
+
|
38
|
+
Puppet::Type.type(:eos_mlag).provide(:eos) do
|
39
|
+
# Create methods that set the @property_hash for the #flush method
|
40
|
+
mk_resource_methods
|
41
|
+
|
42
|
+
# Mix in the api as instance methods
|
43
|
+
include PuppetX::Eos::EapiProviderMixin
|
44
|
+
|
45
|
+
# Mix in the api as class methods
|
46
|
+
extend PuppetX::Eos::EapiProviderMixin
|
47
|
+
|
48
|
+
def self.instances
|
49
|
+
api = node.api('mlag').get
|
50
|
+
result = api[:global]
|
51
|
+
provider_hash = { name: 'settings', ensure: :present }
|
52
|
+
provider_hash.merge!(result)
|
53
|
+
enable = result[:shutdown] ? :false : :true
|
54
|
+
provider_hash[:enable] = enable
|
55
|
+
[new(provider_hash)]
|
56
|
+
end
|
57
|
+
|
58
|
+
def domain_id=(val)
|
59
|
+
node.api('mlag').set_domain_id(value: val)
|
60
|
+
@property_hash[:domain_id] = val
|
61
|
+
end
|
62
|
+
|
63
|
+
def local_interface=(val)
|
64
|
+
node.api('mlag').set_local_interface(value: val)
|
65
|
+
@property_hash[:local_interface] = val
|
66
|
+
end
|
67
|
+
|
68
|
+
def peer_address=(val)
|
69
|
+
node.api('mlag').set_peer_address(value: val)
|
70
|
+
@property_hash[:peer_address] = val
|
71
|
+
end
|
72
|
+
|
73
|
+
def peer_link=(val)
|
74
|
+
node.api('mlag').set_peer_link(value: val)
|
75
|
+
@property_hash[:peer_link] = val
|
76
|
+
end
|
77
|
+
|
78
|
+
def enable=(val)
|
79
|
+
node.api('mlag').set_shutdown(value: val == :false)
|
80
|
+
@property_hash[:enable] = val
|
81
|
+
end
|
82
|
+
|
83
|
+
def exists?
|
84
|
+
@property_hash[:ensure] == :present
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,90 @@
|
|
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
|
+
require 'puppet/type'
|
33
|
+
require 'pathname'
|
34
|
+
|
35
|
+
module_lib = Pathname.new(__FILE__).parent.parent.parent.parent
|
36
|
+
require File.join module_lib, 'puppet_x/eos/provider'
|
37
|
+
|
38
|
+
Puppet::Type.type(:eos_mlag_interface).provide(:eos) do
|
39
|
+
# Create methods that set the @property_hash for the #flush method
|
40
|
+
mk_resource_methods
|
41
|
+
|
42
|
+
# Mix in the api as instance methods
|
43
|
+
include PuppetX::Eos::EapiProviderMixin
|
44
|
+
|
45
|
+
# Mix in the api as class methods
|
46
|
+
extend PuppetX::Eos::EapiProviderMixin
|
47
|
+
|
48
|
+
def self.instances
|
49
|
+
mlag = node.api('mlag').get
|
50
|
+
mlag[:interfaces].map do |(name, attrs)|
|
51
|
+
provider_hash = { name: name, ensure: :present,
|
52
|
+
mlag_id: attrs[:mlag_id] }
|
53
|
+
new(provider_hash)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def initialize(resource = {})
|
58
|
+
super(resource)
|
59
|
+
@property_flush = {}
|
60
|
+
end
|
61
|
+
|
62
|
+
def mlag_id=(value)
|
63
|
+
node.api('mlag').set_mlag_id(resource[:name], value: value)
|
64
|
+
@property_hash[:mlag_id] = value
|
65
|
+
end
|
66
|
+
|
67
|
+
def exists?
|
68
|
+
@property_hash[:ensure] == :present
|
69
|
+
end
|
70
|
+
|
71
|
+
def create
|
72
|
+
@property_hash = resource.to_hash
|
73
|
+
end
|
74
|
+
|
75
|
+
def destroy
|
76
|
+
@property_hash = resource.to_hash
|
77
|
+
end
|
78
|
+
|
79
|
+
def flush
|
80
|
+
api = node.api('mlag')
|
81
|
+
desired_state = @property_hash.merge!(@property_flush)
|
82
|
+
case desired_state[:ensure]
|
83
|
+
when :present
|
84
|
+
api.set_mlag_id(desired_state[:name], value: desired_state[:mlag_id])
|
85
|
+
when :absent
|
86
|
+
api.set_mlag_id(desired_state[:name])
|
87
|
+
end
|
88
|
+
@property_hash = desired_state
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,68 @@
|
|
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
|
+
require 'puppet/type'
|
33
|
+
require 'pathname'
|
34
|
+
|
35
|
+
module_lib = Pathname.new(__FILE__).parent.parent.parent.parent
|
36
|
+
require File.join module_lib, 'puppet_x/eos/provider'
|
37
|
+
|
38
|
+
Puppet::Type.type(:eos_ntp_config).provide(:eos) do
|
39
|
+
# Create methods that set the @property_hash for the #flush method
|
40
|
+
mk_resource_methods
|
41
|
+
|
42
|
+
# Mix in the api as instance methods
|
43
|
+
include PuppetX::Eos::EapiProviderMixin
|
44
|
+
|
45
|
+
# Mix in the api as class methods
|
46
|
+
extend PuppetX::Eos::EapiProviderMixin
|
47
|
+
|
48
|
+
def initialize(resource = {})
|
49
|
+
super(resource)
|
50
|
+
@property_flush = {}
|
51
|
+
end
|
52
|
+
|
53
|
+
def self.instances
|
54
|
+
result = node.api('ntp').get
|
55
|
+
provider_hash = { name: 'settings', ensure: :present,
|
56
|
+
source_interface: result[:source_interface] }
|
57
|
+
[new(provider_hash)]
|
58
|
+
end
|
59
|
+
|
60
|
+
def source_interface=(val)
|
61
|
+
node.api('ntp').set_source_interface(value: val)
|
62
|
+
@property_hash[:source_interface] = val
|
63
|
+
end
|
64
|
+
|
65
|
+
def exists?
|
66
|
+
@property_hash[:ensure] == :present
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,69 @@
|
|
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
|
+
require 'puppet/type'
|
33
|
+
require 'pathname'
|
34
|
+
|
35
|
+
module_lib = Pathname.new(__FILE__).parent.parent.parent.parent
|
36
|
+
require File.join module_lib, 'puppet_x/eos/provider'
|
37
|
+
|
38
|
+
Puppet::Type.type(:eos_ntp_server).provide(:eos) do
|
39
|
+
# Create methods that set the @property_hash for the #flush method
|
40
|
+
mk_resource_methods
|
41
|
+
|
42
|
+
# Mix in the api as instance methods
|
43
|
+
include PuppetX::Eos::EapiProviderMixin
|
44
|
+
|
45
|
+
# Mix in the api as class methods
|
46
|
+
extend PuppetX::Eos::EapiProviderMixin
|
47
|
+
|
48
|
+
def self.instances
|
49
|
+
ntp = node.api('ntp').get
|
50
|
+
ntp[:servers].map do |(name, _)|
|
51
|
+
provider_hash = { name: name, ensure: :present }
|
52
|
+
new(provider_hash)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def exists?
|
57
|
+
@property_hash[:ensure] == :present
|
58
|
+
end
|
59
|
+
|
60
|
+
def create
|
61
|
+
node.api('ntp').add_server(resource[:name])
|
62
|
+
@property_hash = { name: resource[:name], ensure: :present }
|
63
|
+
end
|
64
|
+
|
65
|
+
def destroy
|
66
|
+
node.api('ntp').remove_server(resource[:name])
|
67
|
+
@property_hash = { name: resource[:name], ensure: :absent }
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,117 @@
|
|
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
|
+
require 'puppet/type'
|
33
|
+
require 'pathname'
|
34
|
+
|
35
|
+
module_lib = Pathname.new(__FILE__).parent.parent.parent.parent
|
36
|
+
require File.join module_lib, 'puppet_x/eos/provider'
|
37
|
+
|
38
|
+
Puppet::Type.type(:eos_portchannel).provide(:eos) do
|
39
|
+
# Create methods that set the @property_hash for the #flush method
|
40
|
+
mk_resource_methods
|
41
|
+
|
42
|
+
# Mix in the api as instance methods
|
43
|
+
include PuppetX::Eos::EapiProviderMixin
|
44
|
+
|
45
|
+
# Mix in the api as class methods
|
46
|
+
extend PuppetX::Eos::EapiProviderMixin
|
47
|
+
|
48
|
+
def self.instances
|
49
|
+
interfaces = node.api('interfaces').getall
|
50
|
+
interfaces.each_with_object([]) do |(name, attrs), arry|
|
51
|
+
next unless attrs[:type] == 'portchannel'
|
52
|
+
provider_hash = { name: name, ensure: :present }
|
53
|
+
provider_hash.merge!(attrs)
|
54
|
+
provider_hash[:enable] = attrs[:shutdown] ? :false : :true
|
55
|
+
provider_hash[:lacp_mode] = attrs[:lacp_mode].to_sym
|
56
|
+
provider_hash[:lacp_fallback] = attrs[:lacp_fallback].to_sym
|
57
|
+
Puppet.debug("#{provider_hash}")
|
58
|
+
arry << new(provider_hash)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
def enable=(val)
|
63
|
+
node.api('interfaces').set_shutdown(resource[:name], value: val == :false)
|
64
|
+
@property_hash[:enable] = val
|
65
|
+
end
|
66
|
+
|
67
|
+
def description=(val)
|
68
|
+
node.api('interfaces').set_description(resource[:name], value: val)
|
69
|
+
@property_hash[:description] = val
|
70
|
+
end
|
71
|
+
|
72
|
+
def lacp_mode=(val)
|
73
|
+
node.api('interfaces').set_lacp_mode(resource[:name], val.to_s)
|
74
|
+
@property_hash[:lacp_mode] = val
|
75
|
+
end
|
76
|
+
|
77
|
+
def members=(val)
|
78
|
+
node.api('interfaces').set_members(resource[:name], val)
|
79
|
+
@property_hash[:members] = val
|
80
|
+
end
|
81
|
+
|
82
|
+
def minimum_links=(val)
|
83
|
+
node.api('interfaces').set_minimum_links(resource[:name], value: val)
|
84
|
+
@property_hash[:minimum_links] = val
|
85
|
+
end
|
86
|
+
|
87
|
+
def lacp_fallback=(val)
|
88
|
+
node.api('interfaces').set_lacp_fallback(resource[:name], value: val.to_s)
|
89
|
+
@property_hash[:lacp_fallback] = val
|
90
|
+
end
|
91
|
+
|
92
|
+
def lacp_timeout=(val)
|
93
|
+
node.api('interfaces').set_lacp_timeout(resource[:name], value: val)
|
94
|
+
@property_hash[:lacp_timeout] = val
|
95
|
+
end
|
96
|
+
|
97
|
+
def exists?
|
98
|
+
@property_hash[:ensure] == :present
|
99
|
+
end
|
100
|
+
|
101
|
+
def create
|
102
|
+
node.api('interfaces').create(resource[:name])
|
103
|
+
@property_hash = { name: resource[:name], ensure: :present }
|
104
|
+
self.enable = resource[:enable] if resource[:enable]
|
105
|
+
self.description = resource[:description] if resource[:description]
|
106
|
+
self.lacp_mode = resource[:lacp_mode] if resource[:lacp_mode]
|
107
|
+
self.members = resource[:members] if resource[:members]
|
108
|
+
self.lacp_fallback = resource[:lacp_fallback] if resource[:lacp_fallback]
|
109
|
+
self.lacp_timeout = resource[:lacp_timeout] if resource[:lacp_timeout]
|
110
|
+
self.minimum_links = resource[:minimum_links] if resource[:minimum_links]
|
111
|
+
end
|
112
|
+
|
113
|
+
def destroy
|
114
|
+
node.api('interfaces').delete(resource[:name])
|
115
|
+
@property_hash = { name: resource[:name], ensure: :absent }
|
116
|
+
end
|
117
|
+
end
|
@@ -0,0 +1,77 @@
|
|
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
|
+
require 'puppet/type'
|
33
|
+
require 'pathname'
|
34
|
+
|
35
|
+
module_lib = Pathname.new(__FILE__).parent.parent.parent.parent
|
36
|
+
require File.join module_lib, 'puppet_x/eos/provider'
|
37
|
+
|
38
|
+
Puppet::Type.type(:eos_snmp).provide(:eos) do
|
39
|
+
# Create methods that set the @property_hash for the #flush method
|
40
|
+
mk_resource_methods
|
41
|
+
|
42
|
+
# Mix in the api as instance methods
|
43
|
+
include PuppetX::Eos::EapiProviderMixin
|
44
|
+
|
45
|
+
# Mix in the api as class methods
|
46
|
+
extend PuppetX::Eos::EapiProviderMixin
|
47
|
+
|
48
|
+
def self.instances
|
49
|
+
provider_hash = { name: 'settings', ensure: :present }
|
50
|
+
provider_hash.merge!(node.api('snmp').get)
|
51
|
+
[new(provider_hash)]
|
52
|
+
end
|
53
|
+
|
54
|
+
def contact=(value)
|
55
|
+
node.api('snmp').set_contact(value: value)
|
56
|
+
@property_hash[:contact] = value
|
57
|
+
end
|
58
|
+
|
59
|
+
def location=(value)
|
60
|
+
node.api('snmp').set_location(value: value)
|
61
|
+
@property_hash[:location] = value
|
62
|
+
end
|
63
|
+
|
64
|
+
def chassis_id=(value)
|
65
|
+
node.api('snmp').set_chassis_id(value: value)
|
66
|
+
@property_hash[:chassis_id] = value
|
67
|
+
end
|
68
|
+
|
69
|
+
def source_interface=(value)
|
70
|
+
node.api('snmp').set_source_interface(value: value)
|
71
|
+
@property_hash[:source_interface] = value
|
72
|
+
end
|
73
|
+
|
74
|
+
def exists?
|
75
|
+
@property_hash[:ensure] == :present
|
76
|
+
end
|
77
|
+
end
|