showexp.php3 4 KB
Newer Older
Leigh B. Stoller's avatar
Leigh B. Stoller committed
1
<?php
Leigh B. Stoller's avatar
Leigh B. Stoller committed
2
3
#
# EMULAB-COPYRIGHT
4
# Copyright (c) 2000-2003 University of Utah and the Flux Group.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
5
6
# All rights reserved.
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
7
include("defs.php3");
8
include("showstuff.php3");
Leigh B. Stoller's avatar
Leigh B. Stoller committed
9

10
11
12
13
14
#
# Standard Testbed Header
#
PAGEHEADER("Show Experiment Information");

15
16
17
#
# Only known and logged in users can end experiments.
#
18
$uid = GETLOGIN();
19
LOGGEDINORDIE($uid);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
20
21

#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
22
# Verify page arguments.
23
# 
Leigh B. Stoller's avatar
Leigh B. Stoller committed
24
25
26
if (!isset($pid) ||
    strcmp($pid, "") == 0) {
    USERERROR("You must provide a Project ID.", 1);
27
28
}

Leigh B. Stoller's avatar
Leigh B. Stoller committed
29
30
31
32
33
34
if (!isset($eid) ||
    strcmp($eid, "") == 0) {
    USERERROR("You must provide an Experiment ID.", 1);
}
$exp_eid = $eid;
$exp_pid = $pid;
35

Leigh B. Stoller's avatar
Leigh B. Stoller committed
36
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
37
# Check to make sure this is a valid PID/EID tuple.
Leigh B. Stoller's avatar
Leigh B. Stoller committed
38
#
39
if (! TBValidExperiment($exp_pid, $exp_eid)) {
40
41
  USERERROR("The experiment $exp_eid is not a valid experiment ".
            "in project $exp_pid.", 1);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
42
43
}

44
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
45
# Verify Permission.
46
#
Leigh B. Stoller's avatar
Leigh B. Stoller committed
47
48
if (! TBExptAccessCheck($uid, $exp_pid, $exp_eid, $TB_EXPT_READINFO)) {
    USERERROR("You do not have permission to view experiment $exp_eid!", 1);
Leigh B. Stoller's avatar
Leigh B. Stoller committed
49
50
}

Chad Barb's avatar
   
Chad Barb committed
51
52


53
$expstate = TBExptState($exp_pid, $exp_eid);
Chad Barb's avatar
   
Chad Barb committed
54

Chad Barb's avatar
   
Chad Barb committed
55
echo "<font size=+2>Experiment <b>".
Chad Barb's avatar
   
Chad Barb committed
56
57
58
     "<a href='showproject.php3?pid=$pid'>$pid</a>/".
     "$eid</b></font>\n";
echo "<br /><br />\n";
59
SUBPAGESTART();
Chad Barb's avatar
   
Chad Barb committed
60

61
SUBMENUSTART("Experiment Options");
62

63
if ($expstate) {
64
    if (TBExptLogFile($exp_pid, $exp_eid)) {
65
66
67
68
	WRITESUBMENUBUTTON("View Activation Logfile",
			   "spewlogfile.php3?pid=$exp_pid&eid=$exp_eid");
    }
      
69
    if (strcmp($expstate, $TB_EXPTSTATE_ACTIVE) == 0) {
Jay Lepreau's avatar
Jay Lepreau committed
70
	WRITESUBMENUBUTTON("Visualization, NS File, Mapping",
71
72
73
			   "shownsfile.php3?pid=$exp_pid&eid=$exp_eid");
    }
    elseif (strcmp($expstate, $TB_EXPTSTATE_SWAPPED) == 0) {
Jay Lepreau's avatar
Jay Lepreau committed
74
	WRITESUBMENUBUTTON("Visualization and NS File",
75
76
77
			   "shownsfile.php3?pid=$exp_pid&eid=$exp_eid");
    }
    else {
78
	WRITESUBMENUBUTTON("Visualization and NS File",
79
80
81
82
			   "shownsfile.php3?pid=$exp_pid&eid=$exp_eid");
    }

    # Swap option.
83
    if (strcmp($expstate, $TB_EXPTSTATE_SWAPPED) == 0) {
84
	WRITESUBMENUBUTTON("Swap this Experiment In",
85
		      "swapexp.php3?inout=in&pid=$exp_pid&eid=$exp_eid");
86
87
    }
    elseif (strcmp($expstate, $TB_EXPTSTATE_ACTIVE) == 0) {
88
	WRITESUBMENUBUTTON("Swap this Experiment Out",
89
		      "swapexp.php3?inout=out&pid=$exp_pid&eid=$exp_eid");
90
91
92

	WRITESUBMENUBUTTON("Control Traffic Shaping",
			   "delaycontrol.php3?pid=$exp_pid&eid=$exp_eid");
Chad Barb's avatar
   
Chad Barb committed
93
    }
94
95
}

