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