Merge branch 'develop' of https://github.com/manzerbredes/istic-openstack into othmane
This commit is contained in:
commit
dac5c28a67
49 changed files with 1103 additions and 208 deletions
|
@ -6,6 +6,7 @@ class AppTest{
|
|||
|
||||
protected $openstack;
|
||||
protected $pluginsApi;
|
||||
protected $postParams;
|
||||
protected $tokenClass;
|
||||
protected $tokenPost;
|
||||
protected $output;
|
||||
|
@ -16,7 +17,9 @@ class AppTest{
|
|||
$this->tokenClass = new genTokenOptions($args);
|
||||
$this->openstack = new OpenStack\OpenStack([]);
|
||||
$this->pluginsApi = plugin_api::getInstance();
|
||||
$this->errorClass = new errorManagement($this);
|
||||
$this->output = array();
|
||||
$this->postParams = $_POST;
|
||||
|
||||
}
|
||||
|
||||
|
@ -40,6 +43,16 @@ class AppTest{
|
|||
$opt = $this->tokenClass->getOptions($service);
|
||||
return $this->openstack->imagesV2($opt);
|
||||
break;
|
||||
case "Compute":
|
||||
if($this->tokenPost == NULL) $this->tokenClass->genComputeToken();
|
||||
$opt = $this->tokenClass->getOptions($service);
|
||||
return $this->openstack->computeV2($opt);
|
||||
break;
|
||||
case "Network":
|
||||
if($this->tokenPost == NULL) $this->tokenClass->genNetworkToken();
|
||||
$opt = $this->tokenClass->getOptions($service);
|
||||
return $this->openstack->networkingV2($opt);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -53,10 +66,21 @@ class AppTest{
|
|||
$this->tokenClass->genNetworkToken();
|
||||
|
||||
$this->setOutput("token", $this->tokenClass->getBackup());
|
||||
}catch(Exception $e){
|
||||
echo $e;
|
||||
exit();
|
||||
}
|
||||
}catch(BadResponseError $e){
|
||||
$this->errorClass->BadResponseHandler($e);
|
||||
}catch(UserInputError $e){
|
||||
$this->errorClass->UserInputHandler($e);
|
||||
}catch(BaseError $e){
|
||||
$this->errorClass->BaseErrorHandler($e);
|
||||
}catch(NotImplementedError $e){
|
||||
$this->errorClass->NotImplementedHandler($e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getPostParam($name){
|
||||
|
||||
return $this->postParams[$name];
|
||||
|
||||
}
|
||||
|
||||
|
@ -67,7 +91,7 @@ class AppTest{
|
|||
}
|
||||
|
||||
public function show(){
|
||||
echo json_encode($this->output);
|
||||
return json_encode($this->output);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
20
server/Test/computeTest.php
Normal file
20
server/Test/computeTest.php
Normal file
|
@ -0,0 +1,20 @@
|
|||
re '../vendor/autoload.php';
|
||||
include('/istic-openstack/server/init.php');
|
||||
include_once("../core/Compute.php");
|
||||
$compute = new compute($App);
|
||||
|
||||
$servers = $compute->listServers();
|
||||
|
||||
$servers= $compute->listServers(true);
|
||||
foreach($servers as $server){
|
||||
//print_r($server);
|
||||
echo $server->name." ".$server->id."<br>";
|
||||
|
||||
//$opt = Array();
|
||||
//$opt['name'] = "Test";
|
||||
//$serverid = Array("id"=>"69d5bcc4-2fab-4634-b0d2-f455fee5b7bd");
|
||||
//$serverid["id"] = "{69d5bcc4-2fab-4634-b0d2-f455fee5b7bd}";
|
||||
//unset($server);
|
||||
//$server = $compute->getServer($serverid);
|
||||
//echo $server->name." ".$server->image;
|
||||
//$server->update(array('name' => 'test'));
|
Loading…
Add table
Add a link
Reference in a new issue