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 ##############################################################################
13 if [ -n "$tmpDir" ]; then
25 tmpDir=`mktemp -d /tmp/deaXXXX`
27 export PATH=`dirname $0`:$PATH
30 error_exit "Argument error"
39 if [ -f "$deafile" ]; then
40 error_exit "$deafile already exists"
43 if [ `fuel env | tail -n +3 | grep -v '^$' | wc -l` -ne 1 ]; then
44 error_exit "Not exactly one environment"
46 envId=`fuel env | tail -n +3 | grep -v '^$' | awk '{ print $1 }'`
48 computeId=`fuel node | grep compute | grep True | head -1 | awk '{ print $1}'`
49 controllerId=`fuel node | grep controller | grep True | head -1 | awk '{ print $1}'`
51 if [ -z "$computeId" ]; then
52 error_exit "Could not find any compute node"
53 elif [ -z "$controllerId" ]; then
54 error_exit "Could not find any controller node"
57 fuel deployment --env $envId --download --dir $tmpDir > /dev/null || \
58 error_exit "Could not get deployment info"
59 fuel settings --env $envId --download --dir $tmpDir > /dev/null || \
60 error_exit "Could not get settings"
61 fuel network --env $envId --download --dir $tmpDir > /dev/null || \
62 error_exit "Could not get network settings"
64 echo "version: 1.0" > $deafile
65 echo "created: `date`" >> $deafile
66 if [ -n "$comment" ]; then
67 echo "comment: $comment" >> $deafile
70 reap_network_scheme.py $tmpDir/deployment_${envId}/*controller_${controllerId}.yaml $deafile controller || \
71 error_exit "Could not extract network scheme for controller"
72 reap_network_scheme.py $tmpDir/deployment_${envId}/compute_${computeId}.yaml $deafile compute || \
73 error_exit "Could not extract network scheme for controller"
74 reap_network_settings.py $tmpDir/network_${envId}.yaml $deafile network || \
75 error_exit "Could not extract network settings"
76 reap_settings.py $tmpDir/settings_${envId}.yaml $deafile settings || \
77 error_exit "Could not extract settings"
79 fuel node --node-id $controllerId --network --download --dir $tmpDir || \
80 error_exit "Could not get network info for node $controllerId"
81 reap_interfaces.py $tmpDir/node_${controllerId}/interfaces.yaml $deafile || \
82 error_exit "Could not extract interfaces"
85 echo "DEA file is available at $deafile"