uid();
$isadmin = ISADMIN();
#
# Verify Page Arguments.
#
$reqargs = RequiredPageArguments("slice_idx", PAGEARG_INTEGER);
$optargs = OptionalPageArguments("showtype", PAGEARG_STRING);
if (!isset($showtype)) {
$showtype='sa';
}
#
# Standard Testbed Header
#
PAGEHEADER("Geni Slice");
if (! ($isadmin || STUDLY())) {
USERERROR("You do not have permission to view Geni slices!", 1);
}
if (! ($showtype == "sa"|| $showtype == "cm" || $showtype == "ch")) {
USERERROR("Improper argument: showtype=$showtype", 1);
}
$slice = GeniSlice::Lookup($showtype, $slice_idx);
if (!$slice) {
USERERROR("No such slice $slice_idx", 1);
}
# The table attributes:
$table = array('#id' => 'form1',
'#title' => "Slice $slice_idx ($showtype)");
$rows = array();
$rows[] = array("idx" => $slice->idx());
$rows[] = array("hrn" => $slice->hrn());
$urn = $slice->urn();
if ($urn) {
$rows[] = array("urn" => $slice->urn());
}
$rows[] = array("uuid" => $slice->uuid());
$rows[] = array("created" => $slice->created());
$rows[] = array("expires" => $slice->expires());
if ($slice->locked()) {
$rows[] = array("locked" => $slice->locked());
}
if (($manifest = $slice->GetManifest())) {
$json = new Services_JSON();
$manifest = $json->encode($manifest);
$rows[] = array("manifest" =>
"".
"Click to View");
}
$experiment = Experiment::LookupByUUID($slice->uuid());
if ($experiment) {
$eid = $experiment->eid();
$exptidx = $experiment->idx();
$url = CreateURL("showexp", $experiment);
$rows[] = array("Experiment" => "$eid ($exptidx)");
}
$geniuser = GeniUser::Lookup($showtype, $slice->creator_uuid());
if ($geniuser) {
$rows[] = array("Creator" => $geniuser->urn());
}
else {
$user = User::LookupByUUID($slice->creator_uuid());
if ($user) {
$url = CreateURL("showuser", $user);
$rows[] = array("Creator" => "". $user->uid() ."");
}
}
if ($showtype != "sa") {
$saslice = GeniSlice::Lookup("sa", $slice->uuid());
if ($saslice) {
$saidx = $saslice->idx();
$url = CreateURL("showslice", "slice_idx", $saidx, "showtype", "sa");
$rows[] = array("SA Slice" => "$saidx");
}
}
if ($showtype != "cm") {
$cmslice = GeniSlice::Lookup("cm", $slice->uuid());
if ($cmslice) {
$cmidx = $cmslice->idx();
$url = CreateURL("showslice", "slice_idx", $cmidx, "showtype", "cm");
$rows[] = array("CM Slice" => "$cmidx");
}
}
list ($html, $button) = TableRender($table, $rows);
echo $html;
$clientslivers = ClientSliver::SliverList($slice);
if ($clientslivers && count($clientslivers)) {
$table = array('#id' => 'clientslivers',
'#title' => "Client Slivers",
'#headings' => array("idx" => "ID",
"urn" => "URN",
"manager" => "Manager URN",
"created" => "Created",
"manifest" => "Manifest"));
$rows = array();
foreach ($clientslivers as $clientsliver) {
$row = array("idx" => $clientsliver->idx(),
"urn" => $clientsliver->urn(),
"manager" => $clientsliver->manager_urn(),
"created" => $clientsliver->created());
if ($clientsliver->manifest()) {
$json = new Services_JSON();
$manifest = $json->encode($clientsliver->manifest());
$row["manifest"] =
"".
"Manifest";
}
else {
$row["manifest"] = "Unknown";
}
$rows[] = $row;
}
list ($html, $button) = TableRender($table, $rows);
echo $html;
}
#
# Standard Testbed Footer
#
PAGEFOOTER();
?>