#!/bin/bash
# [ICS VERSION STRING: unknown]
# This is a bash sourced config file which defines variables used in
# fast fabric tools.  Command line arguments will override these settings.
# Assignments should be scripted such that this file does not override
# exported environment settings, as shown in the defaults below

if [ "$CONFIG_DIR" = "" ]
then
	CONFIG_DIR=/etc
	export CONFIG_DIR
fi

# Override default location for HOSTS_FILE
#export HOSTS_FILE=${HOSTS_FILE:-$CONFIG_DIR/eth-tools/hosts}

# Override default location for SWITCHES_FILE
export SWITCHES_FILE=${SWITCHES_FILE:-$CONFIG_DIR/eth-tools/switches}

# Default management host
export MGMT_HOST=${MGMT_HOST:-localhost}

# Maximum parallel processes for ethhostadmin
# and -p option on other commands
# set to 1 to avoid parallel execution
# 1000 is a reasonable default. If a larger number is needed, it is recommended
# consideration is given to ulimit -u, memory consumption by many scp/ssh sessions,
# and the total number of TCP connections the system can handle.
export FF_MAX_PARALLEL=${FF_MAX_PARALLEL:-1000}

# If the systems are slow for some reason, this can be used to provide a
# multiplier for all timeouts in ethhostadmin
export FF_TIMEOUT_MULT=${FF_TIMEOUT_MULT:-2}

# where to put result files from FastFabric runs of
# ethhostadmin
#export FF_RESULT_DIR=${FF_RESULT_DIR:-.}
export FF_RESULT_DIR=${FF_RESULT_DIR:-$HOME}

# IntelEth product to install during ethhostadmin load and upgrade
export FF_PRODUCT=${FF_PRODUCT:-IntelEth-Basic.`cat /usr/lib/eth-tools/osid_wrapper`}

# IntelEth product version to install during ethhostadmin load and upgrade
export FF_PRODUCT_VERSION=${FF_PRODUCT_VERSION:-`cat /etc/eth-tools/version_wrapper 2>/dev/null`}

# IntelEth packages to install during ethhostadmin load [-P option]
export FF_PACKAGES=${FF_PACKAGES:-eth eth_roce}

# Additional INSTALL options during ethhostadmin load
#export FF_INSTALL_OPTIONS=${FF_INSTALL_OPTIONS:- --answer LIMITS_SEL=4}
export FF_INSTALL_OPTIONS=${FF_INSTALL_OPTIONS:- }

# Additional INSTALL options during ethhostadmin upgrade
export FF_UPGRADE_OPTIONS=${FF_UPGRADE_OPTIONS:- }

# where to upload server specific files to during ethuploadall, ethcaptureall
# [-d option]
export UPLOADS_DIR=${UPLOADS_DIR:-./uploads}

# where to download server specific files from during ethdownloadall
# [-d option]
export DOWNLOADS_DIR=${DOWNLOADS_DIR:-./downloads}

# where to save history and baselines for cluster analysis and health checks
# [-d option]
export FF_ANALYSIS_DIR=${FF_ANALYSIS_DIR:-/var/usr/lib/eth-tools/analysis}

# How to login to host systems during ethhostadmin
# At this time only ssh is supported.
# Note: at present ethcmdall and ethscpall always assume password-less ssh/scp
export FF_LOGIN_METHOD=${FF_LOGIN_METHOD:-ssh}

# initial user name (cannot be root if CFG_LOGIN_METHOD=telnet)
export FF_USERNAME=${FF_USERNAME:-root}

# password for FF_USERNAME (not needed if password-less ssh configured)
export FF_PASSWORD=${FF_PASSWORD:-}

# if FF_USERNAME is not root, what is the root password needed when
# suing to root
export FF_ROOTPASS=${FF_ROOTPASS:=}

# How to login to switches
# can be ssh or telnet
#export FF_SWITCH_LOGIN_METHOD=${FF_SWITCH_LOGIN_METHOD:-ssh}

# password for admin (not needed if password-less ssh configured)
#export FF_SWITCH_ADMIN_PASSWORD=${FF_SWITCH_ADMIN_PASSWORD:-adminpass}

# options for ethreport during ethfabricanalysis health check
# for  strict link speed checks, such as -o slowconfiglinks or 
# -o slowconnlinks may be appropriate
export FF_FABRIC_HEALTH=${FF_FABRIC_HEALTH:- -o errors -o slowlinks}

# list of CLI commands to issue during opachassisanalysis
#export FF_SWITCH_CMDS=${FF_SWITCH_CMDS:-showAllConfig}

# single CLI command to issue to check overall health during opachassisanalysis
# hwCheck is prefered, but is not supported on older switches FW
#export FF_SWITCH_HEALTH=${FF_SWITCH_HEALTH:-hwCheck}

# list of analysis to perform during ethallanalysis
# pick appropriate type of SM to analyze
#export FF_ALL_ANALYSIS=${FF_ALL_ANALYSIS:-fabric switches}
export FF_ALL_ANALYSIS=${FF_ALL_ANALYSIS:-fabric}

# command to perform text files for baseline vs latest snapshot during
# fabric health analysis commands
#export FF_DIFF_CMD=${FF_DIFF_CMD:-diff}
export FF_DIFF_CMD=${FF_DIFF_CMD:-diff -C 1}

# location to find fastfabric mpi_apps for use by assorted fastfabric tools
# As needed they can be copied to a global filesystem and adjust this variable
# This MUST be a absolute path which exists on all nodes
export FF_MPI_APPS_DIR=${FF_MPI_APPS_DIR:-$HOME/mpi_apps}

# location to find CUDA
export FF_CUDA_DIR=${FF_CUDA_DIR:-/usr/local/cuda}

#location of Cable Health Report files
#export FF_CABLE_HEALTH_REPORT_DIR=${FF_CABLE_HEALTH_REPORT_DIR:-/var/opt/opafm/cablehealth}

# Maximum number of cable health report files to maintain
#export FF_CABLE_HEALTH_MAX_FILES=${FF_CABLE_HEALTH_MAX_FILES:- 255}

# env variables to set within each rank of MPI runs done by fastfabric directly
# alternatively the $FF_MPI_APPS_DIR/*.param files can be edited
# with appropriate values.
# example of PSM selection of PSM3_RDMA
#export FF_MPI_ENV=${FF_MPI_ENV:-PSM3_RDMA=1}
export FF_MPI_ENV=${FF_MPI_ENV:-}

# configuration of arguments for MPI performance deviation testing
# via $FF_MPI_APPS_DIR/deviation/deviation
# The defaults should work for most fabrics.  This can be made stricter
# and/or specific to the fabric by using arguments such as -h hostname
# -bwthres and -latthres.  Samples are provided for various topologies.
# See run_deviation or the user's guide for more
# information.
#export FF_DEVIATION_ARGS=${FF_DEVIATION_ARGS:--bwtol 20 -lattol 50 -c -v}
#export FF_DEVIATION_ARGS=${FF_DEVIATION_ARGS:--bwtol 20 -lattol 50 -c -h hostname}
export FF_DEVIATION_ARGS=${FF_DEVIATION_ARGS:--bwtol 20 -lattol 50 -c}
# 1 hop fabric, 100g links, rv w/RDMA=1, PCIe gen3x16 or PCIe gen4x8 Hosts
#export FF_DEVIATION_ARGS==${FF_DEVIATION_ARGS:--bwthres 12000 -latthres 7.5 -c}
# 3 hop fabric, 100g links, rv w/RDMA=1, PCIe gen3x16 Hosts or PCIe gen4x8 Hosts
#export FF_DEVIATION_ARGS==${FF_DEVIATION_ARGS:--bwthres 12000 -latthres 8.5 -c}
# 5 hop fabric, 100g links, rv w/RDMA=1, PCIe gen3x16 Hosts or PCIe gen4x8 Hosts
#export FF_DEVIATION_ARGS==${FF_DEVIATION_ARGS:--bwthres 12000 -latthres 9.5 -c}

# location to find fastfabric shmem_apps for use by assorted fastfabric tools
# As needed they can be copied to a global filesystem and adjust this variable
# This MUST be a absolute path which exists on all nodes
#export FF_SHMEM_APPS_DIR=${FF_SHMEM_APPS_DIR:-$HOME/shmem_apps}

#Serialize output of operations running in parallel
export FF_SERIALIZE_OUTPUT=${FF_SERIALIZE_OUTPUT:-yes}

# Directory name for location of hostverify.sh script and output target directory
# on each host used by ethverifyhosts
export FF_HOSTVERIFY_DIR=${FF_HOSTVERIFY_DIR:-/root}
