xref: /spdk/test/nvmf/host/identify.sh (revision 06b537bfdb4393dea857e204b85d8df46a351d8a)
1#!/usr/bin/env bash
2
3testdir=$(readlink -f $(dirname $0))
4rootdir=$(readlink -f $testdir/../../..)
5source $rootdir/test/common/autotest_common.sh
6source $rootdir/test/nvmf/common.sh
7
8MALLOC_BDEV_SIZE=64
9MALLOC_BLOCK_SIZE=512
10
11rpc_py="$rootdir/scripts/rpc.py"
12
13nvmftestinit
14
15timing_enter start_nvmf_tgt
16
17"${NVMF_APP[@]}" -m 0xF &
18nvmfpid=$!
19
20trap 'process_shm --id $NVMF_APP_SHM_ID; nvmftestfini; exit 1' SIGINT SIGTERM EXIT
21
22waitforlisten $nvmfpid
23$rpc_py nvmf_create_transport $NVMF_TRANSPORT_OPTS -u 8192
24timing_exit start_nvmf_tgt
25
26$rpc_py bdev_malloc_create $MALLOC_BDEV_SIZE $MALLOC_BLOCK_SIZE -b Malloc0
27$rpc_py nvmf_create_subsystem nqn.2016-06.io.spdk:cnode1 -a -s SPDK00000000000001
28# NOTE: This will assign the same NGUID and EUI64 to all bdevs,
29# but currently we only have one (see above), so this is OK.
30$rpc_py nvmf_subsystem_add_ns nqn.2016-06.io.spdk:cnode1 Malloc0 \
31	--nguid "ABCDEF0123456789ABCDEF0123456789" \
32	--eui64 "ABCDEF0123456789"
33$rpc_py nvmf_subsystem_add_listener nqn.2016-06.io.spdk:cnode1 -t $TEST_TRANSPORT -a $NVMF_FIRST_TARGET_IP -s $NVMF_PORT
34
35$rpc_py nvmf_get_subsystems
36
37$SPDK_EXAMPLE_DIR/identify -r "\
38        trtype:$TEST_TRANSPORT \
39        adrfam:IPv4 \
40        traddr:$NVMF_FIRST_TARGET_IP \
41        trsvcid:$NVMF_PORT \
42        subnqn:nqn.2014-08.org.nvmexpress.discovery" -L all
43$SPDK_EXAMPLE_DIR/identify -r "\
44        trtype:$TEST_TRANSPORT \
45        adrfam:IPv4 \
46        traddr:$NVMF_FIRST_TARGET_IP \
47        trsvcid:$NVMF_PORT \
48        subnqn:nqn.2016-06.io.spdk:cnode1" -L all
49sync
50$rpc_py nvmf_delete_subsystem nqn.2016-06.io.spdk:cnode1
51
52trap - SIGINT SIGTERM EXIT
53
54nvmftestfini
55