diff options
Diffstat (limited to 'server')
| -rwxr-xr-x | server/Test/AppTestClass.php | 18 | ||||
| -rw-r--r-- | server/Test/imageTests.php | 90 | ||||
| m--------- | server/vendor/php-opencloud/openstack | 0 |
3 files changed, 51 insertions, 57 deletions
diff --git a/server/Test/AppTestClass.php b/server/Test/AppTestClass.php index 4d7cab5..57dd422 100755 --- a/server/Test/AppTestClass.php +++ b/server/Test/AppTestClass.php @@ -1,6 +1,12 @@ <?php
include_once("../core/Plugin_Api.php");
include_once("../core/LibOverride/genTokenOptions.php");
+include_once("../core/ErrorManagement.php");
+
+use OpenStack\Common\Error\BadResponseError;
+use OpenStack\Common\Error\BaseError;
+use OpenStack\Common\Error\NotImplementedError;
+use OpenStack\Common\Error\UserInputError;
class AppTest{
@@ -10,6 +16,7 @@ class AppTest{ protected $tokenClass;
protected $tokenPost;
protected $output;
+ protected $errorClass;
public function __construct($args){
@@ -19,6 +26,9 @@ class AppTest{ $this->pluginsApi = plugin_api::getInstance();
$this->errorClass = new errorManagement($this);
$this->output = array();
+
+ $this->errorClass = new errorManagement($this);
+
$this->postParams = $_POST;
}
@@ -94,4 +104,12 @@ class AppTest{ return json_encode($this->output);
}
+
+ public function getErrorInstance(){
+
+ return $this->errorClass;
+
+ }
}
+
+
diff --git a/server/Test/imageTests.php b/server/Test/imageTests.php index 94ff7b6..d21eefb 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,52 +14,57 @@ $opt['minDisk'] = 1; $opt['protected'] = false; $opt['minRam'] = 10; -//$new_image = $image->create_image($opt); - +//$new_image = $image->createImage($opt); //Liste des images -$images = $image->list_images(); +$images = $image->action("listImage"); -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; +if(isset($images)){ + 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; + } + echo "</br>"; } echo "</br>"; -} -echo "</br>"; -if(isset($list)){ - foreach ($list as $l) { - echo $l; - echo "</br>"; - } + if(isset($list)){ + foreach ($list as $l) { + echo $l; + echo "</br>"; + } +} +} +else{ + echo "Aucune image présente\n"; } + + // Détails Image -//$details = $image->image_details($id_image); +//$details = $image->imageDetails($id_image); -//$image->delete_image('123456'); +//$image->deleteImage('123456'); -//$image->desactivate_image($id_image); -//$image->reactivate_image($id_image); +//$image->desactivateImage($id_image); +//$image->reactivateImage($id_image); //$file_name = "/home/yogg/Downloads/TinyCore-6.4.1.iso"; -//$image->upload_image($id_image, $file_name); +//$image->uploadImage($id_image, $file_name); -//$image->download_image($id_image); +//$image->downloadImage($id_image); /* $opt_update = Array(); $opt_update['name'] = "Test"; $opt_update['tags'] = null; -$update = $image->update_image($id_image, $opt_update); +$update = $image->updateImage($id_image, $opt_update); echo $update->name; */ diff --git a/server/vendor/php-opencloud/openstack b/server/vendor/php-opencloud/openstack -Subproject 1419eb2e01164bb6b8b837df37724423907352d +Subproject 15aca73f423166c7ef8337ba08615c103c66e93 |
