summaryrefslogtreecommitdiffstats
path: root/utils/infra_setup/heat_template/vstf_heat_template/scp.sh
diff options
context:
space:
mode:
authorYiting.Li <liyiting@huawei.com>2016-01-09 09:50:27 +0800
committerJun Li <matthew.lijun@huawei.com>2016-01-10 03:42:22 +0000
commit0cb54276e3b9aa3d531e574493206e2e3b5e5018 (patch)
treec2fa2ac0b66c633249e05492875fd6e153d5d55c /utils/infra_setup/heat_template/vstf_heat_template/scp.sh
parenta08f4e7265637f994598f233c7713bfe877cada6 (diff)
JIRA: BOTTLENECKS-29
End to End test framework bottleneck vstf test suite ci script(currently progress is ok without vstf images) Change-Id: Ifdd1289b05d2916f6022c01c2581674e01bc022f Signed-off-by: Yiting.Li <liyiting@huawei.com> (cherry picked from commit b8eeff7c6fdbfa5fe308e37a09853a6bc1f20d60)
Diffstat (limited to 'utils/infra_setup/heat_template/vstf_heat_template/scp.sh')
-rw-r--r--utils/infra_setup/heat_template/vstf_heat_template/scp.sh93
1 files changed, 93 insertions, 0 deletions
diff --git a/utils/infra_setup/heat_template/vstf_heat_template/scp.sh b/utils/infra_setup/heat_template/vstf_heat_template/scp.sh
new file mode 100644
index 00000000..b3d6a27b
--- /dev/null
+++ b/utils/infra_setup/heat_template/vstf_heat_template/scp.sh
@@ -0,0 +1,93 @@
+function scp_cmd()
+{
+ local ip=$1
+ local usr=$2
+ local passwd=$3
+ srcfile=$4
+ desfile=$5
+ opt=$6
+ case $opt in
+ file)
+ expect -c "
+ spawn scp -r $srcfile $usr@$ip:$desfile
+ set timeout -1
+ expect {
+ \"*no)?\" {
+ send \"yes\r\"
+ exp_continue
+ }
+ \"*assword:*\" {
+ send \"$passwd\r\"
+ exp_continue
+ }
+ }
+ "
+ ;;
+ dir)
+ expect -c "
+ spawn scp -r $srcfile $usr@$ip:$desfile
+ set timeout -1
+ expect {
+ \"*no)?\" {
+ send \"yes\r\"
+ exp_continue
+ }
+ \"*assword:*\" {
+ send \"$passwd\r\"
+ exp_continue
+ }
+ }
+ "
+ ;;
+ *)
+ echo "err"
+ ;;
+ esac
+}
+
+function remote_scp_cmd()
+{
+ local ip=$1
+ local usr=$2
+ local passwd=$3
+ srcfile=$4
+ desfile=$5
+ opt=$6
+ case $opt in
+ file)
+ expect -c "
+ spawn scp -r $usr@$ip:$srcfile $desfile
+ set timeout -1
+ expect {
+ \"*no)?\" {
+ send \"yes\r\"
+ exp_continue
+ }
+ \"*assword:*\" {
+ send \"$passwd\r\"
+ exp_continue
+ }
+ }
+ "
+ ;;
+ dir)
+ expect -c "
+ spawn scp -r $usr@$ip:$srcfile $desfile
+ set timeout -1
+ expect {
+ \"*no)?\" {
+ send \"yes\r\"
+ exp_continue
+ }
+ \"*assword:*\" {
+ send \"$passwd\r\"
+ exp_continue
+ }
+ }
+ "
+ ;;
+ *)
+ echo "err"
+ ;;
+ esac
+}