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 ##################################################################
29 #
30 # This routine tests unsupported fcinfo options which introduced
31 # as part of comstar support.
32 #
33 ##################################################################
34 # __stc_assertion_start
35 #
36 # ID: fcinfo_comstar_003
37 #
38 # DESCRIPTION:
39 # Test unsupported fcinfo options which are introduced by
40 # comstar support.
41 #
42 # The following test should be failed.
43 # - fcinfo hba-port -i on target mode port
44 # - fcinfo hba-port -t on initiator mode.
45 # - fcinfo hba-port -s on target mode port
46 # - fcinfo remote-port -s -p <target mode port>
47 #
48 # STRATEGY:
49 #
50 # Setup:
51 # Both target mode hba port and intiator mode hba port
52 # should exists on the hosts.
53 # Test:
54 # Verify failure on each command listed above.
55 # Cleanup:
56 # None
57 #
58 # STRATEGY_NOTES:
59 # remote initiators should be connected to the target mode
60 # port to properly run the remote-port related test.
61 #
62 # KEYWORDS:
63 # fcinfo hba-port remote-port
64 #
65 # TESTABILITY: explicit
66 #
67 # AUTHOR: hyon.kim@sun.com
68 #
69 # REVIEWERS: <e-mail, e-mail>
70 #
71 #
72 # ASSERTION_SOURCE:
73 #
74 # // Optional field - a pointer to the document source of the assertion
75 #
76 #
77 # TEST_AUTOMATION_LEVEL: automated
78 #
79 # CODING_STATUS: IN_PROGRESS
80 #
81 # __stc_assertion_end
82 ##############################################################################
83 function tp_fcinfo_003
84 {
85 typeset TEST_NAME="testing unsupported options for fcinfo command"
86 typeset return_code=0
87 typeset re_code=0
88 cti_assert fcinfo_comstar_003 "Testing $TEST_NAME "
89
90 CMD="fcinfo hba-port -t"
91 cti_execute_cmd "$CMD"
92 re_code=$?
93 cti_report "$CMD returns: $re_code"
94 if [ $re_code -ne 0 ];then return 1;fi
95
96 #############################################################
97 # list of target mode hba-port WWNs.
98 #############################################################
99
100 # obtain an unique list of target mode WWNs for each of the HBA types
101 CMD="fcinfo hba-port -t | grep 'Port WWN' > ${LOGDIR}/tgtmode-wwn.out3"
102 cti_execute_cmd $CMD
103 cti_reportfile "${LOGDIR}/tgtmode-wwn.out3"
104
105 #obtain typical target mode HBA to run test
106 CMD="fcinfo hba-port -t | grep Manufacturer > ${LOGDIR}/tgtmode-hbatype.out3"
107 cti_execute_cmd $CMD
108 cti_reportfile "${LOGDIR}/tgtmode-hbatype.out3"
109
110 CMD="paste ${LOGDIR}/tgtmode-hbatype.out3 ${LOGDIR}/tgtmode-wwn.out3"
111 CMD="$CMD > ${LOGDIR}/tgtmode-wwn-hba-list.out3"
112 cti_execute_cmd $CMD
113 cti_reportfile "${LOGDIR}/tgtmode-wwn-hba-list.out3"
114
115 cti_execute_cmd "cat ${LOGDIR}/tgtmode-wwn-hba-list.out3 |"\
116 "grep QLogic > ${LOGDIR}/tgtmode-unique.list3"
117 cti_execute_cmd "cat ${LOGDIR}/tgtmode-wwn-hba-list.out3 |"\
118 "grep JNI >> ${LOGDIR}/tgtmode-unique.list3"
119 cti_execute_cmd "cat ${LOGDIR}/tgtmode-wwn-hba-list.out3 |"\
120 "grep Emulex >> ${LOGDIR}/tgtmode-unique.list3"
121 cti_execute_cmd "cat ${LOGDIR}/tgtmode-wwn-hba-list.out3 |"\
122 "grep Sun >> ${LOGDIR}/tgtmode-unique.list3"
123 cti_reportfile "${LOGDIR}/tgtmode-unique.list3"
124
125 CMD="cut -f 3 -d: ${LOGDIR}/tgtmode-unique.list3"
126 CMD="$CMD > ${LOGDIR}/uniquetgtmodeHBAWWNList3"
127 cti_execute_cmd $CMD
128 cti_reportfile "${LOGDIR}/uniquetgtmodeHBAWWNList3"
129
130 UNIQHBAWWNLIST=`eval "cat ${LOGDIR}/uniquetgtmodeHBAWWNList"`
131
132 #############################################################
133 # Each target mode port, check the invalid options.
134 #############################################################
135 for hbaPWWN in $UNIQHBAWWNLIST;
136 do
137 cti_report "Working on Targt mode HBAPort: $hbaPWWN"
138 CMD="fcinfo hba-port -i $hbaPWWN"
139 cti_execute_cmd "$CMD"
140 re_code=$?
141 cti_report "$CMD returns: $re_code"
142 #if not failed, increase return code.
143 if [ $re_code -eq 0 ];then
144 ((return_code+=1))
145 fi
146
147 CMD="fcinfo remote-port -s -p $hbaPWWN"
148 cti_execute_cmd "$CMD"
149 re_code=$?
150 cti_report "$CMD returns: $re_code"
151 #if not failed, increase return code.
152 if [ $re_code -eq 0 ];then
153 ((return_code+=1))
154 fi
155
156 for rmtport1 in `eval "fcinfo remote-port -p $hbaPWWN" \
157 | grep 'Remote Port WWN' | awk ' { print $4 }'`;
158 do
159
160 CMD="fcinfo remote-port -s -p $hbaPWWN $rmtport1"
161 cti_execute_cmd "$CMD"
162 re_code=$?
163 cti_report "$CMD returns: $re_code"
164 #if not failed, increase return code.
165 if [ $re_code -eq 0 ];then
166 ((return_code+=1))
167 fi
168 done
169 done
170
171 # obtain an unique list of initiator mode WWNs for each of the HBA types
172 CMD="fcinfo hba-port -i | grep 'Port WWN' > ${LOGDIR}/initmode-wwn.out"
173 cti_execute_cmd $CMD
174
175 #if failed to get initiator port list skip the test.
176 re_code=$?
177 if [ $re_code -ne 0 ];then
178 cti_report "Failed to get an initiator mode port."
179 else
180 #obtain typical init mode HBA to run test
181 CMD="fcinfo hba-port -i | grep Manufacturer > ${LOGDIR}/initmode-hbatype.out"
182 cti_execute_cmd $CMD
183
184 CMD="paste ${LOGDIR}/initmode-hbatype.out ${LOGDIR}/initmode-wwn.out"
185 CMD="$CDM > ${LOGDIR}/initmode-wwn-hba-list.out"
186 cti_execute_cmd $CMD
187 cti_reportfile "${LOGDIR}/initmode-wwn-hba-list.out"
188
189 cti_execute_cmd "cat ${LOGDIR}/initmode-wwn-hba-list.out |"\
190 "grep QLogic > ${LOGDIR}/initmode-unique.list"
191 cti_execute_cmd "cat ${LOGDIR}/initmode-wwn-hba-list.out |"\
192 "grep JNI >> ${LOGDIR}/initmode-unique.list"
193 cti_execute_cmd "cat ${LOGDIR}/initmode-wwn-hba-list.out |"\
194 "grep Emulex >> ${LOGDIR}/tgtmode-unique.list"
195 cti_execute_cmd "cat ${LOGDIR}/initmode-wwn-hba-list.out |"\
196 "grep Sun >> ${LOGDIR}/tgtmode-unique.list"
197 cti_reportfile "${LOGDIR}/initmode-unique.list"
198
199 CMD="cut -f 3 -d: ${LOGDIR}/initmode-unique.list"
200 CMD="$CMD > ${LOGDIR}/uniqueinitmodeHBAWWNList"
201 cti_execute_cmd $CMD
202 cti_reportfile "${LOGDIR}/uniquetgtmodeHBAWWNList"
203
204 UNIQHBAWWNLIST=`eval "cat ${LOGDIR}/uniqueinitmodeHBAWWNList"`
205
206 for hbaPWWN in $UNIQHBAWWNLIST;
207 do
208 cti_report "Working on Initiator mode HBAPort: $hbaPWWN"
209 # check failure on -i option.
210 CMD="fcinfo hba-port -t $hbaPWWN"
211 cti_execute_cmd "$CMD"
212 re_code=$?
213 cti_report "$CMD returns: $re_code"
214 #if not failed, increase return code.
215 if [ $re_code -eq 0 ];then
216 ((return_code+=1))
217 fi
218 done
219 fi
220
221 if [[ $return_code != 0 ]]
222 then
223 cti_report "Test Purpose 3: $TEST_NAME failed with return"\
224 "code $return_code"
225 cti_fail "Test Purpose 3: $TEST_NAME failed"
226 else
227 cti_report "$TEST_NAME output: "
228 cti_pass "Test Purpose 3: $TEST_NAME passed"
229 fi
230 }