dbtoir.txt 6.94 KB
Newer Older
1
This file gives a basic overview of experiment creation and teardown, though
2
it is very out-of-date (as of 4/28/03).
3

Christopher Alfeld's avatar
Christopher Alfeld committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150
Prerun Outline:

Step 1 - parse.tcl 

     Here we convert the NS file into a temporary IR file.  We
     assign port numbers and generate a virtual topology in terms 
     of these virtual node:port's. 

     We also do as many checks on the tb-* commands as possible at
     this point.  

     By the end of this step all tb-* commands should have resulted in
     data in the IR file.  The topology we have is very close to the
     final emulation.  All that is missing is the delay nodes and
     extra links that go along with them.

Step 2 - Traffic Generation

     We set up any traffic sources and syncs that may have been requested.

Step 3 - IP address allocation

     We now fill out all unassigned IP addresses.  Whenever a link or
     LAN has already had some of its nodes assigned IP addresses we
     preserve the subnet.  In cases were no IP addresses have been
     assigned we generate a unique subnet and unique IP addresses 
     within that subnet.

Step 4 - Update DB

     If no errors have occurred then we upload our representation into
     the DB (virt_nodes and virt_lans) tables.

--

Swap In Outline:

Step 1 - Snapshot current testbed state

     We generate a ptop file from the current testbed state.

Step 2 - DB to top

     We take the topology from the database and convert it into a top
     file.  This involves generating delay nodes.

Step 3 - Assign

     We check that resources exist and run assign.  If successful we
     convert the output into a virtual node <-> physical node mapping
     and a virtual node:port <-> physical node:port mapping. 

Step 4 - Port Shuffling

     We now shuffle ports as much as possible to match the portmap
     table.  The portmap table holds the last mapping (or none if this
     is the first swapin).  We can swap two ports if physically they
     have the same bandwidth and go to the same destination.  In terms
     of the Utah testbed this means we can always swap ports of the
     same type (ethernet, gigabit, etc.) and so should always be able
     to match the previous mapping.

Step 5 - Reserve Resources

     At this point we call nalloc and grab the resources we need.  If
     the resources are no longer available we go back to step 1 (or
     terminate).

Step 6 - DB

     We need to calculate and setup vlans and delays.  We also update
     portmap, nodes, and interfaces.

Step 7 - tbrun

     We do all the old tbrun tasks.  Should be identical except for
     snmpit taking from vlans instead of IR file.

Step 8 - Final DB

     At the very end we set the state column of the experiments table
     to 'active'.

--

Swap Out Outline:

Step 1 - Teardown

     We reset VLANs, clear up the named maps, and clean up any other
     node state.

Step 2 - DB Teardown

     We do any DB changes to show that the experiment is no longer
     active.  This involves changing vlans, delays, interfaces, and
     nodes and changing the expt_state flag in experiments.

--

End Experiment Outline:

Step 1 - Swap Out

     If the experiment is currently running we swap it out.

Step 2 - Clean up DB

     We remove the experimental data from the DB.  This involves
     virt_nodes, virt_lans.

----------------------------------------------------------------------

Crash Recovery:

If a crash occurs during tbprerun then we should run tbend which will
clean up all partial state.  

If a crash occurs during swapin we should do any necessary tasks to
reset node state and run tbswapout to cleanup DB state.  There is one
potential problem if the crash occurred at exactly the right moment so
that portmap was only partially updated.  In this case we would need
to clear the portmap table for that experiment and would loose our
port consistency.  I foresee this as being extremely unlikely and not
worth worrying about.  On the Utah testbed, as the portmap should
never change after it is setup on the first swapin, this is even more
unlikely.  If we decide we really care about this we can add
generation numbers to the portmap table, add the new generation before
removing the old, and add checks for crash recovery.

If a crash occurs during tbend we should be able to rerun tbend
without adverse effect.
 
----------------------------------------------------------------------

DB tables:

The existing tables: delays, vlans, nodes stick around to represent
current DB state.

We'll need tables to store experiments:

virt_nodes:

pid
eid
virtual name
Christopher Alfeld's avatar
Christopher Alfeld committed
151
type		Indexed into node_types
Christopher Alfeld's avatar
Christopher Alfeld committed
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
ips		This is a list of <port>:<ip>
osid
cmd_line
rpms
deltas
startupcmd
tarfiles


The following table is both lans and links.  Links are just lans with
only two nodes.  

virt_lans:

pid
eid
virtual name
members (node:ports)
delay 
bandwidth
lossrate

We need a table that stores the previous host:port virtual<->physical
mapping.  This table is used in the port shuffling step of tbswapin to
try to maximize port consistency across swaps.  While an experiment is
swapped in the this table is redundant with the vname columns of the
nodes and interfaces table.  However, as soon as an experiment is
swapped out this becomes a useful record of the previous mapping.

portmap:

pid
eid
vnode
vport
pport

Add expt_state to experiments with values 'active'|'dormant'.

Add vname to interfaces table which holds virtual name of each
interface.

--

How it connects:

Virtual			Physical
virt_nodes		nodes	
virt_lans		delays, vlans

--

Example:

NS File:

----------------------------------------------------------------------
source tb_compat.tcl

set ns [new Simulator]

set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]

set lan1 [$ns make-lan "$n1 $n2" 100Mb 0ms]
set link1 [$ns duplex-link $n3 $n2 100Mb 0ms DropTail]

tb-set-node-ip $n1 6.6.6.2
----------------------------------------------------------------------

This will generate a virt_nodes table of something like:

pid	  eid	   vname	ips   ...
testbed	  chris	   n1		0:6.6.6.2
testbed	  chris	   n2		0:6.6.6.3 1:192.168.1.2
testbed	  chris	   n3		0:192.168.1.3

and a virt_lans table of:

pid       eid	   vname	members	...
testbed	  chris	   lan1		n1:0 n2:0
testbed	  chris	   link1	n2:1 n3:0

Now let's assign runs and comes up with the following assignment:

vnode	  pnode
n1	  pc33
n2	  pc19
n3	  pc2

vport	  pport
n1:0	  pc33:eth0
n2:0	  pc19:eth1
n2:1	  pc19:eth3
n3:0	  pc2:eth2

As this is the first run we do now port shuffling.  We do update the
portmap table:

pid	eid	vnode	vport	pport
testbed	chris	n1	0	eth0
testbed	chris	n2	0	eth1
testbed chris	n2	1	eth3
testbed chris	n3	0	eth2

We now generate the vlans table:

Christopher Alfeld's avatar
Christopher Alfeld committed
260 261 262
id     pid	eid	virtual	members
0      testbed	chris	lan1	pc33:eth0 pc19:eth1
1      testbed	chris	link1	pc19:eth3 pc2:eth0
Christopher Alfeld's avatar
Christopher Alfeld committed
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280

Finally we fill in the reserved and interfaces table:

reserved:
node_id		pid	eid	vname	...
pc33		testbed	chris	n1
pc19		testbed	chris	n2
pc2		testbed chris	n3

interfaces:
node_id		port	IP	...
pc33		eth0	6.6.6.2
pc19		eth1	6.6.6.3
pc19		eth3	192.168.1.2
pc2		eth2	192.168.1.3