This commit is contained in:
root 2016-03-23 11:31:51 +01:00
commit a26989103d
131 changed files with 8056 additions and 1164 deletions

View file

@ -1,6 +1,12 @@
<?php
include_once("../core/Plugin_Api.php");
include_once("../core/LibOverride/genTokenOptions.php");
include_once("../core/ErrorManagement.php");
use OpenCloud\Common\Error\BadResponseError;
use OpenCloud\Common\Error\BaseError;
use OpenCloud\Common\Error\NotImplementedError;
use OpenCloud\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;
}
@ -79,10 +89,16 @@ class AppTest{
}
public function getPostParam($name){
return $this->postParams[$name];
}
public function setPostParam($name, $value){
$this->postParams[$name] = $value;
}
public function setOutput($key, $out){
@ -94,4 +110,12 @@ class AppTest{
return json_encode($this->output);
}
public function getErrorInstance(){
return $this->errorClass;
}
}

View file

@ -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;
*/
?>