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 functionality of chap authentication
29 #
30
31 # __stc_assertion_start
32 #
33 # ID: iscsi_auth_004
34 #
35 # DESCRIPTION:
36 # iSCSI target port provider can support connection and LU discovery
37 # with "CHAP" authentication by initiator and be verified by
38 # iSCSI initiator
39 #
40 # STRATEGY:
41 # Setup:
42 # Create target portal group with specified tag 1 and ip address
43 # Create target node with tpgt 1 with specified auth-method of
44 # "chap" authentication
45 # Modify initiator node authentication property with specified
46 # chap user and secret on initiator host by iscsiadm
47 # modify target-param option
48 # Modify the specified target node authentication property on
49 # target host by the same chap user and secret of
50 # initiator node on initiator host and by itadm
51 # modify-target option.
52 # Create a LU on target host by zfs file system
53 # Create the view of LU by default to all target and host groups
54 # Setup initiator node to enable "SendTarget" method
55 # Setup SendTarget with discovery address on initiator host
56 # Test:
57 # Check that device path of specified LU can be visible by
58 # iscsi initiator node
59 # Check that iscsi initiator node has at least 1 connection
60 # Cleanup:
61 # Delete the target portal group
62 # Delete the target node
63 # Delete the configuration information in initiator and target
64 #
65 # STRATEGY_NOTES:
66 #
67 # TESTABILITY: explicit
68 #
69 # AUTHOR: john.gu@sun.com
70 #
71 # REVIEWERS:
72 #
73 # ASSERTION_SOURCE:
74 #
75 # TEST_AUTOMATION_LEVEL: automated
76 #
77 # STATUS: IN_PROGRESS
78 #
79 # COMMENTS:
80 #
81 # __stc_assertion_end
82 #
83 function iscsi_auth_004
84 {
85 cti_pass
86
87 tc_id="iscsi_auth_004"
88 tc_desc="iSCSI target port provider can support connection and LU"
89 tc_desc="${tc_desc} discovery CHAP authentication by initiator and be"
90 tc_desc="${tc_desc} verified by iSCSI initiator"
91
92 print_test_case $tc_id - $tc_desc
93
94 stmsboot_enable_mpxio $ISCSI_IHOST
95
96 typeset portal_list
97 set -A portal_list $(get_portal_list ${ISCSI_THOST})
98
99 typeset t="${IQN_TARGET}.${TARGET[1]}"
100 # Create target and target protal group
101 itadm_create POS tpg 1 "${portal_list[0]}"
102 itadm_create POS target -n ${t} -t 1
103
104 # Set target chap properities on initiator host
105 iscsiadm_modify POS "${ISCSI_IHOST}" target-param -C "120123456789" ${t}
106 iscsiadm_modify POS "${ISCSI_IHOST}" target-param -H "t_chap_user" ${t}
107 iscsiadm_modify POS "${ISCSI_IHOST}" target-param -a "CHAP" ${t}
108
109 # Set target chap properities on target host
110 itadm_modify POS target -s "120123456789" "${t}"
111 itadm_modify POS target -u "t_chap_user" "${t}"
112
113 #Create lu
114 build_fs zdsk
115 fs_zfs_create -V 1g $ZP/${VOL[0]}
116 sbdadm_create_lu POS -s 1024k $DEV_ZVOL/$ZP/${VOL[0]}
117
118 typeset guid
119 eval guid=\$LU_${VOL[0]}_GUID
120 # Add view
121 stmfadm_add POS view "${guid}"
122 # Online lu
123 stmfadm_online POS lu "${guid}"
124 # Online target
125 stmfadm_online POS target "${IQN_TARGET}.${TARGET[1]}"
126
127 # Set discover address
128 iscsiadm_add POS ${ISCSI_IHOST} discovery-address \
129 "${portal_list[0]}"
130
131 # Enable sendTargets discovery method
132 iscsiadm_modify POS ${ISCSI_IHOST} discovery -t enable
133
134 # Verify the lun on initiator host
135 iscsiadm_verify ${ISCSI_IHOST} lun
136
137 tp_cleanup
138 clean_fs zdsk
139 initiator_cleanup "${ISCSI_IHOST}"
140
141
142 }
143