Commit b5fb71e6 authored by David Anderson's avatar David Anderson
Browse files

Update of Linktest brings it into synch with the tolerances

described in my final project paper.
parent 45659a29
......@@ -10,11 +10,10 @@ OBJDIR = ../..
SUBDIR = event/linktest
SYSTEM := $(shell uname -s)
TESTS = linktest
include $(OBJDIR)/Makeconf
all: $(TESTS)
all: script
include $(TESTBED_SRCDIR)/GNUmakerules
......@@ -30,16 +29,22 @@ ifeq ($(SYSTEM),Linux)
LIBS += -ldl
endif
linktest: linktest.o
$(CC) $(LDFLAGS) -o $@ linktest.o $(LIBS)
OBJS = linktest.o
TESTS = linktest
$(TESTS): ../lib/libevent.a ../lib/event.h
$(TESTS): $(OBJS) script
$(CC) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
$(OBJS): linktest.h ../lib/libevent.a ../lib/event.h
script: linktest.pl
chmod 755 linktest.pl
install:
client-install:
$(INSTALL_TEST) linktest \
$(DESTDIR)$(CLIENT_BINDIR)/linktest
$(INSTALL_TEST) $(TESTS) \
$(DESTDIR)$(CLIENT_BINDIR)/$(TESTS)
clean:
/bin/rm -f *.o $(TESTS)
......@@ -4,10 +4,6 @@
* All rights reserved.
*/
/*
* Program to start Linktest scripts.
*
*/
#include <stdio.h>
#include <ctype.h>
#include <netdb.h>
......@@ -23,15 +19,13 @@
#include "tbdefs.h"
#include "log.h"
#include "event.h"
/* (temporarily) hardcoded path until I find a better place to put this
* (such as /var/emulab/somewhere?)*/
#define PATH_LINKTEST "/users/davidand/testbed/event/linktest/linktest.pl"
#include "linktest.h"
static void callback(event_handle_t handle,
event_notification_t notification, void *data);
static void start_linktest( char* args);
static void
start_linktest(char *args);
void
usage(char *progname)
......@@ -42,7 +36,8 @@ usage(char *progname)
exit(-1);
}
int main(int argc, char **argv) {
int
main(int argc, char **argv) {
event_handle_t handle;
address_tuple_t tuple;
char *server = NULL;
......@@ -54,7 +49,7 @@ int main(int argc, char **argv) {
char buf[BUFSIZ];
progname = argv[0];
while ((c = getopt(argc, argv, "s:p:e:")) != -1) {
switch (c) {
case 's':
......@@ -196,15 +191,8 @@ callback(event_handle_t handle, event_notification_t notification, void *data)
}
/*
* Start up the linktest script and wait for it to complete
*/
static void
start_linktest( char* args) {
if( !fork()) {
info ("starting linktest");
execl(PATH_LINKTEST, NULL);
}
wait(NULL);
info ("linktest completed\n");
start_linktest(char *args) {
info("starting linktest.\n");
info(LINKTEST_SCRIPT);
}
......@@ -65,6 +65,7 @@ Simulator instproc make-simulated {args} {
uplevel 1 eval $args
}
### end of tb_compat default
# LINKTEST FUNCTIONS
# holds a pair of simplex links.
......@@ -78,6 +79,9 @@ variable last_link {}
variable hosts
variable lans
variable links
# optional items
variable synserver {}
variable rtproto {}
rename set real_set
proc set {args} {
......@@ -240,6 +244,12 @@ Simulator instproc run {args} {
}
# store the rtproto
Simulator instproc rtproto {arg} {
global rtproto
set rtproto $arg
}
# update lt_links such that lans become new links containing destination hosts
# delay: sum both delays
# loss: product both losses
......@@ -286,7 +296,7 @@ proc join_lans {} {
proc output {} {
global hosts lans links lt_links
global hosts lans links lt_links synserver rtproto
foreach name [array names hosts] {
puts "h $hosts($name)"
......@@ -295,6 +305,12 @@ proc output {} {
puts "[$link toString]"
}
if { [llength $synserver]>0} {
puts "y $synserver"
}
if { [llength $rtproto]>0} {
puts "r $rtproto"
}
}
#
# from here on out, implement netbed-specific commands against lt_links
......@@ -330,7 +346,7 @@ proc tb-set-link-loss {args} {
proc tb-set-lan-loss {lan rate} {
global lt_links
# netbed-implenetation detail: set loss to 1-sqrt(1-L)
# netbed-implentation detail: set loss to 1-sqrt(1-L)
set a [expr 1.0 - $rate]
set b [expr sqrt ($a)]
set newloss [expr 1.0 - $b]
......@@ -384,3 +400,9 @@ proc tb-set-lan-simplex-params {lan node todelay tobw toloss fromdelay frombw fr
}
proc tb-set-sync-server {svr} {
global synserver hosts
real_set synserver $hosts($svr)
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment