1 #
2 # CDDL HEADER START
3 #
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
7 #
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
12 #
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 #
19 # CDDL HEADER END
20 #
21
22 #
23 # Copyright 2009 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26
27 #
28 # A test purpose file to test data visibility related with
29 # iscsi target port provider
30 #
31
32 # __stc_assertion_start
33 #
34 # ID: iscsi_visible_014
35 #
36 # DESCRIPTION:
37 # initiator can get lun information through the target when
38 # --headerdigest ,--datadigest option of initiator node and
39 # --headerdigest ,--datadigest option of one target's
40 # target-param are set to CRC32
41 #
42 # STRATEGY:
43 # Setup:
44 # 1. Configure discovery address with <target side ip address>
45 # for initiator using iscsiadm add discovery-address
46 #
47 # 2. itadm create a target portal group with proper ip address
48 #
49 # 3. itadm create 2 target with the created target portal group
50 #
51 # 4. Create and online luns and bound them to the targets
52 # in stmf frame.
53 #
54 # Test:
55 # 1. Set --headerdigest option of initiator-node to CRC32
56 #
57 # 2. Set --datadigest option of initiator-node to CRC32
58 #
59 # 3. Set --headerdigest option of target-param to CRC32 for one
60 # target.
61 #
62 # 4. Set --datadigest option of target-param to CRC32 for one
63 # target.
64 #
65 # 5. Enable "SentTarget" discovery method on initiator using
66 # iscsiadm modify discovery -t enable
67 #
68 # 6. Check that the initiator can see the luns through the
69 # two targets.
70 #
71 #
72 # Cleanup:
73 # 1. Delete the target luns, target, target portal group
74 #
75 # 2. Disable the discovery method on initiator, remove the
76 # discovery address and clear digest option
77 #
78 # STRATEGY_NOTES:
79 #
80 # TESTABILITY: explicit
81 #
82 # AUTHOR: zheng.he@sun.com
83 #
84 # REVIEWERS:
85 #
86 # ASSERTION_SOURCE:
87 #
88 # TEST_AUTOMATION_LEVEL: automated
89 #
90 # STATUS: IN_PROGRESS
91 #
92 # COMMENTS:
93 #
94 # __stc_assertion_end
95 #
96 function tp_iscsi_visible_014
97 {
98 cti_pass
99
100 tc_id="tp_iscsi_visible_014"
101
102 tc_desc="initiator can get lun information through the target when"
103 tc_desc="${tc_desc} --headerdigest ,--datadigest option of initiator"
104 tc_desc="${tc_desc} node and --headerdigest ,--datadigest option"
105 tc_desc="${tc_desc} of one target's target-param are set to CRC32"
106 print_test_case $tc_id - $tc_desc
107
108 # Set discover address
109 typeset portal_list
110 set -A portal_list $(get_portal_list ${ISCSI_THOST})
111
112 iscsiadm_add POS ${ISCSI_IHOST} discovery-address \
113 "${portal_list[0]}"
114
115 # Create target and target protal group
116 itadm_create POS tpg 1 "${portal_list[0]}"
117 itadm_create POS target -n ${IQN_TARGET}.${TARGET[0]} -t 1
118 itadm_create POS target -n ${IQN_TARGET}.${TARGET[1]} -t 1
119
120 #Create lu
121 build_fs zdsk
122 fs_zfs_create -V 1g $ZP/${VOL[0]}
123 sbdadm_create_lu POS -s 1024k $DEV_ZVOL/$ZP/${VOL[0]}
124
125 typeset guid1
126
127 eval guid1="\$LU_${VOL[0]}_GUID"
128
129 # Add view
130 stmfadm_add POS view "${guid1}"
131
132 #Set --headerdigest option of initiator node CRC32.
133 iscsiadm_modify POS ${ISCSI_IHOST} initiator-node -h CRC32 \
134
135 #Set --datadigest option of initiator node CRC32.
136 iscsiadm_modify POS ${ISCSI_IHOST} initiator-node -d CRC32 \
137
138 #Set --headerdigest option of target-param to CRC32.
139 iscsiadm_modify POS ${ISCSI_IHOST} target-param -h CRC32 \
140 "${IQN_TARGET}.${TARGET[0]}"
141
142 #Set --datadigest option of target-param to CRC32.
143 iscsiadm_modify POS ${ISCSI_IHOST} target-param -d CRC32 \
144 "${IQN_TARGET}.${TARGET[0]}"
145
146 # Enable sendTargets discovery method
147 iscsiadm_modify POS ${ISCSI_IHOST} discovery -t enable
148
149 # Verify the lun on initiator host
150 iscsiadm_verify ${ISCSI_IHOST} lun
151
152 tp_cleanup
153 clean_fs zdsk
154 initiator_cleanup "${ISCSI_IHOST}"
155
156 }
157