From 7dac4543ee8f303b86dcc2501f1f55f0c0b96a55 Mon Sep 17 00:00:00 2001 From: harti Date: Thu, 29 Jan 2004 15:58:06 +0000 Subject: Add a simple test script for the ng_atmpif node. Submitted by: Vincent Jardin --- tools/regression/atm/harp/atm_udp.ng | 155 +++++++++++++++++++++++++++++++ tools/regression/atm/harp/memory_leak.sh | 13 +++ 2 files changed, 168 insertions(+) create mode 100644 tools/regression/atm/harp/atm_udp.ng create mode 100644 tools/regression/atm/harp/memory_leak.sh (limited to 'tools/regression/atm') diff --git a/tools/regression/atm/harp/atm_udp.ng b/tools/regression/atm/harp/atm_udp.ng new file mode 100644 index 0000000..329b696 --- /dev/null +++ b/tools/regression/atm/harp/atm_udp.ng @@ -0,0 +1,155 @@ +#!/bin/sh +# +# $FreeBSD$ +# +err() { + echo "$*" >&2 +} +usage() { + err "Usage: `basename $0` atmindex loc_ip udp_port rem_ip udp_port [pref_iface]" + err " or: `basename $0` flush" + exit $1 +} + +args=`getopt ed $*` +if [ $? != 0 ] ; then + usage 2 +fi +set -- $args + +debug_enable=0 + +for i +do + case "$i" + in + -e) + debug_enable=1 + shift;; + -d) + debug_enable=-1 + shift;; + --) + shift ; break;; + esac +done + +if [ $# -lt 1 ] ; then + err "Missing arguments" + usage 1 +fi + +# +# Handle debug flags +# +case ${debug_enable} in + +1) + # + # Enable all the HARP debugging features + # + sysctl -w net.harp.atm.atm_debug=1 + sysctl -w net.harp.atm.atm_dev_print=1 + sysctl -w net.harp.atm.atm_print_data=1 + sysctl -w net.harp.ip.ipatm_print=1 + sysctl -w net.harp.spans.spanscls_print=1 + sysctl -w net.harp.uni.uniarp_print=1 + sysctl -w net.harp.uni.unisig_print_msg=2 + ;; + +-1) + # + # Disable all the HARP debugging features + # + sysctl -w net.harp.atm.atm_debug=0 + sysctl -w net.harp.atm.atm_dev_print=0 + sysctl -w net.harp.atm.atm_print_data=0 + sysctl -w net.harp.ip.ipatm_print=0 + sysctl -w net.harp.spans.spanscls_print=0 + sysctl -w net.harp.uni.uniarp_print=0 + sysctl -w net.harp.uni.unisig_print_msg=0 + ;; +esac + +if [ "${1}" = "flush" ] ; then + # + # Remove all atmpif nodes + # + for i in `ngctl list | grep atmpif | awk '{print $6}'` ; do + ngctl shutdown [$i]: + done + exit 0 +fi + +ID=${1} + +if [ $# -lt 5 -o $# -gt 6 ] ; then + err "wrong number of arguments" + usage 1 +fi + +LOC_IP=${2} +LOC_UDP_PORT=${3} +REM_IP=${4} +REM_UDP_PORT=${5} +PREF_IFACE=${6} + +if [ "${LOC_IP}" = "" -o "${LOC_UDP_PORT}" = "" -o \ + "${REM_IP}" = "" -o "${REM_UDP_PORT}" = "" ] ; then + err "bad argument" + usage 1 +fi + +# +# Default interface prefix: atmX +# +if [ "${PREF_IFACE}" = "" ] ; then + PREF_IFACE="atm" +fi + +# Create the ATM PIF (Physical Interface) vatmpifXX +# +ngctl -f - <