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 target discovery
29 #
30
31 # __stc_assertion_start
32 #
33 # ID: iscsi_discovery_005
34 #
35 # DESCRIPTION:
36 # iSCSI target with a active target portal can register into the
37 # default discovery domain of iSNS server and be visible by
38 # initiator node in the same default discovery domain
39 #
40 # STRATEGY:
41 # Setup:
42 # Setup iSNS server ip address on initiator host
43 # Modify default settings to isns enable and configure the isns
44 # server ip address and port on target host
45 # Create a target portal group
46 # Create target node with specified node name and a tpg by
47 # itadm create-target option
48 # Enable isns_server service on initiator host
49 # Test:
50 # Check that target node can be visible by initiator node
51 # Cleanup:
52 # Delete the target node
53 # Delete the configuration information in initiator and target
54 #
55 # STRATEGY_NOTES:
56 #
57 # TESTABILITY: explicit
58 #
59 # AUTHOR: john.gu@sun.com
60 #
61 # REVIEWERS:
62 #
63 # ASSERTION_SOURCE:
64 #
65 # TEST_AUTOMATION_LEVEL: automated
66 #
67 # STATUS: IN_PROGRESS
68 #
69 # COMMENTS:
70 #
71 # __stc_assertion_end
72 #
73 function iscsi_discovery_005
74 {
75 cti_pass
76
77 tc_id="iscsi_discovery_005"
78
79 tc_desc="iSCSI target with a active target portal can register into the"
80 tc_desc="${tc_desc} default discovery domain of iSNS server and be"
81 tc_desc="${tc_desc} visible byinitiator node in the same default"
82 tc_desc="${tc_desc} discovery domain"
83
84 print_test_case $tc_id - $tc_desc
85
86 typeset t="${IQN_TARGET}.${TARGET[0]}"
87
88 # Setup isns server ip address on initiator host
89 iscsiadm_add POS "${ISCSI_IHOST}" isns-server "${ISNS_HOST}"
90
91 # Enable isns service on target host
92 itadm_modify POS defaults -I "${ISNS_HOST}"
93 itadm_modify POS defaults -i "enable"
94
95 typeset portal_list
96 set -A portal_list $(get_portal_list ${ISCSI_THOST})
97
98 # Create target protal group
99 itadm_create POS tpg 1 "${portal_list[0]}"
100 # Create target
101 itadm_create POS target -n ${t} -t 1
102
103 # Enable isns discovery on initiator host
104 iscsiadm_modify POS "${ISCSI_IHOST}" discovery -i "enable"
105
106 # sleep for a while to give initiator update its target
107 # list from isns server
108 sleep 5
109
110 iscsiadm_verify ${ISCSI_IHOST} target
111
112 initiator_cleanup "${ISCSI_IHOST}"
113
114 tp_cleanup
115 }
116