Commit 0ae05b5a authored by Lucas Nussbaum's avatar Lucas Nussbaum Committed by Simon Delamare

New allocation for Nancy VLANs to fit all interfaces

parent 9108823f
......@@ -86,8 +86,10 @@ vlans:
local nancy graphite eth0 0 0 4 0
local nancy graphique eth0 0 0 8 0
local nancy graoully eth0 0 0 9 0
local nancy graoully eth0 0 0 10 0
local nancy grimoire eth0 0 0 10 0
local nancy grimoire eth1 0 0 10 10
local nancy grimoire eth2 0 0 10 20
local nancy grimoire eth3 0 0 10 30
local nancy grisou eth0 0 0 11 0
local nancy grisou eth1 0 0 11 60
local nancy grisou eth2 0 0 11 120
......@@ -124,17 +126,24 @@ vlans:
global lyon orion eth0 0 0 6 95
global lyon hercule eth1 0 0 6 99
global lyon nova eth0 0 0 6 111
global nancy grimoire eth0 0 0 7 0
global nancy grimoire eth1 0 0 7 8
global nancy grimoire eth2 0 0 7 16
global nancy grimoire eth3 0 0 7 24
global nancy grisou eth0 0 0 7 32
global nancy grisou eth1 0 0 7 83
global nancy grisou eth2 0 0 7 134
global nancy grisou eth3 0 0 7 185
global nancy grele eth0 0 0 8 0
global nancy griffon eth0 0 0 8 0
global nancy griffon eth0 0 0 8 14
global nancy graphene eth0 0 0 8 92
global nancy graphite eth0 0 0 8 236
global nancy grcinq eth0 0 0 9 0
global nancy grvingt eth0 0 0 9 48
global nancy graphique eth0 0 0 9 142
global nancy graoully eth0 0 0 9 148
global nancy grimoire eth0 0 0 9 165
global nancy grisou eth0 0 0 9 174
global nancy grimani eth0 0 0 9 225
global nancy grisou eth4 0 0 9 164
global nancy grimani eth0 0 0 9 215
global rennes paravance eth0 0 0 12 1
global rennes paravance eth1 0 0 12 73
global rennes parasilo eth0 0 0 12 145
......@@ -176,6 +185,9 @@ vlans:
routed nancy graphique eth0 0 16 9 0
routed nancy graoully eth0 0 16 10 0
routed nancy grimoire eth0 0 16 11 0
routed nancy grimoire eth1 0 16 11 10
routed nancy grimoire eth2 0 16 11 20
routed nancy grimoire eth3 0 16 11 30
routed nancy grisou eth0 0 16 12 0
routed nancy grisou eth1 0 16 12 60
routed nancy grisou eth2 0 16 12 120
......
......@@ -51,24 +51,8 @@ def load_yaml_file_hierarchy(directory = File.expand_path("../../input/grid5000/
add_kavlan_ips(global_hash)
return global_hash
end
# FIXME missing clusters / interfaces:
# NO VLAN OFFSET: ["local", "nancy", "grimoire", "eth1"] / grimoire-8-eth1-kavlan-1.nancy.grid5000.fr
# NO VLAN OFFSET: ["routed", "nancy", "grimoire", "eth1"] / grimoire-8-eth1-kavlan-4.nancy.grid5000.fr
# NO VLAN OFFSET: ["global", "nancy", "grimoire", "eth1"] / grimoire-8-eth1-kavlan-11.nancy.grid5000.fr
# NO VLAN OFFSET: ["local", "nancy", "grimoire", "eth2"] / grimoire-8-eth2-kavlan-1.nancy.grid5000.fr
# NO VLAN OFFSET: ["routed", "nancy", "grimoire", "eth2"] / grimoire-8-eth2-kavlan-4.nancy.grid5000.fr
# NO VLAN OFFSET: ["global", "nancy", "grimoire", "eth2"] / grimoire-8-eth2-kavlan-11.nancy.grid5000.fr
# NO VLAN OFFSET: ["local", "nancy", "grimoire", "eth3"] / grimoire-8-eth3-kavlan-1.nancy.grid5000.fr
# NO VLAN OFFSET: ["routed", "nancy", "grimoire", "eth3"] / grimoire-8-eth3-kavlan-4.nancy.grid5000.fr
# NO VLAN OFFSET: ["global", "nancy", "grimoire", "eth3"] / grimoire-8-eth3-kavlan-11.nancy.grid5000.fr
# NO VLAN OFFSET: ["global", "nancy", "grisou", "eth1"] / grisou-43-eth1-kavlan-11.nancy.grid5000.fr
# NO VLAN OFFSET: ["global", "nancy", "grisou", "eth2"] / grisou-43-eth2-kavlan-11.nancy.grid5000.fr
# NO VLAN OFFSET: ["global", "nancy", "grisou", "eth3"] / grisou-43-eth3-kavlan-11.nancy.grid5000.fr
# NO VLAN OFFSET: ["global", "nancy", "grisou", "eth4"] / grisou-43-eth4-kavlan-11.nancy.grid5000.fr
def sorted_vlan_offsets
offsets = load_yaml_file_hierarchy['vlans']['offsets'].split("\n").
map { |l| l = l.split(/\s+/) ; (4..7).each { |e| l[e] = l[e].to_i } ; l }
......@@ -93,7 +77,8 @@ def add_kavlan_ips(h)
vlan_base = h['vlans']['base']
vlan_offset = h['vlans']['offsets'].split("\n").map { |l| l = l.split(/\s+/) ; [ l[0..3], l[4..-1].inject(0) { |a, b| (a << 8) + b.to_i } ] }.to_h
h['sites'].each_pair do |site_uid, hs|
p site_uid
# forget about allocated ips for local vlans, since we are starting a new site
$allocated.delete_if { |k, v| v[3] == 'local' }
hs['clusters'].each_pair do |cluster_uid, hc|
hc['nodes'].each_pair do |node_uid, hn|
# raise "Old kavlan data in input/ for #{node_uid}" if hn.has_key?('kavlan') # FIXME uncomment after input/ is cleaned up
......@@ -106,7 +91,7 @@ def add_kavlan_ips(h)
base = IPAddress::IPv4::new(v['address']).to_u32
k = [type, site_uid, cluster_uid, iface]
if not vlan_offset.has_key?(k)
puts "Missing VLAN offset for #{k}"
raise "Missing VLAN offset for #{k}"
if GET_FROM_DNS
puts "Trying to get from DNS..."
next if $tried_resolv[k]
......@@ -123,9 +108,10 @@ def add_kavlan_ips(h)
end
next
end
ip = IPAddress::IPv4::parse_u32(base + vlan_offset[k] + node_id)
raise "IP already allocated: #{ip} (trying to add it to #{node_uid}-#{iface})" if $allocated[ip]
$allocated[ip] = true
ip = IPAddress::IPv4::parse_u32(base + vlan_offset[k] + node_id).to_s
a = [ site_uid, node_uid, iface, type, vlan ]
raise "IP already allocated: #{ip} (trying to add it to #{a} ; allocated to #{$allocated[ip]})" if $allocated[ip]
$allocated[ip] = a
hn['kavlan'][iface]["kavlan-#{vlan}"] = ip
end
end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment