aboutsummaryrefslogtreecommitdiffstats
path: root/resources/tools/virl/bin
diff options
context:
space:
mode:
authorCarsten Koester <ckoester@cisco.com>2016-05-25 05:58:29 -0400
committerDave Wallace <dwallacelf@gmail.com>2016-06-02 00:18:28 +0000
commit9d378548cc86028c55baf17260d32d0055603b78 (patch)
tree1cc67da7195459abcaca5f12f0f4b74bc399b60e /resources/tools/virl/bin
parent036f36181c177e4c77f22cdbdcb87fb2f94df3bf (diff)
CSIT-111: Add Packer based framework to auto-generate disk images
Change-Id: Ia18ea34a6288aec0f12f176f4cc264d0f215d1fd Signed-off-by: Carsten Koester <ckoester@cisco.com>
Diffstat (limited to 'resources/tools/virl/bin')
-rwxr-xr-xresources/tools/virl/bin/start-testcase23
-rwxr-xr-xresources/tools/virl/bin/stop-testcase2
2 files changed, 18 insertions, 7 deletions
diff --git a/resources/tools/virl/bin/start-testcase b/resources/tools/virl/bin/start-testcase
index b46f5add27..10028e6516 100755
--- a/resources/tools/virl/bin/start-testcase
+++ b/resources/tools/virl/bin/start-testcase
@@ -24,6 +24,7 @@ import tempfile
import shutil
import time
import paramiko
+import netifaces
#
# Helper function to indent a text string
@@ -40,6 +41,14 @@ def indent(lines, amount, fillchar=' '):
#
def main():
#
+ # Get our default interface IP address. This will become the default
+ # value for the "NFS Server IP" option.
+ #
+ gws = netifaces.gateways()
+ addrs = netifaces.ifaddresses(gws['default'][netifaces.AF_INET][1])
+ default_addr = addrs[netifaces.AF_INET][0]['addr']
+
+ #
# Verify CLI parameters and try to download our VPP image into a temporary
# file first
#
@@ -53,11 +62,9 @@ def main():
parser.add_argument("-k", "--keep", help="Keep (do not delete) the " +
"simulation in case of error", action='store_true')
parser.add_argument("-v", "--verbosity", action="count", default=0)
- # FIXME: THe default value for the following line should not be a hardcoded
- # address. We should determine it dynamically (e.g. IP address of first
- # interface or whichever interface is tied to the flat network)
- parser.add_argument("-nip", "--nfs-server-ip", help="NFS server (our) IP",
- default="10.30.51.28")
+ parser.add_argument("-nip", "--nfs-server-ip", help="NFS server (our) IP " +
+ "default is derived from routing table: " +
+ "{}".format(default_addr), default=default_addr)
parser.add_argument("-ns", "--nfs-scratch-directory",
help="Server location for NFS scratch diretory",
default="/nfs/scratch")
@@ -66,7 +73,7 @@ def main():
"directory", default="/nfs/common")
parser.add_argument("-wc", "--wait-count",
help="number of intervals to wait for simulation to " +
- "be ready", type=int, default=12)
+ "be ready", type=int, default=24)
parser.add_argument("-wt", "--wait-time",
help="length of a single interval to wait for " +
"simulation to be ready", type=int, default=5)
@@ -83,6 +90,9 @@ def main():
default="/home/jenkins-in/.ssh/id_rsa_virl")
parser.add_argument("-spu", "--ssh-pubkey", help="SSH public keyfile",
default="/home/jenkins-in/.ssh/id_rsa_virl.pub")
+ parser.add_argument("-r", "--release", help="VM disk image/release " +
+ "(ex. \"csit-ubuntu-14.04.4_2016-05-25_1.0\")",
+ default="csit-ubuntu-14.04.4_2016-05-25_1.0")
parser.add_argument("--topology-directory", help="Topology directory",
default="/home/jenkins-in/testcase-infra/topologies")
@@ -134,6 +144,7 @@ def main():
args.nfs_server_ip+":"+args.nfs_scratch_directory)
line = line.replace("$$NFS_SERVER_COMMON$$", \
args.nfs_server_ip+":"+args.nfs_common_directory)
+ line = line.replace("$$VM_IMAGE$$", "server-"+args.release)
new_file.write(line)
os.close(temp_handle)
diff --git a/resources/tools/virl/bin/stop-testcase b/resources/tools/virl/bin/stop-testcase
index dbbb53e30f..1175fcf2b5 100755
--- a/resources/tools/virl/bin/stop-testcase
+++ b/resources/tools/virl/bin/stop-testcase
@@ -21,4 +21,4 @@ NFS_SCRATCH_SERVERDIR="/nfs/scratch" # Our own (NFS s
TESTCASE=$1
virl_std_client -u $VIRL_USER -p $VIRL_PASSWORD simengine-stop --session-id $TESTCASE
-rm -fr ${NFS_SCRATCH_SERVERDIR}/${TESTCASE}
+sudo rm -fr ${NFS_SCRATCH_SERVERDIR}/${TESTCASE}