Commit 08737f67 authored by Leigh Stoller's avatar Leigh Stoller

Keith Sklower's changes to support a single control network model for

ElabInElab experiments, so as not to consume an interface.

I actually modified Keith's changes so that we can dynmaically choose
the single or dual model in the NS file (Keith's changes hardwired the
system to only single control network) since the single network model
has the disadvantage of not allowing new nodes to be added to an inner
elab, which would make it impossible to test some things (like the
newnode path!).

To choose the single control network model, place this in your NS file:

	tb-elabinelab-singlenet

other it defaults to the older dual network model.
parent baab5fc2
......@@ -174,6 +174,7 @@ my %experiment_fields = ("multiplex_factor" => 1,
"elab_in_elab" => 1,
"elabinelab_eid" => 1,
"elabinelab_cvstag" => 1,
"elabinelab_singlenet" => 1,
"security_level" => 1,
"delay_capacity" => 1,
"dpdb" => 1);
......
......@@ -745,6 +745,7 @@ REPLACE INTO table_regex VALUES ('firewall_rules','rule','text','regex','^\\w[-\
REPLACE INTO table_regex VALUES ('virt_nodes','inner_elab_role','text','regex','^(boss|boss\\+router|router|ops|ops\\+fs|fs|node)$',0,0,NULL);
REPLACE INTO table_regex VALUES ('virt_nodes','plab_role','text','regex','^(plc|node|none)$',0,0,NULL);
REPLACE INTO table_regex VALUES ('experiments','elab_in_elab','int','redirect','default:boolean',0,0,NULL);
REPLACE INTO table_regex VALUES ('experiments','elabinelab_singlenet','int','redirect','default:boolean',0,0,NULL);
REPLACE INTO table_regex VALUES ('experiments','elabinelab_cvstag','text','regex','^[-\\w\\@\\/\\.]+$',0,0,NULL);
REPLACE INTO table_regex VALUES ('images','imageid','text','regex','^[a-zA-Z0-9][-\\w\\.+]+$',0,45,NULL);
REPLACE INTO table_regex VALUES ('images','imagename','text','regex','^[a-zA-Z0-9][-\\w\\.+]+$',2,30,NULL);
......
......@@ -181,9 +181,10 @@ my $firewalled = TBExptFirewall($pid, $eid, \$firewall);
# XXX NOSETUP option needs more work ...
#
$query_result =
DBQueryFatal("select elabinelab_nosetup from experiments ".
DBQueryFatal("select elabinelab_nosetup,elabinelab_singlenet ".
" from experiments ".
"where pid='$pid' and eid='$eid'");
my ($nosetup) = $query_result->fetchrow_array();
my ($nosetup,$singlenet) = $query_result->fetchrow_array();
#
# Presetup; turn off firewall.
......@@ -779,6 +780,7 @@ sub DumpDBGoo()
or die("*** $0:\n".
" Could not create temporary table temp_interfaces\n");
if (! $singlenet) {
# First, mark the real control network as "other" to avoid it being
# thought of as the control network!.
DBQueryWarn("update temp_interfaces ".
......@@ -792,6 +794,7 @@ sub DumpDBGoo()
"where IP!='' and role='" . TBDB_IFACEROLE_EXPERIMENT() . "'")
or die("*** $0:\n".
" Could not update roles in temp_interfaces\n");
}
# And rename the fs/ops nodes as above.
if (defined($fsnode)) {
......@@ -822,8 +825,8 @@ sub DumpDBGoo()
"select t.* from reserved as r ".
"left join virt_nodes as v on v.vname=r.vname and ".
" v.pid=r.pid and v.eid=r.eid ".
"left join wires as t on t.node_id1=r.node_id and ".
" t.type='Node' ".
"left join wires as t on t.node_id1=r.node_id ".
($singlenet == 0 ? " and t.type='Node' " : " ") .
"where r.pid='$pid' and r.eid='$eid' and ".
" v.inner_elab_role in ('node','ops','fs','ops+fs') ")
or die("*** $0:\n".
......@@ -841,6 +844,7 @@ sub DumpDBGoo()
or die("*** $0:\n".
" Could not ops node_id in temp_wires\n");
if (! $singlenet) {
# But we need to take out the wires that are being used as the
# inner control network, or at least mark them as Control.
$query_result =
......@@ -852,6 +856,7 @@ sub DumpDBGoo()
"where node_id1='$node_id' and card1=$card and ".
" port1=$port");
}
}
# Okay, now add the "trunk" wires in without any alteration.
DBQueryWarn("insert into temp_wires ".
"select * from wires where type='Trunk'")
......
......@@ -127,14 +127,17 @@ for {set i 1} {$i <= $maxpcs} {incr i} {
tb-set-hardware [set $name] pcslow
}
}
set publiclan [$ns make-lan $lanstr 100Mb 0ms]
tb-set-ip-lan $myboss $publiclan 10.200.1.252
tb-set-ip-lan $myops $publiclan 10.200.1.253
tb-set-ip-lan $myfs $publiclan 10.200.1.251
for {set i 1} {$i <= $maxpcs} {incr i} {
if { ${::GLOBALS::elabinelab_singlenet} == 0 } {
set publiclan [$ns make-lan $lanstr 100Mb 0ms]
tb-set-ip-lan $myboss $publiclan 10.200.1.252
tb-set-ip-lan $myops $publiclan 10.200.1.253
tb-set-ip-lan $myfs $publiclan 10.200.1.251
for {set i 1} {$i <= $maxpcs} {incr i} {
set name "mypc${i}"
tb-set-ip-lan [set $name] $publiclan 10.200.1.$i
}
}
if {[info exists ::TBCOMPAT::elabinelab_nodeos("boss")]} {
......
......@@ -100,13 +100,16 @@ for {set i 1} {$i <= $maxpcs} {incr i} {
tb-set-hardware [set $name] pcslow
}
}
set publiclan [$ns make-lan $lanstr 100Mb 0ms]
tb-set-ip-lan $myboss $publiclan 10.200.1.252
tb-set-ip-lan $myops $publiclan 10.200.1.253
for {set i 1} {$i <= $maxpcs} {incr i} {
if { ${::GLOBALS::elabinelab_singlenet} == 0 } {
set publiclan [$ns make-lan $lanstr 100Mb 0ms]
tb-set-ip-lan $myboss $publiclan 10.200.1.252
tb-set-ip-lan $myops $publiclan 10.200.1.253
for {set i 1} {$i <= $maxpcs} {incr i} {
set name "mypc${i}"
tb-set-ip-lan [set $name] $publiclan 10.200.1.$i
}
}
if {[info exists ::TBCOMPAT::elabinelab_nodeos("boss")]} {
......
......@@ -77,6 +77,7 @@ proc tb-elab-in-elab {onoff} {}
proc tb-elab-in-elab-topology {topo} {}
proc tb-set-inner-elab-eid {eid} {}
proc tb-set-elabinelab-cvstag {cvstag} {}
proc tb-elabinelab-singlenet {} {}
proc tb-set-node-inner-elab-role {node role} {}
proc tb-set-node-id {vnode myid} {}
proc tb-set-link-est-bandwidth {srclink args} {}
......
......@@ -265,6 +265,7 @@ namespace eval GLOBALS {
variable elabinelab_topo ""
variable elabinelab_eid {}
variable elabinelab_cvstag {}
variable elabinelab_singlenet 0
# Does user want a per-experiment DB?
variable dpdb 0
......
......@@ -397,6 +397,7 @@ Simulator instproc run {} {
var_import ::GLOBALS::elabinelab_topo
var_import ::GLOBALS::elabinelab_eid
var_import ::GLOBALS::elabinelab_cvstag
var_import ::GLOBALS::elabinelab_singlenet
var_import ::GLOBALS::security_level
var_import ::GLOBALS::explicit_firewall
var_import ::GLOBALS::sourcefile_list
......@@ -627,6 +628,8 @@ Simulator instproc run {} {
if {$elab_in_elab} {
lappend fields "elab_in_elab"
lappend values 1
lappend fields "elabinelab_singlenet"
lappend values $elabinelab_singlenet
if { $elabinelab_eid != {} } {
lappend fields "elabinelab_eid"
......
......@@ -1575,6 +1575,11 @@ proc tb-set-elabinelab-cvstag {cvstag} {
set elabinelab_cvstag $cvstag
}
proc tb-elabinelab-singlenet {} {
var_import ::GLOBALS::elabinelab_singlenet
set elabinelab_singlenet 1
}
#
# Set the inner elab role for a node.
......
This diff is collapsed.
......@@ -158,6 +158,7 @@ typedef struct {
int isplabdslice;
int isplabsvc;
int elab_in_elab;
int singlenet; /* Modifier for elab_in_elab */
int update_accounts;
char nodeid[TBDB_FLEN_NODEID];
char vnodeid[TBDB_FLEN_NODEID];
......@@ -4055,7 +4056,7 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp)
" pt.isremotenode,vt.issubnode,e.keyhash, "
" nk.sfshostid,e.eventkey,vt.isplabdslice, "
" ps.admin, "
" e.elab_in_elab "
" e.elab_in_elab,e.elabinelab_singlenet "
"from nodes as nv "
"left join nodes as np on "
" np.node_id=nv.phys_nodeid "
......@@ -4075,7 +4076,7 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp)
" nk.node_id=nv.node_id "
"where nv.node_id='%s' and "
" (i.IP='%s' and i.role='ctrl') ",
24, reqp->vnodeid, inet_ntoa(ipaddr));
25, reqp->vnodeid, inet_ntoa(ipaddr));
}
else {
res = mydb_query("select t.class,t.type,n.node_id,n.jailflag,"
......@@ -4085,7 +4086,7 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp)
" e.sync_server,t.class,t.type, "
" t.isremotenode,t.issubnode,e.keyhash, "
" nk.sfshostid,e.eventkey,0, "
" 0,e.elab_in_elab "
" 0,e.elab_in_elab,e.elabinelab_singlenet "
"from interfaces as i "
"left join nodes as n on n.node_id=i.node_id "
"left join reserved as r on "
......@@ -4097,7 +4098,7 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp)
"left join node_hostkeys as nk on "
" nk.node_id=n.node_id "
"where i.IP='%s' and i.role='ctrl'", /*XXX*/
24, inet_ntoa(ipaddr));
25, inet_ntoa(ipaddr));
}
if (!res) {
......@@ -4128,6 +4129,7 @@ iptonodeid(struct in_addr ipaddr, tmcdreq_t *reqp)
reqp->isplabdslice = (! strcasecmp(row[21], "0") ? 0 : 1);
reqp->isplabsvc = (row[22] && strcasecmp(row[22], "0")) ? 1 : 0;
reqp->elab_in_elab = (row[23] && strcasecmp(row[23], "0")) ? 1 : 0;
reqp->singlenet = (row[24] && strcasecmp(row[24], "0")) ? 1 : 0;
if (row[8])
strncpy(reqp->testdb, row[8], sizeof(reqp->testdb));
......@@ -5834,14 +5836,28 @@ COMMAND_PROTOTYPE(doemulabconfig)
* that all the nodes are on a single lan. If we get fancier about
* that, we will have to figure out how to label the specific lans
* se we know which is which.
*
* Note the single vs dual control network differences!
*/
res = mydb_query("select r.node_id,r.inner_elab_role,vl.ip,r.vname "
" from reserved as r "
"left join virt_lans as vl on vl.vnode=r.vname and "
if (reqp->singlenet) {
res = mydb_query("select r.node_id,r.inner_elab_role,"
" i.IP,r.vname from reserved as r "
"left join interfaces as i on "
" i.node_id=r.node_id and i.role='ctrl' "
"where r.pid='%s' and r.eid='%s' and "
" r.inner_elab_role is not null",
4, reqp->pid, reqp->eid);
}
else {
res = mydb_query("select r.node_id,r.inner_elab_role,"
" vl.ip,r.vname from reserved as r "
"left join virt_lans as vl on "
" vl.vnode=r.vname and "
" vl.pid=r.pid and vl.eid=r.eid "
"where r.pid='%s' and r.eid='%s' and "
" r.inner_elab_role is not null",
4, reqp->pid, reqp->eid);
}
if (!res) {
error("EMULABCONFIG: %s: DB Error getting elab_in_elab\n",
......@@ -5959,6 +5975,13 @@ COMMAND_PROTOTYPE(doemulabconfig)
}
}
mysql_free_result(res);
/*
* Tell the inner elab if its a single control network setup.
*/
bufp += OUTPUT(bufp, ebufp - bufp, "SINGLE_CONTROLNET=%d\n",
reqp->singlenet);
client_writeback(sock, buf, strlen(buf), tcp);
return 0;
}
......
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