Scripts fixes and updates
Related-PROD: PROD-34629
Change-Id: I62ff687b6edf14d54fb39a4c9da5badb6ff301c6
diff --git a/cleanup.sh b/cleanup.sh
deleted file mode 100644
index c39774f..0000000
--- a/cleanup.sh
+++ /dev/null
@@ -1,333 +0,0 @@
-#!/bin/bash
-export OS_INTERFACE='admin'
-mask='cvp\|s_rally\|rally_\|tempest_\|tempest-|\spt-'
-stack_alt=false
-stack_regex='api-[0-9]+-[a-z]+'
-dry_run=false
-clean_projects=false
-make_servers_active=false
-serial=false
-batch_size=10
-# granularity values: days,hours,minutes,seconds
-stack_granularity=days
-stack_granularity_value=1
-
-function show_help {
- printf "Resource cleaning script\nMask is: %s\n\t-h, -?\tShow this help\n" ${mask}
- printf "\t-t\tDry run mode, no cleaning done\n"
- printf "\t-P\tForce cleaning of projects\n"
- printf "\t-s\tUse single thread of 'openstack' client for cleanup\n"
- printf "\t-S\tSet servers to ACTIVE before deletion (bare metal reqiured)\n"
- printf "\t-f\tForce stack cleanup with an additional mask of '%s'\n" ${stack_regex}
- printf "\t-F\tForce purge deleted stacks. Batch size: %s, >%s %s\n" ${batch_size} ${stack_granularity_value} ${stack_granularity}
-}
-
-OPTIND=1 # Reset in case getopts has been used previously in the shell.
-while getopts "h?:tsSPfF" opt; do
- case "$opt" in
- h|\?)
- show_help
- exit 0
- ;;
- t) dry_run=true
- printf "Running in dry-run mode\n"
- ;;
- s) serial=true
- printf "Single threaded mode enabled\n"
- ;;
- S) make_servers_active=true
- printf "Servers will be set to ACTIVE before deletion\n"
- ;;
- P) clean_projects=true
- printf "Project cleanning enabled\n"
- ;;
- f) stack_alt=true
- printf "Cleaning stacks using additional mask '%s'\n" ${stack_regex}
- ;;
- F) purge_deleted_stacks=true
- printf "Purging stacks deleted >$stack_granularity_value $stack_granularity ago enabled, batch size %s\n" $stack_batch_size
- ;;
- esac
-done
-
-shift $((OPTIND-1))
-[ "${1:-}" = "--" ] && shift
-
-### Execute collected commands and flush the temp file
-function _clean_and_flush {
- if [ "$dry_run" = true ] ; then
- return 0
- fi
- if [ -s ${cmds} ]; then
- if [ "${serial}" = false ] ; then
- echo "... processing $(cat ${cmds} | wc -l) commands, worker threads ${batch_size}"
- cat ${cmds} | tr '\n' '\0' | xargs -P ${batch_size} -n 1 -0 echo | openstack
- #cat ${cmds} | openstack
- truncate -s 0 ${cmds}
- else
- echo "... processing $(cat ${cmds} | wc -l) commands"
- cat ${cmds} | tr '\n' '\0' | xargs -P 1 -n 1 -0 echo | openstack
- truncate -s 0 ${cmds}
- fi
- fi
-}
-
-function _clean_and_flush_cinder {
- if [ "$dry_run" = true ] ; then
- return 0
- fi
- if [ -s ${cmds} ]; then
- if [ "${serial}" = false ] ; then
- echo "... processing $(cat ${cmds} | wc -l) commands, worker threads ${batch_size}"
- cat ${cmds} | tr '\n' '\0' | xargs -I{} -P ${batch_size} -n 1 -0 /bin/bash -c 'cinder --os-volume-api-version 3.43 {}'
- #cat ${cmds} | cinder --os-volume-api-version 3.43
- truncate -s 0 ${cmds}
- else
- echo "... processing $(cat ${cmds} | wc -l) commands"
- cat ${cmds} | tr '\n' '\0' | xargs -I{} -P 1 -n 1 -0 /bin/bash -c 'cinder --os-volume-api-version 3.43 {}'
- truncate -s 0 ${cmds}
- fi
- fi
-}
-
-### Users
-function _clean_users {
- users=( $(openstack user list -c ID -c Name -f value | grep ${mask} | cut -d' ' -f1) )
- echo "-> ${#users[@]} users containing '${mask}' found"
- printf "%s\n" ${users[@]} | xargs -I{} echo user delete {} >>${cmds}
- _clean_and_flush
-}
-
-### Roles
-function _clean_roles {
- roles=( $(openstack role list -c ID -c Name -f value | grep ${mask} | cut -d' ' -f1) )
- echo "-> ${#roles[@]} roles containing '${mask}' found"
- printf "%s\n" ${roles[@]} | xargs -I{} echo role delete {} >>${cmds}
- _clean_and_flush
-}
-
-### Projects
-function _clean_projects {
- projects=( $(openstack project list -c ID -c Name -f value | grep ${mask} | cut -d' ' -f1) )
- echo "-> ${#projects[@]} projects containing '${mask}' found"
- printf "%s\n" ${projects[@]} | xargs -I{} echo project delete {} >>${cmds}
- _clean_and_flush
-}
-
-### Servers
-function _clean_servers {
- servers=( $(openstack server list -c ID -c Name -f value --all | grep "${mask}" | cut -d' ' -f1) )
- echo "-> ${#servers[@]} servers containing '${mask}' found"
- if [ "$make_servers_active" = true ]; then
- printf "%s\n" ${servers[@]} | xargs -I{} echo server set --state active {} >>${cmds}
- fi
- printf "%s\n" ${servers[@]} | xargs -I{} echo server delete {} >>${cmds}
- _clean_and_flush
-}
-
-### Reset snapshot state and delete
-function _clean_snapshots {
- snapshots=( $(openstack volume snapshot list --all -c ID -c Name -f value | grep ${mask} | cut -d' ' -f1) )
- echo "-> ${#snapshots[@]} snapshots containing '${mask}' found"
- printf "%s\n" ${snapshots[@]} | xargs -I{} echo volume snapshot set --state available {} >>${cmds}
- printf "%s\n" ${snapshots[@]} | xargs -I{} echo volume snapshot delete {} >>${cmds}
- _clean_and_flush
-}
-
-function _clean_volumes {
- volumes=( $(openstack volume list --all -c ID -c Name -c Type -f value | grep ${mask} | cut -d' ' -f1) )
- echo "-> ${#volumes[@]} volumes containing '${mask}' found"
- printf "%s\n" ${volumes[@]} | xargs -I{} echo volume set --state available {} >>${cmds}
- printf "%s\n" ${volumes[@]} | xargs -I{} echo volume delete {} >>${cmds}
- _clean_and_flush
-}
-
-function _clean_volume_groups {
- groups=( $(cinder --os-volume-api-version 3.43 group-list --all-tenants 1 | grep ${mask} | awk '{print $2}') )
- echo "-> ${#groups[@]} groups containing '${mask}' found"
- printf "%s\n" ${groups[@]} | xargs -I{} echo group-delete {} >>${cmds}
- _clean_and_flush_cinder
-}
-
-function _clean_volume_group_types {
- group_types=( $(cinder --os-volume-api-version 3.43 group-type-list | grep ${mask} | awk '{print $2}') )
- echo "-> ${#group_types[@]} group types containing '${mask}' found"
- printf "%s\n" ${group_types[@]} | xargs -I{} echo group-type-delete {} >>${cmds}
- _clean_and_flush_cinder
-}
-
-### Volume types
-function _clean_volume_types {
- vtypes=( $(openstack volume type list -c ID -c Name -f value | grep ${mask} | cut -d' ' -f1) )
- echo "-> ${#vtypes[@]} volume types containing '${mask}' found"
- printf "%s\n" ${vtypes[@]} | xargs -I{} echo volume type delete {} >>${cmds}
- _clean_and_flush
-}
-
-### Images
-function _clean_images {
- images=( $(openstack image list -c ID -c Name -f value | grep ${mask} | cut -d' ' -f1) )
- echo "-> ${#images[@]} images containing '${mask}' found"
- printf "%s\n" ${images[@]} | xargs -I{} echo image delete {} >>${cmds}
- _clean_and_flush
-}
-
-### Sec groups
-function _clean_sec_groups {
- projects=( $(openstack project list -c ID -c Name -f value | grep ${mask} | cut -d' ' -f1) )
- sgroups=( $(printf "%s\n" ${projects[@]} | xargs -I{} /bin/bash -c "openstack security group list -c ID -c Project -f value | grep {} | cut -d' ' -f1") )
- echo "-> ${#sgroups[@]} security groups for project containing '${mask}' found"
- printf "%s\n" ${sgroups[@]} | xargs -I{} echo security group delete {} >>${cmds}
- _clean_and_flush
-
- # Additional step to cleanup 'hanged' groups
- sgroups_raw=( $(openstack security group list -c ID -c Name -f value | grep ${mask} | cut -d' ' -f1) )
- echo "-> ${#sgroups_raw[@]} security groups for '${mask}' found"
- printf "%s\n" ${sgroups_raw[@]} | xargs -I{} echo security group delete {} >>${cmds}
- _clean_and_flush
-}
-
-### Keypairs
-function _clean_keypairs {
- keypairs=( $(openstack keypair list -c Name -f value | grep ${mask}) )
- echo "-> ${#keypairs[@]} keypairs containing '${mask}' found"
- printf "%s\n" ${keypairs[@]} | xargs -I{} echo keypair delete {} >>${cmds}
- _clean_and_flush
-}
-
-### Routers and Networks
-function _clean_routers_and_networks {
- routers=( $(openstack router list -c ID -c Name -f value | grep ${mask} | cut -d ' ' -f1) )
- if [ ${#routers[@]} -eq 0 ]; then
- echo "-> No routers containing '${mask}' found"
- else
- echo "-> ${#routers[@]} routers containing '${mask}' found"
- echo "... unsetting gateways"
- printf "%s\n" ${routers[@]} | xargs -I{} echo router unset --external-gateway {} >>${cmds}
- _clean_and_flush
-
- echo "... removing ports"
- for router in ${routers[@]}; do
- r_ports=( $(openstack port list --router ${router} -f value -c ID) )
- if [ ${#r_ports[@]} -eq 0 ]; then
- echo "... no ports to unplug for ${router}"
- else
- for r_port in ${r_ports[@]}; do
- echo "... queued removal of port '${r_port}' from router '${router}'"
- echo "router remove port ${router} ${r_port}" >>${cmds}
- done
- fi
- done
- _clean_and_flush
-
- echo "... deleting routers"
- printf "%s\n" ${routers[@]} | xargs -I{} echo router delete {} >>${cmds}
- _clean_and_flush
- fi
-
- networks=( $(openstack network list | grep "${mask}" | cut -d' ' -f2) )
- if [ ${#networks[@]} -eq 0 ]; then
- echo "-> No networks containing '${mask}' found"
- else
- ports=()
- subnets=()
- for((idx=0;idx<${#networks[@]};idx++)) do
- ports+=( $(openstack port list --network ${networks[idx]} -c ID -f value) )
- subnets+=( $(openstack subnet list --network ${networks[idx]} -c ID -f value) )
- echo "-> $((${idx}+1)) of ${#networks[@]}, total ${#ports[@]} ports, ${#subnets[@]} subnets"
- done
- printf "%s\n" ${ports[@]} | xargs -I{} echo port delete {} >>${cmds}
- printf "%s\n" ${subnets[@]} | xargs -I{} echo subnet delete {} >>${cmds}
- echo network delete ${networks[@]} >>${cmds}
- echo "-> ${#routers[@]} routers, ${#ports[@]} ports, ${#subnets[@]} subnets, ${#networks[@]} networks"
- fi
- _clean_and_flush
-}
-
-### Regions
-function _clean_regions {
- regions=( $(openstack region list -c Region -f value | grep ${mask}) )
- echo "-> ${#regions[@]} regions containing '${mask}' found"
- printf "%s\n" ${regions[@]} | xargs -I{} echo region delete {} >>${cmds}
- _clean_and_flush
-}
-
-### Stacks
-function _clean_stacks {
- # By default openstack denies use of global_index for everyone.
- # In case you want to have handy cleanup, consider updating policy.json here:
- # root@ctl0x:~# cat -n /etc/heat/policy.json | grep global_index
- # 48 "stacks:global_index": "rule:deny_everybody",
- # 73 "software_configs:global_index": "rule:deny_everybody",
- # After this you will be able to use --all option
-
- stacks=( $(openstack stack list --nested --hidden -c ID -c "Stack Name" -f value | grep ${mask} | cut -d' ' -f1) )
- echo "-> ${#stacks[@]} stacks containing '${mask}' found"
- printf "%s\n" ${stacks[@]} | xargs -I{} echo stack check {} >>${cmds}
- printf "%s\n" ${stacks[@]} | xargs -I{} echo stack delete -y {} >>${cmds}
- _clean_and_flush
-
- if [ "$stack_alt" = true ]; then
- stacks=( $(openstack stack list --nested --hidden -c ID -c "Stack Name" -f value | grep -E ${stack_regex} | cut -d' ' -f1) )
- echo "-> ${#stacks[@]} stacks containing '${stack_regex}' found"
- printf "%s\n" ${stacks[@]} | xargs -I{} echo stack check {} >>${cmds}
- printf "%s\n" ${stacks[@]} | xargs -I{} echo stack delete -y {} >>${cmds}
- _clean_and_flush
- fi
-
- if [ "$purge_deleted_stacks" = true ]; then
- heat-manage purge_deleted -g ${stack_granularity} -b ${batch_size} ${stack_granularity_value} | wc -l | xargs -I{} echo "-> Purged {} stacks"
- fi
-}
-
-### Containers
-function _clean_containers {
- containers=( $(openstack container list --all -c ID -c Name -f value | grep ${mask} | cut -d' ' -f1) )
- echo "-> ${#containers[@]} containers containing '${mask}' found"
- printf "%s\n" ${containers[@]} | xargs -I{} echo container delete {} >>${cmds}
- _clean_and_flush
-}
-
-function _clean_flavors {
- flavors=( $(openstack flavor list --all -c ID -c Name -f value | grep ${mask} | cut -d' ' -f1) )
- echo "-> ${#flavors[@]} flavors containing '${mask}' found"
- printf "%s\n" ${flavors[@]} | xargs -I{} echo flavor delete {} >>${cmds}
- _clean_and_flush
-}
-
-###################
-### Main
-###################
-# temp file for commands
-cmds=$(mktemp)
-trap "rm -f ${cmds}" EXIT
-echo "Using tempfile: '${cmds}'"
-
-# Consider cleaning contrail resources carefully
-# ...and only after that - clean projects
-
-_clean_stacks
-_clean_servers
-_clean_flavors
-_clean_users
-_clean_roles
-_clean_snapshots
-_clean_volumes
-_clean_volume_groups
-_clean_volume_group_types
-_clean_volume_types
-_clean_images
-_clean_sec_groups
-_clean_keypairs
-_clean_routers_and_networks
-_clean_regions
-_clean_containers
-
-# project cleaning disabled by default
-# Coz cleaning Contrail with no projects is a hard task
-if [ "$clean_projects" = true ]; then
- _clean_projects
-fi
-
-# remove temp file
-rm ${cmds}
diff --git a/configure.sh b/configure.sh
index 1b7892b..322ee01 100755
--- a/configure.sh
+++ b/configure.sh
@@ -57,7 +57,7 @@
# default tempest version is 18.0.0 now, unless
# it is explicitly defined in pipelines
if [ "$tempest_version" == "" ]; then
- tempest_version='18.0.0'
+ tempest_version='master'
fi
if [ "$PROXY" == "offline" ]; then
rally verify create-verifier --name tempest_verifier_$sub_name --type tempest --source $TEMPEST_REPO --system-wide --version $tempest_version
@@ -86,7 +86,9 @@
glance_image() {
current_path=$(pwd)
# fetch image with exact name: testvm
-IMAGE_NAME2=testvm
+IMAGE_NAME=cvp.cirros.35
+IMAGE_NAME2=cvp.cirros.40
+IMAGE_REF=$(glance image-list | grep "\b${IMAGE_NAME}\b" | awk '{print $2}')
IMAGE_REF2=$(glance image-list | grep "\b${IMAGE_NAME2}\b" | awk '{print $2}')
if [ "${IMAGE_REF2}" == "" ]; then
if [ "$PROXY" != "offline" ]; then
@@ -108,7 +110,10 @@
IMAGE_REF2=""
fi
fi
+
+sed -i 's/${IMAGE_REF}/'$IMAGE_REF'/g' $current_path/cvp-configuration/tempest/tempest_ext.conf
sed -i 's/${IMAGE_REF2}/'$IMAGE_REF2'/g' $current_path/cvp-configuration/tempest/tempest_ext.conf
+sed -i 's/${IMAGE_NAME}/'$IMAGE_NAME'/g' $current_path/cvp-configuration/tempest/tempest_ext.conf
sed -i 's/${IMAGE_NAME2}/'$IMAGE_NAME2'/g' $current_path/cvp-configuration/tempest/tempest_ext.conf
}
diff --git a/k8s/docker-mos-toolset-full b/k8s/docker-mos-toolset-full
index 5a1200d..161437d 100644
--- a/k8s/docker-mos-toolset-full
+++ b/k8s/docker-mos-toolset-full
@@ -18,7 +18,7 @@
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
apt-get install -y python3-pip python3-venv vim git iperf3 mtr htop iputils-ping traceroute tcpdump wget iproute2 curl screen
-RUN pip3 install --no-cache-dir python-openstackclient python-neutronclient python-heatclient pyghmi python-octaviaclient tempestparser python-ironicclient aodhclient gnocchiclient
+RUN pip3 install --no-cache-dir python-openstackclient python-neutronclient python-heatclient pyghmi python-octaviaclient tempestparser python-ironicclient aodhclient gnocchiclient python-barbicanclient python-glanceclient
RUN git clone https://gerrit.mcp.mirantis.com/mcp/cvp-configuration /opt/res-files && \
git clone http://gerrit.mcp.mirantis.com/mcp/cfg-checker /opt/cfg-checker && \
diff --git a/k8s/qa-ubuntu.yaml b/k8s/qa-ubuntu.yaml
index c67b54f..d3f3541 100644
--- a/k8s/qa-ubuntu.yaml
+++ b/k8s/qa-ubuntu.yaml
@@ -65,7 +65,8 @@
name: keystone-keystone-admin
imagePullPolicy: IfNotPresent
name: ubuntu
- image: 127.0.0.1:44301/general/external/docker.io/library/ubuntu:bionic-20201119
+ #image: 127.0.0.1:44301/general/external/docker.io/library/ubuntu:bionic-20201119
+ image: savex13/toolset:latest
volumeMounts:
- mountPath: /artifacts
name: qa-pv-a
diff --git a/k8s/rally-files/init-rally.sh b/k8s/rally-files/init-rally.sh
index f18349a..aef2b4f 100644
--- a/k8s/rally-files/init-rally.sh
+++ b/k8s/rally-files/init-rally.sh
@@ -21,7 +21,7 @@
# Configure kubernetes
# Check and prepare kubespec file
if [ ! -f /artifacts/kubespec_generated.yaml ]; then
- sudo bash /artifacts/rally-files/gen_kubespec.sh /artifacts/mos-kubeconf.yaml
+ sudo bash /artifacts/rally-files/gen_kubespec.sh /artifacts/mos-kubeconfig.yaml
fi
# Create kubernetes env
rally env create --name kubernetes --spec /artifacts/kubespec_generated.yaml
diff --git a/scripts/cmp_check.sh b/scripts/cmp_check.sh
index 823c0b4..9da254a 100644
--- a/scripts/cmp_check.sh
+++ b/scripts/cmp_check.sh
@@ -125,6 +125,8 @@
function vm_create() {
[ ! "$silent" = true ] && set -x
openstack server create --nic net-id=${fixed_net_left_id} --image ${cirros35_id} --flavor ${flavor_tiny_id} --key-name ${keypair_id} --security-group ${secgroup_all_id} --availability-zone ${zone}:${1} ${2} 2>${tmp_out} >/dev/null
+ #openstack server create --nic net-id=${fixed_net_left_id} --image ${ubuntu16_id} --flavor ${flavor_high_id} --key-name ${keypair_id} --security-group ${secgroup_all_id} --availability-zone ${zone}:${1} ${2} 2>${tmp_out} >/dev/null
+ #openstack server create --nic net-id=${fixed_net_right_id} --image ${ubuntu16_id} --flavor ${flavor_high_id} --key-name ${keypair_id} --security-group ${secgroup_all_id} --availability-zone ${zone}:${1} ${2} 2>${tmp_out} >/dev/null
#openstack server create --nic net-id=${fixed_net_left_id} --image ${ubuntuspt_id} --flavor ${flavor_high_id} --key-name ${keypair_id} --security-group ${secgroup_all_id} --availability-zone ${zone}:${1} ${2} 2>${tmp_out} >/dev/null
[ ! 0 -eq $? ] && errors+=("${1}/${2}: $(cat ${tmp_out})")
set +x
diff --git a/scripts/prepare.sh b/scripts/prepare.sh
deleted file mode 100644
index 2521d7e..0000000
--- a/scripts/prepare.sh
+++ /dev/null
@@ -1,394 +0,0 @@
-#!/bin/bash
-export OS_INTERFACE='admin'
-
-# local vars
-name_prefix=cvp
-filename=${name_prefix}.manifest
-rcfile=${name_prefix}rc
-huge_pages=false
-logfile=prepare.log
-
-# Project, User, Roles
-project=${name_prefix}.project
-user=${name_prefix}.user
-admin=${name_prefix}.admin
-password=mcp1234
-
-# Security group
-sg_all=${name_prefix}.sg.all
-sg_icmp=${name_prefix}.sg.icmp
-sg_ssh=${name_prefix}.sg.ssh
-sg_iperf=${name_prefix}.sg.perf
-
-# Testkey
-key=${name_prefix}_testkey
-
-# Flavors: tiny, small (cirrus and migration), medium (ubuntu and volume/stress activities)
-flavor_t=${name_prefix}.tiny
-flavor_s=${name_prefix}.small
-flavor_m=${name_prefix}.medium
-flavor_h=${name_prefix}.high
-
-# Fixed Networks (2, for testing router interconnection)
-net_left=${name_prefix}.net.1
-net_right=${name_prefix}.net.2
-subnet1=${name_prefix}.subnet.1
-subnet2=${name_prefix}.subnet.2
-
-# Router
-router=${name_prefix}.router
-
-# Images: cirros (3.5, 4.0), ubuntu (16.04)
-cirros3=${name_prefix}.cirros.35
-cirros4=${name_prefix}.cirros.40
-ubuntu16=${name_prefix}.ubuntu.1604
-ubuntuspt=${name_prefix}.ubuntu.spt
-
-cirros3_link=http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
-cirros4_link=http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-aarch64-disk.img
-ubuntu16_link=https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img
-
-# Volume (2GB)
-volume=${name_prefix}.volume
-
-function show_help {
- printf "CVP Pipeline: Resource creation script\n\t-h, -?\t\tShow this help\n"
- printf "\t-H\t\tAdds '--property hw:mem_page_size=large' to flavors, i.e. huge_pages for DPDK\n"
- printf "\t-w <path>\tSets working folder"
-}
-
-OPTIND=1 # Reset in case getopts has been used previously in the shell.
-while getopts "h?:Hw:" opt; do
- case "$opt" in
- h|\?)
- show_help
- exit 0
- ;;
- w) working_folder=${OPTARG}
- printf "# Working folder is ${working_folder}\n"
- ;;
- h) huge_pages=true
- printf "# Using 'huge_pages' property in flavors\n"
- ;;
- esac
-done
-
-shift $((OPTIND-1))
-[ "${1:-}" = "--" ] && shift
-
-function put() {
- echo "$1=$2" | tee -a ${filename}
-}
-
-# now, some hard to understand stuff...
-# f1 $(<command with output to cut>)
-function f1() { echo $1 | cut -d' ' -f1; };
-# <commands with output to cut> | p1
-function p1() { while read input; do echo ${input} | cut -d' ' -f1; done; };
-# ol1 is short for openstack list with 1 param. Also grep and cut
-# "ol1 network public" will list all networks, grep by name public and return IDs
-function ol1() { echo $(openstack $1 list -c ID -c Name -f value | grep $2 | cut -d' ' -f1); }
-# same as ol1 but with 2 initial commands before list
-function ol2() { echo $(openstack $1 $2 list -c ID -c Name -f value | grep $3 | cut -d' ' -f1); }
-
-function print_manifest() {
- touch ./${filename}
- truncate -s 0 ${filename}
- printf "\n\n# Checking and filling manifest: $(pwd)/${filename}\n"
- put project_name ${project}
- put project_id $(ol1 project ${project})
- put user_name ${user}
- put user_id $(ol1 user ${user})
- put admin_name ${admin}
- put admin_id $(ol1 user ${admin})
- # sg
- put secgroup_all_name ${sg_all}
- put secgroup_all_id $(ol2 security group ${sg_all})
- put secgroup_icmp_name ${sg_icmp}
- put secgroup_icmp_id $(ol2 security group ${sg_icmp})
- put secgroup_ssh_name ${sg_ssh}
- put secgroup_ssh_id $(ol2 security group ${sg_ssh})
- put secgroup_iperf_name ${sg_iperf}
- put secgroup_iperf_id $(ol2 security group ${sg_iperf})
-
- # keypair
- put keypair_name ${key}
- put keypair_id $(ol1 keypair ${key})
-
- # flavors
- put flavor_tiny_name ${flavor_t}
- put flavor_tiny_id $(ol1 flavor ${flavor_t})
- put flavor_small_name ${flavor_s}
- put flavor_small_id $(ol1 flavor ${flavor_s})
- put flavor_medium_name ${flavor_m}
- put flavor_medium_id $(ol1 flavor ${flavor_m})
- put flavor_high_name ${flavor_h}
- put flavor_high_id $(ol1 flavor ${flavor_h})
-
- # fixed nets
- put fixed_net_left_name ${net_left}
- put fixed_net_left_id $(ol1 network ${net_left})
- put fixed_net_right_name ${net_right}
- put fixed_net_right_id $(ol1 network ${net_right})
- put fixed_net_left_subnet_name ${subnet1}
- put fixed_net_left_subnet_id $(openstack subnet list --network ${net_left} -c ID -f value | p1)
- put fixed_net_right_subnet_name ${subnet2}
- put fixed_net_right_subnet_id $(openstack subnet list --network ${net_right} -c ID -f value | p1)
-
- # router
- put router_name ${router}
- put router_id $(ol1 router ${router})
-
- # volumes
- put volume_name ${volume}
- put volume_id $(ol1 volume ${volume})
-
- # images
- put cirros35_name ${cirros3}
- put cirros35_id $(ol1 image ${cirros3})
- put cirros40_name ${cirros4}
- put cirros40_id $(ol1 image ${cirros4})
- put ubuntu16_name ${ubuntu16}
- put ubuntu16_id $(ol1 image ${ubuntu16})
- put ubuntuspt_name ${ubuntuspt}
- put ubuntuspt_id $(ol1 image ${ubuntuspt})
-}
-
-# create rc file out of current ENV vars
-function putrc() {
- printf "# Saving ${1} file\n"
- echo "export OS_IDENTITY_API_VERSION=${OS_IDENTITY_API_VERSION:-3}" >${1}
- echo "export OS_AUTH_URL=${OS_AUTH_URL}" >>${1}
- echo "export OS_PROJECT_DOMAIN_NAME=${OS_PROJECT_DOMAIN_NAME}" >>${1}
- echo "export OS_USER_DOMAIN_NAME=${OS_USER_DOMAIN_NAME}" >>${1}
- echo "export OS_PROJECT_NAME=${OS_PROJECT_NAME}" >>${1}
- echo "export OS_TENANT_NAME=${OS_TENANT_NAME}" >>${1}
- echo "export OS_USERNAME=${OS_USERNAME}" >>${1}
- echo "export OS_PASSWORD=${OS_PASSWORD}" >>${1}
- echo "export OS_REGION_NAME=${OS_REGION_NAME}" >>${1}
- echo "export OS_INTERFACE=${OS_INTERFACE}" >>${1}
- echo "export OS_ENDPOINT_TYPE=${OS_ENDPOINT_TYPE}" >>${1}
- echo "export OS_CACERT=${OS_CACERT}" >>${1}
-}
-
-# update ENV vars to newly created project
-function updatesession() {
- export OS_PROJECT_NAME=${project}
- export OS_TENANT_NAME=${project}
- export OS_USERNAME=${admin}
- export OS_PASSWORD=${password}
-}
-
-function process_cmds() {
- if [ -s ${cmds} ]; then
- cat ${cmds} | tr '\n' '\0' | xargs -P 1 -n 1 -0 echo | tee /dev/tty | openstack -v 2>&1 >>${logfile}
- truncate -s 0 ${cmds}
- fi
-}
-
-function _project() {
- echo project create ${project} >>${cmds}
- echo role add --user admin --project ${project} admin >>${cmds}
-}
-
-function _users() {
- echo user create --project ${project} --password ${password} ${user} >>${cmds}
- echo user create --project ${project} --password ${password} ${admin} >>${cmds}
- echo role add --user ${admin} --project ${project} admin >>${cmds}
- echo role add --user ${user} --project ${project} member >>${cmds}
-}
-
-function _sg_all() {
- echo security group create --project ${project} ${sg_all} >>${cmds}
- # icmp
- echo security group rule create --protocol icmp ${sg_all} >>${cmds}
- # ssh
- echo security group rule create --protocol tcp --dst-port 22 ${sg_all} >>${cmds}
- # iperf
- echo security group rule create --protocol tcp --dst-port 5001 ${sg_all} >>${cmds}
- # iperf3
- echo security group rule create --protocol tcp --dst-port 5201 ${sg_all} >>${cmds}
- # nc connectivity
- echo security group rule create --protocol tcp --dst-port 3000 ${sg_all} >>${cmds}
- # http
- echo security group rule create --protocol tcp --dst-port 80 ${sg_all} >>${cmds}
- # https
- echo security group rule create --protocol tcp --dst-port 443 ${sg_all} >>${cmds}
-}
-
-function _sg_icmp() {
- echo security group create --project ${project} ${sg_icmp} >>${cmds}
- echo security group rule create --protocol icmp ${sg_icmp} >>${cmds}
-}
-
-function _sg_ssh() {
- echo security group create --project ${project} ${sg_ssh} >>${cmds}
- # icmp
- echo security group rule create --protocol icmp ${sg_ssh} >>${cmds}
- # ssh
- echo security group rule create --protocol tcp --dst-port 22 ${sg_ssh} >>${cmds}
-}
-
-function _sg_iperf() {
- echo security group create --project ${project} ${sg_iperf} >>${cmds}
- # icmp
- echo security group rule create --protocol icmp ${sg_iperf} >>${cmds}
- # iperf
- echo security group rule create --protocol tcp --dst-port 5001 ${sg_iperf} >>${cmds}
- # iperf3
- echo security group rule create --protocol tcp --dst-port 5201 ${sg_iperf} >>${cmds}
-}
-
-function create_keypair() {
- echo "# Creating keypair"
- openstack keypair create ${key} >${key}
- chmod 600 ${key}
- echo "-> created keyfile: $(pwd)/${key}"
-}
-
-function _flavors() {
- # huge paged flavors
- if [ "$huge_pages" = true ]; then
- echo flavor create --id 1 --ram 64 --disk 1 --vcpus 1 ${flavor_t} --property hw:mem_page_size=large >>${cmds}
- echo flavor create --id 2 --ram 256 --disk 2 --vcpus 1 ${flavor_s} --property hw:mem_page_size=large >>${cmds}
- echo flavor create --id 3 --ram 2048 --disk 10 --vcpus 2 ${flavor_m} --property hw:mem_page_size=large >>${cmds}
- echo flavor create --id 4 --ram 2048 --disk 20 --vcpus 4 ${flavor_h} --property hw:mem_page_size=large >>${cmds}
- else
- echo flavor create --id 1 --ram 64 --disk 1 --vcpus 1 ${flavor_t} >>${cmds}
- echo flavor create --id 2 --ram 256 --disk 2 --vcpus 1 ${flavor_s} >>${cmds}
- echo flavor create --id 3 --ram 2048 --disk 10 --vcpus 2 ${flavor_m} >>${cmds}
- echo flavor create --id 4 --ram 2048 --disk 20 --vcpus 4 ${flavor_h} >>${cmds}
- fi
-}
-
-function _volumes() {
- echo volume create --size 2 ${volume} >>${cmds}
-}
-
-function create_fixed_nets() {
- echo "# Creating fixed networks"
- echo network create --project ${project} ${net_left} >>${cmds}
- echo subnet create ${subnet1} --network ${net_left} --subnet-range 10.10.11.0/24 >>${cmds}
- echo network set --share ${net_left} >>${cmds}
- echo network create --project ${project} ${net_right} >>${cmds}
- echo subnet create ${subnet2} --network ${net_right} --subnet-range 10.10.12.0/24 >>${cmds}
- echo network set --share ${net_right} >>${cmds}
- process_cmds
-
- # get subnet ids
- subnet1_id=$(openstack subnet list --network ${net_left} -c ID -f value)
- subnet2_id=$(openstack subnet list --network ${net_right} -c ID -f value)
-
- echo router create --project ${project} ${router} >>${cmds}
- process_cmds
-
- router_id=$(openstack router list -c ID -c Name -f value | grep ${router} | cut -d' ' -f1)
- echo router add subnet ${router_id} ${subnet1_id} >>${cmds}
- echo router add subnet ${router_id} ${subnet2_id} >>${cmds}
- process_cmds
-
- # TODO: Search for external net
- external=public
- echo router set ${router} --external-gateway ${external} >>${cmds}
- process_cmds
-}
-
-function _get_image() {
- # build vars for name and link
- name="${1}"
- link="${1}_link"
- which wget >/dev/null
- if [ $? -ne 0 ]; then
- printf "\nERROR: 'wget' not detected. Download skipped: ${!name}\n"
- else
- # no redownloads, quet, save named and show progress
- r=$(wget --no-check-certificate -nc -q -O ./${!name} --show-progress ${!link})
- if [ $? -ne 0 ]; then
- # non-empty output on error
- echo ${r}
- fi
- fi
-}
-
-function create_image() {
- name="${1}"
- # Check if image is in the cloud
- echo "# Checking image '${!name}'"
- ids=( $(ol1 image ${!name}) )
- # if array is empty, download and upload it
- if [ ${#ids[@]} -eq 0 ]; then
- # check and download
- if [ ! -f ${!name} ]; then
- r=$(_get_image ${1})
- else
- r=""
- fi
- # check if output is not empty
- if [ ${#r} -eq 0 ]; then
- image_id=$(openstack image create --public --disk-format qcow2 --container-format bare --file ${!name} ${!name} -c id -f value)
- echo "-> created ${!name} (${image_id})"
- else
- printf "\n-> Error detected, creation skipped\n"
- fi
- else
- # image(s) already there, list them
- for id in ${ids[@]}; do
- echo "-> found ${!name} with ID of '${id}'"
- done
- fi
-}
-
-###################
-### Main
-###################
-if [[ -z ${working_folder+x} ]]; then
- # cwd into working dir
- cd ${working_folder}
-fi
-
-cmds=$(mktemp)
-trap "rm -f ${cmds}" EXIT
-echo "Using tempfile: '${cmds}'"
-
-touch ${logfile}
-echo "Using log file: '${logfile}'"
-
-# Create
-echo "# Creating project and users"
-_project
-_users
-process_cmds
-
-echo "# Creating 'rc' and switching"
-putrc "./adminrc"
-updatesession
-putrc "./${rcfile}"
-
-echo "# Creating basic resources"
-# not dependent stuff
-_sg_all
-_sg_icmp
-_sg_ssh
-_sg_iperf
-_flavors
-_volumes
-process_cmds
-
-# sophisticated, step dependent stuff
-create_keypair
-create_fixed_nets
-
-# images
-create_image cirros3
-create_image cirros4
-create_image ubuntu16
-# update image name to correct one uploaded
-ubuntuspt_file="ubuntuspt.img"
-openstack image create --public --disk-format qcow2 --container-format bare --file ${ubuntuspt_file} ${ubuntuspt} -c id -f value
-
-### Manifest and fall back to original rc
-print_manifest
-printf ="\n\nSetting quota\n"
-openstack quota set --cores -1 --ram -1 --instances -1 --volumes -1 --gigabytes -1 cvp.project
-source "./adminrc"
-printf "\n\nOriginal rc preserved and backed up in 'adminrc'\nNew rc is '${rcfile}'\n"
diff --git a/tempest/tempest_ext.conf b/tempest/tempest_ext.conf
index 5a73965..6d55002 100644
--- a/tempest/tempest_ext.conf
+++ b/tempest/tempest_ext.conf
@@ -1,4 +1,7 @@
[compute]
+flavor_ref = 1
+flavor_ref_alt = 2
+image_ref = ${IMAGE_REF}
image_ref_alt = ${IMAGE_REF2}
min_microversion = 2.1
max_microversion = latest
@@ -25,15 +28,15 @@
project_domain_name = Default
user_domain_name = Default
endpoint_type = internal
-instance_type = m1.tiny
-minimal_instance_type = m1.tiny
+instance_type = cvp.tiny
+minimal_instance_type = cvp.tiny
network_for_ssh = ${PUBLIC_NET}
floating_network_name = ${PUBLIC_NET}
-fixed_subnet_name = ${FIXED_SUBNET_NAME}
+fixed_subnet_name = cvp.subnet.1
disable_ssl_certificate_validation = True
-image_ref = ${IMAGE_NAME2}
-minimal_image_ref = ${IMAGE_NAME2}
-fixed_network_name = ${FIXED_NET}
+image_ref = cvp.tiny
+minimal_image_ref = cvp.cirros.35
+fixed_network_name = cvp.net.1
build_timeout = 180
ssh_timeout = 30
boot_config_env = /home/rally/boot_config_none_env.yaml