correct syntaxt on Network, add tests for automating

This commit is contained in:
Yoggzo 2016-04-19 17:17:14 +02:00
parent 71794b98c5
commit 2d260aa6f5
3 changed files with 58 additions and 9 deletions

View file

@ -0,0 +1,24 @@
<?php
include('InitTest.php');
include_once("../core/Image.php");
include_once("../core/Compute.php");
include_once("../core/Network.php");
include_once("../core/FloatingIp.php");
include_once("../core/Automating.php");
$image = new Image($App);
$compute = new Compute($App);
$network = new Network($App);
$floatingIp = new FloatingIp($App);
$automating = new Automating($App);
$compute->listServers();
$servers = json_decode($App->show(), true)["Servers"];
foreach($servers as $server){
echo $server->name." ".$server->id."<br>";
}
?>

View file

@ -105,7 +105,16 @@ class floatingIp implements Core{
$this->app->setOutput("Error", "Incorrect parameter opt"); $this->app->setOutput("Error", "Incorrect parameter opt");
} }
try{ try{
$floatingip = null; //obtenir ip $floatingips = listFloatingIps();
$floatingIp = null;
foreach ($floatingips as $f) {
if($f['id'] == $id){
$floatingIp = $f;
}
}
if(!isset($floatingIp)){
$this->app->setOutput("Error", "Unknowing floatingip id");
}
$floatingip->update(); $floatingip->update();
@ -139,7 +148,16 @@ class floatingIp implements Core{
$this->app->setOutput("Error", "Incorrect parameter opt"); $this->app->setOutput("Error", "Incorrect parameter opt");
} }
try{ try{
$floatingip = null; //obtenir ip $floatingips = listFloatingIps();
$floatingIp = null;
foreach ($floatingips as $f) {
if($f['id'] == $id){
$floatingIp = $f;
}
}
if(!isset($floatingIp)){
$this->app->setOutput("Error", "Unknowing floatingip id");
}
$floatingip->delete(); $floatingip->delete();
@ -173,7 +191,16 @@ class floatingIp implements Core{
$this->app->setOutput("Error", "Incorrect parameter opt"); $this->app->setOutput("Error", "Incorrect parameter opt");
} }
try{ try{
$floatingip = null; //obtenir ip $floatingips = listFloatingIps();
$floatingIp = null;
foreach ($floatingips as $f) {
if($f['id'] == $id){
$floatingIp = $f;
}
}
if(!isset($floatingIp)){
$this->app->setOutput("Error", "Unknowing floatingip id");
}
$floatingip->retrieve(); $floatingip->retrieve();

View file

@ -333,8 +333,7 @@ class network{
* retrieve a specific network * retrieve a specific network
* @param networkId ID of network which we want to get * @param networkId ID of network which we want to get
* @return Network * @return Network
*/ */
retrieve a specific network
private function getNetwork() private function getNetwork()
{ {
$network=""; $network="";
@ -592,7 +591,6 @@ class network{
* Delete a network given * Delete a network given
* *
* @param String networkId ID if network which we want to delete * @param String networkId ID if network which we want to delete
* *
* *
* @return void * @return void
@ -627,7 +625,6 @@ class network{
* Delete a subnet given * Delete a subnet given
* *
* @param String subnetId ID if network which we want to delete * @param String subnetId ID if network which we want to delete
* *
* *
* @return void * @return void
@ -1187,7 +1184,7 @@ class network{
* @return void * @return void
*/ */
private function deleteSecurityGroupe() private function deleteSecurityGroupe()
{ {
try try
{ {
@ -1210,4 +1207,5 @@ class network{
{ {
$this->app->getErrorInstance->NotImplementedHandler($e); $this->app->getErrorInstance->NotImplementedHandler($e);
} }
} }
}