Commit d266bd71 authored by Shashi Guruprasad's avatar Shashi Guruprasad

Distributed NSE changes. In other words, simulation resources are

now mapped to more than one PC if required. The simnode_capacity
column in the node_types table determines how many sim nodes can
be packed on one PC. The packing factor can also be controlled via
tb-set-colocate-factor to be smaller than simnode_capacity.

- No frontend code changes. To summarize:
  $ns make-simulated {
    ...
  }
  is still the easy way to put a whole bunch of Tcl code to be
  in simulation.
  One unrelated fix in the frontend code is to fix the
  xmlencode() function which prior to this would knock off
  newlines from columns in the XML output. This affected
  nseconfigs since it is one of the few columns with embedded
  newlines. Also changed the event type and event object type
  in traffic.tcl from TRAFGEN/MODIFY to NSE/NSEEVENT.

- More Tcl code in a new directory tbsetup/nseparse
  -> Runs on ops similar to the main parser. This is invoked
     from assign_wrapper in the end if there are simnodes
  -> Partitions the Tcl code into multiple Tcl specifications
     and updates the nseconfigs table via xmlconvert
  -> Comes with a lot of caveats. Arbitrary Tcl code such as user
     specified objects or procedures will not be re-generated. For
     example, if a user wanted a procedure to be included in Tcl
     code for all partitions, there is no way for code in nseparse
     to do that. Besides that, it needs to be tested more thoroughly.

- xmlconvert has a new option -s. When invoked with this option,
  the experiments table is not allowed to be modified. Also,
  virtual tables are just updated (as opposed to deleting
  all rows in the first invocation before inserting new rows)

- nse.patch has all the IP address related changes committed in
  iversion 1.11 + 2 other changes. 1) MTU discovery support in
  the ICMP agent 2) "$ns rlink" mechanism for sim node to real
  node links

- nseinput.tcl includes several client side changes to add IP
  routes in NSE and the kernel routing table for packets crossing
  pnodes. Also made the parsing of tmcc command output more robust
  to new changes. Other client side changes in libsetup.pm and other
  scripts to run nse, are also in this commit

- Besides the expected changes in assign_wrapper for simulated nodes,
  the interfaces and veth_interfaces tables are updated with
  routing table identifiers (rtabid). The tmcd changes are already
  committed. This field is used only by sim hosts on the client side.
  Of course, they can be used by jails as well if desired.
