From 7eb85509e77cca19f23f0b0f9151ddd3794ef09b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20Gaidamour?= <jeremie.gaidamour@inria.fr>
Date: Mon, 18 Apr 2016 16:06:48 +0200
Subject: [PATCH] [nancy] Added ip/mac of pdus and MIC for the dhcp generator.
 Also fixed some MAC addresses.

---
 .../nancy/clusters/graphene/graphene.yaml     |  4 +-
 .../clusters/graphene/nodes/graphene-28.yaml  |  4 +-
 .../clusters/graphique/nodes/graphique-3.yaml |  3 +-
 .../clusters/graphique/nodes/graphique-4.yaml |  3 +-
 .../nancy/clusters/graphite/graphite.yaml     | 15 +++++++
 dev/input/grid5000/sites/nancy/pdus.yaml      | 39 +++++++++++++++++++
 dev/puppet/dhcp.rb                            | 18 +++++++++
 7 files changed, 80 insertions(+), 6 deletions(-)

diff --git a/dev/input/grid5000/sites/nancy/clusters/graphene/graphene.yaml b/dev/input/grid5000/sites/nancy/clusters/graphene/graphene.yaml
index c921f1a1342..0bc983250b1 100644
--- a/dev/input/grid5000/sites/nancy/clusters/graphene/graphene.yaml
+++ b/dev/input/grid5000/sites/nancy/clusters/graphene/graphene.yaml
@@ -714,8 +714,8 @@ nodes:
     network_adapters:
       bmc:
         ip: 172.17.64.29
-        #mac: 00:e0:81:d5:06:57 # should be check
-        mac: 00:e0:81:d5:07:f3
+        mac: 00:e0:81:d5:06:57 # according to the DHCP config
+        #mac: 00:e0:81:d5:07:f3
       eth0:
         ip6: fe80::2e0:81ff:fed5:654
   graphene-30:
diff --git a/dev/input/grid5000/sites/nancy/clusters/graphene/nodes/graphene-28.yaml b/dev/input/grid5000/sites/nancy/clusters/graphene/nodes/graphene-28.yaml
index bc3cc1167f5..6c5b0ed3387 100644
--- a/dev/input/grid5000/sites/nancy/clusters/graphene/nodes/graphene-28.yaml
+++ b/dev/input/grid5000/sites/nancy/clusters/graphene/nodes/graphene-28.yaml
@@ -56,8 +56,8 @@ graphene-28:
       driver: e1000e
       mountable: false
     bmc:
-      #mac: 00:e0:81:d5:07:f3 #TODO: should be check
-      mac: 00:e0:81:d5:06:5f
+      mac: 00:e0:81:d5:07:f3  # according to the DHCP config
+      #mac: 00:e0:81:d5:06:5f
       ip: 172.17.64.28
   storage_devices:
     sda:
diff --git a/dev/input/grid5000/sites/nancy/clusters/graphique/nodes/graphique-3.yaml b/dev/input/grid5000/sites/nancy/clusters/graphique/nodes/graphique-3.yaml
index 0842efba029..0bc5480e599 100644
--- a/dev/input/grid5000/sites/nancy/clusters/graphique/nodes/graphique-3.yaml
+++ b/dev/input/grid5000/sites/nancy/clusters/graphique/nodes/graphique-3.yaml
@@ -71,4 +71,5 @@ graphique-3:
       rate: 1000000000
     bmc:
       ip: 172.17.67.3
-      mac: 18:fb:7b:9b:68:d3
+      #mac: 18:fb:7b:9b:68:d3
+      mac: 18:fb:7b:9b:91:6D # according to the DHCP config
\ No newline at end of file
diff --git a/dev/input/grid5000/sites/nancy/clusters/graphique/nodes/graphique-4.yaml b/dev/input/grid5000/sites/nancy/clusters/graphique/nodes/graphique-4.yaml
index 6880d210b2b..68788bb9530 100644
--- a/dev/input/grid5000/sites/nancy/clusters/graphique/nodes/graphique-4.yaml
+++ b/dev/input/grid5000/sites/nancy/clusters/graphique/nodes/graphique-4.yaml
@@ -64,7 +64,8 @@ graphique-4:
       rate: 1000000000
     bmc:
       ip: 172.17.67.4
-      mac: 18:fb:7b:9b:91:6d
+      #mac: 18:fb:7b:9b:91:6d
+      mac: B0:83:FE:E4:69:D8 # according to the DHCP config
   chassis:
     serial: HYTRV42
     manufacturer: Dell Inc.
diff --git a/dev/input/grid5000/sites/nancy/clusters/graphite/graphite.yaml b/dev/input/grid5000/sites/nancy/clusters/graphite/graphite.yaml
index 41fc102e420..19454223807 100644
--- a/dev/input/grid5000/sites/nancy/clusters/graphite/graphite.yaml
+++ b/dev/input/grid5000/sites/nancy/clusters/graphite/graphite.yaml
@@ -125,6 +125,10 @@ nodes:
       sda:
         timeread: 959
         timewrite: 2205
+    mic:
+      ip: 172.16.68.5
+      mac: 4C:79:BA:5C:01:74
+
   graphite-2:
     chassis:
       serial: B6Q7NZ1
@@ -136,6 +140,10 @@ nodes:
       sda:
         timeread: 956
         timewrite: 1991
+    mic:
+      ip: 172.16.68.6 
+      mac: 4C:79:BA:5C:01:18
+
   graphite-3:
     chassis:
       serial: G5Q7NZ1
@@ -150,6 +158,10 @@ nodes:
       sda:
         timeread: 958
         timewrite: 2963
+    mic:
+      ip: 172.16.68.87
+      mac: 4C:79:BA:5C:01:AC
+
   graphite-4:
     chassis:
       serial: 66Q7NZ1
@@ -164,3 +176,6 @@ nodes:
       sda:
         timeread: 978
         timewrite: 3300
+    mic:
+      ip: 172.16.68.8 
+      mac: 4C:79:BA:5C:01:0C
diff --git a/dev/input/grid5000/sites/nancy/pdus.yaml b/dev/input/grid5000/sites/nancy/pdus.yaml
index caf15a1c46f..8e4477a1311 100644
--- a/dev/input/grid5000/sites/nancy/pdus.yaml
+++ b/dev/input/grid5000/sites/nancy/pdus.yaml
@@ -76,3 +76,42 @@ pdus:
           unit: W
           outlet_prefix_oid: iso.3.6.1.4.1.318.1.1.26.9.4.3.1.7
 
+  graoully-pdu1:
+    ip: 172.17.79.243
+    mac: 00:C0:B7:85:24:B7
+
+  graoully-pdu2:
+    ip:  172.17.79.244 
+    mac: 00:C0:B7:85:13:9C
+
+  graphene-pdu1:
+    ip:  172.17.79.208 
+    mac: 00:C0:B7:4D:A4:B0
+
+  graphene-pdu2:
+    ip:  172.17.79.209 
+    mac: 00:C0:B7:4D:A4:A3
+
+  graphene-pdu3:
+    ip:  172.17.79.210 
+    mac: 00:C0:B7:4D:A4:AA
+
+  graphene-pdu4:
+    ip:  172.17.79.211 
+    mac: 00:C0:B7:4D:A4:BC
+
+  graphene-pdu5:
+    ip:  172.17.79.212 
+    mac: 00:C0:B7:4D:A4:AC
+
+  graphene-pdu6:
+    ip:  172.17.79.213 
+    mac: 00:C0:B7:4D:A1:87
+
+  graphene-pdu7:
+    ip:  172.17.79.214 
+    mac: 00:C0:B7:4D:D7:87
+
+  graphene-pdu8:
+    ip:  172.17.79.215 
+    mac: 00:C0:B7:4D:A1:87
diff --git a/dev/puppet/dhcp.rb b/dev/puppet/dhcp.rb
index f3aab1e239d..f6ec733e3c6 100644
--- a/dev/puppet/dhcp.rb
+++ b/dev/puppet/dhcp.rb
@@ -60,6 +60,24 @@ global_hash["sites"].each { |site_uid, site_hash|
                     })
   }
 
+  # Relocate ip/mac info of pdus
+  site_hash['pdus'].each { |pdu_uid, pdu_hash|
+    if pdu_hash['ip'] && pdu_hash['mac']
+      pdu_hash['network_adapters'] ||= {}
+      pdu_hash['network_adapters']['pdu'] ||= {}
+      pdu_hash['network_adapters']['pdu']['ip']  = pdu_hash.delete('ip')
+      pdu_hash['network_adapters']['pdu']['mac'] = pdu_hash.delete('mac')
+    end
+  }
+
+  key = 'pdus'
+  write_dhcp_file({
+                    "filename"            => key + ".conf",
+                    "site_uid"            => site_uid,
+                    "nodes"               => site_hash['pdus'],
+                    "network_adapters"  => ['pdu'],
+                  })
+
   next
 
   # Other dhcp files
-- 
GitLab