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_003
  34 #
  35 # DESCRIPTION:
  36 #       Verify that iscsi target node can support the send-target discovery
  37 #       by iscsi initiator node
  38 #
  39 # STRATEGY:
  40 #       Setup:
  41 #               Create target portal group with specified tag 1 and ip address 1
  42 #               Create target node 1 with tpgt 1 and specified node name 1
  43 #               Create target node 2 with tpgt 1 and specified node name 2
  44 #               Setup initiator node to enable send-target discovery
  45 #               Add the discovery-address to initiator node by iscsiadm
  46 #                   add discovery-address option
  47 #                   with specified ip address 1
  48 #       Test:
  49 #               Check that target node 1 can be visible by initiator node
  50 #               Check that target node 2 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_003
  74 {
  75         cti_pass
  76 
  77         tc_id="iscsi_discovery_003"
  78 
  79         tc_desc="Verify that iscsi target node can support the send-target"
  80         tc_desc="${tc_desc} discovery by iscsi initiator node"
  81         print_test_case $tc_id - $tc_desc
  82         
  83         typeset portal_list
  84         set -A portal_list $(get_portal_list ${ISCSI_THOST})
  85         # Create target portal
  86         itadm_create POS tpg 1 "${portal_list[0]}"
  87 
  88         # Create target node
  89         itadm_create POS target -n "${IQN_TARGET}.${TARGET[0]}" -t 1
  90         itadm_create POS target -n "${IQN_TARGET}.${TARGET[1]}" -t 1
  91         
  92         # Enable sendTargets discovery on initiator host
  93         iscsiadm_modify POS "${ISCSI_IHOST}" discovery -t "enable" 
  94         iscsiadm_add POS "${ISCSI_IHOST}" discovery-address "${portal_list[0]}" 
  95 
  96         iscsiadm_verify ${ISCSI_IHOST} target
  97 
  98         tp_cleanup
  99         initiator_cleanup "${ISCSI_IHOST}"
 100 }
 101