-usage() { echo "Usage: $0 [-s <nosdn|odl|opencontrail>]
- [-t <noha|ha|tip>]
- [-o <juno|liberty>]
- [-l <default|intelpod5>]
- [-f <ipv6,dpdk,lxd,dvr>]
- [-d <trusty|xenial>]
- [-a <amd64>]
- [-m <openstack|kubernetes>]
- [-i <0|1>]
- [-r <a|b>]" 1>&2 exit 1; }
-
-while getopts ":s:t:o:l:h:r:f:d:a:m:i:" opt; do
- case "${opt}" in
- s)
- opnfvsdn=${OPTARG}
- ;;
- t)
- opnfvtype=${OPTARG}
- ;;
- o)
- openstack=${OPTARG}
- ;;
- l)
- opnfvlab=${OPTARG}
- ;;
- r)
- opnfvrel=${OPTARG}
- ;;
- f)
- opnfvfeature=${OPTARG}
- ;;
- d)
- opnfvdistro=${OPTARG}
- ;;
- a)
- opnfvarch=${OPTARG}
- ;;
- m)
- opnfvmodel=${OPTARG}
- ;;
- i)
- virtinstall=${OPTARG}
- ;;
- h)
- usage
- ;;
- *)
- ;;
- esac
-done
+#A string with command options
+options=$@
+
+# An array with all the arguments
+arguments=($options)
+
+# Loop index
+index=0
+
+for argument in $options
+ do
+ # Incrementing index
+ index=`expr $index + 1`
+
+ # The conditions
+ case $argument in
+ -h|--help )
+ usage;
+ ;;
+ -s|--sdn )
+ if ([ "arguments[index]" != "" ]); then
+ opnfvsdn=${arguments[index]}
+ fi;
+ ;;
+ -t|--type )
+ if ([ "arguments[index]" != "" ]); then
+ opnfvtype=${arguments[index]}
+ fi;
+ ;;
+ -o|--openstack )
+ if ([ "arguments[index]" != "" ]); then
+ openstack=${arguments[index]}
+ fi;
+ ;;
+
+ -l|--lab )
+ if ([ "arguments[index]" != "" ]); then
+ opnfvlab=${arguments[index]}
+ fi;
+ ;;
+
+ -r|--release )
+ if ([ "arguments[index]" != "" ]); then
+ opnfvrel=${arguments[index]}
+ fi;
+ ;;
+
+ -f|--feature )
+ if ([ "arguments[index]" != "" ]); then
+ opnfvfeature=${arguments[index]}
+ fi;
+ ;;
+
+ -d|--distro )
+ if ([ "arguments[index]" != "" ]); then
+ opnfdistro=${arguments[index]}
+ fi;
+ ;;
+
+ -a|--arch )
+ if ([ "arguments[index]" != "" ]); then
+ opnfvarch=${arguments[index]}
+ fi;
+ ;;
+
+ -m|--model )
+ if ([ "arguments[index]" != "" ]); then
+ opnfvmodel=${arguments[index]}
+ fi;
+ ;;
+
+ -i|--virtinstall )
+ if ([ "arguments[index]" != "" ]); then
+ virtinstall=${arguments[index]}
+ fi;
+ ;;
+ --maasinstall )
+ if ([ "arguments[index]" != "" ]); then
+ maasinstall=${arguments[index]}
+ fi;
+ ;;
+ --labfile )
+ if ([ "arguments[index]" != "" ]); then
+ labfile=${arguments[index]}
+ fi;
+ ;;
+ esac
+ done
+