1 #!/usr/bin/ksh 2 # 3 # CDDL HEADER START 4 # 5 # The contents of this file are subject to the terms of the 6 # Common Development and Distribution License, Version 1.0 only 7 # (the "License"). You may not use this file except in compliance 8 # with the License. 9 # 10 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 11 # or http://www.opensolaris.org/os/licensing. 12 # See the License for the specific language governing permissions 13 # and limitations under the License. 14 # 15 # When distributing Covered Code, include this CDDL HEADER in each 16 # file and include the License file at usr/src/OPENSOLARIS.LICENSE. 17 # If applicable, add the following below this CDDL HEADER, with the 18 # fields enclosed by brackets "[]" replaced with your own identifying 19 # information: Portions Copyright [yyyy] [name of copyright owner] 20 # 21 # CDDL HEADER END 22 # 23 # 24 #ident "%Z%%M% %I% %E% SMI" 25 # 26 # Copyright (c) 2001 by Sun Microsystems, Inc. 27 # All rights reserved. 28 # 29 30 # 31 # Source the utilities. 32 # 33 DIRNAME=`dirname $0` 34 . ${DIRNAME}/utilities.san 35 36 # 37 # Process the input arguments. 38 # 39 VALIDOPTS=dr:p: 40 process_args $@ 41 42 # 43 # In case the tester wants to see script output, allow them 44 # to run in debug mode. 45 # 46 TESTNAME=`basename $0` 47 if [ ! -z "${DEBUG}" ] 48 then 49 OUTFILE=/tmp/${TESTNAME}.$$ 50 echo "Output from test: ${TESTNAME}" >${OUTFILE} 51 echo >>${OUTFILE} 52 echo "debug output can be found at ${OUTFILE}" 53 else 54 OUTFILE=/dev/null 55 fi 56 57 # 58 # Verify that option is already defined in the dhcptab 59 # 60 DATAFILE=/tmp/${TESTNAME}.data.$$ 61 /usr/sbin/dhtadm -r ${DHCPRSRC} -p ${DHCPPATH} -P >${DATAFILE} 2>>${OUTFILE} 62 RET=$? 63 if [ "${RET}" != "0" ] 64 then 65 rm ${DATAFILE} 66 echo "Error displaying dhcptab = ${RET}" 67 echo "${TESTNAME} - Test failed!" 68 exit 1 69 fi 70 71 OPTION=`grep "^TestOpt" ${DATAFILE}` 72 OPTION_DEFINITION=$(get_value ${OPTION}) 73 if [ "${OPTION_DEFINITION}" != "Vendor=the_test_class,11,ASCII,1,0" ] 74 then 75 rm ${DATAFILE} 76 echo "Option definition should have been defined as: Vendor=the_test_class,11,ASCII,1,0" 77 echo "${TESTNAME} - Test failed!" 78 exit 1 79 fi 80 rm ${DATAFILE} 81 82 # 83 # Modify the option. 84 # 85 /usr/sbin/dhtadm -r ${DHCPRSRC} -p ${DHCPPATH} -M -s TestOpt -d 'Site,130,IP,1,0' >>${OUTFILE} 2>&1 86 RET=$? 87 if [ "${RET}" != "0" ] 88 then 89 echo "Error modifying option = ${RET}" 90 echo "${TESTNAME} - Test failed!" 91 exit 1 92 fi 93 94 # 95 # Verify that the option is defined in the dhcptab. 96 # 97 /usr/sbin/dhtadm -r ${DHCPRSRC} -p ${DHCPPATH} -P >${DATAFILE} 2>>${OUTFILE} 98 RET=$? 99 if [ "${RET}" != "0" ] 100 then 101 rm ${DATAFILE} 102 echo "Error displaying dhcptab = ${RET}" 103 echo "${TESTNAME} - Test failed!" 104 exit 1 105 fi 106 107 OPTION=`grep "^TestOpt" ${DATAFILE}` 108 if [ -z "${OPTION}" ] 109 then 110 rm ${DATAFILE} 111 echo "Option not modified in dhcptab" 112 echo "${TESTNAME} - Test failed!" 113 exit 1 114 fi 115 rm ${DATAFILE} 116 117 # 118 # Verify that the defintion was defined correctly 119 # 120 OPTION_DEFINITION=$(get_value ${OPTION}) 121 if [ "${OPTION_DEFINITION}" != "Site,130,IP,1,0" ] 122 then 123 echo "Option definition is not valid: ${OPTION_DEFINITION}" 124 echo "${TESTNAME} - Test failed!" 125 exit 1 126 fi 127 128 echo "${TESTNAME} - Test passed." 129 exit 0