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