From 1e2724112eb417d2eed7f9bcc7e21506d778a2c7 Mon Sep 17 00:00:00 2001 From: Zhijiang Hu Date: Mon, 21 Aug 2017 07:03:49 -0400 Subject: Add tools for testing FIP After deployment, we can manually use this script to simply test basic FIP connectivity. Change-Id: Iccc3edd71ea4c3d38dbed09411093a96a9679ae7 Signed-off-by: Zhijiang Hu --- tools/daisy-post-fip.sh | 63 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 tools/daisy-post-fip.sh diff --git a/tools/daisy-post-fip.sh b/tools/daisy-post-fip.sh new file mode 100644 index 00000000..80d79e38 --- /dev/null +++ b/tools/daisy-post-fip.sh @@ -0,0 +1,63 @@ +#!/bin/bash + +############################################################################## +# Copyright (c) 2016 ZTE Coreporation and others. +# +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +############################################################################## + +IMAGE_NAME=TestVM + +# Sanitize language settings to avoid commands bailing out +# with "unsupported locale setting" errors. +unset LANG +unset LANGUAGE +LC_ALL=C +export LC_ALL +for i in curl openstack; do + if [[ ! $(type ${i} 2>/dev/null) ]]; then + if [ "${i}" == 'curl' ]; then + echo "Please install ${i} before proceeding" + else + echo "Please install python-${i}client before proceeding" + fi + exit + fi +done + +# Move to top level directory +REAL_PATH=$(python -c "import os,sys;print os.path.realpath('$0')") +cd "$(dirname "$REAL_PATH")/.." + +# Test for credentials set +if [[ "${OS_USERNAME}" == "" ]]; then + echo "No Keystone credentials specified. Try running source openrc" + exit +fi + +echo "Configuring tenant network." + +openstack network create --provider-network-type vxlan demo-net +openstack subnet create --subnet-range 10.0.0.0/24 --network demo-net \ + --gateway 10.0.0.1 --dns-nameserver 8.8.8.8 demo-subnet +DEMO_NET_ID=$(openstack network list | awk '/ demo-net / {print $2}') + +openstack router create demo-router +openstack router add subnet demo-router demo-subnet +openstack router set --external-gateway admin_external demo-router + +openstack floating ip create admin_external +DEMO_FIP=$(openstack floating ip list | awk '/ None / {print $4}') + +openstack server create --image ${IMAGE_NAME} --flavor m1.micro \ + --nic net-id=${DEMO_NET_ID} demo1 + +# Wait for guest ready to accept FIP, seems need it. +sleep 10 + +openstack server add floating ip demo1 ${DEMO_FIP} + +echo "Now you can test ping ${DEMO_FIP} from external network" -- cgit 1.2.3-korg