96
WRITESUBMENUBUTTON("Terminate this Experiment",
97
98
		   "endexp.php3?pid=$exp_pid&eid=$exp_eid");

99
100
101
102
103
104
105
106
#
# Admin and project/experiment leader get this option.
#
if (TBExptAccessCheck($uid, $exp_pid, $exp_eid, $TB_EXPT_UPDATEACCOUNTS)) {
    WRITESUBMENUBUTTON("Update Mounts/Accounts",
		       "updateaccounts.php3?pid=$exp_pid&eid=$exp_eid");
}

107
108
# Reboot option
if (TBExptAccessCheck($uid, $exp_pid, $exp_eid, $TB_EXPT_MODIFY)) {
109
    WRITESUBMENUBUTTON("Reboot All Nodes",
110
111
112
		       "boot.php3?pid=$exp_pid&eid=$exp_eid");
}

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
if (ISADMIN($uid)) {
    if (strcmp($expstate, $TB_EXPTSTATE_ACTIVE) == 0) {

	SUBMENUSECTION("Beta-Test Options");
	    
	WRITESUBMENUBUTTON("Restart this Experiment",
			   "swapexp.php3?inout=restart&pid=$exp_pid".
			   "&eid=$exp_eid");
	
	WRITESUBMENUBUTTON("Modify this Experiment",
			   "modifyexp.php3?pid=$exp_pid&eid=$exp_eid");

	SUBMENUSECTION("Admin Options");
	
	WRITESUBMENUBUTTON("Send a Swap Request",
			   "request_swapexp.php3?".
			   "&pid=$exp_pid&eid=$exp_eid");
	
	WRITESUBMENUBUTTON("Force Swap Out (Idle-Swap)",
			   "swapexp.php3?inout=out&force=1".
			   "&pid=$exp_pid&eid=$exp_eid");

	SUBMENUSECTIONEND();
    }
}
    
Chad Barb's avatar
   
Chad Barb committed
139
140
SUBMENUEND_2A();

141
142
143
144
echo "<br>
      <a href='shownsfile.php3?pid=$exp_pid&eid=$exp_eid'>
         <img width=160 height=160 border=1 alt='experiment vis'
              src='top2image.php3?pid=$pid&eid=$eid&thumb=160'></a>\n";
Chad Barb's avatar
   
Chad Barb committed
145
146

SUBMENUEND_2B();
147
148
149
150
151
152

#
# Dump experiment record.
# 
SHOWEXP($exp_pid, $exp_eid);

153
SUBPAGEEND();
154
155
156
157
158
159

#
# Dump the node information.
#
SHOWNODES($exp_pid, $exp_eid);

160
161
162
163
164
165
166
167
if (ISADMIN($uid)) {
    echo "<center>
          <h3>Experiment Stats</h3>
         </center>\n";

    SHOWEXPTSTATS($exp_pid, $exp_eid);
}

168
169
170
171
#
# Standard Testbed Footer
# 
PAGEFOOTER();
172
?>