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.
21 cat /dev
/zero | ssh-keygen
-q -N "" > /dev
/null
24 echo -e "\nInstalling osmclient ${OSMCLIENT}"
25 python3
-m pip
install git
+https
://osm.etsi.org
/gerrit
/osm
/osmclient@
${OSMCLIENT}
29 echo -e "\nDownloading packages ${PACKAGES}"
30 rm -rf ${PACKAGES_FOLDER}
31 git clone https
://osm.etsi.org
/gitlab
/vnf-onboarding
/osm-packages.git
${PACKAGES_FOLDER}
35 # Fetch conformance tests
36 git clone
--single-branch --branch ${NFV_TESTS_BRANCH} https
://forge.etsi.org
/rep
/nfv
/api-tests.git
/robot-systest
/conformance-tests
/repo
37 #python3 -m pip install -r /robot-systest/conformance-tests/repo/requirements.txt
38 python3
-m pip
install -r /robot-systest
/conformance-tests
/requirements.txt
44 while [ $attempts -ge 0 ] ; do
45 echo -e "\n$( date '+%F_%H:%M:%S' ) Creating K8s Cluster"
47 osm k8scluster-add
--creds ${K8S_CREDENTIALS} --version "v1" --vim ${VIM_TARGET} --k8s-nets "{\"net1\": \"${VIM_MGMT_NET}\"}" ${VIM_TARGET} --description "Robot cluster
" --skip-jujubundle
51 while [[ ${STATUS} != "ENABLED
" ]]
54 if [[ $i -eq 5 ]]; then
55 echo "K8s cluster stuck
for more than
50 seconds
:"
56 osm k8scluster-show ${VIM_TARGET}
57 osm k8scluster-delete ${VIM_TARGET}
62 STATUS=`osm k8scluster-list | grep ${VIM_TARGET} | awk '{print $8}'`
64 if [[ ${STATUS} = "ENABLED
" ]] ; then
69 if [ $attempts -lt 0 ] ; then
70 echo "K8s cluster failed to enter ENABLED state
"
77 while [ $attempts -ge 0 ] ; do
78 echo -e "\n$
( date '+%F_%H:%M:%S' ) Creating VIM
${VIM_TARGET}"
79 osm vim-create --name ${VIM_TARGET} --user ${OS_USERNAME} --password ${OS_PASSWORD} --tenant ${OS_PROJECT_NAME} \
80 --auth_url ${OS_AUTH_URL} --account_type openstack --description vim \
81 --config "{management_network_name
: ${VIM_MGMT_NET}, dataplane_physical_net
: ${DATAPLANE:-physnet2}}" || true
84 while [[ ${STATUS} != "ENABLED
" ]]
87 if [[ $i -eq 5 ]]; then
88 echo "VIM stuck
for more than
50 seconds as
: ${VIM_LIST}"
89 osm vim-delete --force ${VIM_TARGET}
94 VIM_LIST=`osm vim-list --long | grep ${VIM_TARGET}`
95 echo VIM status: ${VIM_LIST}
96 STATUS=`echo ${VIM_LIST} | grep -io ENABLED`
98 if [[ ${STATUS} = "ENABLED
" ]] ; then
103 if [ $attempts -lt 0 ] ; then
104 echo "VIM failed to enter ENABLED state
"
111 if [ -n "${SDNC_URL}" ]; then
112 osm sdnc-create --name sdnc-osm --type ${SDNC_TYPE} --user ${SDNC_USER} --password ${SDNC_PASSWORD} --url ${SDNC_URL}
115 while [ ${COUNTER} -lt 5 ] ; do
116 echo "Checking status of SDNC sdnc-osm to see
if it is enabled
"
117 STATUS=$(osm sdnc-show sdnc-osm |grep -io ENABLED)
118 if [ "${STATUS}" == "ENABLED
" ]; then
124 if [ "${STATUS}" == "ENABLED
" ]; then
127 echo "SDNC failed to enter ENABLED state
"
128 osm sdnc-show sdnc-osm
131 if [ -f /root/port-mapping.yaml ]; then
132 osm vim-update ${VIM_TARGET} --sdn_controller sdnc-osm --sdn_port_mapping /root/port-mapping.yaml
135 while [ ${COUNTER2} -lt 5 ] ; do
136 echo "Checking status of VIM
$VIM_TARGET to see
if there is port-mapping
"
137 osm vim-show $VIM_TARGET |grep sdn-port-mapping
138 if [ $? -eq 0 ]; then
145 if [ "${RESULT}" == "OK
" ]; then
146 echo "Port-mapping correctly added
"
148 echo "Port-mapping failed to be added
"
149 osm vim-show ${VIM_TARGET}
159 RUN_CONFORMANCE_TESTS=false
168 PACKAGES=$2 && download_packages
171 -o|--osmclientversion)
172 OSMCLIENT=$2 && install_osmclient
182 NFV_TESTS_BRANCH=$2 && download_tst010
183 RUN_CONFORMANCE_TESTS=true
190 docker run
--rm=true
-t osmtests
--env-file <env_file
> \\
191 -v <path_to_reports
>:/reports osmtests
\\
192 -v <path_to_clouds.yaml
>:/robot-systest
/clouds.yaml
\\
193 -v <path_to_kubeconfig
>:/root
/.kube
/config
\\
194 -o <osmclient_version
> \\
195 -p <package_branch
> \\
199 --env-file: It is the environmental
file where is described the OSM target and VIM
200 -o <osmclient_version
> [OPTIONAL
]: It is used to specify a particular osmclient version. Default
: latest
201 -p <package_branch
> [OPTIONAL
]: OSM packages repository branch. Default
: master
202 -t <testing_tags
> [OPTIONAL
]: Robot tests tags.
[sanity
, daily
, regression
, particular_test
]. Default
: sanity
203 -T <testing_branch
> [OPTIONAL
]: Run SOL005 Robot conformance tests
204 -c To create a VIM and K8s cluster
for the tests
207 <path_to_reports
> [OPTIONAL
]: It is the absolute path to reports location
in the
host
208 <path_to_clouds.yaml
> [OPTIONAL
]: It is the absolute path to the clouds.yaml
file in the
host
209 <path_to_kubeconfig
> [OPTIONAL
]: It is the kubeconfig
file to be used
for k8s clusters
"
214 echo "Error
: Unsupported flag
$1" >&2
224 eval set -- "$PARAMS"
226 if [[ -n "$BRANCH_NAME" ]]; then
227 PACKAGES=$BRANCH_NAME && download_packages
228 OSMCLIENT=$BRANCH_NAME && install_osmclient
232 if [ "$RUN_CONFORMANCE_TESTS" = true ] ; then
233 python3 ${ROBOT_DEVOPS_FOLDER}/conformance-tests/run_conformance_tests.py
236 if [[ -n "${TEST}" ]]; then
237 robot -d ${ROBOT_DEVOPS_FOLDER}/reports --tagstatinclude "cluster_*" -i ${TEST} ${ROBOT_DEVOPS_FOLDER}/testsuite/
239 echo "No
test was provided. Exiting...
"