Class: Rbeapi::Api::VxlanInterface
- Inherits:
-
BaseInterface
- Object
- Entity
- BaseInterface
- Rbeapi::Api::VxlanInterface
- Defined in:
- lib/rbeapi/api/interfaces.rb
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
-
#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.
-
#set_multicast_group(name = 'Vxlan1', opts = {}) ⇒ Boolean
Configures the vxlan multcast-group flood address to the specified value.
-
#set_source_interface(name = 'Vxlan1', opts = {}) ⇒ Boolean
Configures the vxlan source-interface to the specified value.
Methods inherited from BaseInterface
#create, #default, #delete, #set_description, #set_shutdown
Methods inherited from Entity
#configure, #get_block, #initialize, instance
Constructor Details
This class inherits a constructor from Rbeapi::Api::Entity
Instance Method Details
#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
1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 |
# File 'lib/rbeapi/api/interfaces.rb', line 1082 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 end |
#set_multicast_group(name = 'Vxlan1', opts = {}) ⇒ Boolean
Configures the vxlan multcast-group flood address to the specified value. The value should be a valid multicast address
1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 |
# File 'lib/rbeapi/api/interfaces.rb', line 1177 def set_multicast_group(name = 'Vxlan1', opts = {}) value = opts[:value] default = opts.fetch(:default, false) cmds = ["interface #{name}"] case default when true cmds << 'default vxlan multicast-group' when false cmds << (value ? "vxlan multicast-group #{value}" : \ 'no vxlan multtcast-group') end configure(cmds) end |
#set_source_interface(name = 'Vxlan1', opts = {}) ⇒ Boolean
Configures the vxlan source-interface to the specified value. This parameter should be a the interface identifier of the interface to act as the source for all Vxlan traffic
1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 |
# File 'lib/rbeapi/api/interfaces.rb', line 1146 def set_source_interface(name = 'Vxlan1', opts = {}) value = opts[:value] default = opts.fetch(:default, false) cmds = ["interface #{name}"] case default when true cmds << 'default vxlan source-interface' when false cmds << (value ? "vxlan source-interface #{value}" : \ 'no vxlan source-interface') end configure(cmds) end |