Class: Rbeapi::Api::VxlanInterface
- Inherits:
-
BaseInterface
- Object
- Entity
- BaseInterface
- Rbeapi::Api::VxlanInterface
- Defined in:
- lib/rbeapi/api/interfaces.rb
Overview
The VxlanInterface class manages all Vxlan interfaces on an EOS node.
Constant Summary collapse
- DEFAULT_SRC_INTF =
''- DEFAULT_MCAST_GRP =
''
Constants inherited from BaseInterface
BaseInterface::DEFAULT_INTF_DESCRIPTION
Instance Attribute Summary
Attributes inherited from Entity
Instance Method Summary collapse
-
#add_vtep(name, vtep) ⇒ Boolean
add_vtep adds a new VTEP endpoint to the global flood list for the specified interface.
-
#get(name = 'Vxlan1') ⇒ nil, Hash<String, String>
Returns the Vxlan interface configuration as a Ruby hash of key/value pairs from the nodes running configuration.
-
#remove_vlan(name, vlan) ⇒ Boolean
remove_vlan deletes a previously configured VLAN to VNI mapping on the specified interface.
-
#remove_vtep(name, vtep) ⇒ Boolean
remove_vtep deletes a VTEP endpoint from the global flood list for the specified interface.
-
#set_multicast_group(name = 'Vxlan1', opts = {}) ⇒ Boolean
Configures the vxlan multicast-group flood address to the specified value.
-
#set_source_interface(name = 'Vxlan1', opts = {}) ⇒ Boolean
Configures the vxlan source-interface to the specified value.
-
#set_udp_port(name, opts = {}) ⇒ Boolean
set_udp_port configures the Vxlan udp-port value in EOS for the specified interface name.
-
#update_vlan(name, vlan, vni) ⇒ Boolean
update_vlan creates a new vlan to vni mapping for the specified interface in the nodes current configuration.
Methods inherited from BaseInterface
#create, #default, #delete, #set_description, #set_shutdown
Methods inherited from Entity
#command_builder, #configure, #configure_interface, #get_block, #initialize, instance
Constructor Details
This class inherits a constructor from Rbeapi::Api::Entity
Instance Method Details
#add_vtep(name, vtep) ⇒ Boolean
add_vtep adds a new VTEP endpoint to the global flood list for the specified interface. If the VTEP endpoint is already configured, this method will still return successfully.
1158 1159 1160 |
# File 'lib/rbeapi/api/interfaces.rb', line 1158 def add_vtep(name, vtep) configure_interface(name, "vxlan flood vtep add #{vtep}") end |
#get(name = 'Vxlan1') ⇒ nil, Hash<String, String>
Returns the Vxlan interface configuration as a Ruby hash of key/value pairs from the nodes running configuration. This method extends the BaseInterface get method and adds the Vxlan specific attributes to the hash
The returned resource hash contains the following
* name: (String) The full interface name identifier
* type: (String) 'vxlan'
* description: (String) The configured interface description
* shutdown: (Boolean) The admin state of the interface
* source_interface: (String) The vxlan source-interface value
* multicast_group: (String) The vxlan multicast-group value
* udp_port: (Fixnum) The vxlan udp-port value
* flood_list: (Array) The list of VTEPs to flood traffic towards
959 960 961 962 963 964 965 966 967 968 969 970 971 |
# File 'lib/rbeapi/api/interfaces.rb', line 959 def get(name = 'Vxlan1') config = get_block("interface #{name}") return nil unless config response = super(name) response[:type] = 'vxlan' response.merge!(parse_source_interface(config)) response.merge!(parse_multicast_group(config)) response.merge!(parse_udp_port(config)) response.merge!(parse_flood_list(config)) response.merge!(parse_vlans(config)) response end |
#remove_vlan(name, vlan) ⇒ Boolean
remove_vlan deletes a previously configured VLAN to VNI mapping on the specified interface.
1207 1208 1209 |
# File 'lib/rbeapi/api/interfaces.rb', line 1207 def remove_vlan(name, vlan) configure_interface(name, "no vxlan vlan #{vlan} vni") end |
#remove_vtep(name, vtep) ⇒ Boolean
remove_vtep deletes a VTEP endpoint from the global flood list for the specified interface. If the VTEP endpoint specified is not configured, this method will still return successfully.
1173 1174 1175 |
# File 'lib/rbeapi/api/interfaces.rb', line 1173 def remove_vtep(name, vtep) configure_interface(name, "vxlan flood vtep remove #{vtep}") end |
#set_multicast_group(name = 'Vxlan1', opts = {}) ⇒ Boolean
Configures the vxlan multicast-group flood address to the specified value. The value should be a valid multicast address
1113 1114 1115 1116 |
# File 'lib/rbeapi/api/interfaces.rb', line 1113 def set_multicast_group(name = 'Vxlan1', opts = {}) commands = command_builder('vxlan multicast-group', opts) configure_interface(name, commands) end |
#set_source_interface(name = 'Vxlan1', opts = {}) ⇒ Boolean
Configures the vxlan source-interface to the specified value. This parameter should be the interface identifier of the interface to act as the source for all Vxlan traffic
1088 1089 1090 1091 |
# File 'lib/rbeapi/api/interfaces.rb', line 1088 def set_source_interface(name = 'Vxlan1', opts = {}) commands = command_builder('vxlan source-interface', opts) configure_interface(name, commands) end |
#set_udp_port(name, opts = {}) ⇒ Boolean
set_udp_port configures the Vxlan udp-port value in EOS for the specified interface name. If the enable keyword is false then the no keyword is used to configure the value. If the default option is provided and set to true, then the default keyword is used. If both options are provided, the default keyword will take precedence.
1142 1143 1144 1145 |
# File 'lib/rbeapi/api/interfaces.rb', line 1142 def set_udp_port(name, opts = {}) commands = command_builder('vxlan udp-port', opts) configure_interface(name, commands) end |
#update_vlan(name, vlan, vni) ⇒ Boolean
update_vlan creates a new vlan to vni mapping for the specified interface in the nodes current configuration
1190 1191 1192 |
# File 'lib/rbeapi/api/interfaces.rb', line 1190 def update_vlan(name, vlan, vni) configure_interface(name, "vxlan vlan #{vlan} vni #{vni}") end |