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_002
  34 #
  35 # DESCRIPTION:
  36 #       iSCSI target port provider can register into the default discovery
  37 #       domain of iSNS server and be visible by initiator node in the same
  38 #       default discovery domain
  39 #
  40 # STRATEGY:
  41 #       Setup:
  42 #               Setup iSNS server ip address on initiator host
  43 #               Modify default settings to isns enable and configure the isns
  44 #                   server ip address and port on target host
  45 #               Create target node with specified node name by
  46 #                   itadm create-target option
  47 #               Enable isns_server service on initiator host
  48 #       Test:
  49 #               Check that target node can be visible by initiator node
  50 #       Cleanup:
  51 #               Delete the target node
  52 #               Delete the configuration information in initiator and target
  53 #
  54 #       STRATEGY_NOTES:
  55 #
  56 # TESTABILITY: explicit
  57 #
  58 # AUTHOR: john.gu@sun.com
  59 #
  60 # REVIEWERS:
  61 #
  62 # ASSERTION_SOURCE:
  63 #
  64 # TEST_AUTOMATION_LEVEL: automated
  65 #
  66 # STATUS: IN_PROGRESS
  67 #
  68 # COMMENTS:
  69 #
  70 # __stc_assertion_end
  71 #
  72 function iscsi_discovery_002
  73 {
  74         cti_pass
  75 
  76         tc_id="iscsi_discovery_002"
  77 
  78         tc_desc="iSCSI target port provider can register into the default"
  79         tc_desc="${tc_desc} discovery domain of iSNS server and be visible by"
  80         tc_desc="${tc_desc}  initiator node in the same default discovery domain"
  81         print_test_case $tc_id - $tc_desc
  82 
  83         typeset t="${IQN_TARGET}.${TARGET[0]}"
  84 
  85         # Setup isns server ip address on initiator host
  86         iscsiadm_add POS "${ISCSI_IHOST}" isns-server "${ISNS_HOST}" 
  87 
  88         # Enable isns service on target host
  89         itadm_modify POS defaults -I "${ISNS_HOST}"
  90         itadm_modify POS defaults -i "enable"
  91 
  92         # Create target 
  93         itadm_create POS target -n ${t}
  94 
  95         # Enable isns discovery on initiator host
  96         iscsiadm_modify POS "${ISCSI_IHOST}" discovery -i "enable" 
  97 
  98         # sleep for a while to give initiator update its target
  99         # list from isns server
 100         sleep 5
 101         iscsiadm_verify ${ISCSI_IHOST} target
 102 
 103         initiator_cleanup "${ISCSI_IHOST}"
 104 
 105         tp_cleanup
 106 }
 107