Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
grid5000
reference-repository
Commits
c1bcd234
Commit
c1bcd234
authored
Apr 22, 2020
by
IMBERT Matthieu
Committed by
Baptiste Jonglez
Nov 12, 2020
Browse files
[ipv6] use global config instead of hardcoded value
parent
a633007f
Changes
2
Show whitespace changes
Inline
Side-by-side
input/grid5000/ipv6.yaml
View file @
c1bcd234
---
---
ipv6
:
ipv6
:
prefix
:
'
2001:660:4406'
site-indexes
:
site-indexes
:
grenoble
:
1
grenoble
:
1
lille
:
2
lille
:
2
...
...
lib/refrepo/input_loader.rb
View file @
c1bcd234
...
@@ -162,7 +162,7 @@ def add_ipv6(h)
...
@@ -162,7 +162,7 @@ def add_ipv6(h)
ip4
=
ipv6_adapters
.
values
[
0
][
'ip'
]
ip4
=
ipv6_adapters
.
values
[
0
][
'ip'
]
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
=
'2001:660:4406
:'
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
)
...
@@ -199,7 +199,7 @@ def add_kavlan_ipv6s(h)
...
@@ -199,7 +199,7 @@ def add_kavlan_ipv6s(h)
hn
[
'kavlan6'
][
iface
]
=
{}
hn
[
'kavlan6'
][
iface
]
=
{}
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
=
'2001:660:4406
:'
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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment