X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Ftools%2Fvirl%2Fbin%2Fstart-testcase;h=10028e651645cbeb5d2d9f8c1d34e59f99978df1;hp=b46f5add277604c903e2d2b857e725b188085038;hb=9d378548cc86028c55baf17260d32d0055603b78;hpb=036f36181c177e4c77f22cdbdcb87fb2f94df3bf 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 @@ -39,6 +40,14 @@ def indent(lines, amount, fillchar=' '): # functions. # 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)