Commit add602df authored by Timothy Stack's avatar Timothy Stack

Parse the NS file with the real NS parser so we can make sure linktest is
doing the "right" thing.

	* configure, configure.in: Add tbsetup/nsverify files.

	* tbsetup/GNUmakefile.in: Add nsverify subdir.

	* tbsetup/tbprerun.in: Run verify-ns on the experiments NS file.

	* tbsetup/ns2ir/nstb_compat.tcl: Bring up-to-date with the current
	world.

	* tbsetup/nsverify/GNUmakefile.in: Makefile.

	* tbsetup/nsverify/ns-2.27.patch: Patch file for NS version 2.27.

	* tbsetup/nsverify/nstbparse.in: Wrapper for the NS parser.

	* tbsetup/nsverify/tb_compat.tcl: Different version of
	tb_compat.tcl that is used to verify linktest parameters.

	* tbsetup/nsverify/verify-ns.in: Script that runs on boss and
	verifies that the testbed parser worked correctly.

	* tbsetup/ns2ir/parse-ns.in, tbsetup/ns2ir/parse.proxy.in: Tweaked
	a bit so parse.proxy can be used to run the regular NS parser in
	addition to the testbed one.
parent f117671b
......@@ -2,7 +2,7 @@
# Guess values for system-dependent variables and create Makefiles.
# Generated automatically using autoconf version 2.13
# Copyright (C) 1992, 93, 94, 95, 96, 05 Free Software Foundation, Inc.
# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
#
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
......@@ -2261,7 +2261,10 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/ns2ir/parse-ns tbsetup/ns2ir/parse.proxy \
tbsetup/ns2ir/sim.tcl tbsetup/nseswap tbsetup/nseparse/GNUmakefile \
tbsetup/nseparse/nse.parse.proxy tbsetup/nseparse/parse-nse \
tbsetup/nseparse/nse.parse.tcl tbsetup/db2ns \
tbsetup/nseparse/nse.parse.tcl \
tbsetup/nsverify/GNUmakefile tbsetup/nsverify/nstbparse \
tbsetup/nsverify/verify-ns \
tbsetup/db2ns \
tbsetup/tbprerun tbsetup/tbswap tbsetup/tbend tbsetup/tbrestart \
tbsetup/tbreport tbsetup/named_setup tbsetup/exports_setup \
tbsetup/checkpass/GNUmakefile tbsetup/assign_wrapper tbsetup/ptopgen \
......
......@@ -699,7 +699,10 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/ns2ir/parse-ns tbsetup/ns2ir/parse.proxy \
tbsetup/ns2ir/sim.tcl tbsetup/nseswap tbsetup/nseparse/GNUmakefile \
tbsetup/nseparse/nse.parse.proxy tbsetup/nseparse/parse-nse \
tbsetup/nseparse/nse.parse.tcl tbsetup/db2ns \
tbsetup/nseparse/nse.parse.tcl \
tbsetup/nsverify/GNUmakefile tbsetup/nsverify/nstbparse \
tbsetup/nsverify/verify-ns \
tbsetup/db2ns \
tbsetup/tbprerun tbsetup/tbswap tbsetup/tbend tbsetup/tbrestart \
tbsetup/tbreport tbsetup/named_setup tbsetup/exports_setup \
tbsetup/checkpass/GNUmakefile tbsetup/assign_wrapper tbsetup/ptopgen \
......
......@@ -13,7 +13,7 @@ PLABSUPPORT = @PLABSUPPORT@
include $(OBJDIR)/Makeconf
SUBDIRS = checkpass ns2ir ipassign nseparse checkup
SUBDIRS = checkpass ns2ir nsverify ipassign nseparse checkup
BIN_STUFF = power snmpit tbend tbprerun tbreport \
os_load endexp batchexp swapexp \
......@@ -75,13 +75,16 @@ wanlinksolve: wanlinksolve.cc
routecalc: routecalc.cc
${CXX} $< ${CXXFLAGS} -o $@ ${LIBS} -lm -lstdc++ ${LDFLAGS}
.PHONY: checkpass ns2ir plab ipassign checkup
.PHONY: checkpass ns2ir nsverify plab ipassign checkup
checkpass:
@$(MAKE) -C checkpass all
ns2ir:
@$(MAKE) -C ns2ir all
nsverify:
@$(MAKE) -C nsverify all
nseparse:
@$(MAKE) -C nseparse all
......@@ -116,6 +119,7 @@ endif
subdir-install:
@$(MAKE) -C checkpass install
@$(MAKE) -C ns2ir install
@$(MAKE) -C nsverify install
@$(MAKE) -C nseparse install
$(PLAB_INSTALL)
@$(MAKE) -C ipassign install
......@@ -130,6 +134,7 @@ script-install: $(addprefix $(INSTALL_BINDIR)/, $(BIN_STUFF)) \
post-install:
@$(MAKE) -C ns2ir post-install
@$(MAKE) -C nsverify post-install
@$(MAKE) -C nseparse post-install
$(PLAB_POST_INSTALL)
@$(MAKE) -C ipassign post-install
......@@ -191,6 +196,7 @@ control-install: $(addprefix $(INSTALL_SBINDIR)/, $(CTRLBIN_STUFF)) \
$(addprefix $(INSTALL_BINDIR)/, fetchtar.proxy) \
$(addprefix $(INSTALL_LIBDIR)/, libtestbed.pm)
@$(MAKE) -C ns2ir control-install
@$(MAKE) -C nsverify control-install
@$(MAKE) -C nseparse control-install
#
......@@ -211,6 +217,7 @@ clean: subdir-clean
subdir-clean:
@$(MAKE) -C checkpass clean
@$(MAKE) -C ns2ir clean
@$(MAKE) -C nsverify clean
@$(MAKE) -C nseparse clean
@$(MAKE) -C plab clean
@$(MAKE) -C ipassign clean
......@@ -221,6 +228,7 @@ distclean: subdir-distclean
subdir-distclean:
@$(MAKE) -C checkpass distclean
@$(MAKE) -C ns2ir distclean
@$(MAKE) -C nsverify distclean
@$(MAKE) -C nseparse distclean
@$(MAKE) -C plab distclean
@$(MAKE) -C ipassign distclean
......
# -*- tcl -*-
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2004, 2006 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -53,6 +53,7 @@ proc tb-set-lan-protocol {lanlink protocol} {}
proc tb-set-lan-accesspoint {lanlink node} {}
proc tb-set-lan-setting {lanlink capkey capval} {}
proc tb-set-node-lan-setting {lanlink node capkey capval} {}
proc tb-elab-in-elab {onoff} {}
Class Program
......@@ -62,6 +63,55 @@ Program instproc init {args} {
Program instproc unknown {m args} {
}
Class Firewall
Firewall instproc init {args} {
global last_fw
set last_fw $self
}
Firewall instproc unknown {m args} {
}
Class EventSequence
EventSequence instproc init {args} {
}
EventSequence instproc unknown {m args} {
}
Class EventTimeline
EventTimeline instproc init {args} {
}
EventTimeline instproc unknown {m args} {
}
Class EventGroup
EventGroup instproc init {args} {
}
EventGroup instproc unknown {m args} {
}
Class Console -superclass Agent
Console instproc init {args} {
}
Console instproc unknown {m args} {
}
Topography instproc load_area {args} {
}
Topography instproc checkdest {args} {
return 1
}
Class NSENode -superclass Node
NSENode instproc make-simulated {args} {
......@@ -79,3 +129,44 @@ Simulator instproc nsenode {args} {
Simulator instproc make-simulated {args} {
uplevel 1 eval $args
}
Simulator instproc event-sequence {args} {
$self instvar id_counter
incr id_counter
return [new EventSequence]
}
Simulator instproc event-timeline {args} {
$self instvar id_counter
incr id_counter
return [new EventTimeline]
}
Simulator instproc event-group {args} {
return [new EventGroup]
}
Simulator instproc make-cloud {nodes args} {
return [$self make-lan $nodes 100Mbps 0ms]
}
Node instproc program-agent {args} {
}
Node instproc topography {args} {
}
Node instproc console {} {
return [new Console]
}
Simulator instproc connect {src dst} {
}
LanNode instproc trace {args} {
}
LanNode instproc trace_endnode {args} {
}
......@@ -191,6 +191,7 @@ system("touch $outfile") == 0 or
my $cmdargs = "$TB/libexec/ns2ir/parse.proxy ";
$cmdargs .= " -u $dbuid"
if (defined($dbuid));
$cmdargs .= " -- ";
$cmdargs .= " -a"
if ($anonmode);
$cmdargs .= " -n"
......
......@@ -2,12 +2,12 @@
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2004 University of Utah and the Flux Group.
# Copyright (c) 2000-2004, 2006 University of Utah and the Flux Group.
# All rights reserved.
#
use English;
use Getopt::Std;
use Getopt::Long;
use BSD::Resource;
use POSIX qw(:signal_h);
......@@ -41,11 +41,15 @@ my $TB = "@prefix@";
my $TBOPS = "@TBOPSEMAIL@";
my $TESTMODE = @TESTMODE@;
my $parser = "$TB/lib/ns2ir/parse.tcl";
my $vlib = "$TB/lib/nsverify";
my $vparser = "$TB/libexec/nsverify/nstbparse";
# Locals
my $tempdir = "/tmp/parse-$$";
my $nsfile = "$$.ns";
my $optlist = "u:v";
#
# Turn off line buffering on output
#
......@@ -63,6 +67,22 @@ delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
use lib "@prefix@/lib";
use libtestbed;
my $user;
my $verifymode = 0;
#
# Parse command arguments. Once we return from getopts, all that should be
# left are the required arguments.
#
if (! GetOptions("u:s" => \$user,
"v" => \$verifymode)) {
usage();
}
if ($verifymode) {
$parser = $vparser;
}
#
# First option has to be the -u option, the user to run this script as.
# In testmode, we are not run as root, so run as the current user, and
......@@ -73,14 +93,6 @@ if (! $TESTMODE) {
die("*** $0:\n".
" Must be root to run this script!");
}
if ($ARGV[0] ne "-u") {
die("*** $0:\n".
" Improper first argument. Must be the user name!\n");
}
my $user = $ARGV[1];
shift(@ARGV);
shift(@ARGV);
(undef,undef,$unix_uid) = getpwnam($user) or
die("*** $0:\n".
......@@ -157,6 +169,11 @@ if (! $pid) {
# Give parent a chance to react.
sleep(1);
if ($verifymode) {
chdir($vlib);
$nsfile = $tempdir . "/" . $nsfile;
}
exec("nice -15 $parser @ARGV $nsfile");
die("Could not exec the parser!\n");
}
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2006 University of Utah and the Flux Group.
# All rights reserved.
#
#
# Insert Copyright Here.
#
SRCDIR = @srcdir@
TESTBED_SRCDIR = @top_srcdir@
OBJDIR = ../..
SUBDIR = tbsetup/nsverify
NS_VERSION=2.27
TCLCL_VERSION=1.15
NS_SRC_TARBALL=ns-allinone-$(NS_VERSION).tar.gz
include $(OBJDIR)/Makeconf
LIB_STUFF = tb_compat.tcl nstb_compat.tcl
LIBEXEC_STUFF = nstbparse
BOSSLIBEXEC = verify-ns
all: $(LIB_STUFF) $(LIBEXEC_STUFF)
include $(TESTBED_SRCDIR)/GNUmakerules
install: \
$(addprefix $(INSTALL_LIBEXECDIR)/, $(BOSSLIBEXEC)) \
$(addprefix $(INSTALL_DIR)/opsdir/lib/nsverify/, $(LIB_STUFF)) \
$(addprefix $(INSTALL_DIR)/opsdir/libexec/nsverify/, $(LIBEXEC_STUFF))
post-install:
chmod 775 $(INSTALL_LIBEXECDIR)
chown root $(INSTALL_LIBEXECDIR)/verify-ns
chmod u+s $(INSTALL_LIBEXECDIR)/verify-ns
nstb_compat.tcl: $(SRCDIR)/../ns2ir/nstb_compat.tcl
cp $< $@
ns-allinone-$(NS_VERSION):
@if test -f /share/tarballs/$(NS_SRC_TARBALL); then \
echo "Unpacking $(NS_SRC_TARBALL)"; \
tar xfz /share/tarballs/$(NS_SRC_TARBALL); \
else \
echo "Downloading $(NS_SRC_TARBALL)"; \
wget --quiet \
http://www.emulab.net/downloads/ns-allinone-2.27.tar.gz; \
echo "Unpacking $(NS_SRC_TARBALL)"; \
tar xfz $(NS_SRC_TARBALL); \
fi
patch-ns-$(NS_VERSION):
patch -d ns-allinone-$(NS_VERSION)/ns-$(NS_VERSION) \
< $(SRCDIR)/ns-$(NS_VERSION).patch
touch $@
nstb: ns-allinone-$(NS_VERSION) patch-ns-$(NS_VERSION)
@cd $</tclcl-$(TCLCL_VERSION); \
./configure --with-tcl=/usr/local; \
$(MAKE)
@cd $</ns-$(NS_VERSION); \
./configure; \
$(MAKE)
cp $</ns-$(NS_VERSION)/ns $@
control-install: nstb \
$(addprefix $(INSTALL_LIBDIR)/nsverify/, $(LIB_STUFF)) \
$(addprefix $(INSTALL_LIBEXECDIR)/nsverify/, $(LIBEXEC_STUFF) nstb)
$(INSTALL_LIBDIR)/nsverify/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_LIBDIR)/nsverify
$(INSTALL) $< $@
$(INSTALL_LIBEXECDIR)/nsverify/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_LIBEXECDIR)/nsverify
$(INSTALL) $< $@
$(INSTALL_DIR)/opsdir/lib/nsverify/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_DIR)/opsdir/lib/nsverify
$(INSTALL) $< $@
$(INSTALL_DIR)/opsdir/libexec/nsverify/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_DIR)/opsdir/libexec/nsverify
$(INSTALL) $< $@
clean:
diff -ur ./tcl/lan/vlan.tcl ../../ns-allinone-2.27-emulab/ns-2.27/tcl/lan/vlan.tcl
--- ./tcl/lan/vlan.tcl Mon Jan 12 17:54:40 2004
+++ ../../ns-allinone-2.27-emulab/ns-2.27/tcl/lan/vlan.tcl Fri Jan 20 17:39:02 2006
@@ -143,8 +143,12 @@
$src add-neighbor $self
set sid [$src id]
- set link_($sid:$id_) [new Vlink $ns_ $self $src $self $bw 0]
- set link_($id_:$sid) [new Vlink $ns_ $self $self $src $bw 0]
+ set link_($sid:$id_) [new Vlink $ns_ $self $src $self $bw $delay]
+ set link_($id_:$sid) [new Vlink $ns_ $self $self $src $bw $delay]
+
+ # linktest: add to the linktest set of links.
+ $ns_ addLTLink $sid:$id_
+ $ns_ addLTLink $id_:$sid
$src add-oif [$link_($sid:$id_) head] $link_($sid:$id_)
$src add-iif [[$nif set iface_] label] $link_($id_:$sid)
@@ -520,6 +524,12 @@
$lan addNode $nodelist $bw $delay $llType $ifqType $macType \
$phyType $mactrace $ifqLen
+ # linktest renaming
+ $self instvar id_counter
+ $lan set tbaltname_ tblan-lan[incr id_counter]
+ global last_lan
+ set last_lan $lan
+
return $lan
}
diff -ur ./tcl/lib/ns-lib.tcl ../../ns-allinone-2.27-emulab/ns-2.27/tcl/lib/ns-lib.tcl
--- ./tcl/lib/ns-lib.tcl Mon Jan 12 17:54:42 2004
+++ ../../ns-allinone-2.27-emulab/ns-2.27/tcl/lib/ns-lib.tcl Fri Jan 20 17:38:51 2006
@@ -258,6 +258,11 @@
$self multicast $args
}
eval $self next $args
+
+ # linktest renaming
+ $self set id_counter 0
+ global last_sim
+ set last_sim $self
}
Simulator instproc nullagent {} {
@@ -561,6 +566,13 @@
$node set ns_ $self
$self check-node-num
+
+ # linktest renaming
+ $self instvar id_counter
+ $node set tbaltname_ tbnode-n[incr id_counter]
+ global last_host
+ set last_host $node
+
return $node
}
@@ -1159,6 +1171,28 @@
$n1 set-neighbor [$n2 id]
$n2 set-neighbor [$n1 id]
}
+
+ ### linktest -- set up DupLink class to return
+ set dup [new Duplink]
+ $dup set from $link_($i1:$i2)
+ $dup set to $link_($i2:$i1)
+
+ # add the duplink ref to the simplex links.
+ $link_($i1:$i2) set linkRef_ $dup
+ $link_($i2:$i1) set linkRef_ $dup
+
+ # and add to the linktest list of links.
+ $self addLTLink $i1:$i2 $type
+ $self addLTLink $i2:$i1 $type
+
+ $self instvar id_counter
+ $dup set tbaltname_ tblink-l[incr id_counter]
+
+ # naming
+ global last_link
+ set last_link $dup
+
+ return $dup
}
Simulator instproc duplex-intserv-link { n1 n2 bw pd sched signal adc args } {
#! @prefix@/libexec/nsverify/nstb
# rename set in order to capture the variable names used in the ns file.
variable last_host {}
variable last_lan {}
variable last_link {}
variable last_sim {}
variable last_fw {}
# arrays mapping tcl hostnames to variable names
variable hosts
variable lans
variable links
# optional items
variable rtproto "none"
variable simname
rename puts real_puts
proc puts {args} {
}
rename set real_set
proc set {args} {
global last_host last_lan last_link last_sim last_fw
global hosts lans links simname
if {[llength $args] == 1} {
return [uplevel real_set \{[lindex $args 0]\}]
}
real_set var [lindex $args 0]
real_set rval [lindex $args 1]
# Here we change ARRAY(INDEX) to ARRAY-INDEX
regsub -all {[\(]} $var {-} out
regsub -all {[\)]} $out {} val
if {$rval == {}} {
} elseif {$rval == $last_host} {
array set hosts [list $last_host $val]
} elseif {$rval == $last_lan} {
array set lans [list $last_lan $val]
} elseif {$rval == $last_link} {
array set links [list $last_link $val]
} elseif {$rval == $last_sim} {
real_set simname $last_sim
} elseif {$rval == $last_fw} {
array set hosts [list $last_fw $val]
}
real_set last_host {}
real_set last_lan {}
real_set last_link {}
real_set last_sim {}
real_set last_fw {}
# There are a bunch of cases where we just pass through to real set.
return [uplevel real_set \{[lindex $args 0]\} \{[lindex $args 1]\}]
}
variable pid [lindex $argv 0]
variable gid [lindex $argv 1]
variable eid [lindex $argv 2]
variable nsfile [lindex $argv 3]
variable tbroot @prefix@
variable libdir @prefix@/lib/ns2ir
source [lindex $argv 3]
# -*- tcl -*-
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003, 2006 University of Utah and the Flux Group.
# All rights reserved.
#
source nstb_compat.tcl
# Linktest-specific functions. Source these before running
# linktest-ns.
# holds a pair of simplex links.
Class Duplink
Duplink instproc init {} {
}
Duplink instproc unknown {m args} {
}
# converts internal ns structures to linktest structure
# where it's easier for me to get to them.
Class LTLink
LTLink instproc init {} {
$self instvar lanOrLink_ src_ dst_ bw_ delay_ loss_
# note: lanOrLink is the "owner" entity.
set loss_ 0
}
LTLink instproc lanOrLink {} {
$self instvar lanOrLink_
set lanOrLink_
}
LTLink instproc src {} {
$self instvar src_
set src_
}
LTLink instproc dst {} {
$self instvar dst_
set dst_
}
LTLink instproc bw {} {
$self instvar bw_
set bw_
}
LTLink instproc delay {} {
$self instvar delay_
set delay_
}
LTLink instproc loss {} {
$self instvar loss_
set loss_
}
LTLink instproc set_lanOrLink { lanOrLink } {
$self instvar lanOrLink_
set lanOrLink_ $lanOrLink
}
LTLink instproc set_src { src } {
$self instvar src_
set src_ $src
}
LTLink instproc set_dst { dst } {
$self instvar dst_
set dst_ $dst
}
# use some parsing procs provided by ns.
LTLink instproc set_bw { bw } {
$self instvar bw_
set bw_ [bw_parse $bw]
}
LTLink instproc set_delay { delay } {
$self instvar delay_
set delay_ [time_parse $delay]
}
LTLink instproc set_loss { loss } {
$self instvar loss_
set loss_ $loss
}
#LTLink instproc clone {} {
# $self instvar lanOrLink_ src_ dst_ bw_ delay_ loss_
# set newLink [new LTLink]
# $newLink set_src $src_
# $newLink set_dst $dst_
# $newLink set_bw $bw_
# $newLink set_delay $delay_
# $newLink set_loss $loss_
# return $newLink
#}