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 view visibility of the stmf framework.
  29 
  30 #
  31 # __stc_assertion_start
  32 # 
  33 # ID: visible004
  34 # 
  35 # DESCRIPTION:
  36 #       Verify the view visibility with stmf service offline
  37 # 
  38 # STRATEGY:
  39 # 
  40 #       Setup:
  41 #               Create a host group hg
  42 #               Create a target group tg1 tg2
  43 #               Create a logical unit lu 
  44 #               Add all the host initiator ports into the host group hg
  45 #               Add the target port port1 into the target group tg1
  46 #               Add the target port port2 into the target group tg2
  47 #               Add the view entry with hg, tg1 and lu
  48 #               Add the view entry with hg, tg2 and lu
  49 #               svcadm disable stmf service
  50 #       Test: 
  51 #               Verify the host side can not see any target device
  52 #       Cleanup:
  53 #               Delete the host group
  54 #               Delete the target group
  55 #               Delete the logical units
  56 #               Delete the view entry
  57 # 
  58 #       STRATEGY_NOTES:
  59 # 
  60 # KEYWORDS:
  61 # 
  62 #       stmfadm add-view
  63 # 
  64 # TESTABILITY: explicit
  65 # 
  66 # AUTHOR: John.Gu@Sun.COM
  67 # 
  68 # REVIEWERS:
  69 # 
  70 # TEST_AUTOMATION_LEVEL: automated
  71 # 
  72 # CODING_STATUS: IN_PROGRESS (2008-02-14)
  73 # 
  74 # __stc_assertion_end
  75 function visible004 {
  76         cti_pass
  77         tc_id="visible004"
  78         tc_desc="Verify the view visibility with stmf service offline"
  79         print_test_case $tc_id - $tc_desc
  80 
  81         build_fs zdsk
  82         fs_zfs_create -V 1g $ZP/${VOL[0]}               
  83 
  84         sbdadm_create_lu POS -s 1024k $DEV_ZVOL/$ZP/${VOL[0]}
  85         eval guid=\$LU_${VOL[0]}_GUID
  86         
  87         stmfadm_create POS tg ${TG[0]}
  88         stmfadm_create POS tg ${TG[1]}
  89         stmfadm_create POS hg ${HG[0]}  
  90 
  91         stmf_smf_disable
  92         pos=0
  93         for target in $G_TARGET
  94         do
  95                 if [ $pos -eq 0 ];then
  96                         stmfadm_add POS tg-member -g ${TG[0]} $target
  97                         pos=1
  98                 else
  99                         stmfadm_add POS tg-member -g ${TG[1]} $target
 100                         pos=0
 101                 fi
 102         done
 103         stmf_smf_enable
 104 
 105         stmsboot_enable_mpxio $FC_IHOST
 106         typeset hostname=`format_shellvar $FC_IHOST`
 107         eval initiator_list="\$HOST_${hostname}_INITIATOR"
 108         for port in $initiator_list
 109         do
 110                 stmfadm_add POS hg-member -g ${HG[0]} $port
 111         done
 112 
 113         stmfadm_add POS view -t ${TG[0]} -h ${HG[0]} $guid
 114         stmfadm_add POS view -t ${TG[1]} -h ${HG[0]} $guid
 115 
 116         stmf_smf_disable
 117         
 118         stmfadm_verify initiator
 119 
 120         tp_cleanup
 121         clean_fs zdsk
 122         
 123 }