Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
bbf6f1ef
Commit
bbf6f1ef
authored
Jan 30, 2002
by
Leigh B. Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for Chad's NS file generator stuff; allow NS file to
passed along as a URL argument.
parent
a2c63d31
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
71 additions
and
7 deletions
+71
-7
www/beginexp_form.php3
www/beginexp_form.php3
+26
-6
www/beginexp_process.php3
www/beginexp_process.php3
+23
-1
www/spitnsdata.php3
www/spitnsdata.php3
+22
-0
No files found.
www/beginexp_form.php3
View file @
bbf6f1ef
...
...
@@ -12,6 +12,17 @@ PAGEHEADER("Begin a new Testbed Experiment");
$uid
=
GETLOGIN
();
LOGGEDINORDIE
(
$uid
);
#
# See if nsdata was provided. Clear it if an empty string, otherwise
# reencode it.
#
if
(
isset
(
$nsdata
))
{
if
(
strcmp
(
$nsdata
,
""
)
==
0
)
unset
(
$nsdata
);
else
$nsdata
=
rawurlencode
(
$nsdata
);
}
#
# See what projects the uid can create experiments in. Must be at least one.
#
...
...
@@ -64,9 +75,18 @@ echo "<tr>
</tr>
\n
"
;
#
# NS file upload.
#
echo
"<tr>
# NS file.
#
if
(
isset
(
$nsdata
))
{
echo
"<tr>
<td colspan=2>*Your Auto Generated NS file:  </td>
<input type=hidden name=nsdata value=
$nsdata
>
<td><a target=_blank href=spitnsdata.php3?nsdata=
$nsdata
>
View NS File</a></td>
</tr>
\n
"
;
}
else
{
echo
"<tr>
<td rowspan>*Your NS file:  </td>
<td rowspan><center>Upload (20K max)<br>
...
...
@@ -83,7 +103,8 @@ echo "<tr>
<br>
<input type=
\"
text
\"
name=
\"
exp_localnsfile
\"
size=
\"
50
\"
>
</td>
</tr>
\n
"
;
</tr>
\n
"
;
}
#
# Expires.
...
...
@@ -180,8 +201,7 @@ echo "<p><blockquote>
<a href='newosid_form.php3'>create the OSID first!</a>
<li> You can view a <a href='showosid_list.php3'> list of OSIDs</a>
that are available for you to use in your NS file.
<li>
You can also view a <a href='showimageid_list.php3'> list of
<li> You can also view a <a href='showimageid_list.php3'> list of
ImageIDs.</a>
</ul>
</blockquote>
\n
"
;
...
...
www/beginexp_process.php3
View file @
bbf6f1ef
...
...
@@ -6,7 +6,8 @@ include("defs.php3");
#
PAGEHEADER
(
"Beginning a Testbed Experiment"
);
$mydebug
=
0
;
$mydebug
=
0
;
$delnsfile
=
0
;
#
# First off, sanity check the form to make sure all the required fields
...
...
@@ -124,6 +125,23 @@ elseif ($specupload) {
$nsfile
=
$exp_nsfile
;
$nonsfile
=
0
;
}
elseif
(
isset
(
$nsdata
)
&&
strcmp
(
$nsdata
,
""
))
{
#
# The NS file is encoded in the URL. Must create a temp file
# to hold it, and pass through to the backend.
#
# XXX Hard to believe, but there is no equiv of mkstemp in php3.
#
$nsfile
=
tempnam
(
"/tmp"
,
"
$exp_pid
-
$exp_id
.nsfile."
);
$delnsfile
=
1
;
$nonsfile
=
0
;
if
(
!
(
$fp
=
fopen
(
$nsfile
,
"w"
)))
{
TBERROR
(
"Could not create temporary file
$nsfile
"
,
1
);
}
fwrite
(
$fp
,
urldecode
(
$nsdata
));
fclose
(
$fp
);
}
else
{
#
# I am going to allow shell experiments to be created (No NS file),
...
...
@@ -299,6 +317,10 @@ $result = exec("$TBSUEXEC_PATH $uid $unix_gid ".
"-p
$exp_pid
-g
$exp_gid
-e
$exp_id
$nsfile
"
,
$output
,
$retval
);
if
(
$delnsfile
)
{
unlink
(
$nsfile
);
}
if
(
$retval
)
{
echo
"<br><br><h2>
Setup Failure(
$retval
): Output as follows:
...
...
www/spitnsdata.php3
0 → 100644
View file @
bbf6f1ef
<?php
include
(
"defs.php3"
);
#
# Spit back an NS file to the user. It comes in as an urlencoded argument
# and we send it back as plain text so that user can write it out. This
# is in support of the graphical NS topology editor that fires off an
# experiment directly.
#
#
# See if nsdata was provided.
#
if
(
!
isset
(
$nsdata
)
||
strcmp
(
$nsdata
,
""
)
==
0
)
{
PAGEERROR
(
"No NS file provided!"
);
}
header
(
"Content-Type: text/plain"
);
echo
"
$nsdata
"
;
?>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment