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 data visibility related with
  29 # iscsi target port provider
  30 #
  31 
  32 # __stc_assertion_start
  33 #
  34 # ID: iscsi_visible_005
  35 #
  36 # DESCRIPTION:
  37 #       initiator can update its target list when target are removed on target
  38 #       side
  39 #
  40 # STRATEGY:
  41 #       Setup:
  42 #               1. Configure discovery address with <target side ip address>
  43 #                  for initiator using iscsiadm add discovery-address
  44 #
  45 #               2. itadm create a target portal group with proper ip address
  46 #
  47 #               3. itadm create 3 targets with the created target portal group
  48 #
  49 #               4. Enable "SentTarget" discovery method on initiator using
  50 #                  iscsiadm modify discovery -t enable
  51 #
  52 #               5. Check that the initiator have the 3 new created target in
  53 #                  its target list
  54 #       Test:
  55 #               1. itadm delete the 2 targets on target side.
  56 #
  57 #               2. Wait a few second for initiator to update the information.
  58 #                  (Is there any specification on how long should wait ?)
  59 #
  60 #               3. Verify that the initiator only have one target in its list
  61 #
  62 #       Cleanup:
  63 #               1. Delete the targets, target portal group
  64 #
  65 #               2. Disable the discovery method on initiator and remove the
  66 #                  discovery address
  67 #
  68 #       STRATEGY_NOTES:
  69 #
  70 # TESTABILITY: explicit
  71 #
  72 # AUTHOR: zheng.he@sun.com
  73 #
  74 # REVIEWERS:
  75 #
  76 # ASSERTION_SOURCE:
  77 #
  78 # TEST_AUTOMATION_LEVEL: automated
  79 #
  80 # STATUS: IN_PROGRESS
  81 #
  82 # COMMENTS:
  83 #
  84 # __stc_assertion_end
  85 #
  86 function tp_iscsi_visible_005
  87 {
  88         cti_pass
  89 
  90         tc_id="tp_iscsi_visible_005"
  91 
  92         tc_desc="initiator can update its target list when target are"
  93         tc_desc="${tc_desc} removed on target side"
  94         print_test_case $tc_id - $tc_desc
  95 
  96         typeset portal_list
  97         set -A portal_list $(get_portal_list ${ISCSI_THOST})
  98 
  99         iscsiadm_add POS "${ISCSI_IHOST}" discovery-address "${portal_list[0]}"
 100 
 101         itadm_create POS tpg 1 "${portal_list[0]}"
 102         itadm_create POS target -n ${IQN_TARGET}:${TARGET[1]} -t 1
 103         itadm_create POS target -n ${IQN_TARGET}:${TARGET[2]} -t 1
 104         itadm_create POS target -n ${IQN_TARGET}:${TARGET[3]} -t 1
 105 
 106         iscsiadm_modify POS "${ISCSI_IHOST}" discovery -t enable
 107         iscsiadm_verify "${ISCSI_IHOST}" target 
 108 
 109         #iscsiadm_verify target 
 110         itadm_delete POS target -f ${IQN_TARGET}:${TARGET[1]}
 111         itadm_delete POS target -f ${IQN_TARGET}:${TARGET[2]}
 112 
 113         iscsiadm_modify POS "${ISCSI_IHOST}" discovery -t disable
 114         iscsiadm_modify POS "${ISCSI_IHOST}" discovery -t enable
 115         iscsiadm_verify "${ISCSI_IHOST}" target 
 116 
 117         tp_cleanup
 118         initiator_cleanup "${ISCSI_IHOST}"
 119 }
 120