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