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"
34 if [ ! -f "$deaFile" ]; then
35 error_exit "Can't find $deaFile"
39 if [ `fuel env | tail -n +3 | grep -v '^$' | wc -l` -ne 1 ]; then
40 error_exit "Not exactly one environment"
42 envId=`fuel env | tail -n +3 | grep -v '^$' | awk '{ print $1 }'`
44 # Phase 1: Graft deployment information
45 if [ "a" == "b" ]; then
46 fuel deployment --env $envId --default --dir $tmpDir || \
47 error_exit "Could not dump environment"
49 for controller in `find $tmpDir -type f | grep -v compute`
51 transplant_network_scheme.py $controller $deaFile controller || \
52 error_exit "Failed to graft `basename $controller`"
55 for compute in `find $tmpDir -type f | grep compute`
57 transplant_network_scheme.py $compute $deaFile compute || \
58 error_exit "Failed to graft `basename $compute`"
61 fuel deployment --env $envId --upload --dir $tmpDir || \
62 error_exit "Could not upload environment"
64 # Phase 2: Graft interface information
66 for nodeId in `fuel node | grep True | awk '{ print $1}'`
69 fuel node --node-id $nodeId --network --download --dir $tmpDir || \
70 error_exit "Could not download node $nodeId"
72 transplant_interfaces.py ${tmpDir}/node_${nodeId}/interfaces.yaml $deaFile || \
73 error_exit "Failed to graft interfaces"
75 fuel node --node-id $nodeId --network --upload --dir $tmpDir || \
76 error_exit "Could not upload node $nodeId"