Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
reference-repository
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
GitLab upgrade completed. Current version is 17.11.3.
Show more breadcrumbs
grid5000
reference-repository
Commits
31230546
Commit
31230546
authored
5 years ago
by
Lucas Nussbaum
Committed by
Teddy Valette
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[dev] Add allocation of IPv4 addresses
parent
6245f391
Branches
Branches containing commit
No related tags found
1 merge request
!102
Ipv4 second
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
input/grid5000/ipv4.yaml
+71
-0
71 additions, 0 deletions
input/grid5000/ipv4.yaml
lib/refrepo/gen/reference-api.rb
+4
-4
4 additions, 4 deletions
lib/refrepo/gen/reference-api.rb
lib/refrepo/input_loader.rb
+32
-1
32 additions, 1 deletion
lib/refrepo/input_loader.rb
with
107 additions
and
5 deletions
input/grid5000/ipv4.yaml
0 → 100644
+
71
−
0
View file @
31230546
---
ipv4
:
base
:
172.16.0.0
sites_offsets
:
|-
grenoble 0 0 16 0
lille 0 0 32 0
lyon 0 0 48 0
nancy 0 0 64 0
rennes 0 0 96 0
sophia 0 0 128 0
luxembourg 0 0 176 0
nantes 0 0 192 0
iface_offsets
:
|-
grenoble yeti eth0 0 0 3 0
grenoble dahu eth0 0 0 4 0
grenoble troll eth0 0 0 6 0
grenoble troll eth1 0 0 6 100
lille chifflot eth0 0 0 4 0
lille chifflot eth1 0 0 4 100
lille chetemi eth0 0 0 5 0
lille chetemi eth1 0 0 5 100
lille chifflet eth0 0 0 6 0
lille chifflet eth1 0 0 6 100
lille chiclet eth0 0 0 7 0
lille chiclet eth1 0 0 7 100
luxembourg granduc eth0 0 0 0 0
luxembourg granduc eth1 0 0 0 100
luxembourg granduc eth2 0 0 0 200
luxembourg petitprince eth0 0 0 1 0
luxembourg petitprince eth1 0 0 1 100
lyon sagittaire eth1 0 0 1 0
lyon taurus eth0 0 0 0 0
lyon orion eth0 0 0 2 0
lyon hercule eth1 0 0 3 0
lyon nova eth0 0 0 4 0
lyon gemini eth0 0 0 5 0
lyon pyxis eth0 0 0 6 0
nancy graffiti eth2 0 0 0 0
nancy gros eth0 0 0 2 0
nancy gros eth1 0 0 2 128
nancy graphique eth0 0 0 3 0
nancy graphite eth0 0 0 4 0
nancy graoully eth0 0 0 6 0
nancy grimoire eth0 0 0 7 0
nancy grimoire eth1 0 0 7 50
nancy grimoire eth2 0 0 7 100
nancy grimoire eth3 0 0 7 150
nancy grisou eth0 0 0 8 0
nancy grisou eth1 0 0 8 100
nancy grisou eth2 0 0 8 200
nancy grisou eth3 0 0 9 100
nancy grisou eth4 0 0 9 200
nancy grimani eth0 0 0 9 0
nancy grele eth0 0 0 10 0
nancy grcinq eth0 0 0 11 0
nancy grvingt eth0 0 0 12 0
nancy grue eth0 0 0 13 0
nantes econome eth0 0 0 0 0
nantes ecotype eth0 0 0 1 0
nantes ecotype eth1 0 0 2 0
rennes parapide eth0 0 0 2 0
rennes parapluie eth1 0 0 3 0
rennes paranoia eth0 0 0 4 0
rennes paranoia eth1 0 0 4 100
rennes paranoia eth2 0 0 4 200
rennes paravance eth0 0 0 0 0
rennes paravance eth1 0 0 0 100
rennes parasilo eth0 0 0 1 0
rennes parasilo eth1 0 0 1 100
sophia suno eth0 0 0 2 0
sophia uvb eth0 0 0 4 0
This diff is collapsed.
Click to expand it.
lib/refrepo/gen/reference-api.rb
+
4
−
4
View file @
31230546
...
@@ -111,11 +111,11 @@ def generate_reference_api
...
@@ -111,11 +111,11 @@ def generate_reference_api
# remove kavlan information for now
# remove kavlan information for now
global_hash
.
delete
(
'vlans'
)
global_hash
.
delete
(
'vlans'
)
# remove software info
# also remove software info
global_hash
.
delete
(
'software'
)
global_hash
.
delete
(
'software'
)
# remove ipv4 info
# also remove ipv6 info
global_hash
.
delete
(
'ipv4'
)
# remove ipv6 info
global_hash
.
delete
(
'ipv6'
)
global_hash
.
delete
(
'ipv6'
)
grid_path
=
Pathname
.
new
(
refapi_path
)
grid_path
=
Pathname
.
new
(
refapi_path
)
...
...
This diff is collapsed.
Click to expand it.
lib/refrepo/input_loader.rb
+
32
−
1
View file @
31230546
...
@@ -50,7 +50,10 @@ def load_yaml_file_hierarchy(directory = File.expand_path("../../input/grid5000/
...
@@ -50,7 +50,10 @@ def load_yaml_file_hierarchy(directory = File.expand_path("../../input/grid5000/
# populate each node with its IPv6
# populate each node with its IPv6
add_ipv6
(
global_hash
)
add_ipv6
(
global_hash
)
# populate each node with its kavlan IPs
# populate each node with its IPv4 addresses
add_ipv4
(
global_hash
)
# populate each node with its kavlan IPv4 IPs
add_kavlan_ips
(
global_hash
)
add_kavlan_ips
(
global_hash
)
add_kavlan_ipv6s
(
global_hash
)
add_kavlan_ipv6s
(
global_hash
)
...
@@ -111,6 +114,34 @@ def add_kavlan_ips(h)
...
@@ -111,6 +114,34 @@ def add_kavlan_ips(h)
end
end
end
end
def
add_ipv4
(
h
)
allocated
=
{}
base
=
IPAddress
::
IPv4
::
new
(
h
[
'ipv4'
][
'base'
]).
to_u32
sites_offsets
=
h
[
'ipv4'
][
'sites_offsets'
].
split
(
"
\n
"
).
map
{
|
l
|
l
=
l
.
split
(
/\s+/
)
;
[
l
[
0
],
l
[
1
..-
1
].
inject
(
0
)
{
|
a
,
b
|
(
a
<<
8
)
+
b
.
to_i
}
]
}.
to_h
iface_offsets
=
h
[
'ipv4'
][
'iface_offsets'
].
split
(
"
\n
"
).
map
{
|
l
|
l
=
l
.
split
(
/\s+/
)
;
[
l
[
0
..
2
],
l
[
3
..-
1
].
inject
(
0
)
{
|
a
,
b
|
(
a
<<
8
)
+
b
.
to_i
}
]
}.
to_h
h
[
'sites'
].
each_pair
do
|
site_uid
,
hs
|
hs
[
'clusters'
].
each_pair
do
|
cluster_uid
,
hc
|
hc
[
'nodes'
].
each_pair
do
|
node_uid
,
hn
|
raise
"Node hash for
#{
node_uid
}
is nil"
if
hn
.
nil?
node_id
=
node_uid
.
split
(
'-'
)[
1
].
to_i
hn
[
'network_adapters'
].
each_pair
do
|
iface
,
v
|
# only allocate mountable ethernet interfaces
next
if
not
(
v
[
'mountable'
]
and
v
[
'interface'
]
==
'Ethernet'
)
k
=
[
site_uid
,
cluster_uid
,
iface
]
if
not
iface_offsets
.
has_key?
(
k
)
raise
"Missing IPv4 information for
#{
k
}
"
end
ip
=
IPAddress
::
IPv4
::
parse_u32
(
base
+
sites_offsets
[
site_uid
]
+
iface_offsets
[
k
]
+
node_id
).
to_s
a
=
[
site_uid
,
node_uid
,
iface
]
raise
"IP already allocated:
#{
ip
}
(trying to add it to
#{
a
}
; allocated to
#{
allocated
[
ip
]
}
)"
if
allocated
[
ip
]
allocated
[
ip
]
=
a
v
[
'ip'
]
=
ip
end
end
end
end
end
def
add_ipv6
(
h
)
def
add_ipv6
(
h
)
# for each node
# for each node
h
[
'sites'
].
each_pair
do
|
site_uid
,
hs
|
h
[
'sites'
].
each_pair
do
|
site_uid
,
hs
|
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment