Updates docs for SR1 with final revision
[genesis.git] / fuel / prototypes / auto-deploy / create_templates / generate_fuel_node_info.py
1 #!/usr/bin/python
2 ##############################################################################
3 # Copyright (c) 2015 Ericsson AB and others.
4 # stefan.k.berg@ericsson.com
5 # jonas.bjurel@ericsson.com
6 # All rights reserved. This program and the accompanying materials
7 # are made available under the terms of the Apache License, Version 2.0
8 # which accompanies this distribution, and is available at
9 # http://www.apache.org/licenses/LICENSE-2.0
10 ##############################################################################
11
12 import yaml
13 import re
14 import sys
15 import os
16
17 if len(sys.argv) != 3:
18     sys.stderr.write("Usage: "+sys.argv[0]+" <nodeid> <dhafile>\n")
19     sys.exit(1)
20
21 nodeId=int(sys.argv[1])
22 dhafile=sys.argv[2]
23
24 f1 = open("/etc/fuel/astute.yaml", 'r')
25 doc = yaml.load(f1)
26 f1.close()
27
28 dhaMac = doc["ADMIN_NETWORK"]["mac"]
29
30 # Write contribution to DHA file
31 f2 = open(dhafile, 'a')
32 f2.write("- id: " + str(nodeId) + "\n")
33 f2.write("  pxeMac: " + dhaMac + "\n")
34 f2.write("  isFuel: yes\n")
35 f2.close()
36