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