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# 33DIRNAME=`dirname $0` 34. ${DIRNAME}/utilities.san 35 36# 37# Process the input arguments. 38# 39VALIDOPTS=dr:p: 40process_args $@ 41 42# 43# In case the tester wants to see script output, allow them 44# to run in debug mode. 45# 46TESTNAME=`basename $0` 47if [ ! -z "${DEBUG}" ] 48then 49 OUTFILE=/tmp/${TESTNAME}.$$ 50 echo "Output from test: ${TESTNAME}" >${OUTFILE} 51 echo >>${OUTFILE} 52 echo "debug output can be found at ${OUTFILE}" 53else 54 OUTFILE=/dev/null 55fi 56 57# 58# Set variables. 59# 60 61SRVNAME=`uname -n` 62SRVADDR=`get_server_ip` 63DHCPCONFIG=/usr/sbin/dhcpconfig 64IMPORTFILE=/tmp/move.zip 65 66# 67# Import. 68# 69${DHCPCONFIG} -I ${IMPORTFILE} >>${OUTFILE} 2>&1 70RET=$? 71if [ "${RET}" != "0" ] 72then 73 echo "Error importing DHCP data = ${RET}" 74 echo "${TESTNAME} - Test failed!" 75 exit 1 76fi 77 78# 79# Verify that the Locale macro was added to the dhcptab. 80# 81DATAFILE=/tmp/${TESTNAME}.data.$$ 82/usr/sbin/dhtadm -r ${DHCPRSRC} -p ${DHCPPATH} -P >${DATAFILE} 2>>${OUTFILE} 83RET=$? 84if [ "${RET}" != "0" ] 85then 86 rm ${DATAFILE} 87 echo "Error displaying dhcptab = ${RET}" 88 echo "${TESTNAME} - Test failed!" 89 exit 1 90fi 91 92LOCALE=`grep "^Locale" ${DATAFILE}` 93if [ -z "${LOCALE}" ] 94then 95 rm ${DATAFILE} 96 echo "Locale macro was not added to the dhcptab" 97 echo "${TESTNAME} - Test failed!" 98 exit 1 99fi 100 101# 102# Verify that the server macro was added to the dhcptab. 103# 104SERVER_MACRO=`grep "^${SRVNAME}" ${DATAFILE}` 105if [ -z "${SERVER_MACRO}" ] 106then 107 rm ${DATAFILE} 108 echo "Server macro was not removed from the dhcptab" 109 echo "${TESTNAME} - Test failed!" 110 exit 1 111fi 112rm ${DATAFILE} 113 114# 115# Verify that the network table was created. 116# 117SUBNET=`get_netmask ${SRVADDR}` 118SUBNETADDR=`get_subnet_addr ${SRVADDR} ${SUBNET}` 119NETTABS=`/usr/sbin/pntadm -r ${DHCPRSRC} -p ${DHCPPATH} -L 2>>${OUTFILE}` 120NETTAB=`echo ${NETTABS} | fgrep ${SUBNETADDR}` 121if [ -z ${NETTAB} ] 122then 123 echo "${SUBNETADDR} was not imported." 124 echo "${TESTNAME} - Test failed!" 125 exit 1 126fi 127 128echo "${TESTNAME} - Test passed." 129exit 0 130