# and Technology through the research contract #IP-2003-143.
#
-# $Id: editor.tcl,v 1.88 2008/01/05 18:06:25 marko Exp $
+# $Id: editor.tcl,v 1.89 2008/04/28 11:32:34 miljenko Exp $
#****h* imunes/editor.tcl
.button3menu.ethereal add command -label $label \
-command "startethereal $node $ifc"
}
+ .button3menu add command -label "Opera Browser" \
+ -command "startopera $node"
.button3menu add command -label Start \
-command "[typemodel $node].start $eid $node"
.button3menu add command -label Stop \
} else {
.button3menu add cascade -label "Ethereal" \
-menu .button3menu.ethereal -state disabled
+ .button3menu add command -label "Opera Browser" \
+ -state disabled
.button3menu add command -label start \
-command "[typemodel $node].start $eid $node" -state disabled
.button3menu add command -label stop \
}
+#****f* editor.tcl/startopera
+# NAME
+# startopera -- start opera
+# SYNOPSIS
+# startopera $node
+# FUNCTION
+# This procedure starts opera on the specified node
+# INPUTS
+# * node -- node id
+# * iface -- interface name
+#****
+proc startopera { node } {
+ upvar 0 ::cf::[set ::curcfg]::eid eid
+
+ # set interface "$iface@$eid\.$node"
+ nexec startopera $eid.$node &
+}
+
+
#****f* editor.tcl/button1
# NAME
# button1
# and Technology through the research contract #IP-2003-143.
#
-# $Id: exec.tcl,v 1.71 2008/01/31 10:56:56 marko Exp $
+# $Id: exec.tcl,v 1.72 2008/04/28 11:32:34 miljenko Exp $
#****f* exec.tcl/nexec
set defindex [lsearch $vimages .]
set vimages [lreplace $vimages $defindex $defindex]
+ # Wait for TIME_WAIT timeout in all vimages
+ set vrti 1
+ set sec 60
+
+ # wm title $wi "Please wait ..."
+ set w .timewait
+ catch {destroy $w}
+ toplevel $w -takefocus 1
+ wm geometry $w +150+150
+ wm title $w "Please wait ..."
+ message $w.msg -justify left -aspect 1200 \
+ -text "\nDue to the known bug we must wait for TIME_WAIT expiration on virtual nodes (up to 60 sec).
+Please don't try killing the process.
+(countdown on status line)\n"
+ pack $w.msg
+ update
+ grab $w
+
+ while { $vrti == 1 } {
+ set vrti 0
+ foreach vimage $vimages {
+ # puts "vimage $vimage...\n"
+ while { [catch {nexec vimage $eid.$vimage netstat -an -f inet | fgrep "WAIT"} odg] == 0} {
+ set vrti 1
+ # puts "vimage $vimage: \n$odg\n"
+ after 2000
+ set sec [expr $sec - 2]
+ statline "~ $sec sec ..."
+ pack $w.msg
+ update
+ }
+ }
+ }
+ destroy .timewait
# Kill all processes in all vimages
foreach vimage $vimages {
set stattxt "Terminating processes in vimage $vimage"
cp himage $ROOTDIR/$BINDIR/
chmod 755 $ROOTDIR/$BINDIR/himage
+cp startopera $ROOTDIR/$BINDIR/
+chmod 755 $ROOTDIR/$BINDIR/startopera
+
echo Done!
--- /dev/null
+#! /bin/sh
+
+if [ $# -ne 1 ]
+then
+ echo "Usage: $0 hostname_of_X_app_client"
+ exit 1
+fi
+
+ifconfig ethx11 > /dev/null 2>&1
+if [ $? -eq 0 ]
+then
+ echo "Only one Opera instance is allowed."
+ exit 2
+fi
+
+vimage $1 hostname > /dev/null 2>&1
+if [ $? -ne 0 ]
+then
+ echo "Error! "
+ echo "Please check that Experiment with node $1 is running"
+ exit 2
+fi
+
+######
+# Create virtual ethernet connection between "default" and "remote" hosta
+#
+remote=$1
+eth_remote=ethx11
+IP_eth_remote="10.255.255.2"
+
+eth_default=ethx11
+IP_eth_default="10.255.255.1"
+
+######
+# One ethernet interface is for $remote
+ngctl mkpeer eiface ether ether > /dev/null 2>&1
+ngctl mkpeer eiface ether ether > /dev/null 2>&1
+ngctl connect ngeth0: ngeth1: ether ether > /dev/null 2>&1
+
+vimage -i $remote ngeth0 $eth_remote > /dev/null 2>&1
+vimage $remote ifconfig $eth_remote link 40:a:b:c:d:01 > /dev/null 2>&1
+vimage $remote ifconfig $eth_remote $IP_eth_remote/24 > /dev/null 2>&1
+
+######
+# the other is for "default"
+vimage -i . ngeth1 $eth_default > /dev/null 2>&1
+ifconfig $eth_default link 40:a:b:c:d:02 > /dev/null 2>&1
+ifconfig $eth_default $IP_eth_default/24 > /dev/null 2>&1
+
+######
+# Allow remote host to access X
+xhost +$IP_eth_remote > /dev/null 2>&1
+
+######
+# Call Operu on $remote
+#
+vimage $remote opera -display ${IP_eth_default}:0
+
+sleep 2
+
+ngctl shutdown ngeth0: > /dev/null 2>&1
+ngctl shutdown ngeth1: > /dev/null 2>&1
+xhost -$IP_eth_remote > /dev/null 2>&1
+