parent de16d8e4
......@@ -1221,6 +1221,7 @@ else
event/trafgen/GNUmakefile \
event/proxy/GNUmakefile \
event/nsetrafgen/GNUmakefile \
event/nsetrafgen/nseinput.tcl \
event/delay-agent/GNUmakefile \
event/program-agent/GNUmakefile \
event/stated/waitForState \
......@@ -1294,7 +1295,7 @@ fi
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# ./install, which can be erroneously created by make from ./install.sh.
echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6
echo "configure:1298: checking for a BSD compatible install" >&5
echo "configure:1299: checking for a BSD compatible install" >&5
if test -z "$INSTALL"; then
if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
......@@ -1396,7 +1397,9 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/snmpit tbsetup/ns2ir/GNUmakefile \
tbsetup/ns2ir/parse.tcl tbsetup/ns2ir/tb_compat.tcl \
tbsetup/ns2ir/parse-ns tbsetup/ns2ir/parse.proxy \
tbsetup/ns2ir/sim.tcl tbsetup/db2ns \
tbsetup/ns2ir/sim.tcl tbsetup/nseparse/GNUmakefile \
tbsetup/nseparse/nse.parse.proxy tbsetup/nseparse/parse-nse \
tbsetup/nseparse/nse.parse.tcl tbsetup/db2ns \
tbsetup/tbprerun tbsetup/tbswap tbsetup/tbend \
tbsetup/tbreport tbsetup/named_setup tbsetup/exports_setup \
tbsetup/checkpass/GNUmakefile tbsetup/assign_wrapper tbsetup/ptopgen \
......
......@@ -334,6 +334,7 @@ else
event/trafgen/GNUmakefile \
event/proxy/GNUmakefile \
event/nsetrafgen/GNUmakefile \
event/nsetrafgen/nseinput.tcl \
event/delay-agent/GNUmakefile \
event/program-agent/GNUmakefile \
event/stated/waitForState \
......@@ -439,7 +440,9 @@ outfiles="$outfiles Makeconf GNUmakefile \
tbsetup/snmpit tbsetup/ns2ir/GNUmakefile \
tbsetup/ns2ir/parse.tcl tbsetup/ns2ir/tb_compat.tcl \
tbsetup/ns2ir/parse-ns tbsetup/ns2ir/parse.proxy \
tbsetup/ns2ir/sim.tcl tbsetup/db2ns \
tbsetup/ns2ir/sim.tcl tbsetup/nseparse/GNUmakefile \
tbsetup/nseparse/nse.parse.proxy tbsetup/nseparse/parse-nse \
tbsetup/nseparse/nse.parse.tcl tbsetup/db2ns \
tbsetup/tbprerun tbsetup/tbswap tbsetup/tbend \
tbsetup/tbreport tbsetup/named_setup tbsetup/exports_setup \
tbsetup/checkpass/GNUmakefile tbsetup/assign_wrapper tbsetup/ptopgen \
......
......@@ -24,10 +24,13 @@ sub usage()
exit(-1);
}
my $optlist = "x:nd";
my $optlist = "x:nds";
my $fromxml = 0;
my $impotent = 0;
my $debug = 0;
# Results of parsing nse specifications. Therefore different treatment.
# In particular, we don't expect updates to the experiments table
my $simparse = 0;
#
# Configure variables
......@@ -105,6 +108,9 @@ if (! getopts($optlist, \%options)) {
if (defined($options{"d"})) {
$debug = 1;
}
if (defined($options{"s"})) {
$simparse = 1;
}
if (defined($options{"x"})) {
$fromxml = 1;
$xmlfile = $options{"x"};
......@@ -180,21 +186,27 @@ sub readXML($$$) {
fatal($@)
if (eval { $parser->parse(*STDIN); return 1; } != 1);
#
# Verify.
#
# Must be exactly one experiments table row, and we prune out lots
# of stuff that is not allowed. Note that we never insert a
# experiment, but only allow updates of certain values.
#
if (scalar(@{$virtual_tables{"experiments"}}) != 1) {
fatal("Must be exactly one experiments table row!");
}
my %experiments_table = %{@{$virtual_tables{"experiments"}}[0]};
foreach my $key (keys(%experiments_table)) {
delete($experiments_table{$key})
if (!exists($experiment_fields{$key}));
# If these are the results of parsing the nse specifications,
# we don't expect updates to the experiments table
my %experiments_table;
if ( ! $simparse ) {
#
# Verify.
#
# Must be exactly one experiments table row, and we prune out lots
# of stuff that is not allowed. Note that we never insert a
# experiment, but only allow updates of certain values.
#
if (scalar(@{$virtual_tables{"experiments"}}) != 1) {
fatal("Must be exactly one experiments table row!");
}
%experiments_table = %{@{$virtual_tables{"experiments"}}[0]};
foreach my $key (keys(%experiments_table)) {
delete($experiments_table{$key})
if (!exists($experiment_fields{$key}));
}
}
#
......@@ -218,7 +230,7 @@ sub readXML($$$) {
# First the experiments table, which gets an update statement, if there
# is anything to update.
#
if (scalar(keys(%experiments_table))) {
if ( (! $simparse) && scalar(keys(%experiments_table))) {
my @setlist = ();
foreach my $key (keys(%experiments_table)) {
......@@ -257,10 +269,13 @@ sub readXML($$$) {
next
if ($table eq "experiments");
# Delete always.
DBQueryFatal("delete from $table ".
"where eid='$eid' and pid='$pid'")
if (!$impotent);
# Delete only during the initial parsing and not
# during parsing of nse specifications
if ( ! $simparse ) {
DBQueryFatal("delete from $table ".
"where eid='$eid' and pid='$pid'")
if (!$impotent);
}
next
if (!defined($virtual_tables{$table}));
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
......@@ -9,8 +9,8 @@ TESTBED_SRCDIR = @top_srcdir@
OBJDIR = ../..
SUBDIR = event/nsetrafgen
INSTALL_SUPDIR = /usr/testbed/sup/sup/FBSD45-STD/root
INSTALL_FILES = $(SRCDIR)/nseinput.tcl $(SRCDIR)/startnse
INSTALL_NSE = $(SRCDIR)/nse
INSTALL_FILES = nseinput.tcl $(SRCDIR)/startnse
INSTALL_NSE = nse
include $(OBJDIR)/Makeconf
......@@ -18,7 +18,7 @@ all: msg
msg:
@echo ""
@echo -n "WARNING! You must first do a \"make buildnse\""
@echo -n "WARNING! You must first do a \"make buildnse\" "
@echo "if nse is not built"
@echo "WARNING! It takes about 15 minutes for buildnse"
@echo ""
......@@ -30,19 +30,21 @@ include $(TESTBED_SRCDIR)/GNUmakerules
# the testbed as well as ns configure script, we need to resort
# to this kind of hack
buildnse:
ln -s $(SRCDIR)/tbevent.h .
ln -s $(SRCDIR)/tbevent.cc .
ln -s $(SRCDIR)/tbnexthop.h .
ln -s $(SRCDIR)/tbnexthop.cc .
ln -s $(SRCDIR)/ip_fw.h .
ln -s $(SRCDIR)/../../lib/libtb/log.h .
ln -s $(SRCDIR)/../../lib/libtb/tbdefs.h .
ln -s $(SRCDIR)/../lib/event.h .
ln -sf $(SRCDIR)/tbevent.h .
ln -sf $(SRCDIR)/tbevent.cc .
ln -sf $(SRCDIR)/tbnexthop.h .
ln -sf $(SRCDIR)/tbnexthop.cc .
ln -sf $(SRCDIR)/ip_fw.h .
ln -sf $(SRCDIR)/../../lib/libtb/log.h .
ln -sf $(SRCDIR)/../../lib/libtb/tbdefs.h .
ln -sf $(SRCDIR)/../lib/event.h .
$(SRCDIR)/nse-install $(SRCDIR)/nse.patch
sup-install:
cp -p $(INSTALL_FILES) $(INSTALL_SUPDIR)$(CLIENT_BINDIR)
cp -p $(INSTALL_NSE) $(INSTALL_SUPDIR)/usr/local/bin
-mkdir -p $(INSTALL_SUPDIR)/$(CLIENT_BINDIR)/
-cp $(INSTALL_FILES) $(INSTALL_SUPDIR)/$(CLIENT_BINDIR)
-mkdir -p $(INSTALL_SUPDIR)/usr/local/bin/
-cp $(INSTALL_NSE) $(INSTALL_SUPDIR)/usr/local/bin
client-install:
cp -p $(INSTALL_FILES) $(DESTDIR)$(CLIENT_BINDIR)
......
ns-2.26/trace/cmu-trace.cc
ns-2.26/tools/random.cc
ns-2.26/tcp/tcp-full.cc
ns-2.26/tcp/tcp-full.h
ns-2.26/tcp/tcp.h
ns-2.26/tcl/lib/ns-address.tcl
ns-2.26/tcl/lib/ns-default.tcl
ns-2.26/tcl/lib/ns-lib.tcl
ns-2.26/tcl/lib/ns-link.tcl
ns-2.26/tcl/lib/ns-node.tcl
ns-2.26/tcl/lib/ns-rtmodule.tcl
ns-2.26/apps/telnet.cc
ns-2.26/classifier/classifier-hash.h
ns-2.26/classifier/classifier.cc
ns-2.26/classifier/classifier.h
ns-2.26/common/ip.h
ns-2.26/common/packet.h
ns-2.26/common/scheduler.cc
ns-2.26/common/scheduler.h
ns-2.26/common/simulator.cc
ns-2.26/common/simulator.h
ns-2.26/common/tclAppInit.cc
ns-2.26/common/timer-handler.cc
ns-2.26/common/timer-handler.h
ns-2.26/routing/address.cc
ns-2.26/routing/address.h
ns-2.26/emulate/iptap.cc
ns-2.26/emulate/iptap.h
ns-2.26/emulate/icmp.cc
ns-2.26/emulate/icmp.h
ns-2.26/emulate/net-ip.cc
ns-2.26/emulate/net-pcap.cc
ns-2.26/emulate/net.cc
ns-2.26/emulate/net.h
ns-2.26/emulate/tap.cc
ns-2.26/emulate/tap.h
ns-2.26/emulate/tcptap.cc
ns-2.26/link/delay.h
ns-2.26/mcast/lms.h
ns-2.26/Makefile.in
ns-2.26/config.h
install
......@@ -17,3 +17,5 @@ fi
cd ns-allinone-2.26
./install
cp ns-2.26/nse ..
cd ..
strip nse
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2002 University of Utah and the Flux Group.
* Copyright (c) 2000-2003 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -47,7 +47,7 @@ TbEventSink::callback(event_handle_t handle,
info("Received Event: %lu:%ld \"%s\"\n", now.tv_sec, now.tv_usec, argsbuf);
// All events coming in to NSE should be MODIFY events and we just need to
// All events coming in to NSE should be NSEEVENT events and we just need to
// evaluate the string in args. If the user sent code with wrong syntax,
// we just print a warning in the log. Also we need a mechanism
// to report the error back to the experimenter
......@@ -164,19 +164,21 @@ TbEventSink::subscribe() {
tuple->site = ADDRESSTUPLE_ANY;
tuple->group = ADDRESSTUPLE_ANY;
tuple->expt = ADDRESSTUPLE_ANY; /* pid/eid */
tuple->objtype = TBDB_OBJECTTYPE_TRAFGEN;
tuple->objtype = TBDB_OBJECTTYPE_NSE;
if( objnamelist[0] != 0 ) {
tuple->objname = objnamelist;
info( "NSE event subscription for object list: \"%s\" for node %s\n",
tuple->objname, tuple->host);
} else {
tuple->objname = ADDRESSTUPLE_ANY;
info( "NSE event subscription for node %s\n", tuple->host);
}
tuple->eventtype = ADDRESSTUPLE_ANY;
info( "TRAFGEN event subscription for object list: \"%s\" for node %s\n", tuple->objname, tuple->host);
if (!event_subscribe(ehandle, callback, tuple, this)) {
fatal("could not subscribe to TRAFGEN events for objects %s", tuple->objname );
fatal("could not subscribe to NSE events for objects %s", tuple->objname );
}
address_tuple_free(tuple);
......
......@@ -602,9 +602,11 @@ handle_simevent(event_handle_t handle, sched_event_t *eventp)
/*
* All we know about is the "SWAPOUT" and "HALT" event!
* Also NSESWAP event
*/
if (strcmp(evtype, TBDB_EVENTTYPE_HALT) &&
strcmp(evtype, TBDB_EVENTTYPE_SWAPOUT)) {
strcmp(evtype, TBDB_EVENTTYPE_SWAPOUT) &&
strcmp(evtype, TBDB_EVENTTYPE_NSESWAP)) {
error("cannot handle SIMULATOR event %s.\n", evtype);
return 0;
}
......
......@@ -13,7 +13,7 @@ PLABSUPPORT = @PLABSUPPORT@
include $(OBJDIR)/Makeconf
SUBDIRS = checkpass ns2ir ipassign
SUBDIRS = checkpass ns2ir ipassign nseparse
BIN_STUFF = power snmpit tbend tbprerun tbreport \
os_load startexp endexp batchexp swapexp \
......@@ -72,6 +72,9 @@ checkpass:
ns2ir:
@$(MAKE) -C ns2ir all
nseparse:
@$(MAKE) -C nseparse all
plab:
@$(MAKE) -C plab all
......@@ -98,6 +101,7 @@ endif
subdir-install:
@$(MAKE) -C checkpass install
@$(MAKE) -C ns2ir install
@$(MAKE) -C nseparse install
$(PLAB_INSTALL)
@$(MAKE) -C ipassign install
......@@ -109,6 +113,7 @@ script-install: $(addprefix $(INSTALL_BINDIR)/, $(BIN_STUFF)) \
post-install:
@$(MAKE) -C ns2ir post-install
@$(MAKE) -C nseparse post-install
$(PLAB_POST_INSTALL)
@$(MAKE) -C ipassign post-install
chmod 775 $(INSTALL_BINDIR)
......@@ -168,6 +173,7 @@ control-install: $(addprefix $(INSTALL_SBINDIR)/, console_setup.proxy) \
$(addprefix $(INSTALL_BINDIR)/, fetchtar.proxy) \
$(addprefix $(INSTALL_LIBDIR)/, libtestbed.pm)
@$(MAKE) -C ns2ir control-install
@$(MAKE) -C nseparse control-install
$(LINKS)
#
......@@ -181,6 +187,7 @@ clean: subdir-clean
subdir-clean:
@$(MAKE) -C checkpass clean
@$(MAKE) -C ns2ir clean
@$(MAKE) -C nseparse clean
# @$(MAKE) -C plab clean
@$(MAKE) -C ipassign clean
......@@ -189,6 +196,7 @@ distclean: subdir-distclean
subdir-distclean:
@$(MAKE) -C checkpass distclean
@$(MAKE) -C ns2ir distclean
@$(MAKE) -C nseparse distclean
@$(MAKE) -C plab distclean
@$(MAKE) -C ipassign distclean
#
......
This diff is collapsed.
......@@ -307,7 +307,7 @@ Simulator instproc run {} {
append nsecfg_script "\$$simu use-scheduler RealTime\n\n"
append nsecfg_script $nseconfig
$self spitxml_data "nseconfigs" [list "vname" "nseconfig" ] [list $self $nsecfg_script ]
$self spitxml_data "nseconfigs" [list "vname" "nseconfig" ] [list fullsim $nsecfg_script ]
}
# Update the DB
......@@ -503,8 +503,8 @@ Simulator instproc at {time eventstring} {
# case when the above string has syntax errors. Maybe
# just have a way reporting errors back to the
# the user from the NSE that finds the syntax errors
set otype TRAFGEN
set etype MODIFY
set otype NSE
set etype NSEEVENT
set args "\$$obj $cmd [lrange $event 2 end]"
set vnode [$obj get_node]
set vname $obj
......@@ -981,12 +981,12 @@ proc spitxml_data {tag fields values} {
}
proc xmlencode {args} {
regsub -all "&" [eval concat $args] "\\&" args
regsub -all "<" $args "\\&lt;" args
regsub -all ">" $args "\\&gt;" args
regsub -all "\"" $args "\\&\#34;" args
regsub -all "]" $args "\\&\#93;" args
regsub -all "'" $args "\\&\#39;" args
set retval [eval append retval $args]
regsub -all "&" $retval "\\&amp;" retval
regsub -all "<" $retval "\\&lt;" retval
regsub -all ">" $retval "\\&gt;" retval
regsub -all "\"" $retval "\\&\#34;" retval
regsub -all "]" $retval "\\&\#93;" retval
return $args
return $retval
}
......@@ -65,6 +65,12 @@ Agent instproc init {} {
$self set generator "TG"
global ::GLOBALS::last_class
set ::GLOBALS::last_class $self
var_import ::GLOBALS::simulated
if { $simulated == 1 } {
$self set simulated 1
} else {
$self set simulated 0
}
}
Agent instproc set_node {node} {
$self set node $node
......@@ -108,6 +114,7 @@ Agent instproc updatedb {DB} {
$self instvar generator
$self instvar port
$self instvar link
$self instvar simulated
if {$node == {}} {
perror "\[updatedb] $self is not attached to a node."
......@@ -140,10 +147,12 @@ Agent instproc updatedb {DB} {
set target_vname $destination
}
# Update the DB
spitxml_data "virt_trafgens" [list "vnode" "vname" "role" "proto" "port" "ip" "target_vnode" "target_vname" "target_port" "target_ip" "generator" ] [list $node $application $role $proto $port $ip $target_vnode $target_vname $target_port $target_ip $generator ]
if { $simulated == 0 } {
# Update the DB
spitxml_data "virt_trafgens" [list "vnode" "vname" "role" "proto" "port" "ip" "target_vnode" "target_vname" "target_port" "target_ip" "generator" ] [list $node $application $role $proto $port $ip $target_vnode $target_vname $target_port $target_ip $generator ]
spitxml_data "virt_agents" [list "vnode" "vname" "objecttype" ] [list $node $application $objtypes(TRAFGEN)]
spitxml_data "virt_agents" [list "vnode" "vname" "objecttype" ] [list $node $application $objtypes(TRAFGEN)]
}
}
# get_nseconfig is only defined for subclasses that will be simulated by NSE
......@@ -220,6 +229,7 @@ Agent/TCP/FullTcp instproc updatedb {DB} {
$self instvar generator
$self instvar port
$self instvar link
$self instvar simulated
if {$node == {}} {
perror "\[updatedb] $self is not attached to a node."
......@@ -247,13 +257,15 @@ Agent/TCP/FullTcp instproc updatedb {DB} {
set vname $self
set target_vname $destination
# Update the DB
spitxml_data "virt_trafgens" [list "vnode" "vname" "role" "proto" "port" "ip" "target_vnode" "target_vname" "target_port" "target_ip" "generator" ] [list $node $vname $role $proto $port $ip $target_vnode $target_vname $target_port $target_ip $generator]
spitxml_data "virt_agents" [list "vnode" "vname" "objecttype"] [list $node $vname $objtypes(TRAFGEN) ]
if { $simulated == 0 } {
# Update the DB
spitxml_data "virt_trafgens" [list "vnode" "vname" "role" "proto" "port" "ip" "target_vnode" "target_vname" "target_port" "target_ip" "generator" ] [list $node $vname $role $proto $port $ip $target_vnode $target_vname $target_port $target_ip $generator]
if {$application != {}} {
spitxml_data "virt_agents" [list "vnode" "vname" "objecttype" ] [list $node $application $objtypes(TRAFGEN) ]
spitxml_data "virt_agents" [list "vnode" "vname" "objecttype"] [list $node $vname $objtypes(NSE) ]
if {$application != {}} {
spitxml_data "virt_agents" [list "vnode" "vname" "objecttype" ] [list $node $application $objtypes(NSE) ]
}
}
}
......@@ -341,6 +353,12 @@ Application instproc init {} {
$self set role {}
global ::GLOBALS::last_class
set ::GLOBALS::last_class $self
var_import ::GLOBALS::simulated
if { $simulated == 1 } {
$self set simulated 1
} else {
$self set simulated 0
}
}
Application instproc attach-agent {agent} {
$self set agent $agent
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
#
# Insert Copyright Here.
#
SRCDIR = @srcdir@
TESTBED_SRCDIR = @top_srcdir@
OBJDIR = ../..
SUBDIR = tbsetup/nseparse
include $(OBJDIR)/Makeconf
LIB_STUFF = nse.node.tcl nse.sim.tcl nse.null.tcl \
nse.agent.tcl nse.parse.tcl
BOSSLIBEXEC = parse-nse
USERLIBEXEC = nse.parse.proxy
#
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
#
all: $(LIB_STUFF) $(BOSSLIBEXEC) $(USERLIBEXEC)
include $(TESTBED_SRCDIR)/GNUmakerules
install: control-install \
$(addprefix $(INSTALL_LIBEXECDIR)/, $(BOSSLIBEXEC)) \
$(addprefix $(INSTALL_DIR)/opsdir/lib/nseparse/, $(LIB_STUFF)) \
$(addprefix $(INSTALL_DIR)/opsdir/libexec/nseparse/, $(USERLIBEXEC))
control-install: $(addprefix $(INSTALL_LIBDIR)/nseparse/, $(LIB_STUFF)) \
$(addprefix $(INSTALL_LIBEXECDIR)/nseparse/, $(USERLIBEXEC))
post-install:
chmod 775 $(INSTALL_LIBEXECDIR)
chown root $(INSTALL_LIBEXECDIR)/parse-nse
chmod u+s $(INSTALL_LIBEXECDIR)/parse-nse
$(INSTALL_LIBDIR)/nseparse/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_LIBDIR)/nseparse
$(INSTALL) $< $@
$(INSTALL_LIBEXECDIR)/nseparse/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_LIBEXECDIR)/nseparse
$(INSTALL) $< $@
$(INSTALL_DIR)/opsdir/lib/nseparse/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_DIR)/opsdir/lib/nseparse
$(INSTALL) $< $@
$(INSTALL_DIR)/opsdir/libexec/nseparse/%: %
@echo "Installing $<"
-mkdir -p $(INSTALL_DIR)/opsdir/libexec/nseparse
$(INSTALL) $< $@
clean:
# -*- tcl -*-
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
######################################################################
# nse.agent.tcl
#
#
######################################################################
Class Agent
# Agent
Agent instproc init {args} {
var_import GLOBALS::last_class
var_import GLOBALS::last_cmd
$self set nseconfig {}
$self set classname "Agent"
$self set objname $self
$self set node {}
$self set application {}
$self set destination {}
$self set ip {}
$self set port {}
$self instvar classname
if { $last_cmd == {} } {
if { $args == {} } {
$self set createcmd "\[new $classname]"
} else {
$self set createcmd "\[new $classname $args]"
}
} else {
$self set createcmd $last_cmd
}
real_set last_class $self
}
Agent instproc set_node {node} {
$self set node $node
}
Agent instproc get_node {} {
$self instvar node
return $node
}
Agent instproc set_application {application} {
$self set application $application
}
Agent instproc connect {dst} {
$self instvar destination
$self instvar nseconfig
$self instvar objname
real_set destination $dst
real_set sim [lindex [Simulator info instances] 0]
append nseconfig "\$[$sim set objname] ip-connect \$$objname [$dst set ip] [$dst set port]\n"
}
Agent instproc unknown {m args} {
$self instvar nseconfig
$self instvar objname
append nseconfig "\$$objname $m $args\n"
}
Class Application
# Application
Application instproc init {args} {
var_import GLOBALS::last_class
var_import GLOBALS::last_cmd
$self set nseconfig {}
$self set classname "Application"
$self set objname $self
$self instvar classname
if { $last_cmd == {} } {
if { $args == {} } {
$self set createcmd "\[new $classname]"
} else {
$self set createcmd "\[new $classname $args]"
}
} else {
$self set createcmd $last_cmd
}
real_set last_class $self
}
Application instproc attach-agent {agent} {
$self set agent $agent
$agent set_application $self
$self instvar objname
$self instvar createcmd
$self instvar nseconfig
append nseconfig "\$$objname attach-agent \$[$agent set objname]\n"
}
Application instproc get_node {} {
$self instvar agent
return [$agent get_node]
}
Application instproc unknown {m args} {
$self instvar nseconfig
$self instvar objname
append nseconfig "\$$objname $m $args\n"
}
# -*- tcl -*-
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
######################################################################
# nse.node.tcl
#
# This defines the Node class. Instances of this class are created by
# the 'node' method of Simulator. A Node is connected to a number of
# LanLinks. Each such connection is associated with a virtual port,
# an integer. Each virtual port also has an IP address. Virtual
# ports start at 0 and go up continuously. Besides the port
# information each node also has a variety of strings. These strings
# are set by tb-* commands and dumped to the DB but are otherwise
# uninterpreted.
######################################################################
Class Node
Node instproc init {args} {
var_import GLOBALS::last_class
var_import GLOBALS::last_cmd
$self set nseconfig {}
$self set classname "Node"
$self set objname $self
$self set next_portnumber 5000
$self instvar classname
if { $last_cmd == {} } {
if { $args == {} } {
$self set createcmd "\[new $classname]"
} else {
$self set createcmd "\[new $classname $args]"
}
} else {
$self set createcmd $last_cmd
}
real_set last_class $self
}
# Attach an agent to a node. This mainly a bookkeeping device so
# that the we can update the DB at the end.
Node instproc attach-agent {agent} {
$self instvar agentlist
$self instvar nseconfig
$self instvar objname
var_import GLOBALS::last_cmd
lappend agentlist $agent
# $agent set_node $self
# append nseconfig "\$$objname attach-agent \$[$agent set objname]\n"
}
Node instproc unknown {m args} {
$self instvar nseconfig
$self instvar objname
append nseconfig "\$$objname $m $args\n"
}
Node instproc nextportnumber {} {
$self instvar next_portnumber
set next_port [incr next_portnumber]
return $next_port
}
\ No newline at end of file
# -*- tcl -*-
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
# All rights reserved.
#
######################################################################
# nse.null.tcl
#
# This defines the NullClass. The NullClass is used for all classes
# created that we don't know about. The NullClass will accept any
# method invocation with any arguments. It will display an
# unsupported message in all such cases.
######################################################################