summaryrefslogtreecommitdiff
path: root/server/Test/imageTests.php
diff options
context:
space:
mode:
authormanzerbredes <loic.guegan_secondary@yahoo.fr>2016-03-28 12:17:43 +0200
committermanzerbredes <loic.guegan_secondary@yahoo.fr>2016-03-28 12:17:43 +0200
commit53f65de9d4163c9c095f2b8e87baca648c3645bd (patch)
tree37f167f38b25aa50bd7dd1429438c0245a280a28 /server/Test/imageTests.php
parent60cfe3ebc039df8d6a468a43a59e7fd8c2a16956 (diff)
parent804fa322d841d73ee7592885ec500dc94e91b9e6 (diff)
Test
Diffstat (limited to 'server/Test/imageTests.php')
-rwxr-xr-xserver/Test/imageTests.php104
1 files changed, 83 insertions, 21 deletions
diff --git a/server/Test/imageTests.php b/server/Test/imageTests.php
index 883387d..4adec08 100755
--- a/server/Test/imageTests.php
+++ b/server/Test/imageTests.php
@@ -1,9 +1,14 @@
<?php
include('InitTest.php');
include_once("../core/Image.php");
+include_once("../core/Compute.php");
$image = new Image($App);
+$compute = new Compute($App);
+// Création image
+/*
+echo "Création image :</br>";
$opt = Array();
$opt['name'] = "Test";
$opt['tags'] = ['test', 'openstack'];
@@ -14,39 +19,96 @@ $opt['minDisk'] = 1;
$opt['protected'] = false;
$opt['minRam'] = 10;
-//$App->setPostParam('id', 'sdfihlus154dfhj');
-$err = $image->action("createImage");
+$App->setPostParam('opt', $opt);
+$image->action("createImage");
+$retCreate = json_decode($App->show(), true)["Images"];
+$idNew = $retCreate['id'];
+*/
+/*
+// Delete Image
+$App->setPostParam('id', $idNew);
+$image->action("deleteImage");
+*/
-//Liste des images
+// Liste images
$image->action("listImage");
$im = $App->show();
$images = json_decode($im, true)["Images"];
-$recup;
-echo "Images présentes :";
-echo "</br>";
+echo "List images :</br>";
foreach($images as $i){
- $recup = $i;
- echo $recup['name'];
+ echo $i['name']."</br>"; // Nom
+ echo $i['status']."</br>"; // Status
+ $id = $i['id']; // Id
+ echo $id."</br>";
+ foreach ($i['tags'] as $tag) { // Tags
+ echo $tag."</br>";
+ }
echo "</br>";
- //echo $recup['id'];
- }
+ }
+
+
+// Details images
+echo "Détail image :</br>";
+$App->setPostParam('id', $id);
+$image->action("detailsImage");
+$retDetails = json_decode($App->show(), true)["Images"];
+echo $retDetails['id']."</br>";
echo "</br>";
-echo "Erreur capturée: ";
+
+
+/*
+// Download image
+$App->setPostParam('id', $id);
+$image->action("downloadImage");
+*/
+
+
+// Desactivate Images
+echo "Desactivate image : </br>";
+echo $id."</br>";
+$App->setPostParam('id', $id);
+$err = $image->action("desactivateImage");
echo "</br>";
-
- /*
- //$App->setPostParam('id', $recup['id']);
- $App->setPostParam('id', 'sdfihlus154dfhj');
- $err = $image->action("detailsImage");
- $temp = $App->show();
- $ret = json_decode($temp, true)["Images"];
- echo $ret['id'];
- */
- //$App->getPostParam("id");
+/*
+// Resactivate Images
+echo $id."</br>";
+$App->setPostParam('id', $id);
+$err = $image->action("resactivateImage");
+*/
+
+/*
+// Details images
+echo "Update image :</br>";
+$optUpdate = Array();
+$optUpdate['tags'] = ['ciros', 'testUpdate'];
+$App->setPostParam('id', $id);
+$App->setPostParam('opt', $optUpdate);
+$image->action("updateImage");
+$retDetails = json_decode($App->show(), true)["Images"];
+foreach ($retDetails['tags'] as $tag) { // Tags
+ echo $tag."</br>";
+}
+*/
+
+/*
+echo "Flavors: ";
+echo "</br>";
+$compute->action("listFlavors");
+$flavors = json_decode($App->show(), true)["Flavors"];
+
+foreach($flavors as $f){
+ echo "Id=".$f['id'].", ";
+ echo "name=".$f['name'].", ";
+ echo "ram=".$f['ram'].", ";
+ echo "disk=".$f['disk'].", ";
+ echo "vcpus=".$f['vcpus'];
+ echo "</br>";
+ }
+*/
?> \ No newline at end of file