4 # Copyright 2019 Tech Mahindra Limited
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
22 # 1. Feature 7829: Mrityunjay Yadav, Jayant Madavi : MY00514913@techmahindra.com : 06-Sep-2019
23 # Entry script to start the vim, smoke, openstack_stage_4 and comprehensive test using Robot Framework as a Automation Test Framework
26 BASEDIR
=$
(dirname "$0")
27 TOPDIR
=$
(dirname "$BASEDIR")
28 DESCRIPTOR_DIR
=$TOPDIR/descriptor-packages
32 echo -e "\nInstalling robot requirements"
33 # installing python packages
34 pip
install haikunator requests robotframework robotframework-seleniumlibrary robotframework-requests robotframework-jsonlibrary
37 while getopts ":t:-:" o
; do
43 [[ "${OPTARG}" == "do_install" ]] && robot_prerequisite
&& continue
46 echo -e "Invalid option: '-$OPTARG'\n" >&2
52 if [[ -z $TEST ]]; then
53 printf "Test not provided. \nRunning default test: smoke\n"
57 if [[ "$TEST" == "vim" ]]; then
58 echo "Robot Framework Vim Test"
59 robot
-d $BASEDIR/reports
-i vim
$BASEDIR/testsuite
/
61 elif [[ "$TEST" == "smoke" ]]; then
62 echo "Robot Framework SMOKE test"
63 robot
--removekeywords tag
:vim-setup
--removekeywords WUKS
-d $BASEDIR/reports
-i smoke
$BASEDIR/testsuite
/
65 elif [[ "$TEST" == "sanity" ]]; then
66 echo "Robot Framework Cirros VNF Test"
67 mkdir
-p $BASEDIR/images
/cache
68 if [[ ! -z $OS_AUTH_URL ]]; then
69 (openstack image show cirros-0.3
.5-x86_64-disk.img
) ||
(wget
-r -nc http
://download.cirros-cloud.net
/0.3.5/cirros-0.3
.5-x86_64-disk.img
-O $BASEDIR/images
/cache
/cirros-0.3
.5-x86_64-disk.img
&& make $BASEDIR/images
/cache
/cirros-0.3
.5-x86_64-disk.img
&& openstack image create
--file $BASEDIR/images
/cache
/cirros-0.3
.5-x86_64-disk.img cirros-0.3
.5-x86_64-disk.img
)
71 if [[ ! -z $VCD_AUTH_URL ]]; then
72 # TODO: Check for image over VIM before downloading
73 if [[ ! -s $BASEDIR/images
/cache
/cirros-0.3
.5-x86_64-disk.img
]]; then
74 wget
-r -nc http
://download.cirros-cloud.net
/0.3.5/cirros-0.3
.5-x86_64-disk.img
-O $BASEDIR/images
/cache
/cirros-0.3
.5-x86_64-disk.img
76 ovf_converter
$BASEDIR/images
/cache
/cirros-0.3
.5-x86_64-disk.img
-n cirros
77 python
$TOPDIR/tools
/vmware_ovf_upload.py
$VCD_AUTH_URL $VCD_USERNAME $VCD_PASSWORD $VCD_ORGANIZATION $BASEDIR/images
/cache
/cirros.ovf
79 robot
--removekeywords tag
:vim-setup
--removekeywords WUKS
-d $BASEDIR/reports
-i sanity
$BASEDIR/testsuite
/
81 elif [[ "$TEST" == "comprehensive" ]]; then
82 echo "Robot Framework Comprehensive Test"
83 echo "Installing chrome driver and chrome for UI testing"
84 # installing chrome driver and chrome for UI testing
85 curl
-sS -o - https
://dl-ssl.google.com
/linux
/linux_signing_key.pub | apt-key add
-
86 echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc
/apt
/sources.list.d
/google-chrome.list
87 apt-get update
&& apt-get
-y install google-chrome-stable chromium-chromedriver
88 echo "Checking of image over VIMs"
89 mkdir
-p $BASEDIR/images
/cache
90 if [[ ! -z $OS_AUTH_URL ]]; then
91 (openstack image show ubuntu1604
) ||
(wget
-r -nc https
://cloud-images.ubuntu.com
/xenial
/current
/xenial-server-cloudimg-amd64-disk1.img
-O $BASEDIR/images
/cache
/xenial-server-cloudimg-amd64-disk1.img
&& make $BASEDIR/images
/cache
/xenial-server-cloudimg-amd64-disk1.img
&& openstack image create
--file $BASEDIR/images
/cache
/xenial-server-cloudimg-amd64-disk1.img ubuntu1604
)
92 (openstack image show hackfest3-mgmt
) ||
(wget
-r -nc https
://cloud-images.ubuntu.com
/xenial
/current
/xenial-server-cloudimg-amd64-disk1.img
-O $BASEDIR/images
/cache
/xenial-server-cloudimg-amd64-disk1.img
&& make $BASEDIR/images
/cache
/xenial-server-cloudimg-amd64-disk1.img
&& openstack image create
--file $BASEDIR/images
/cache
/xenial-server-cloudimg-amd64-disk1.img hackfest3-mgmt
)
94 if [[ ! -z $VCD_AUTH_URL ]]; then
95 # TODO: Check for image over VIM before downloading
96 if [[ ! -s $BASEDIR/images
/cache
/xenial-server-cloudimg-amd64-disk1.img
]]; then
97 wget
-r -nc https
://cloud-images.ubuntu.com
/xenial
/current
/xenial-server-cloudimg-amd64-disk1.img
-O $BASEDIR/images
/cache
/xenial-server-cloudimg-amd64-disk1.img
99 ovf_converter
$BASEDIR/images
/cache
/xenial-server-cloudimg-amd64-disk1.img
-n ubuntu1604
100 python
$TOPDIR/tools
/vmware_ovf_upload.py
$VCD_AUTH_URL $VCD_USERNAME $VCD_PASSWORD $VCD_ORGANIZATION $BASEDIR/images
/cache
/ubuntu1604.ovf
102 robot
--removekeywords tag
:vim-setup
--removekeywords WUKS
-d $BASEDIR/reports
-i comprehensive
$BASEDIR/testsuite
/
105 echo "wrong test provided"