summaryrefslogtreecommitdiff
path: root/server/Test/imageTests.php
diff options
context:
space:
mode:
authorroot <root@kabir-PC>2016-03-23 11:31:51 +0100
committerroot <root@kabir-PC>2016-03-23 11:31:51 +0100
commita26989103d70fb0dd3ff6834de107cae246778c3 (patch)
tree0f243c83b790ffb57f19261fc2a509131f6776ce /server/Test/imageTests.php
parent1342db60283cb61a1c3810993575d35b9fb33ac0 (diff)
parent6e78d76f887d1149ea85bfb06db7ee7ad7435f5a (diff)
Merge branch 'develop' of https://github.com/manzerbredes/istic-openstack into develop
Diffstat (limited to 'server/Test/imageTests.php')
-rw-r--r--server/Test/imageTests.php88
1 files changed, 22 insertions, 66 deletions
diff --git a/server/Test/imageTests.php b/server/Test/imageTests.php
index 94ff7b6..d184d44 100644
--- a/server/Test/imageTests.php
+++ b/server/Test/imageTests.php
@@ -1,35 +1,6 @@
<?php
-require '../vendor/autoload.php';
-include('/istic-openstack/server/init.php');
-
-/*
-$options = Array();
-$options["user"] = Array("name"=>"admin", "password"=>"ae5or6cn", "domain"=>["id"=>"Default"]);
-$options["scope"] = Array("project"=>Array("name"=>"admin", "domain"=>["id"=>"Default"]));
-$options["authUrl"] = "http://148.60.11.31:5000/v3";
-
-$openstack = new OpenStack\OpenStack($options);
-
-//$identity = $openstack->identityV3();
-//var_dump($identity);
-// Since usernames will not be unique across an entire OpenStack installation,
-// when authenticating with them you must also provide your domain ID. You do
-// not have to do this if you authenticate with a user ID.
-/*$token = $identity->generateToken([
- 'user' => [
- 'name' => 'admin',
- 'password' => 'ae5or6cn',
- 'domain' => [
- 'id' => 'Default'
- ]
- ]
- ]);
- */
-//$compute = $openstack->computeV2(["region" => "RegionOne"]);
-//$image= $openstack->imagesV2(["region" => "RegionOne"]);
-//var_dump($compute->client);
-//$servers = $compute->listServers(true);
-echo 'toto';
+include('InitTest.php');
+include_once("../core/Image.php");
$image = new Image($App);
@@ -43,53 +14,38 @@ $opt['minDisk'] = 1;
$opt['protected'] = false;
$opt['minRam'] = 10;
-//$new_image = $image->create_image($opt);
+//$App->setPostParam('id', 'sdfihlus154dfhj');
+//$err = $image->action("createImage");
//Liste des images
-$images = $image->list_images();
+$image->action("listImage");
+$im = $App->show();
+$images = json_decode($im, true)["Images"];
+$recup;
echo "Images présentes :";
echo "</br>";
-
foreach($images as $i){
- echo $i->name;
- if($i->name == "Test"){
- $id_image = $i->id;
- $list = $i->tags;
- echo $i->status;
- }
+ $recup = $i;
+ echo $recup['name'];
echo "</br>";
-}
+ //echo $recup['id'];
+ }
echo "</br>";
+echo "Erreur capturée: ";
+echo "</br>";
+
+/*
+$App->setPostParam('id', 354);
+$err = $image->action("deleteImage");
+$temp = $App->show();
+$ret = json_decode($temp, true)["Images"];
+echo $ret['id'];
+*/
-if(isset($list)){
- foreach ($list as $l) {
- echo $l;
- echo "</br>";
- }
-}
-
-// Détails Image
-//$details = $image->image_details($id_image);
-
-//$image->delete_image('123456');
-
-//$image->desactivate_image($id_image);
-//$image->reactivate_image($id_image);
-
-//$file_name = "/home/yogg/Downloads/TinyCore-6.4.1.iso";
-//$image->upload_image($id_image, $file_name);
-//$image->download_image($id_image);
-/*
-$opt_update = Array();
-$opt_update['name'] = "Test";
-$opt_update['tags'] = null;
-$update = $image->update_image($id_image, $opt_update);
-echo $update->name;
-*/
?> \ No newline at end of file