Class: PuppetX::Eos::Vxlan
- Inherits:
-
Object
- Object
- PuppetX::Eos::Vxlan
- Defined in:
- lib/puppet_x/eos/modules/vxlan.rb
Overview
The Vxlan provides an instance for managing vxlan virtual tunnel interfaces in EOS
Instance Method Summary collapse
-
#create ⇒ Boolean
Creates a new logical vxlan virtual interface in the running-config.
-
#default ⇒ Boolean
Defaults an existing vxlan logical interface from the running-config).
-
#delete ⇒ Boolean
Deletes an existing vxlan logical interface from the running-config.
-
#get ⇒ nil, Hash<String, String|Hash|Array>
Returns the vlan data for the provided id with the show vlan <id> command.
-
#initialize(api) ⇒ Vxlan
constructor
A new instance of Vxlan.
-
#set_multicast_group(opts = {}) ⇒ Boolean
Configures the multicast-group parameter for the Vxlan interface.
-
#set_source_interface(opts = {}) ⇒ Boolean
Configures the source-interface parameter for the Vxlan interface.
Constructor Details
#initialize(api) ⇒ Vxlan
Returns a new instance of Vxlan.
44 45 46 |
# File 'lib/puppet_x/eos/modules/vxlan.rb', line 44 def initialize(api) @api = api end |
Instance Method Details
#create ⇒ Boolean
Creates a new logical vxlan virtual interface in the running-config
65 66 67 |
# File 'lib/puppet_x/eos/modules/vxlan.rb', line 65 def create @api.config('interface vxlan 1') == [{}] end |
#default ⇒ Boolean
Defaults an existing vxlan logical interface from the running-config)
81 82 83 |
# File 'lib/puppet_x/eos/modules/vxlan.rb', line 81 def default @api.config('default interface vxlan 1') == [{}] end |
#delete ⇒ Boolean
Deletes an existing vxlan logical interface from the running-config
73 74 75 |
# File 'lib/puppet_x/eos/modules/vxlan.rb', line 73 def delete @api.config('no interface vxlan 1') == [{}] end |
#get ⇒ nil, Hash<String, String|Hash|Array>
Returns the vlan data for the provided id with the show vlan <id> command. If the id doesn’t exist then nil is returned
57 58 59 |
# File 'lib/puppet_x/eos/modules/vxlan.rb', line 57 def get @api.enable('show interfaces vxlan 1') end |
#set_multicast_group(opts = {}) ⇒ Boolean
Configures the multicast-group parameter for the Vxlan interface
116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/puppet_x/eos/modules/vxlan.rb', line 116 def set_multicast_group(opts = {}) value = opts[:value] default = opts[:default] || false cmds = ['interface vxlan 1'] case default when true cmds << 'default vxlan multicast-group' when false cmds << (value.nil? ? 'no vxlan multicast-group' : \ "vxlan multicast-group #{value}") end @api.config(cmds) == [{}, {}] end |
#set_source_interface(opts = {}) ⇒ Boolean
Configures the source-interface parameter for the Vxlan interface
93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/puppet_x/eos/modules/vxlan.rb', line 93 def set_source_interface(opts = {}) value = opts[:value] default = opts[:default] || false cmds = ['interface vxlan 1'] case default when true cmds << 'default vxlan source-interface' when false cmds << (value.nil? ? 'no vxlan source-interface' : \ "vxlan source-interface #{value}") end @api.config(cmds) == [{}, {}] end |