#!/bin/sh
#
#
#    Copyright (c) 1996-2006 Brocade Communications Systems, Inc.
#    All rights reserved.
#
#
# NAME
#      diagskiptests - set or display diagnostics skip test flags
# 
# SYNOPSIS
#      diagskiptests [ value | -show ]
# 
# AVAILABILITY
#      admin
# 
# DESCRIPTION
#      This  command  sets  the  diagnostics skip test flags to the
#      specified value.  The skip test flags  are  saved  in  flash
#      memory   and   stays   set   until  the  next  execution  of
#      diagskiptests. The mode becomes active as soon as this  com-
#      mand  is  executed.  It  does  not  require a reboot to take
#      effect.
# 
#      The skip test flags are used to skip the execution  of  cer-
#      tain  post  tests  that may prove hazardous to normal switch
#      operation.  The exact use of this flag is determined by  the
#      POST(Power-On Self-Test) scripts and the specific test meth-
#      ods that are used.
# 
# OPTIONS
#      value     Specify a bit mask for tests to be skipped.
# 
#      -show     If specified or no value  is  given,  the  current
#                skip test flags will be displayed.
# 
# EXAMPLES
#      > diagskiptests -show
#      Skip tests is 1.
# 

echo "This command is no longer supported as of Fabric OS v6.2.0"
exit 3

#
#
# Load library -- must be first.
#
home="/fabos/share"
util="diagcommon.sh"
ok=0

if [ $# -eq 0 ]; then
	# Check RBAC permission on command
	/fabos/libexec/rbac_check `/bin/basename $0`
else
	# Check RBAC permission on identified options
	/fabos/libexec/rbac_check `/bin/basename $0` $1
fi

if [ $? -ne 0 ]; then
	exit 127
fi

for f in "./$util" "$FABOSHOME/share/$util" "$home/$util" ; do
	if [ -r $f ] ; then
		. $f
		ok=1
		break;
	fi
done
if [ $ok -ne 1 ] ; then
	echo "Error -- could not locate $util"
	exit 3
fi

#
# Program customization
#

config_string="diag.skip"	# config string to update
config_name="Skip tests"	# User name of config.
config_default=1		# default value
config_mode=$INTEGER		# config mode

syntax="`/bin/basename $0` [ value \| -show ]" ; export syntax

#
# diagskiptests()
#
checkForShow "$config_name" "$config_string" "$config_mode" "$config_default" $1
val=`getValue $1`
if [ $? != 0 ] ; then exit 3 ; fi

cur_val=`getConfig $config_string $config_mode $config_default`
if [ "$cur_val" != "$val" ]
then
	setConfig $config_string $config_mode $val
	updateConfig
	echo $config_name is now $val.
else
	echo $config_name is still $val.
fi
exit 0
