diff --git a/data/grid5000/grid5000.json b/data/grid5000/grid5000.json index 50af87612e74f29fa87e43d3d53e178caaefa99c..6573a6a97c5b6f50f395ac93b78f7a4434e926bd 100644 --- a/data/grid5000/grid5000.json +++ b/data/grid5000/grid5000.json @@ -1,16 +1,4 @@ { - "ipv6": { - "site-indexes": { - "grenoble": 1, - "lille": 2, - "luxembourg": 3, - "lyon": 4, - "nancy": 5, - "nantes": 6, - "rennes": 7, - "sophia": 8 - } - }, "type": "grid", "uid": "grid5000" } \ No newline at end of file diff --git a/input/grid5000/ipv6.yaml b/input/grid5000/ipv6.yaml deleted file mode 100644 index cd94bb7cb445ea43895d2c55f13fa6960970616c..0000000000000000000000000000000000000000 --- a/input/grid5000/ipv6.yaml +++ /dev/null @@ -1,10 +0,0 @@ -ipv6: - site-indexes: - grenoble: 1 - lille: 2 - luxembourg: 3 - lyon: 4 - nancy: 5 - nantes: 6 - rennes: 7 - sophia: 8 diff --git a/lib/refrepo/input_loader.rb b/lib/refrepo/input_loader.rb index fd88f0401de56402c6313b593536012f8bc7c627..55442113b30a78d1039c8a156a2b87c10e9ea2a7 100644 --- a/lib/refrepo/input_loader.rb +++ b/lib/refrepo/input_loader.rb @@ -107,6 +107,17 @@ def add_kavlan_ips(h) end end +$ipv6_site_indexes = { + 'grenoble' => 1, + 'lille' => 2, + 'luxembourg' => 3, + 'lyon' => 4, + 'nancy' => 5, + 'nantes' => 6, + 'rennes' => 7, + 'sophia' => 8, +} + def add_ipv6(h) # for each node h['sites'].each_pair do |site_uid, hs| @@ -121,7 +132,7 @@ def add_ipv6(h) if not ip4.nil? # compute and assign IPv6 based on IPv4 ip6 = '2001:660:4406:' - ip6 += '%x' % h['ipv6']['site-indexes'][site_uid] + ip6 += '%x' % $ipv6_site_indexes[site_uid] ip6 += '00:' ip6 += '%x::' % ((ip4.split('.')[2].to_i & 0b1111) + 1) ip6 += '%x' % (ip4.split('.')[3].to_i)