showexp.php3 4.14 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
}

51
$expindex = TBExptIndex($exp_pid, $exp_eid);
52
$expstate = TBExptState($exp_pid, $exp_eid);
Chad Barb's avatar
   
Chad Barb committed
53

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

60
SUBMENUSTART("Experiment Options");
61

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

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

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

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

98
99
100
101
102
103
104
105
#
# 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");
}

106
107
# Reboot option
if (TBExptAccessCheck($uid, $exp_pid, $exp_eid, $TB_EXPT_MODIFY)) {
108
    WRITESUBMENUBUTTON("Reboot All Nodes",
109
		       "boot.php3?pid=$exp_pid&eid=$exp_eid");
Chad Barb's avatar
   
Chad Barb committed
110
111
112
    WRITESUBMENUBUTTON("Modify this Experiment",
		       "modifyexp.php3?pid=$exp_pid&eid=$exp_eid");

113
114
}

115
116
117
118
# History
WRITESUBMENUBUTTON("Show History",
		   "showstats.php3?showby=expt&which=$expindex");

119
if (ISADMIN($uid)) {
Chad Barb's avatar
   
Chad Barb committed
120
    if (strcmp($expstate, $TB_EXPTSTATE_ACTIVE) == 0) {		
121
	SUBMENUSECTION("Beta-Test Options");
Chad Barb's avatar
   
Chad Barb committed
122
123
124
125
	WRITESUBMENUBUTTON("Restart this Experiment",
			   "swapexp.php3?inout=restart&pid=$exp_pid".
			   "&eid=$exp_eid");

126
127
128
129
130
131
132
133
134
	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");
Chad Barb's avatar
Chad Barb committed
135
	
136
137
138
139
	SUBMENUSECTIONEND();
    }
}
    
Chad Barb's avatar
   
Chad Barb committed
140
141
SUBMENUEND_2A();

142
143
144
145
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
146
147

SUBMENUEND_2B();
148
149
150
151
152
153

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

154
SUBPAGEEND();
155
156
157
158
159
160

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

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

    SHOWEXPTSTATS($exp_pid, $exp_eid);
}

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