diff options
author | Stefan K. Berg <stefan.k.berg@ericsson.com> | 2015-05-12 15:54:39 +0200 |
---|---|---|
committer | Stefan K. Berg <stefan.k.berg@ericsson.com> | 2015-05-12 15:56:16 +0200 |
commit | 129ffe434c010508f26416983835e80dec0cc1d8 (patch) | |
tree | 7ba38349007080e0825fdcd99936ef452cd120a0 /fuel/prototypes/deploy/create_templates | |
parent | 82acf9fc006912f50ca799dee2489b53c712d936 (diff) |
Corrected directory name
It was never meant for the first level to be called anything
else than auto-deploy - really needed to get rid of the
terrible .../deploy/deploy/deploy.sh!
JIRA
Change-Id: Ifa68e5922ca8da9cc72df963e8138a8fc0b8b63b
Signed-off-by: Stefan K. Berg <stefan.k.berg@ericsson.com>
Diffstat (limited to 'fuel/prototypes/deploy/create_templates')
8 files changed, 0 insertions, 500 deletions
diff --git a/fuel/prototypes/deploy/create_templates/create_templates.sh b/fuel/prototypes/deploy/create_templates/create_templates.sh deleted file mode 100755 index 8f6101b..0000000 --- a/fuel/prototypes/deploy/create_templates/create_templates.sh +++ /dev/null @@ -1,184 +0,0 @@ -#!/bin/bash -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# stefan.k.berg@ericsson.com -# jonas.bjurel@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -cleanup () { - if [ -n "$tmpDir" ]; then - rm -Rf $tmpDir - fi -} - -trap cleanup exit - -error_exit () { - echo "Error: $@" >&2 - exit 1 -} - -tmpDir=`mktemp -d /tmp/deaXXXX` - -export PATH=`dirname $0`:$PATH - -if [ $# -lt 2 ]; then - error_exit "`basename $0`: <deafile> <dhafile> <comment>" -fi - -deafile=$1 -dhafile=$2 -shift 2 - -if [ $# -ne 0 ]; then - comment="$@" -else - comment="" -fi - -if [ -f $deafile ]; then - error_exit "$deafile already exists" -elif [ -f $dhafile ]; then - error_exit "$dhafile already exists" -fi - -# Create headers - -cat >$deafile << EOF -title: Deployment Environment Adapter (DEA) -# DEA API version supported -version: 1.1 -created: `date` -comment: $comment -EOF - -cat >$dhafile << EOF -title: Deployment Hardware Adapter (DHA) -# DHA API version supported -version: 1.1 -created: `date` -comment: $comment - -# Adapter to use for this definition -adapter: - -# Node list. -# Mandatory properties are id and role. -# The MAC address of the PXE boot interface for Fuel is not -# mandatory to be defined. -# All other properties are adapter specific. - -EOF - -if [ `fuel env | tail -n +3 | grep -v '^$' | wc -l` -ne 1 ]; then - error_exit "Not exactly one environment" -fi -envId=`fuel env | tail -n +3 | grep -v '^$' | awk '{ print $1 }'` - -computeId=`fuel node | grep compute | grep True | head -1 | awk '{ print $1}'` -controllerId=`fuel node | grep controller | grep True | head -1 | awk '{ print $1}'` - -if [ -z "$computeId" ]; then - error_exit "Could not find any compute node" -elif [ -z "$controllerId" ]; then - error_exit "Could not find any controller node" -fi - -fuel deployment --env $envId --download --dir $tmpDir > /dev/null || \ - error_exit "Could not get deployment info" -fuel settings --env $envId --download --dir $tmpDir > /dev/null || \ - error_exit "Could not get settings" -fuel network --env $envId --download --dir $tmpDir > /dev/null || \ - error_exit "Could not get network settings" - -# Create node structure for DEA mapping to the DHA -# Note! Nodes will be renumbered to always start with id 1 -echo "nodes:" >> $deafile -echo "nodes:" >> $dhafile -minNode=`fuel node | tail -n +3 | sed 's/ .*//' | sort -n | head -1` -for realNodeId in `fuel node | tail -n +3 | sed 's/ .*//' | sort -n` -do - nodeId=$[realNodeId - minNode + 1] - role=`fuel node --node-id $realNodeId | tail -n +3 | cut -d "|" -f 7 | sed 's/ //g'` || \ - error_exit "Could not get role for node $realNodeId" - - if [ -z "$role" ]; then - error_exit "Node $realNodeId has no role - is this environment really deployed?" - fi - - fuel node --node-id $realNodeId --network --download --dir $tmpDir > /dev/null || \ - error_exit "Could not get network info for node $controllerId" - - generate_node_info.py $nodeId $role $tmpDir/node_${realNodeId}/interfaces.yaml $dhafile | \ - grep -v "^nodes:" >> $deafile || \ - error_exit "Could not extract info for node $realNodeId" -done - -cat >>$dhafile <<EOF -# Adding the Fuel node as node id $[nodeId + 1] which may not be correct - please -# adjust as needed. -EOF -generate_fuel_node_info.py $[nodeId +1] $dhafile || \ - error_exit "Could not extract info for the Fuel node" - -# Environment mode -echo "environment_mode: `fuel env | tail -n +3 | cut -d "|" -f 4 | sed 's/ //g' | sed 's/ha_compact/ha/'`" \ - >>$deafile || error_exit "Could not get environment mode" - -echo "environment_name: `fuel env | tail -n +3 | cut -d "|" -f 3 | sed 's/ //g'`" \ - >>$deafile || error_exit "Could not get environment mode" - -reap_fuel_settings.py $deafile fuel || \ - error_exit "Could not extract Fuel node settings" - -# TODO: Potentially move the network scheme into each node of the DEA nodes structure -# TODO: instead (this may be too generic to support all node types) -reap_network_scheme.py $tmpDir/deployment_${envId}/*controller_${controllerId}.yaml \ - $deafile controller || error_exit "Could not extract network scheme for controller" - -# TODO: Potentially move the network scheme into each node of the DEA nodes structure -# TODO: instead (this may be too generic to support all node types) -reap_network_scheme.py $tmpDir/deployment_${envId}/compute_${computeId}.yaml $deafile \ - compute || error_exit "Could not extract network scheme for compute" - -reap_opnfv_astute.py $tmpDir/deployment_${envId}/*controller_${controllerId}.yaml \ - $tmpDir/deployment_${envId}/compute_${computeId}.yaml ${deafile} || \ - error_exit "Could not extract opnfv info from astute" - -reap_network_settings.py $tmpDir/network_${envId}.yaml $deafile network || \ - error_exit "Could not extract network settings" - - -reap_settings.py $tmpDir/settings_${envId}.yaml $deafile settings || \ - error_exit "Could not extract settings" - -# Last part of the DHA file -cat >>$dhafile << EOF - -# Deployment power on strategy -# all: Turn on all nodes at once. There will be no correlation -# between the DHA and DEA node numbering. MAC addresses -# will be used to select the node roles though. -# sequence: Turn on the nodes in sequence starting with the lowest order -# node and wait for the node to be detected by Fuel. Not until -# the node has been detected and assigned a role will the next -# node be turned on. -powerOnStrategy: sequence - -# If fuelCustomInstall is set to true, Fuel is assumed to be installed by -# calling the DHA adapter function "dha_fuelCustomInstall()" with two -# arguments: node ID and the ISO file name to deploy. The custom install -# function is then to handle all necessary logic to boot the Fuel master -# from the ISO and then return. -# Allowed values: true, false - -fuelCustomInstall: false -EOF - - -echo "DEA file is available at $deafile" -echo "DHA file is available at $dhafile (this is just a template)" diff --git a/fuel/prototypes/deploy/create_templates/generate_fuel_node_info.py b/fuel/prototypes/deploy/create_templates/generate_fuel_node_info.py deleted file mode 100755 index 845d2ab..0000000 --- a/fuel/prototypes/deploy/create_templates/generate_fuel_node_info.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/python -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# stefan.k.berg@ericsson.com -# jonas.bjurel@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -import yaml -import re -import sys -import os - -if len(sys.argv) != 3: - sys.stderr.write("Usage: "+sys.argv[0]+" <nodeid> <dhafile>\n") - sys.exit(1) - -nodeId=int(sys.argv[1]) -dhafile=sys.argv[2] - -f1 = open("/etc/fuel/astute.yaml", 'r') -doc = yaml.load(f1) -f1.close() - -dhaMac = doc["ADMIN_NETWORK"]["mac"] - -# Write contribution to DHA file -f2 = open(dhafile, 'a') -f2.write("- id: " + str(nodeId) + "\n") -f2.write(" pxeMac: " + dhaMac + "\n") -f2.write(" isFuel: yes\n") -f2.close() - diff --git a/fuel/prototypes/deploy/create_templates/generate_node_info.py b/fuel/prototypes/deploy/create_templates/generate_node_info.py deleted file mode 100755 index e4a7dd3..0000000 --- a/fuel/prototypes/deploy/create_templates/generate_node_info.py +++ /dev/null @@ -1,61 +0,0 @@ -#!/usr/bin/python -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# stefan.k.berg@ericsson.com -# jonas.bjurel@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -import yaml -import re -import sys -import os - -if len(sys.argv) != 5: - sys.stderr.write("Usage: "+sys.argv[0]+" <nodeid> <role> <infile> <dhafile>\n") - sys.exit(1) - -infile = sys.argv[3] -if not os.path.exists(infile): - sys.stderr.write("ERROR: The file "+infile+" could not be opened\n") - sys.exit(1) - -nodeId=int(sys.argv[1]) -nodeRole=sys.argv[2] -dhafile=sys.argv[4] - -f1 = open(infile, 'r') -doc = yaml.load(f1) -f1.close() - -out = {} - -node = {} -node["id"] = nodeId -node["role"] = nodeRole -node["interfaces"] = {} - - -for interface in doc: - iface = {} - networks = [] - for network in interface["assigned_networks"]: - networks.append(network["name"]) - if network["name"] == "management": - dhaMac = interface["mac"] - if networks: - node["interfaces"][interface["name"]] = networks - -out = [node] - -sys.stdout.write(yaml.dump(out, default_flow_style=False)) - -# Write contribution to DHA file -f2 = open(dhafile, 'a') -f2.write("- id: " + str(nodeId) + "\n") -f2.write(" pxeMac: " + dhaMac + "\n") -f2.close() - diff --git a/fuel/prototypes/deploy/create_templates/reap_fuel_settings.py b/fuel/prototypes/deploy/create_templates/reap_fuel_settings.py deleted file mode 100755 index a8ddba9..0000000 --- a/fuel/prototypes/deploy/create_templates/reap_fuel_settings.py +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/bin/python -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# stefan.k.berg@ericsson.com -# jonas.bjurel@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -import yaml -import re -import sys -import os - -if len(sys.argv) != 3: - sys.stderr.write("Usage: "+sys.argv[0]+" <outfile> <outnamespace>\n") - sys.exit(1) - -infile = "/etc/fuel/astute.yaml" -if not os.path.exists(infile): - sys.stderr.write("ERROR: The file "+infile+" could not be opened\n") - sys.exit(1) - -outfile = sys.argv[1] -namespace = sys.argv[2] - -f1 = open(infile, 'r') -doc = yaml.load(f1) -f1.close() - -out = {} -out[namespace] = {} - -# Delete unique data -del(doc["ADMIN_NETWORK"]["mac"]) -del(doc["ADMIN_NETWORK"]["interface"]) - -for copy in [ "ADMIN_NETWORK", "HOSTNAME", "DNS_DOMAIN", "DNS_SEARCH", - "DNS_UPSTREAM", "NTP1", "NTP2", "NTP3", "ADMIN_NETWORK", "FUEL_ACCESS" ]: - out[namespace][copy] = doc[copy] - -f2 = open(outfile, 'a') -f2.write(yaml.dump(out, default_flow_style=False)) -f2.close() - diff --git a/fuel/prototypes/deploy/create_templates/reap_network_scheme.py b/fuel/prototypes/deploy/create_templates/reap_network_scheme.py deleted file mode 100755 index 19c18bf..0000000 --- a/fuel/prototypes/deploy/create_templates/reap_network_scheme.py +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/python -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# stefan.k.berg@ericsson.com -# jonas.bjurel@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -import yaml -import re -import sys -import os - -if len(sys.argv) != 4: - sys.stderr.write("Usage: "+sys.argv[0]+" <infile> <outfile> <outnamespace>\n") - sys.exit(1) - -infile = sys.argv[1] -if not os.path.exists(infile): - sys.stderr.write("ERROR: The file "+infile+" could not be opened\n") - sys.exit(1) - -outfile = sys.argv[2] -namespace = sys.argv[3] - -f1 = open(infile, 'r') -doc = yaml.load(f1) -f1.close() - -out = {} -out[namespace] = doc["network_scheme"]["transformations"] -f2 = open(outfile, 'a') -f2.write(yaml.dump(out, default_flow_style=False)) -f2.close() - diff --git a/fuel/prototypes/deploy/create_templates/reap_network_settings.py b/fuel/prototypes/deploy/create_templates/reap_network_settings.py deleted file mode 100755 index b03a063..0000000 --- a/fuel/prototypes/deploy/create_templates/reap_network_settings.py +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/python -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# stefan.k.berg@ericsson.com -# jonas.bjurel@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -import yaml -import re -import sys -import os - -if len(sys.argv) != 4: - sys.stderr.write("Usage: "+sys.argv[0]+" <infile> <outfile> <outnamespace>\n") - sys.exit(1) - -infile = sys.argv[1] -if not os.path.exists(infile): - sys.stderr.write("ERROR: The file "+infile+" could not be opened\n") - sys.exit(1) - -outfile = sys.argv[2] -namespace = sys.argv[3] - -f1 = open(infile, 'r') -doc = yaml.load(f1) -f1.close() - -for nw in doc["networks"]: - try: - del nw["id"] - except: - pass - - try: - del nw["group_id"] - except: - pass - -out = {} -out[namespace] = doc -f2 = open(outfile, 'a') -f2.write(yaml.dump(out, default_flow_style=False)) -f2.close() diff --git a/fuel/prototypes/deploy/create_templates/reap_opnfv_astute.py b/fuel/prototypes/deploy/create_templates/reap_opnfv_astute.py deleted file mode 100755 index 55fad05..0000000 --- a/fuel/prototypes/deploy/create_templates/reap_opnfv_astute.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/python -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# stefan.k.berg@ericsson.com -# jonas.bjurel@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -import yaml -import re -import sys -import os - -if len(sys.argv) != 4: - sys.stderr.write("Usage: "+sys.argv[0]+" <controllerfile> <computefile> <outfile>\n") - sys.exit(1) - -controller = sys.argv[1] -if not os.path.exists(controller): - sys.stderr.write("ERROR: The file "+controller+" could not be opened\n") - sys.exit(1) - -compute = sys.argv[2] -if not os.path.exists(compute): - sys.stderr.write("ERROR: The file "+compute+" could not be opened\n") - sys.exit(1) - -outfile = sys.argv[3] - -f_controller = open(controller, 'r') -doc_controller = yaml.load(f_controller) -f_controller.close() - -f_compute = open(compute, 'r') -doc_compute = yaml.load(f_compute) -f_compute.close() - -out = {} -out["opnfv"] = {} -out["opnfv"]["controller"] = doc_controller["opnfv"] -out["opnfv"]["compute"] = doc_compute["opnfv"] - -f2 = open(outfile, 'a') -f2.write(yaml.dump(out, default_flow_style=False)) -f2.close() - diff --git a/fuel/prototypes/deploy/create_templates/reap_settings.py b/fuel/prototypes/deploy/create_templates/reap_settings.py deleted file mode 100755 index 22794d2..0000000 --- a/fuel/prototypes/deploy/create_templates/reap_settings.py +++ /dev/null @@ -1,37 +0,0 @@ -#!/usr/bin/python -############################################################################## -# Copyright (c) 2015 Ericsson AB and others. -# stefan.k.berg@ericsson.com -# jonas.bjurel@ericsson.com -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -import yaml -import re -import sys -import os - -if len(sys.argv) != 4: - sys.stderr.write("Usage: "+sys.argv[0]+" <infile> <outfile> <outnamespace>\n") - sys.exit(1) - -infile = sys.argv[1] -if not os.path.exists(infile): - sys.stderr.write("ERROR: The file "+infile+" could not be opened\n") - sys.exit(1) - -outfile = sys.argv[2] -namespace = sys.argv[3] - -f1 = open(infile, 'r') -doc = yaml.load(f1) -f1.close() - -out = {} -out[namespace] = doc -f2 = open(outfile, 'a') -f2.write(yaml.dump(out, default_flow_style=False)) -f2.close() |