Last active
August 1, 2018 22:25
-
-
Save electrocucaracha/3b83004b0233b99c480546d895939839 to your computer and use it in GitHub Desktop.
releng-xci helper functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OPNFV | |
export XCI_BUILD_CLEAN_VM_OS=false | |
function ssh_xci { | |
ssh -o StrictHostKeyChecking=no -i ~/releng-xci/xci/scripts/vm/id_rsa_for_dib -l devuser ${1:-ubuntu}_xci_vm | |
} | |
function tail_xci { | |
ssh -o StrictHostKeyChecking=no -i ~/releng-xci/xci/scripts/vm/id_rsa_for_dib -l devuser ${1:-ubuntu}_xci_vm tail -f /home/devuser/releng-xci/xci/${2:-xci-deploy.log} | |
} | |
function pull_xci { | |
scp -i ~/releng-xci/xci/scripts/vm/id_rsa_for_dib devuser@${1:-ubuntu}_xci_vm:/home/devuser/releng-xci/${2:-"/xci/xci-deploy.log"} ./$(date +%Y-%m-%d:%H:%M)_xci-deploy.log | |
} | |
function push_xci { | |
scp -i ~/releng-xci/xci/scripts/vm/id_rsa_for_dib $2 devuser@${1:-ubuntu}_xci_vm:/home/devuser/releng-xci/$2 | |
} | |
alias ssh_xci='ssh_xci' | |
alias tail_xci='tail_xci' | |
alias pull_xci='pull_xci' | |
alias push_xci='push_xci' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
export XCI_FLAVOR="ha" | |
export INSTALLER_TYPE="osa" | |
export XCI_ANSIBLE_VERBOSITY="-vvvv" | |
devuser=/home/devuser | |
export http_proxy= | |
export https_proxy= | |
export ftp_proxy= | |
mgmt_net=$(echo 172.29.236.{10..15} | sed 's/ /,/g') | |
tunnel_net=$(echo 172.29.240.{10..15} | sed 's/ /,/g') | |
storage_net=$(echo 172.29.244.{10..15} | sed 's/ /,/g') | |
local_net=$(echo 192.168.122.{1..7} | sed 's/ /,/g'),192.168.122.220 | |
export no_proxy=localhost,127.0.0.1,$mgmt_net,$tunnel_net,$storage_net,$local_net | |
cat <<EOL > $devuser/.ansible.cfg | |
[defaults] | |
callback_whitelist = profile_tasks | |
EOL | |
source /etc/os-release || source /usr/lib/os-release | |
if [ ! -f $devuser/.proxy ] | |
then | |
echo "http_proxy=$http_proxy" | sudo tee --append /etc/environment | |
echo "https_proxy=$https_proxy" | sudo tee --append /etc/environment | |
echo "no_proxy=$no_proxy" | sudo tee --append /etc/environment | |
if [ -f $devuser/.bashrc ] | |
then | |
echo "export http_proxy=$http_proxy" >> $devuser/.bashrc | |
echo "export https_proxy=$https_proxy" >> $devuser/.bashrc | |
echo "export no_proxy=$no_proxy" >> $devuser/.bashrc | |
fi | |
case ${ID,,} in | |
*suse) | |
;; | |
ubuntu|debian) | |
echo "Acquire::http::Proxy \"$http_proxy\";" | sudo tee --append /etc/apt/apt.conf.d/01proxy | |
echo "Acquire::https::Proxy \"$https_proxy\";" | sudo tee --append /etc/apt/apt.conf.d/01proxy | |
;; | |
rhel|centos|fedora) | |
echo "http_proxy=$http_proxy" | sudo tee --append /etc/yum.conf | |
echo "https_proxy=$https_proxy" | sudo tee --append /etc/yum.conf | |
echo "no_proxy=$no_proxy" | sudo tee --append /etc/yum.conf | |
;; | |
*) echo "ERROR: Supported package manager not found. Supported: apt,yum,zypper"; exit 1;; | |
esac | |
touch /home/devuser/.proxy | |
fi | |
cd $devuser/releng-xci/ | |
git diff > changes.patch | |
cd xci/ | |
./xci-deploy.sh > xci-deploy.log 2>&1 | |
echo "Running Functest..." | |
ansible-playbook -i xci/playbooks/inventory releng-xci/xci/playbooks/prepare-functest.yml | |
source /root/openrc | |
openstack --insecure network create --external --provider-physical-network flat --provider-network-type flat ext-net | |
openstack --insecure subnet create --network ext-net --allocation-pool start=10.10.10.5,end=10.10.10.254 --subnet-range 10.10.10.0/24 --gateway 10.10.10.1 --no-dhcp ext-subnet | |
sudo docker run -ti --env-file env -v $(pwd)/openrc:/home/opnfv/functest/conf/env_file -v $(pwd)/images:/home/opnfv/functest/images -v /root/.ssh/id_rsa:/root/.ssh/id_rsa opnfv/functest-features /bin/bash | |
python /usr/bin/run_sfc_tests.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
declare -A dns_opnfv=( | |
["opnfv"]="192.168.122.2" | |
["controller00"]="192.168.122.3" | |
["controller01"]="192.168.122.4" | |
["controller02"]="192.168.122.6" | |
["compute00"]="192.168.122.7" | |
["compute01"]="192.168.122.8" | |
) | |
case "${!dns_opnfv[@]}" in *" $1 "*) ssh root@${dns_opnfv[$1]} ;; esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment