Mentions légales du service

Skip to content
Snippets Groups Projects
Commit db25d0a9 authored by IMBERT Matthieu's avatar IMBERT Matthieu Committed by Baptiste Jonglez
Browse files

[ipv6] refactoring: rename var

parent c1bcd234
No related branches found
No related tags found
No related merge requests found
--- ---
ipv6: ipv6:
prefix: '2001:660:4406' prefix: '2001:660:4406'
site-indexes: site_indexes:
grenoble: 1 grenoble: 1
lille: 2 lille: 2
luxembourg: 3 luxembourg: 3
......
...@@ -163,7 +163,7 @@ def add_ipv6(h) ...@@ -163,7 +163,7 @@ def add_ipv6(h)
ipv6_adapters.each_with_index do |(_iface, nah), idx| ipv6_adapters.each_with_index do |(_iface, nah), idx|
# compute and assign IPv6 based on IPv4 of the first adapter # compute and assign IPv6 based on IPv4 of the first adapter
ip6 = h['ipv6']['prefix'] + ':' ip6 = h['ipv6']['prefix'] + ':'
ip6 += '%x' % h['ipv6']['site-indexes'][site_uid] ip6 += '%x' % h['ipv6']['site_indexes'][site_uid]
ip6 += '00:' ip6 += '00:'
ip6 += '%x' % ((ip4.split('.')[2].to_i & 0b1111) + 1) ip6 += '%x' % ((ip4.split('.')[2].to_i & 0b1111) + 1)
if idx > 0 if idx > 0
...@@ -200,7 +200,7 @@ def add_kavlan_ipv6s(h) ...@@ -200,7 +200,7 @@ def add_kavlan_ipv6s(h)
hn['kavlan'][iface].each_key do |kvl| hn['kavlan'][iface].each_key do |kvl|
kvl_id = kvl.split('-')[1].to_i kvl_id = kvl.split('-')[1].to_i
ip6 = h['ipv6']['prefix'] + ':' ip6 = h['ipv6']['prefix'] + ':'
ip6 += '%x' % h['ipv6']['site-indexes'][site_uid] ip6 += '%x' % h['ipv6']['site_indexes'][site_uid]
ip6 += '%x:' % (kvl_id + 0x80) ip6 += '%x:' % (kvl_id + 0x80)
ip6 += '%x' % ((ip4.split('.')[2].to_i & 0b1111) + 1) ip6 += '%x' % ((ip4.split('.')[2].to_i & 0b1111) + 1)
if idx > 0 if idx > 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment