Cipher keys in sma are encoded by base64 that by default wrap line after 76chars. It causes issues for 256bit keys in sma flow. Adding "-w 0" disables line wrapping Signed-off-by: Michal Rozegnal <michal.rozegnal@intel.com> Change-Id: Ic6a8136672b1cdbd8d71d3cc1caa82a5bc898636 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/15888 Reviewed-by: Jacek Kalwas <jacek.kalwas@intel.com> Reviewed-by: <sebastian.brzezinka@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Konrad Sztyber <konrad.sztyber@intel.com> Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
58 lines
903 B
Bash
58 lines
903 B
Bash
# SPDX-License-Identifier: BSD-3-Clause
|
|
# Copyright (C) 2022 Intel Corporation
|
|
# All rights reserved.
|
|
#
|
|
|
|
function sma_waitforlisten() {
|
|
local sma_addr=${1:-127.0.0.1}
|
|
local sma_port=${2:-8080}
|
|
|
|
for ((i = 0; i < 5; i++)); do
|
|
if nc -z $sma_addr $sma_port; then
|
|
return 0
|
|
fi
|
|
sleep 1s
|
|
done
|
|
return 1
|
|
}
|
|
|
|
function uuid2base64() {
|
|
python <<- EOF
|
|
import base64, uuid
|
|
print(base64.b64encode(uuid.UUID("$1").bytes).decode())
|
|
EOF
|
|
}
|
|
|
|
get_cipher() {
|
|
case "$1" in
|
|
AES_CBC) echo 0 ;;
|
|
AES_XTS) echo 1 ;;
|
|
*) echo "$1" ;;
|
|
esac
|
|
}
|
|
|
|
format_key() {
|
|
base64 -w 0 <(echo -n "$1")
|
|
}
|
|
|
|
uuid2nguid() {
|
|
# The NGUID returned by the RPC is UPPERCASE
|
|
local uuid=${1^^}
|
|
echo ${uuid//-/}
|
|
}
|
|
|
|
get_qos_caps() {
|
|
local rootdir
|
|
|
|
rootdir="$(dirname $BASH_SOURCE)/../.."
|
|
|
|
"$rootdir/scripts/sma-client.py" <<- EOF
|
|
{
|
|
"method": "GetQosCapabilities",
|
|
"params": {
|
|
"device_type": $1
|
|
}
|
|
}
|
|
EOF
|
|
}
|