Skip to content

Commit

Permalink
M #-: Support for in-network vxlan configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
rsmontero committed Jan 20, 2021
1 parent 1a347de commit 1ccb364
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
3 changes: 3 additions & 0 deletions share/etc/oned.conf
Original file line number Diff line number Diff line change
Expand Up @@ -1071,6 +1071,9 @@ INHERIT_VNET_ATTR = "IP_LINK_CONF"
INHERIT_VNET_ATTR = "EXTERNAL"
INHERIT_VNET_ATTR = "AWS_ALLOCATION_ID"
INHERIT_VNET_ATTR = "GATEWAY"
INHERIT_VNET_ATTR = "VXLAN_MODE"
INHERIT_VNET_ATTR = "VXLAN_TEP"
INHERIT_VNET_ATTR = "VXLAN_MC"

INHERIT_VNET_ATTR = "VCENTER_NET_REF"
INHERIT_VNET_ATTR = "VCENTER_SWITCH_NAME"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,7 @@ vntemplates:
phydev: 'eth0'
automatic_vlan_id: 'yes'
netrole: 'private'
vxlan_mode: 'evpn'
vxlan_tep: 'dev'
ip_link_conf: 'nolearning='
cluster_ids: "${cluster.0.id}"
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,7 @@ vntemplates:
phydev: 'bond0'
automatic_vlan_id: 'yes'
netrole: 'private'
vxlan_mode: 'evpn'
vxlan_tep: 'dev'
ip_link_conf: 'nolearning='
cluster_ids: "${cluster.0.id}"
14 changes: 10 additions & 4 deletions src/vnm_mad/remotes/vxlan/vxlan.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ module VXLAN
# This function creates and activate a VLAN device
############################################################################
def create_vlan_dev
vxlan_mode = @nic[:conf][:vxlan_mode] || 'multicast'
vxlan_mode = conf_attribute(@nic, :vxlan_mode, 'multicast')
group = ""

if vxlan_mode.downcase == 'evpn'
vxlan_tep = @nic[:conf][:vxlan_tep] || 'dev'
vxlan_tep = conf_attribute(@nic, :vxlan_tep, 'dev')

if vxlan_tep.downcase == 'dev'
tep = "dev #{@nic[:phydev]}"
Expand All @@ -37,9 +37,9 @@ def create_vlan_dev
end
else
begin
ipaddr = IPAddr.new @nic[:conf][:vxlan_mc]
ipaddr = IPAddr.new conf_attribute(@nic, :vxlan_mc, '239.0.0.0')
rescue
ipaddr = IPAddr.new "239.0.0.0"
ipaddr = IPAddr.new '239.0.0.0'
end

mc = ipaddr.to_i + @nic[@attr_vlan_id].to_i
Expand Down Expand Up @@ -105,4 +105,10 @@ def get_interface_first_ip(name)
end
return nil
end

def conf_attribute(nic, name, default)
return nic[name] unless nic[name].nil?

nic[:conf][name] || default
end
end

0 comments on commit 1ccb364

Please sign in to comment.