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:R: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 # Set variables. 59 # 60 61 SRVNAME=`uname -n` 62 SRVADDR=`get_server_ip` 63 DHCP_DEFAULTS=/etc/inet/dhcpsvc.conf 64 65 # 66 # Convert. 67 # 68 /usr/sbin/dhcpconfig -C -f -r ${DHCPRSRC_NEW} -p ${DHCPPATH_NEW} >>${OUTFILE} 2>&1 69 RET=$? 70 if [ "${RET}" != "0" ] 71 then 72 echo "Error converting datastore = ${RET}" 73 echo "${TESTNAME} - Test failed!" 74 exit 1 75 fi 76 77 # 78 # Verify that the datastore resource was defined in the defaults file 79 # 80 DEFLINE=`grep "RESOURCE=${DHCPRSRC_NEW}" ${DHCP_DEFAULTS}` 81 if [ -z "${DEFLINE}" ] 82 then 83 echo "New RESOURCE not set correctly in ${DHCP_DEFAULTS}" 84 echo "${TESTNAME} - Test failed!" 85 exit 1 86 fi 87 88 # 89 # Verify that the datastore path was defined in the defaults file 90 # 91 DEFLINE=`grep "PATH=${DHCPPATH_NEW}" ${DHCP_DEFAULTS}` 92 if [ -z "${DEFLINE}" ] 93 then 94 echo "New PATH not set correctly in ${DHCP_DEFAULTS}" 95 echo "${TESTNAME} - Test failed!" 96 exit 1 97 fi 98 99 # 100 # Verify that the dhcptab was created. 101 # 102 DATAFILE=/tmp/${TESTNAME}.data.$$ 103 /usr/sbin/dhtadm -r ${DHCPRSRC_NEW} -p ${DHCPPATH_NEW} -P >${DATAFILE} 2>>${OUTFILE} 104 RET=$? 105 if [ "${RET}" != "0" ] 106 then 107 rm ${DATAFILE} 108 echo "Error displaying dhcptab = ${RET}" 109 echo "${TESTNAME} - Test failed!" 110 exit 1 111 fi 112 rm ${DATAFILE} 113 114 # 115 # Verify that the network table was created. 116 # 117 SUBNET=`get_netmask ${SRVADDR}` 118 SUBNETADDR=`get_subnet_addr ${SRVADDR} ${SUBNET}` 119 /usr/sbin/pntadm -r ${DHCPRSRC_NEW} -p ${DHCPPATH_NEW} -L >${DATAFILE} 2>>${OUTFILE} 120 RET=$? 121 if [ "${RET}" != "0" ] 122 then 123 rm ${DATAFILE} 124 echo "Error listing network tables = ${RET}" 125 echo "${TESTNAME} - Test failed!" 126 exit 1 127 fi 128 129 ENTRY=`grep "^${SUBNETADDR}$" ${DATAFILE}` 130 if [ -z "${ENTRY}" ] 131 then 132 rm ${DATAFILE} 133 echo "Did not find network table, ${SUBNETADDR}" 134 echo "${TESTNAME} - Test failed!" 135 exit 1 136 fi 137 rm ${DATAFILE} 138 139 echo "${TESTNAME} - Test passed." 140 exit 0 141 142 143