From 2d260aa6f591030f869063ccdb1f6997d12c1294 Mon Sep 17 00:00:00 2001
From: Yoggzo <yogg@epsina.com>
Date: Tue, 19 Apr 2016 17:17:14 +0200
Subject: [PATCH 01/13] correct syntaxt on Network, add tests for automating

---
 server/Test/automatingTests.php | 24 ++++++++++++++++++++++++
 server/core/FloatingIp.php      | 33 ++++++++++++++++++++++++++++++---
 server/core/Network.php         | 10 ++++------
 3 files changed, 58 insertions(+), 9 deletions(-)
 create mode 100644 server/Test/automatingTests.php

diff --git a/server/Test/automatingTests.php b/server/Test/automatingTests.php
new file mode 100644
index 0000000..5cdee26
--- /dev/null
+++ b/server/Test/automatingTests.php
@@ -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>";
+}
+
+?>
\ No newline at end of file
diff --git a/server/core/FloatingIp.php b/server/core/FloatingIp.php
index 4271a84..c5a947e 100755
--- a/server/core/FloatingIp.php
+++ b/server/core/FloatingIp.php
@@ -105,7 +105,16 @@ class floatingIp implements Core{
 			$this->app->setOutput("Error", "Incorrect parameter opt");
 		}
 		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();
 
@@ -139,7 +148,16 @@ class floatingIp implements Core{
 			$this->app->setOutput("Error", "Incorrect parameter opt");
 		}
 		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();
 			
@@ -173,7 +191,16 @@ class floatingIp implements Core{
 			$this->app->setOutput("Error", "Incorrect parameter opt");
 		}
 		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();
 			
diff --git a/server/core/Network.php b/server/core/Network.php
index ad0cbaf..fef3512 100755
--- a/server/core/Network.php
+++ b/server/core/Network.php
@@ -333,8 +333,7 @@ class network{
 	* retrieve a specific network
 	* @param networkId ID of network which we want to get
 	* @return Network
-	*/
-	retrieve a specific network 
+	*/ 
 	private function getNetwork()
 	{
 		$network="";
@@ -592,7 +591,6 @@ class network{
 	* Delete a network given
 	*
 	* @param String networkId ID if network which we want to delete
-	
 	* 
 	*
 	* @return void	
@@ -627,7 +625,6 @@ class network{
 	* Delete a subnet given
 	*
 	* @param String subnetId ID if network which we want to delete
-	
 	* 
 	*
 	* @return void	
@@ -1187,7 +1184,7 @@ class network{
 	* @return void
 	*/
 	private function deleteSecurityGroupe()
-     	{	
+    {	
 		try
 		{
 		
@@ -1210,4 +1207,5 @@ class network{
 		{
 			$this->app->getErrorInstance->NotImplementedHandler($e);
         	}
-	}	
+	}
+}	

From 3795d05a97dd144073d466be1ed0fd144683d8df Mon Sep 17 00:00:00 2001
From: Yoggzo <yogg@epsina.com>
Date: Tue, 19 Apr 2016 18:00:37 +0200
Subject: [PATCH 02/13] trying test floatingip

---
 server/Test/AppTestClass.php    |  5 ++++
 server/Test/automatingTests.php | 22 +++++++++------
 server/core/FloatingIp.php      | 50 +++++++++++++++++++++++----------
 3 files changed, 53 insertions(+), 24 deletions(-)

diff --git a/server/Test/AppTestClass.php b/server/Test/AppTestClass.php
index a663514..eaea7f6 100755
--- a/server/Test/AppTestClass.php
+++ b/server/Test/AppTestClass.php
@@ -63,6 +63,11 @@ class AppTest{
 				$opt = $this->tokenClass->getOptions($service);
 				return $this->openstack->networkingV2($opt);
 				break;
+			case "FloatingIp":
+				if($this->tokenPost == NULL) $this->tokenClass->genNetworkToken();
+				$opt = $this->tokenClass->getOptions($service);
+				return $this->openstack->networkingV2ExtLayer3($opt);
+				break;
 		}
 		
 	}
diff --git a/server/Test/automatingTests.php b/server/Test/automatingTests.php
index 5cdee26..6de4de5 100644
--- a/server/Test/automatingTests.php
+++ b/server/Test/automatingTests.php
@@ -2,23 +2,27 @@
 include('InitTest.php');
 include_once("../core/Image.php");
 include_once("../core/Compute.php");
-include_once("../core/Network.php");
+//include_once("../core/Network.php");
+//include_once("../core/Automating.php");
 include_once("../core/FloatingIp.php");
-include_once("../core/Automating.php");
 
 $image = new Image($App);
 $compute = new Compute($App);
-$network = new Network($App);
+//$network = new Network($App);
 $floatingIp = new FloatingIp($App);
-$automating = new Automating($App);
-
-
-$compute->listServers();
+//$automating = new Automating($App);
 
+// Liste des serveurs
+$compute->action("listServers");
 $servers = json_decode($App->show(), true)["Servers"];
-
 foreach($servers as $server){
-	echo $server->name." ".$server->id."<br>";
+	echo $server['name']." ".$server['id']."<br>";
 }
 
+// liste des floatingip
+$floatingIp->action("listFloatingIp");
+$listFloatingIp =  json_decode($App->show(), true)["FloatingIp"];
+foreach ($listFloatingIp as $floatIp){
+	echo $floatIp['floating_ip_address']." ".$floatIp['id']." ".$floatIp["status"]."<br>";
+}
 ?>
\ No newline at end of file
diff --git a/server/core/FloatingIp.php b/server/core/FloatingIp.php
index c5a947e..bbcd888 100755
--- a/server/core/FloatingIp.php
+++ b/server/core/FloatingIp.php
@@ -14,7 +14,7 @@ use OpenCloud\Common\Error\BaseError;
 use OpenCloud\Common\Error\NotImplementedError;
 use OpenCloud\Common\Error\UserInputError;
 
-include("CoreInterface.php");
+//include("CoreInterface.php");
 
 /**
 * Image Class of the back-end application
@@ -22,7 +22,7 @@ include("CoreInterface.php");
 * Management of images
 *
 */
-class floatingIp implements Core{ 
+class floatingIp { 
 
 	/** @var App $app protected, contains the main app object */
 	protected $app;
@@ -31,11 +31,11 @@ class floatingIp implements Core{
 	protected $libClass;
 	
 	/**
-	* Image constructor
+	* floatingip constructor
 	*
 	* @param App $app the main app object
 	*
-	* @return Image
+	* @return floatingip
 	*/
 	public function __construct($app){
 		if(!isset($app)){
@@ -57,6 +57,36 @@ class floatingIp implements Core{
 		 $this->{$action.""}();	
 	}
 
+
+	/**
+	* List floatingip
+	* 
+	* @return list of the floatingip
+	*/
+	private function listFloatingIp(){
+		try{
+			$result = array();
+			$l = $this->libClass->getFloatingIps();
+
+
+
+			foreach ($l as $tmp) {
+				$serult[] = $tmp;
+			}
+			$this->app->setOutput("FloatingIp", $result);
+		}catch(BadResponseError $e){
+			$this->app->getErrorInstance()->BadResponseHandler($e);
+        }catch(UserInputError $e){
+			$this->app->getErrorInstance()->UserInputHandler($e);
+        }catch(BaseError $e){
+			$this->app->getErrorInstance()->BaseErrorHandler($e);
+        }catch(NotImplementedError $e){
+			$this->app->getErrorInstance()->NotImplementedHandler($e);
+        }catch(Exception $e){
+        	$this->app->getErrorInstance()->OtherException($e);
+        }
+	}
+
 	/**
 	* Create a new floating IP adress
 	*
@@ -72,7 +102,7 @@ class floatingIp implements Core{
 		}
 		try{
 			$floatingip = $this->libClass->create($opt);
-			if(!isset){
+			if(!isset($floatingip)){
 				$this->app->setOutput("Error", "Unknowing error during floating ip creation");
 			}
 			else{
@@ -118,9 +148,6 @@ class floatingIp implements Core{
 
 			$floatingip->update();
 
-			if(!isset){
-				$this->app->setOutput("Error", "Unknowing error during floating ip creation");
-			}
 		}catch(BadResponseError $e){
 			$this->app->getErrorInstance()->BadResponseHandler($e);
         }catch(UserInputError $e){
@@ -161,9 +188,6 @@ class floatingIp implements Core{
 
 			$floatingip->delete();
 			
-			if(!isset){
-				$this->app->setOutput("Error", "Unknowing error during floating ip creation");
-			}
 		}catch(BadResponseError $e){
 			$this->app->getErrorInstance()->BadResponseHandler($e);
         }catch(UserInputError $e){
@@ -203,10 +227,6 @@ class floatingIp implements Core{
 			}
 
 			$floatingip->retrieve();
-			
-			if(!isset){
-				$this->app->setOutput("Error", "Unknowing error during floating ip creation");
-			}
 		}catch(BadResponseError $e){
 			$this->app->getErrorInstance()->BadResponseHandler($e);
         }catch(UserInputError $e){

From 6a3f770c762de4decfbb483bb8212ea44ffc44d1 Mon Sep 17 00:00:00 2001
From: Yoggzo <yogg@epsina.com>
Date: Tue, 19 Apr 2016 18:27:27 +0200
Subject: [PATCH 03/13] add init FloatingIp

---
 server/Test/AppTestClass.php | 2 +-
 server/core/App.php          | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/server/Test/AppTestClass.php b/server/Test/AppTestClass.php
index eaea7f6..d8a02ca 100755
--- a/server/Test/AppTestClass.php
+++ b/server/Test/AppTestClass.php
@@ -65,7 +65,7 @@ class AppTest{
 				break;
 			case "FloatingIp":
 				if($this->tokenPost == NULL) $this->tokenClass->genNetworkToken();
-				$opt = $this->tokenClass->getOptions($service);
+				$opt = $this->tokenClass->getOptions('Network');
 				return $this->openstack->networkingV2ExtLayer3($opt);
 				break;
 		}
diff --git a/server/core/App.php b/server/core/App.php
index 48bb9ab..a4be6ec 100755
--- a/server/core/App.php
+++ b/server/core/App.php
@@ -64,6 +64,11 @@ class App{
 				$opt = $this->tokenClass->getOptions($service);
 				return $this->openstack->computeV2($opt);
 				break;
+			case "FloatingIp":
+				if($this->tokenPost == NULL) $this->tokenClass->genNetworkToken();
+				$opt = $this->tokenClass->getOptions('Network');
+				return $this->openstack->networkingV2ExtLayer3($opt);
+				break;
 		}
 		
 	}

From 00184e623ec6dd1b5757fd9b268bc2afe97c338b Mon Sep 17 00:00:00 2001
From: Yoggzo <yogg@epsina.com>
Date: Tue, 19 Apr 2016 18:33:21 +0200
Subject: [PATCH 04/13] trying floating ip

---
 server/core/FloatingIp.php | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/server/core/FloatingIp.php b/server/core/FloatingIp.php
index bbcd888..26f5ef1 100755
--- a/server/core/FloatingIp.php
+++ b/server/core/FloatingIp.php
@@ -66,13 +66,13 @@ class floatingIp {
 	private function listFloatingIp(){
 		try{
 			$result = array();
+
 			$l = $this->libClass->getFloatingIps();
-
-
-
+			echo 'toto';
 			foreach ($l as $tmp) {
-				$serult[] = $tmp;
+				$result[] = $tmp;
 			}
+
 			$this->app->setOutput("FloatingIp", $result);
 		}catch(BadResponseError $e){
 			$this->app->getErrorInstance()->BadResponseHandler($e);

From 49ce03168ad0c71a1df3ff4f9f161cbbe61bb277 Mon Sep 17 00:00:00 2001
From: EoleDev <EoleDev@outlook.fr>
Date: Tue, 19 Apr 2016 19:44:09 +0200
Subject: [PATCH 05/13] Error patch

---
 server/Test/automatingTests.php | 2 +-
 server/core/FloatingIp.php      | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
 mode change 100644 => 100755 server/Test/automatingTests.php

diff --git a/server/Test/automatingTests.php b/server/Test/automatingTests.php
old mode 100644
new mode 100755
index 6de4de5..8715464
--- a/server/Test/automatingTests.php
+++ b/server/Test/automatingTests.php
@@ -23,6 +23,6 @@ foreach($servers as $server){
 $floatingIp->action("listFloatingIp");
 $listFloatingIp =  json_decode($App->show(), true)["FloatingIp"];
 foreach ($listFloatingIp as $floatIp){
-	echo $floatIp['floating_ip_address']." ".$floatIp['id']." ".$floatIp["status"]."<br>";
+	echo "IP : ".$floatIp['floating_ip_address']." et ID: ".$floatIp['id']." ".$floatIp["status"]."<br>";
 }
 ?>
\ No newline at end of file
diff --git a/server/core/FloatingIp.php b/server/core/FloatingIp.php
index 26f5ef1..f26c3fb 100755
--- a/server/core/FloatingIp.php
+++ b/server/core/FloatingIp.php
@@ -66,8 +66,8 @@ class floatingIp {
 	private function listFloatingIp(){
 		try{
 			$result = array();
-
-			$l = $this->libClass->getFloatingIps();
+			$l = $this->libClass->listFloatingIps();
+			error_log(var_export($l, true), 0);
 			echo 'toto';
 			foreach ($l as $tmp) {
 				$result[] = $tmp;

From 438b9b4dcdee7e0c18c3477bb9592ac7efbebfec Mon Sep 17 00:00:00 2001
From: Yoggzo <yogg@epsina.com>
Date: Tue, 19 Apr 2016 23:16:37 +0200
Subject: [PATCH 06/13] Correction de cette putain de classe non testee par
 othmane

---
 server/core/Network.php | 310 ++++++++++++++++++++++++----------------
 1 file changed, 184 insertions(+), 126 deletions(-)

diff --git a/server/core/Network.php b/server/core/Network.php
index fef3512..9564f06 100755
--- a/server/core/Network.php
+++ b/server/core/Network.php
@@ -14,8 +14,6 @@ use OpenCloud\Common\Error\BaseError;
 use OpenCloud\Common\Error\NotImplementedError;
 use OpenCloud\Common\Error\UserInputError;
 
-include("CoreInterface.php");
-
 /**
 * Network Class of the back-end application
 *
@@ -73,24 +71,29 @@ class network{
 	{
 		$options = array();
 		// check the name if it is null
-		if (isset($this->app->getPostParam("name")))
+		$name = $this->app->getPostParam("name");
+		$adminStateUp = $this->app->getPostParam("adminStateUp");
+		$shared = $this->app->getPostParam("shared");
+		$tenantId = $this->app->getPostParam("tenantId");
+
+		if (isset($name))
 		{
-			$options['name'] = $this->app->getPostParam("name"); 
+			$options['name'] = $name; 
 		}
 		// check the adminStateUp if it is null
-		if (isset($this->app->getPostParam("adminStateUp")))
+		if (isset($adminStateUp))
 		{
-			$options['adminStateUp'] = $this->app->getPostParam("adminStateUp"); 
+			$options['adminStateUp'] = $adminStateUp; 
 		}
 		// check the shared if it is null
-		if (isset($this->app->getPostParam("shared")))
+		if (isset($shared))
 		{
-			$options['shared'] = $this->app->getPostParam("shared"); 
+			$options['shared'] = $shared; 
 		}
 		// check the tenantId if it is null
-		if (isset($this->app->getPostParam("tenantId")))
+		if (isset($tenantId))
 		{
-			$options['tenantId'] = $this->app->getPostParam("tenantId"); 
+			$options['tenantId'] =$tenantId; 
 		}
 		try
 		{
@@ -138,49 +141,61 @@ class network{
 
 	private function create_subnet()
 	{	$options = array();
-		if (isset($this->app->getPostParam("networkId")))
+		$networkId = $this->app->getPostParam("networkId");
+		$ipVersion = $this->app->getPostParam("ipVersion");
+		$cidr = $this->app->getPostParam("cidr");
+		$tenantId = $this->app->getPostParam("tenantId");
+		$name = $this->app->getPostParam("name");
+		$gatewayIp = $this->app->getPostParam("gatewayIp");
+		$dnsNameservers = $this->app->getPostParam("dnsNameservers");
+		$allocationPools = $this->app->getPostParam("allocationPools");
+		$hostRoutes = $this->app->getPostParam("hostRoutes");
+		$enableDhcp = $this->app->getPostParam("enableDhcp");
+		$tenantId = $this->app->getPostParam("tenantId");
+
+		if (isset($networkId))
 		{
 			$options['networkId'] = $networkId; 
 		}
-		if (isset($this->app->getPostParam("ipVersion")))
+		if (isset($ipVersion))
 		{
-			$options['ipVersion'] = $this->app->getPostParam("ipVersion"); 
+			$options['ipVersion'] = $ipVersion; 
 		}
-		if (isset($this->app->getPostParam("cidr")))
+		if (isset($cidr))
 		{
-			$options['cidr'] = $this->app->getPostParam("cidr"); 
+			$options['cidr'] = $cidr; 
 		}
-		if (isset($this->app->getPostParam("tenantId")))
+		if (isset($tenantId))
 		{
-			$options['tenantId'] = $this->app->getPostParam("tenantId"); 
+			$options['tenantId'] = $tenantId; 
 		}
-		if (isset($this->app->getPostParam("name")))
+		if (isset($name))
 		{
-			$options['name'] = $$this->app->getPostParam("name"); 
+			$options['name'] = $name; 
 		}
-		if (isset($this->app->getPostParam("gatewayIp")))
+		if (isset($gatewayIp))
 		{
-			$options['gatewayIp'] = $this->app->getPostParam("gatewayIp"); 
+			$options['gatewayIp'] = $gatewayIp; 
 		}
-		if (isset($this->app->getPostParam("dnsNameservers")))
+		if (isset($dnsNameservers))
 		{
-			$options['dnsNameservers'] = $this->app->getPostParam("dnsNameservers"); 
+			$options['dnsNameservers'] = $dnsNameservers; 
 		}
-		if (isset($this->app->getPostParam("allocationPools")))
+		if (isset($allocationPools))
 		{
-			$options['allocationPools'] = $this->app->getPostParam("allocationPools"); 
+			$options['allocationPools'] = $allocationPools; 
 		}
-		if (isset($this->app->getPostParam("hostRoutes")))
+		if (isset($hostRoutes))
 		{
-			$options['hostRoutes'] = $this->app->getPostParam("hostRoutes"); 
+			$options['hostRoutes'] = $hostRoutes; 
 		}
-		if (isset($this->app->getPostParam("enableDhcp")))
+		if (isset($enableDhcp))
 		{
-			$options['enableDhcp'] = $this->app->getPostParam("enableDhcp"); 
+			$options['enableDhcp'] = $enableDhcp; 
 		}
-		if (isset($this->app->getPostParam("tenantId")))
+		if (isset($tenantId))
 		{
-			$options['tenantId'] = $this->app->getPostParam("tenantId"); 
+			$options['tenantId'] = $tenantId; 
 		}
 		
 		try
@@ -339,10 +354,10 @@ class network{
 		$network="";
 		
 		try
-		{	$newtork = $this->libClass->getNetwork($this->app->getPostParam("networkId"));
-			$network->retrieve();
-
-			
+		{	
+			$networkId = $this->app->getPostParam("networkId");
+			$newtork = $this->libClass->getNetworkP($networkId);
+			$network->retrieve();			
 		}
 
 		
@@ -371,7 +386,7 @@ class network{
 	* @param String netId ID of network which we want to get
 	* @return Network
 	*/
-	private function getNetwork($netId)
+	private function getNetworkP($netId)
 	{
 		$network="";
 		
@@ -413,10 +428,10 @@ class network{
 		$sbnet="";
 		
 		try
-		{	$subnet = $this->libClass->getSubnet($this->app->getPostParam("subnetId"));
+		{	
+			$subnetId = $this->app->getPostParam("subnetId");
+			$subnet = $this->libClass->getSubnet($subnetId);
 			$subnet->retrieve();
-
-			
 		}
 
 		catch(BadResponseError $e)
@@ -443,7 +458,7 @@ class network{
 	* @param String subnetId ID of subnet which we want to get
 	* @return subnet
 	*/
-	private function getSubnet($subnetId)
+	private function getSubnetP($subnetId)
 	{
 		$subnet="";
 		
@@ -489,21 +504,26 @@ class network{
         private function updateNetwork()
      	{	
 		$options = array();
-		if(isset($this->app->getPostParam("name")))
+		$name = $this->app->getPostParam("name");
+		$shared = $this->app->getPostParam("shared");
+		$adminStateUp = $this->app->getPostParam("adminStateUp");
+
+		if(isset($name))
 		{
-			$options['name'] = $this->app->getPostParam("name");	
+			$options['name'] = $name;	
 		}
-		if(isset($this->app->getPostParam("shared")))
+		if(isset($shared))
 		{
-			$options['shared'] = $this->app->getPostParam("shared");	
+			$options['shared'] = $shared;	
 		}
-		if(isset($this->app->getPostParam("adminStateUp")))
+		if(isset($adminStateUp))
 		{
-			$options['adminStateUp'] = $this->app->getPostParam("adminStateUp");	
+			$options['adminStateUp'] = $adminStateUp;	
 		}
 		try
 		{		
-			$network = getNetwork($this->app->getPostParam("networkId"));
+			$networkId = $this->app->getPostParam("networkId");
+			$network = getNetworkP($networkId);
 		
 			$network->update($options);
 		}
@@ -547,26 +567,30 @@ class network{
 	private function updateSubnet()
      	{	
 		$options = array();
-		if(isset($this->app->getPostParam("name")))
+		$name = $this->app->getPostParam("name");
+		$networkId = $this->app->getPostParam("networkId");
+		$ipVersion = $this->app->getPostParam("ipVersion");
+		$cidr = $this->app->getPostParam("cidr");
+		if(isset($name))
 		{
-			$options['name'] = $this->app->getPostParam("name");	
+			$options['name'] = $name;	
 		}
-		if(isset($this->app->getPostParam("networkId")))
+		if(isset($networkId))
 		{
-			$options['networkId'] = $this->app->getPostParam("networkId");	
+			$options['networkId'] = $networkId;	
 		}
-		if(isset($this->app->getPostParam("ipVersion")))
+		if(isset($ipVersion))
 		{
-			$options['ipVersion'] = $this->app->getPostParam("ipVersion");	
+			$options['ipVersion'] = $ipVersion;	
 		}
-		if(isset($this->app->getPostParam("cidr")))
+		if(isset($cidr))
 		{
-			$options['cidr'] = $this->app->getPostParam("cidr");	
+			$options['cidr'] = $cidr;	
 		}
 		try
 		{
-			$subnet = getSubnet($this->app->getPostParam("networkId"));
-		
+			$networkId = $this->app->getPostParam("networkId");
+			$subnet = getSubnetP($networkId);
 			$subnet->update($options);
 		}
 		catch(BadResponseError $e)
@@ -599,8 +623,8 @@ class network{
      	{
 		try
 		{
-				
-			$network = getNetwork($this->app->getPostParam("networkId"));
+			$networkId = $this->app->getPostParam("networkId");
+			$network = getNetworkP($networkId);
 			$network->delete();
 		}
 		catch(BadResponseError $e)
@@ -633,7 +657,8 @@ class network{
      	{
 		try
 		{		
-			$subnet = getNetwork($this->app->getPostParam("subnetId"));
+			$subnetId = $this->app->getPostParam("subnetId");
+			$subnet = getNetworkP($subnetId);
 			$subnet->delete();
 		}
 		catch(BadResponseError $e)
@@ -673,41 +698,51 @@ class network{
 	private function createPort()
 	{
 		$options = array();
-		if (isset($this->app->getPostParam("networkId")))
+		$networkId = $this->app->getPostParam("networkId");
+		$name = $this->app->getPostParam("name");
+		$adminStateUp = $this->app->getPostParam("adminStateUp");
+		$macAddress = $this->app->getPostParam("macAddress");
+		$fixedIps = $this->app->getPostParam("fixedIps");
+		$deviceId = $this->app->getPostParam("deviceId");
+		$deviceOwner = $this->app->getPostParam("deviceOwner");
+		$securityGroups = $this->app->getPostParam("securityGroups");
+		$tenantId = $this->app->getPostParam("tenantId");
+
+		if (isset($networkId))
 		{
-			$options['networkId'] = $this->app->getPostParam("networkId"); 
+			$options['networkId'] = $networkId; 
 		}
-		if (isset($this->app->getPostParam("name")))
+		if (isset($name))
 		{
-			$options['name'] = $this->app->getPostParam("name"); 
+			$options['name'] = $name; 
 		}
-		if (isset($this->app->getPostParam("adminStateUp")))
+		if (isset($adminStateUp))
 		{
-			$options['adminStateUp'] = $this->app->getPostParam("adminStateUp"); 
+			$options['adminStateUp'] = $adminStateUp; 
 		}
-		if (isset($this->app->getPostParam("macAddress")))
+		if (isset($macAddress))
 		{
-			$options['macAddress'] = $this->app->getPostParam("macAddress"); 
+			$options['macAddress'] = $macAddress; 
 		}
-		if (isset($this->app->getPostParam("fixedIps")))
+		if (isset($fixedIps))
 		{
-			$options['fixedIps'] = $this->app->getPostParam("fixedIps"); 
+			$options['fixedIps'] = $fixedIps; 
 		}
-		if (isset($this->app->getPostParam("deviceId")))
+		if (isset($deviceId))
 		{
-			$options['deviceId'] = $this->app->getPostParam("deviceId"); 
+			$options['deviceId'] = $deviceId; 
 		}
-		if (isset($this->app->getPostParam("deviceOwner")))
+		if (isset($deviceOwner))
 		{
-			$options['deviceOwner'] = $this->app->getPostParam("deviceOwner"); 
+			$options['deviceOwner'] = $deviceOwner; 
 		}
-		if (isset($this->app->getPostParam("securityGroups")))
+		if (isset($securityGroups))
 		{
-			$options['securityGroups'] = $this->app->getPostParam("securityGroups"); 
+			$options['securityGroups'] = $securityGroups; 
 		}
-		if (isset($this->app->getPostParam("tenantId")))
+		if (isset($tenantId))
 		{
-			$options['tenantId'] = $this->app->getPostParam("tenantId"); 
+			$options['tenantId'] = $tenantId; 
 		}
 		try
 		{
@@ -771,7 +806,8 @@ class network{
 	{
 		try
 		{
-			$port = $this->libClass->getport($this->app->getPostParam("portId"));
+			$portId = $this->app->getPostParam("portId");
+			$port = $this->libClass->getport($portId);
 			$this->app->setOutput("Port", $port);
 		}
 		catch(BadResponseError $e)
@@ -800,7 +836,7 @@ class network{
 	* @return port
 	*/
 
-	private function getPort($portId)
+	private function getPortP($portId)
 	{
 		try
 		{
@@ -845,46 +881,55 @@ class network{
 	private function updatePort()
 	{
 		$options = array();
-		
-		if (isset($this->app->getPostParam("networkId")))
+		$networkId = $this->app->getPostParam("networkId");
+		$name = $this->app->getPostParam("name");
+		$adminStateUp = $this->app->getPostParam("adminStateUp");
+		$macAddress = $this->app->getPostParam("macAddress");
+		$fixedIps = $this->app->getPostParam("fixedIps");
+		$deviceId = $this->app->getPostParam("deviceId");
+		$deviceOwner = $this->app->getPostParam("deviceOwner");
+		$securityGroups = $this->app->getPostParam("securityGroups");
+		$tenantId = $this->app->getPostParam("tenantId");
+
+		if (isset($networkId))
 		{
-			$options['networkId'] = $this->app->getPostParam("networkId"); 
+			$options['networkId'] = $networkId; 
 		}
-		if (isset($this->app->getPostParam("name")))
+		if (isset($name))
 		{
-			$options['name'] =$this->app->getPostParam("name"); 
+			$options['name'] = $name; 
 		}
-		if (isset($this->app->getPostParam("adminStateUp")))
+		if (isset($adminStateUp))
 		{
-			$options['adminStateUp'] =$this->app->getPostParam("adminStateUp"); 
+			$options['adminStateUp'] = $adminStateUp; 
 		}
-		if (isset($this->app->getPostParam("macAddress")))
+		if (isset($macAddress))
 		{
-			$options['macAddress'] = $this->app->getPostParam("macAddress"); 
+			$options['macAddress'] = $macAddress; 
 		}
-		if (isset($this->app->getPostParam("fixedIps")))
+		if (isset($fixedIps))
 		{
-			$options['fixedIps'] = $this->app->getPostParam("fixedIps"); 
+			$options['fixedIps'] = $fixedIps; 
 		}
-		if (isset($this->app->getPostParam("deviceId")))
+		if (isset($deviceId))
 		{
-			$options['deviceId'] = $this->app->getPostParam("deviceId"); 
+			$options['deviceId'] = $deviceId; 
 		}
-		if (isset($this->app->getPostParam("deviceOwner")))
+		if (isset($deviceOwner))
 		{
-			$options['deviceOwner'] = $this->app->getPostParam("deviceOwner"); 
+			$options['deviceOwner'] = $deviceOwner; 
 		}
-		if (isset($this->app->getPostParam("networkId")))
+		if (isset($securityGroups))
 		{
-			$options['securityGroups'] = $this->app->getPostParam("securityGroups"); 
+			$options['securityGroups'] = $securityGroups; 
 		}
-		if (isset($this->app->getPostParam("tenantId")))
+		if (isset($tenantId))
 		{
-			$options['tenantId'] = $this->app->getPostParam("tenantId"); 
+			$options['tenantId'] = $tenantId; 
 		}
 		try
 		{
-			$port = getPort($this->app->getPostParam("networkId"));
+			$port = getPortP($networkId);
 			$port->update($options);
 		}
 		catch(BadResponseError $e)
@@ -908,7 +953,6 @@ class network{
 	* Delete a port given
 	*
 	* @param String portId 	id of port which we wante to delete
-	
 	* @return void
 	*/
 	private function deletePort()
@@ -916,7 +960,8 @@ class network{
 		
 		try
 		{
-			$port = getPort($this->app->getPostParam("portId"));
+			$portId = $this->app->getPostParam("portId");
+			$port = getPortP($portId);
 			$port->delete();
 		}
 		catch(BadResponseError $e)
@@ -949,13 +994,16 @@ class network{
 	private function createSecurityGroup()
 	{
 		$options = array();
-		if (isset($this->app->getPostParam("name")))
+		$name = $this->app->getPostParam("name");
+		$description = $this->app->getPostParam("description");
+
+		if (isset($name))
 		{
-			$options['name'] = $this->app->getPostParam("name"); 
+			$options['name'] = $name; 
 		}
-		if (isset($this->app->getPostParam("description")))
+		if (isset($description))
 		{
-			$options['description'] = $this->app->getPostParam("description"); 
+			$options['description'] = $description; 
 		}
 		try
 		{
@@ -997,37 +1045,46 @@ class network{
 	private function createSecurityGroupRule()
 	{
 		$options = array();
-		if (isset($this->app->getPostParam("securityGroupId")))
+		$securityGroupId = $this->app->getPostParam("securityGroupId");
+		$direction = $this->app->getPostParam("direction");
+		$ethertype = $this->app->getPostParam("ethertype");
+		$portRangeMin = $this->app->getPostParam("portRangeMin");
+		$portRangeMax = $this->app->getPostParam("portRangeMax");
+		$protocol = $this->app->getPostParam("protocol");
+		$remoteGroupId = $this->app->getPostParam("remoteGroupId");
+		$remoteIpPrefix = $this->app->getPostParam("remoteIpPrefix");
+
+		if (isset($securityGroupId))
 		{
-			$options['securityGroupId'] = $this->app->getPostParam("securityGroupId"); 
+			$options['securityGroupId'] = $securityGroupId; 
 		}
-		if (isset($this->app->getPostParam("direction")))
+		if (isset($direction))
 		{
-			$options['direction'] = $this->app->getPostParam("direction"); 
+			$options['direction'] = $direction; 
 		}
-		if (isset($this->app->getPostParam("ethertype")))
+		if (isset($ethertype))
 		{
-			$options['ethertype'] = $this->app->getPostParam("ethertype"); 
+			$options['ethertype'] = $ethertype; 
 		}
-		if (isset($this->app->getPostParam("portRangeMin")))
+		if (isset($portRangeMin))
 		{
-			$options['portRangeMin'] = $this->app->getPostParam("portRangeMin"); 
+			$options['portRangeMin'] = $portRangeMin; 
 		}
-		if (isset($this->app->getPostParam("portRangeMax")))
+		if (isset($portRangeMax))
 		{
-			$options['portRangeMax'] = $this->app->getPostParam("portRangeMax"); 
+			$options['portRangeMax'] = $portRangeMax; 
 		}
-		if (isset($this->app->getPostParam("protocol")))
+		if (isset($protocol))
 		{
-			$options['protocol'] = $this->app->getPostParam("protocol"); 
+			$options['protocol'] = $protocol; 
 		}
-		if (isset($this->app->getPostParam("remoteGroupId")))
+		if (isset($remoteGroupId))
 		{
-			$options['remoteGroupId'] = $this->app->getPostParam("remoteGroupId"); 
+			$options['remoteGroupId'] = $remoteGroupId; 
 		}
-		if (isset($this->app->getPostParam("remoteIpPrefix")))
+		if (isset($remoteIpPrefix))
 		{
-			$options['remoteIpPrefix'] = $this->app->getPostParam("remoteIpPrefix"); 
+			$options['remoteIpPrefix'] = $remoteIpPrefix; 
 		}
 		try
 		{
@@ -1125,7 +1182,8 @@ class network{
 	{
 		try
 		{
-			$securityGroupe = $this->libClass->getSecurityGroupe($this->app->getPostParam("securityGroupeId"));
+			$securityGroupId = $this->app->getPostParam("securityGroupeId");
+			$securityGroupe = $this->libClass->getSecurityGroupe($securityGroupId);
 			$this->app->setOutput("securityGroupe", $securityGroupe);
 		}
 		catch(BadResponseError $e)
@@ -1153,7 +1211,7 @@ class network{
 	* @param securityGroupeId ID of security Groupe which we want to get
 	* @return securityGroupe
 	*/
-	private function getSecurityGroupe($securityGroupeId)
+	private function getSecurityGroupeP($securityGroupeId)
 	{
 		try
 		{
@@ -1187,8 +1245,8 @@ class network{
     {	
 		try
 		{
-		
-			$securityGroupe = getSecurityGroupe($this->app->getPostParam("securityGroupeId"));
+			$securityGroupId = $this->app->getPostParam("securityGroupeId");
+			$securityGroupe = getSecurityGroupeP($securityGroupId);
 			$securityGroupe->delete();
 		}
 		catch(BadResponseError $e)

From 94629aeaf523f391f09ef18c1b2ca639e0b02d08 Mon Sep 17 00:00:00 2001
From: Yoggzo <yogg@epsina.com>
Date: Tue, 19 Apr 2016 23:57:03 +0200
Subject: [PATCH 07/13] tentative ip publique

---
 server/Test/automatingTests.php | 65 +++++++++++++++++++++++++++++++--
 server/core/FloatingIp.php      | 51 +++++++++++++++++++++++++-
 server/core/Network.php         |  2 +-
 3 files changed, 111 insertions(+), 7 deletions(-)

diff --git a/server/Test/automatingTests.php b/server/Test/automatingTests.php
index 8715464..078f86b 100755
--- a/server/Test/automatingTests.php
+++ b/server/Test/automatingTests.php
@@ -2,27 +2,84 @@
 include('InitTest.php');
 include_once("../core/Image.php");
 include_once("../core/Compute.php");
-//include_once("../core/Network.php");
+include_once("../core/Network.php");
 //include_once("../core/Automating.php");
 include_once("../core/FloatingIp.php");
 
 $image = new Image($App);
 $compute = new Compute($App);
-//$network = new Network($App);
+$network = new Network($App);
 $floatingIp = new FloatingIp($App);
 //$automating = new Automating($App);
 
 // Liste des serveurs
+echo "Liste des serveurs : </br>";
 $compute->action("listServers");
 $servers = json_decode($App->show(), true)["Servers"];
+$id = null;
 foreach($servers as $server){
-	echo $server['name']." ".$server['id']."<br>";
+	echo $server['name']." ".$server['id']." ".$server['ipv4']."<br>";
+	if(strcmp($server['name'], "bob")){
+		$id = $server['id'];
+	}	
 }
+echo "</br>";
+
+/*
+// Liste des ports
+echo "Liste des ports : </br>";
+$network->action("listPorts");
+$ports = json_decode($App->show(), true)["Network"];
+foreach ($ports as $p) {
+	echo $p["fixedIps"]."</br>";
+}
+*/
+
 
 // liste des floatingip
+echo "Liste des floatingip : </br>";
+$floatingIp->action("listFloatingIp");
+$listFloatingIp =  json_decode($App->show(), true)["FloatingIp"];
+$ip = null;
+foreach ($listFloatingIp as $floatIp){
+	echo $floatIp['floatingIpAddress']." ".$floatIp['id']." ".$floatIp["status"]."<br>";
+	$ip = $floatIp;
+}
+
+echo "</br>";
+
+// Création d'une ip flotante
+$opt = array();
+$opt['floatingNetworkId'] = $id;
+$opt['floatingip'] = $ip;
+//$opt['tenantId'] = "fbf5f920a7954b61b352bc09ce5ae803 ";
+//$opt['fixedIpAddress'] = "10.0.0.52";
+//$opt['floatingIpAddress'] = "148.60.11.116";
+//$opt['portId'] = "10.0.0.52";
+
+$App->setPostParam('opt', $opt);
+$floatingIp->action("createFloatingIp");
+$float =  json_decode($App->show(), true)["FloatingIp"];
+if(!isset($float)){
+	echo "Erreur pendant la création</br>";
+}
+else{
+	foreach ($float as $f) {
+		echo $f." ";
+	}
+	echo "<br>";
+}
+
+
+echo "</br>";
+
+// liste des floatingip
+echo "Liste des floatingip : </br>";
 $floatingIp->action("listFloatingIp");
 $listFloatingIp =  json_decode($App->show(), true)["FloatingIp"];
 foreach ($listFloatingIp as $floatIp){
-	echo "IP : ".$floatIp['floating_ip_address']." et ID: ".$floatIp['id']." ".$floatIp["status"]."<br>";
+	echo $floatIp['floatingIpAddress']." ".$floatIp['id']." ".$floatIp["status"]."<br>";
 }
+
+
 ?>
\ No newline at end of file
diff --git a/server/core/FloatingIp.php b/server/core/FloatingIp.php
index f26c3fb..528ab4f 100755
--- a/server/core/FloatingIp.php
+++ b/server/core/FloatingIp.php
@@ -68,7 +68,6 @@ class floatingIp {
 			$result = array();
 			$l = $this->libClass->listFloatingIps();
 			error_log(var_export($l, true), 0);
-			echo 'toto';
 			foreach ($l as $tmp) {
 				$result[] = $tmp;
 			}
@@ -101,13 +100,61 @@ class floatingIp {
 			$this->app->setOutput("Error", "Incorrect parameter opt");
 		}
 		try{
-			$floatingip = $this->libClass->create($opt);
+			$floatingip = $this->libClass->createFloatingIp($opt);
+			echo 'YOLO';
 			if(!isset($floatingip)){
 				$this->app->setOutput("Error", "Unknowing error during floating ip creation");
 			}
 			else{
 				$this->app->setOutput("FloatingIp", $floatingip);
 			}
+		}catch(BadResponseError $e){
+			echo $e."</br>";
+			$this->app->getErrorInstance()->BadResponseHandler($e);
+        }catch(UserInputError $e){
+        	echo $e."</br>";
+			$this->app->getErrorInstance()->UserInputHandler($e);
+        }catch(BaseError $e){
+        	echo $e."</br>";
+			$this->app->getErrorInstance()->BaseErrorHandler($e);
+        }catch(NotImplementedError $e){
+        	echo $e."</br>";
+			$this->app->getErrorInstance()->NotImplementedHandler($e);
+        }catch(Exception $e){
+        	echo $e->getMessage()."</br>";
+        	$this->app->getErrorInstance()->OtherException($e);
+        }
+	}
+
+
+	/**
+	* Show floatingip details
+	*
+	* @param String id the id of the floatingip
+	*
+	* @return floatingip details
+	*/
+	private function getFloatingIp(){
+		$id = $this->app->getPostParam("id");
+		if(!isset($id)){
+			$this->app->setOutput("Error", "Incorrect parameter opt");
+		}
+
+		try{
+			/*$l = $this->listFloatingIp();
+			$res = null;
+			foreach ($l as $f) {
+				if($f['id']==$id){
+					$res = $f;
+				}
+			}
+			if(!isset($f)){
+				$this->app->setOutput("Error", "Unknow id");
+			}
+			else{*/
+				$res = $this->libClass->getFloatingIp($id);
+				$this->app->setOutput("FloatingIp", $res);
+			//}
 		}catch(BadResponseError $e){
 			$this->app->getErrorInstance()->BadResponseHandler($e);
         }catch(UserInputError $e){
diff --git a/server/core/Network.php b/server/core/Network.php
index 9564f06..3e5e2ca 100755
--- a/server/core/Network.php
+++ b/server/core/Network.php
@@ -40,7 +40,7 @@ class network{
 	
 	public function __construct($app){
 		$this->app = $app;
-		$this->libClass = $app->getLibClass("network");
+		$this->libClass = $app->getLibClass("Network");
 		
 	}
 

From 20dc35d9ab6ce3b9aafeeca14be52b70a30aaf1e Mon Sep 17 00:00:00 2001
From: EoleDev <root@serverpc.home>
Date: Wed, 20 Apr 2016 09:45:24 +0200
Subject: [PATCH 08/13] Error correction automating

---
 server/Test/automatingTests.php | 15 ++++++++++++---
 server/core/Network.php         |  4 ++--
 2 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/server/Test/automatingTests.php b/server/Test/automatingTests.php
index 078f86b..6b0e9d6 100755
--- a/server/Test/automatingTests.php
+++ b/server/Test/automatingTests.php
@@ -34,7 +34,15 @@ foreach ($ports as $p) {
 	echo $p["fixedIps"]."</br>";
 }
 */
-
+//Liste des networks
+echo "Liste des network : </br>";
+$network->action("list_network_ids");
+$servers = json_decode($App->show(), true)["ListNetworkIds"];
+$id = null;
+foreach($servers as $server){
+	echo $server."<br>";
+}
+echo "</br>";
 
 // liste des floatingip
 echo "Liste des floatingip : </br>";
@@ -50,12 +58,13 @@ echo "</br>";
 
 // Création d'une ip flotante
 $opt = array();
-$opt['floatingNetworkId'] = $id;
-$opt['floatingip'] = $ip;
+//$opt['floatingNetworkId'] = $id; !!!!! TOTALEMENT FAUX ici tu passe en parametre l id du serveur et non du network
+//$opt['floatingip'] = $ip; !!!! il n y a pas d objet floatingip a passer en param, celui ci est compose, regarde bien les exemples de l api OpenStack
 //$opt['tenantId'] = "fbf5f920a7954b61b352bc09ce5ae803 ";
 //$opt['fixedIpAddress'] = "10.0.0.52";
 //$opt['floatingIpAddress'] = "148.60.11.116";
 //$opt['portId'] = "10.0.0.52";
+$opt['floatingNetworkId'] = "251b4641-20ff-4a72-8549-1758788b51ce";
 
 $App->setPostParam('opt', $opt);
 $floatingIp->action("createFloatingIp");
diff --git a/server/core/Network.php b/server/core/Network.php
index 3e5e2ca..e93c2c5 100755
--- a/server/core/Network.php
+++ b/server/core/Network.php
@@ -118,7 +118,7 @@ class network{
 
 		
 	}
-
+	
 	/**
 	* Create a new subnet
 	*
@@ -356,7 +356,7 @@ class network{
 		try
 		{	
 			$networkId = $this->app->getPostParam("networkId");
-			$newtork = $this->libClass->getNetworkP($networkId);
+			$newtork = $this->libClass->getNetwork($networkId);
 			$network->retrieve();			
 		}
 

From 94ce37f5175eb6f528d5ad29a446c04d981628f1 Mon Sep 17 00:00:00 2001
From: Yoggzo <yogg@epsina.com>
Date: Thu, 21 Apr 2016 21:31:25 +0200
Subject: [PATCH 09/13] end of floatingip

---
 server/Test/automatingTests.php |  24 ++-----
 server/Test/floatingIpTests.php |  88 +++++++++++++++++++++++
 server/core/FloatingIp.php      | 123 +++++++++++++++++++++-----------
 3 files changed, 172 insertions(+), 63 deletions(-)
 create mode 100644 server/Test/floatingIpTests.php

diff --git a/server/Test/automatingTests.php b/server/Test/automatingTests.php
index 6b0e9d6..3f32d02 100755
--- a/server/Test/automatingTests.php
+++ b/server/Test/automatingTests.php
@@ -44,18 +44,7 @@ foreach($servers as $server){
 }
 echo "</br>";
 
-// liste des floatingip
-echo "Liste des floatingip : </br>";
-$floatingIp->action("listFloatingIp");
-$listFloatingIp =  json_decode($App->show(), true)["FloatingIp"];
-$ip = null;
-foreach ($listFloatingIp as $floatIp){
-	echo $floatIp['floatingIpAddress']." ".$floatIp['id']." ".$floatIp["status"]."<br>";
-	$ip = $floatIp;
-}
-
-echo "</br>";
-
+/*
 // Création d'une ip flotante
 $opt = array();
 //$opt['floatingNetworkId'] = $id; !!!!! TOTALEMENT FAUX ici tu passe en parametre l id du serveur et non du network
@@ -72,15 +61,10 @@ $float =  json_decode($App->show(), true)["FloatingIp"];
 if(!isset($float)){
 	echo "Erreur pendant la création</br>";
 }
-else{
-	foreach ($float as $f) {
-		echo $f." ";
-	}
-	echo "<br>";
-}
-
-
 echo "</br>";
+*/
+
+
 
 // liste des floatingip
 echo "Liste des floatingip : </br>";
diff --git a/server/Test/floatingIpTests.php b/server/Test/floatingIpTests.php
new file mode 100644
index 0000000..191de46
--- /dev/null
+++ b/server/Test/floatingIpTests.php
@@ -0,0 +1,88 @@
+<?php
+
+include('InitTest.php');
+include_once("../core/Compute.php");
+include_once("../core/Network.php");
+include_once("../core/FloatingIp.php");
+
+$compute = new Compute($App);
+$network = new Network($App);
+$floatingIp = new FloatingIp($App);
+
+
+// Liste des serveurs
+echo "Liste des serveurs : </br>";
+$compute->action("listServers");
+$servers = json_decode($App->show(), true)["Servers"];
+$id = null;
+foreach($servers as $server){
+	echo $server['name']." ".$server['id']." ".$server['ipv4']."<br>";
+	if(strcmp($server['name'], "bob")){
+		$id = $server['id'];
+	}	
+}
+echo "</br>";
+
+
+// Liste des networks
+echo "Liste des network : </br>";
+$network->action("list_network_ids");
+$servers = json_decode($App->show(), true)["ListNetworkIds"];
+$id = null;
+foreach($servers as $server){
+	echo $server."<br>";
+}
+echo "</br>";
+
+
+// Liste des floatingip
+echo "Liste des floatingip : </br>";
+$floatingIp->action("listFloatingIp");
+$listFloatingIp =  json_decode($App->show(), true)["FloatingIp"];
+$id = null;
+foreach ($listFloatingIp as $floatIp){
+	echo $floatIp['floatingIpAddress']." ".$floatIp['id']." ".$floatIp["status"]."<br>";
+	$id = $floatIp['id'];
+}
+echo "</br>";
+
+
+// Liste des floatingip
+echo "Get floatingip : </br>";
+$App->setPostParam('id', $id);
+$floatingIp->action("getFloatingIp");
+$getFloatingIp =  json_decode($App->show(), true)["FloatingIp"];
+echo $getFloatingIp['id']."<br>";
+echo "</br>";
+
+
+/*
+// Création d'une ip flotante
+$opt = array();
+$opt['floatingNetworkId'] = "251b4641-20ff-4a72-8549-1758788b51ce";
+
+$App->setPostParam('opt', $opt);
+$floatingIp->action("createFloatingIp");
+$float =  json_decode($App->show(), true)["FloatingIp"];
+if(!isset($float)){
+	echo "Erreur pendant la création</br>";
+}
+echo "</br>";
+*/
+
+/*
+// Suppression d'une ip flotante
+$App->setPostParam('id', $id);
+$floatingIp->action("deleteFloatingIp");
+*/
+
+// Liste des floatingip
+echo "Liste des floatingip : </br>";
+$floatingIp->action("listFloatingIp");
+$listFloatingIp =  json_decode($App->show(), true)["FloatingIp"];
+foreach ($listFloatingIp as $floatIp){
+	echo $floatIp['floatingIpAddress']." ".$floatIp['id']." ".$floatIp["status"]."<br>";
+}
+
+
+?>
\ No newline at end of file
diff --git a/server/core/FloatingIp.php b/server/core/FloatingIp.php
index 528ab4f..cdbb64b 100755
--- a/server/core/FloatingIp.php
+++ b/server/core/FloatingIp.php
@@ -101,11 +101,10 @@ class floatingIp {
 		}
 		try{
 			$floatingip = $this->libClass->createFloatingIp($opt);
-			echo 'YOLO';
+
 			if(!isset($floatingip)){
 				$this->app->setOutput("Error", "Unknowing error during floating ip creation");
-			}
-			else{
+			}else{
 				$this->app->setOutput("FloatingIp", $floatingip);
 			}
 		}catch(BadResponseError $e){
@@ -141,20 +140,29 @@ class floatingIp {
 		}
 
 		try{
-			/*$l = $this->listFloatingIp();
-			$res = null;
-			foreach ($l as $f) {
-				if($f['id']==$id){
-					$res = $f;
+			// List of floating IPs
+			$res = array();
+			$l = $this->libClass->listFloatingIps();
+			foreach ($l as $tmp) {
+				$res[] = $tmp;
+			}
+
+			// Verification if id exists
+			$result = null;
+			foreach ($res as $f) {
+				if(strcmp($res['id'], $id)){
+					$result = $f;
+				
 				}
 			}
-			if(!isset($f)){
+
+			if(!isset($result)){ // If id doesn't exists
 				$this->app->setOutput("Error", "Unknow id");
-			}
-			else{*/
+			}else{ // If id exists
 				$res = $this->libClass->getFloatingIp($id);
 				$this->app->setOutput("FloatingIp", $res);
-			//}
+			}
+
 		}catch(BadResponseError $e){
 			$this->app->getErrorInstance()->BadResponseHandler($e);
         }catch(UserInputError $e){
@@ -182,18 +190,29 @@ class floatingIp {
 			$this->app->setOutput("Error", "Incorrect parameter opt");
 		}
 		try{
-			$floatingips = listFloatingIps();
-			$floatingIp = null;
-			foreach ($floatingips as $f) {
-				if($f['id'] == $id){
-					$floatingIp = $f;
-				}
-			}
-			if(!isset($floatingIp)){
-				$this->app->setOutput("Error", "Unknowing floatingip id");
+
+			// List of floating IPs
+			$res = array();
+			$l = $this->libClass->listFloatingIps();
+			foreach ($l as $tmp) {
+				$res[] = $tmp;
 			}
 
-			$floatingip->update();
+			// Verification if id exists
+			$result = null;
+			foreach ($res as $f) {
+				if(strcmp($res['id'], $id)){
+					$result = $f;
+				
+				}
+			}
+
+			if(!isset($result)){ // If id doesn't exists
+				$this->app->setOutput("Error", "Unknowing floatingip id");
+			}else{
+				$result->update();
+			}
+			
 
 		}catch(BadResponseError $e){
 			$this->app->getErrorInstance()->BadResponseHandler($e);
@@ -222,19 +241,27 @@ class floatingIp {
 			$this->app->setOutput("Error", "Incorrect parameter opt");
 		}
 		try{
-			$floatingips = listFloatingIps();
-			$floatingIp = null;
-			foreach ($floatingips as $f) {
-				if($f['id'] == $id){
-					$floatingIp = $f;
-				}
-			}
-			if(!isset($floatingIp)){
-				$this->app->setOutput("Error", "Unknowing floatingip id");
+			// List of floating IPs
+			$res = array();
+			$l = $this->libClass->listFloatingIps();
+			foreach ($l as $tmp) {
+				$res[] = $tmp;
 			}
 
-			$floatingip->delete();
-			
+			// Verification if id exists
+			$result = null;
+			foreach ($res as $f) {
+				if(strcmp($res['id'], $id)){
+					$result = $f;
+				
+				}
+			}
+
+			if(!isset($result)){ // If id doesn't exists
+				$this->app->setOutput("Error", "Unknowing floatingip id");
+			}else{
+				$result->delete(); 
+			}
 		}catch(BadResponseError $e){
 			$this->app->getErrorInstance()->BadResponseHandler($e);
         }catch(UserInputError $e){
@@ -248,6 +275,7 @@ class floatingIp {
         }
 	}
 
+
 	/**
 	* Retrieve a floating ip
 	*
@@ -262,18 +290,27 @@ class floatingIp {
 			$this->app->setOutput("Error", "Incorrect parameter opt");
 		}
 		try{
-			$floatingips = listFloatingIps();
-			$floatingIp = null;
-			foreach ($floatingips as $f) {
-				if($f['id'] == $id){
-					$floatingIp = $f;
-				}
-			}
-			if(!isset($floatingIp)){
-				$this->app->setOutput("Error", "Unknowing floatingip id");
+			// List of floating IPs
+			$res = array();
+			$l = $this->libClass->listFloatingIps();
+			foreach ($l as $tmp) {
+				$res[] = $tmp;
 			}
 
-			$floatingip->retrieve();
+			// Verification if id exists
+			$result = null;
+			foreach ($res as $f) {
+				if(strcmp($res['id'], $id)){
+					$result = $f;
+				
+				}
+			}
+
+			if(!isset($result)){ // If id doesn't exists
+				$this->app->setOutput("Error", "Unknowing floatingip id");
+			}else{
+				$result->retrieve();
+			}
 		}catch(BadResponseError $e){
 			$this->app->getErrorInstance()->BadResponseHandler($e);
         }catch(UserInputError $e){

From 3f6af0b6446725462362de94f09daf9a723b130d Mon Sep 17 00:00:00 2001
From: Yoggzo <yogg@epsina.com>
Date: Thu, 21 Apr 2016 21:51:46 +0200
Subject: [PATCH 10/13] modification in structure for ip and routers

---
 server/Test/AppTestClass.php                  |  2 +-
 ...tingIpTests.php => NetworkLayer3Tests.php} | 22 +++++-----
 server/Test/automatingTests.php               | 40 +++----------------
 server/core/App.php                           |  2 +-
 server/core/Automating.php                    |  5 ++-
 .../{FloatingIp.php => NetworkLayer3.php}     | 12 +++---
 server/index.php                              |  6 +--
 7 files changed, 30 insertions(+), 59 deletions(-)
 rename server/Test/{floatingIpTests.php => NetworkLayer3Tests.php} (74%)
 rename server/core/{FloatingIp.php => NetworkLayer3.php} (96%)

diff --git a/server/Test/AppTestClass.php b/server/Test/AppTestClass.php
index d8a02ca..972d9b4 100755
--- a/server/Test/AppTestClass.php
+++ b/server/Test/AppTestClass.php
@@ -63,7 +63,7 @@ class AppTest{
 				$opt = $this->tokenClass->getOptions($service);
 				return $this->openstack->networkingV2($opt);
 				break;
-			case "FloatingIp":
+			case "NetworkLayer3":
 				if($this->tokenPost == NULL) $this->tokenClass->genNetworkToken();
 				$opt = $this->tokenClass->getOptions('Network');
 				return $this->openstack->networkingV2ExtLayer3($opt);
diff --git a/server/Test/floatingIpTests.php b/server/Test/NetworkLayer3Tests.php
similarity index 74%
rename from server/Test/floatingIpTests.php
rename to server/Test/NetworkLayer3Tests.php
index 191de46..b827a51 100644
--- a/server/Test/floatingIpTests.php
+++ b/server/Test/NetworkLayer3Tests.php
@@ -3,11 +3,11 @@
 include('InitTest.php');
 include_once("../core/Compute.php");
 include_once("../core/Network.php");
-include_once("../core/FloatingIp.php");
+include_once("../core/NetworkLayer3.php");
 
 $compute = new Compute($App);
 $network = new Network($App);
-$floatingIp = new FloatingIp($App);
+$networkLayer3 = new NetworkLayer3($App);
 
 
 // Liste des serveurs
@@ -37,8 +37,8 @@ echo "</br>";
 
 // Liste des floatingip
 echo "Liste des floatingip : </br>";
-$floatingIp->action("listFloatingIp");
-$listFloatingIp =  json_decode($App->show(), true)["FloatingIp"];
+$networkLayer3->action("listFloatingIp");
+$listFloatingIp =  json_decode($App->show(), true)["NetworkLayer3"];
 $id = null;
 foreach ($listFloatingIp as $floatIp){
 	echo $floatIp['floatingIpAddress']." ".$floatIp['id']." ".$floatIp["status"]."<br>";
@@ -50,8 +50,8 @@ echo "</br>";
 // Liste des floatingip
 echo "Get floatingip : </br>";
 $App->setPostParam('id', $id);
-$floatingIp->action("getFloatingIp");
-$getFloatingIp =  json_decode($App->show(), true)["FloatingIp"];
+$networkLayer3->action("getFloatingIp");
+$getFloatingIp =  json_decode($App->show(), true)["NetworkLayer3"];
 echo $getFloatingIp['id']."<br>";
 echo "</br>";
 
@@ -62,8 +62,8 @@ $opt = array();
 $opt['floatingNetworkId'] = "251b4641-20ff-4a72-8549-1758788b51ce";
 
 $App->setPostParam('opt', $opt);
-$floatingIp->action("createFloatingIp");
-$float =  json_decode($App->show(), true)["FloatingIp"];
+$networkLayer3->action("createFloatingIp");
+$float =  json_decode($App->show(), true)["NetworkLayer3"];
 if(!isset($float)){
 	echo "Erreur pendant la création</br>";
 }
@@ -73,13 +73,13 @@ echo "</br>";
 /*
 // Suppression d'une ip flotante
 $App->setPostParam('id', $id);
-$floatingIp->action("deleteFloatingIp");
+$networkLayer3->action("deleteFloatingIp");
 */
 
 // Liste des floatingip
 echo "Liste des floatingip : </br>";
-$floatingIp->action("listFloatingIp");
-$listFloatingIp =  json_decode($App->show(), true)["FloatingIp"];
+$networkLayer3->action("listFloatingIp");
+$listFloatingIp =  json_decode($App->show(), true)["NetworkLayer3"];
 foreach ($listFloatingIp as $floatIp){
 	echo $floatIp['floatingIpAddress']." ".$floatIp['id']." ".$floatIp["status"]."<br>";
 }
diff --git a/server/Test/automatingTests.php b/server/Test/automatingTests.php
index 3f32d02..e8e8475 100755
--- a/server/Test/automatingTests.php
+++ b/server/Test/automatingTests.php
@@ -4,12 +4,11 @@ include_once("../core/Image.php");
 include_once("../core/Compute.php");
 include_once("../core/Network.php");
 //include_once("../core/Automating.php");
-include_once("../core/FloatingIp.php");
+include_once("../core/NetworkLayer3.php");
 
 $image = new Image($App);
 $compute = new Compute($App);
-$network = new Network($App);
-$floatingIp = new FloatingIp($App);
+$networkLayer3 = new NetworkLayer3($App);
 //$automating = new Automating($App);
 
 // Liste des serveurs
@@ -25,15 +24,7 @@ foreach($servers as $server){
 }
 echo "</br>";
 
-/*
-// Liste des ports
-echo "Liste des ports : </br>";
-$network->action("listPorts");
-$ports = json_decode($App->show(), true)["Network"];
-foreach ($ports as $p) {
-	echo $p["fixedIps"]."</br>";
-}
-*/
+
 //Liste des networks
 echo "Liste des network : </br>";
 $network->action("list_network_ids");
@@ -44,32 +35,11 @@ foreach($servers as $server){
 }
 echo "</br>";
 
-/*
-// Création d'une ip flotante
-$opt = array();
-//$opt['floatingNetworkId'] = $id; !!!!! TOTALEMENT FAUX ici tu passe en parametre l id du serveur et non du network
-//$opt['floatingip'] = $ip; !!!! il n y a pas d objet floatingip a passer en param, celui ci est compose, regarde bien les exemples de l api OpenStack
-//$opt['tenantId'] = "fbf5f920a7954b61b352bc09ce5ae803 ";
-//$opt['fixedIpAddress'] = "10.0.0.52";
-//$opt['floatingIpAddress'] = "148.60.11.116";
-//$opt['portId'] = "10.0.0.52";
-$opt['floatingNetworkId'] = "251b4641-20ff-4a72-8549-1758788b51ce";
-
-$App->setPostParam('opt', $opt);
-$floatingIp->action("createFloatingIp");
-$float =  json_decode($App->show(), true)["FloatingIp"];
-if(!isset($float)){
-	echo "Erreur pendant la création</br>";
-}
-echo "</br>";
-*/
-
-
 
 // liste des floatingip
 echo "Liste des floatingip : </br>";
-$floatingIp->action("listFloatingIp");
-$listFloatingIp =  json_decode($App->show(), true)["FloatingIp"];
+$networkLayer3->action("listFloatingIp");
+$listFloatingIp =  json_decode($App->show(), true)["NetworkLayer3"];
 foreach ($listFloatingIp as $floatIp){
 	echo $floatIp['floatingIpAddress']." ".$floatIp['id']." ".$floatIp["status"]."<br>";
 }
diff --git a/server/core/App.php b/server/core/App.php
index a4be6ec..32ad016 100755
--- a/server/core/App.php
+++ b/server/core/App.php
@@ -64,7 +64,7 @@ class App{
 				$opt = $this->tokenClass->getOptions($service);
 				return $this->openstack->computeV2($opt);
 				break;
-			case "FloatingIp":
+			case "NetworkLayer3":
 				if($this->tokenPost == NULL) $this->tokenClass->genNetworkToken();
 				$opt = $this->tokenClass->getOptions('Network');
 				return $this->openstack->networkingV2ExtLayer3($opt);
diff --git a/server/core/Automating.php b/server/core/Automating.php
index 69a2773..4e212e7 100755
--- a/server/core/Automating.php
+++ b/server/core/Automating.php
@@ -14,6 +14,7 @@ include("CoreInterface.php");
 include("Image.php");
 include("Network.php");
 include("Compute.php");
+include("NetworkLayer3");
 
 class automating implements Core{
 
@@ -22,7 +23,7 @@ class automating implements Core{
 	protected $appImage;
 	protected $appNetwork;
 	protected $appIdentity;
-	protected $appFloatingIp;
+	protected $appNetworkLayer3;
 	protected $app;
 	
 	/**
@@ -40,7 +41,7 @@ class automating implements Core{
 		$this->appImage = $appImage;
 		$this->appNetwork = $appNetwork;
 		$this->appIdentity = $appIdentity;
-		$this->appFloatingIp = $appFloatingIp;
+		$this->appNetworkLayer3 = $appNetworkLayer3;
 		$this->app = $app;
 	}
 
diff --git a/server/core/FloatingIp.php b/server/core/NetworkLayer3.php
similarity index 96%
rename from server/core/FloatingIp.php
rename to server/core/NetworkLayer3.php
index cdbb64b..28d27b4 100755
--- a/server/core/FloatingIp.php
+++ b/server/core/NetworkLayer3.php
@@ -22,7 +22,7 @@ use OpenCloud\Common\Error\UserInputError;
 * Management of images
 *
 */
-class floatingIp { 
+class networkLayer3 { 
 
 	/** @var App $app protected, contains the main app object */
 	protected $app;
@@ -35,14 +35,14 @@ class floatingIp {
 	*
 	* @param App $app the main app object
 	*
-	* @return floatingip
+	* @return networkLayer3
 	*/
 	public function __construct($app){
 		if(!isset($app)){
 			$this->app->setOutput("Error", "Incorrect parameter app");
 		}
 		$this->app = $app;
-		$this->libClass = $app->getLibClass("FloatingIp");
+		$this->libClass = $app->getLibClass("NetworkLayer3");
 	}
 
 
@@ -72,7 +72,7 @@ class floatingIp {
 				$result[] = $tmp;
 			}
 
-			$this->app->setOutput("FloatingIp", $result);
+			$this->app->setOutput("NetworkLayer3", $result);
 		}catch(BadResponseError $e){
 			$this->app->getErrorInstance()->BadResponseHandler($e);
         }catch(UserInputError $e){
@@ -105,7 +105,7 @@ class floatingIp {
 			if(!isset($floatingip)){
 				$this->app->setOutput("Error", "Unknowing error during floating ip creation");
 			}else{
-				$this->app->setOutput("FloatingIp", $floatingip);
+				$this->app->setOutput("NetworkLayer3", $floatingip);
 			}
 		}catch(BadResponseError $e){
 			echo $e."</br>";
@@ -160,7 +160,7 @@ class floatingIp {
 				$this->app->setOutput("Error", "Unknow id");
 			}else{ // If id exists
 				$res = $this->libClass->getFloatingIp($id);
-				$this->app->setOutput("FloatingIp", $res);
+				$this->app->setOutput("NetworkLayer3", $res);
 			}
 
 		}catch(BadResponseError $e){
diff --git a/server/index.php b/server/index.php
index ac66c95..53a24c4 100755
--- a/server/index.php
+++ b/server/index.php
@@ -53,9 +53,9 @@
 				$App->show();
 				break;
 				
-			case "floatingip":
-				include_once("core/FloatingIp.php");
-				$computeObject = new floatingIp($App);
+			case "networkLayer3":
+				include_once("core/NetworkLayer3.php");
+				$computeObject = new networkLayer3($App);
 				$computeObject->action($action);
 				$App->show();
 				break;

From 7e5b9f3a729b676c4efcf40769ed1631bf9fc0ba Mon Sep 17 00:00:00 2001
From: Yoggzo <yogg@epsina.com>
Date: Thu, 21 Apr 2016 22:52:00 +0200
Subject: [PATCH 11/13] add router functions

---
 server/Test/NetworkLayer3Tests.php |  60 +++++++-
 server/core/NetworkLayer3.php      | 233 +++++++++++++++++++++++++++--
 2 files changed, 278 insertions(+), 15 deletions(-)

diff --git a/server/Test/NetworkLayer3Tests.php b/server/Test/NetworkLayer3Tests.php
index b827a51..cb14e3a 100644
--- a/server/Test/NetworkLayer3Tests.php
+++ b/server/Test/NetworkLayer3Tests.php
@@ -47,7 +47,7 @@ foreach ($listFloatingIp as $floatIp){
 echo "</br>";
 
 
-// Liste des floatingip
+// get floatingip
 echo "Get floatingip : </br>";
 $App->setPostParam('id', $id);
 $networkLayer3->action("getFloatingIp");
@@ -70,12 +70,14 @@ if(!isset($float)){
 echo "</br>";
 */
 
+
 /*
 // Suppression d'une ip flotante
 $App->setPostParam('id', $id);
 $networkLayer3->action("deleteFloatingIp");
 */
 
+
 // Liste des floatingip
 echo "Liste des floatingip : </br>";
 $networkLayer3->action("listFloatingIp");
@@ -83,6 +85,62 @@ $listFloatingIp =  json_decode($App->show(), true)["NetworkLayer3"];
 foreach ($listFloatingIp as $floatIp){
 	echo $floatIp['floatingIpAddress']." ".$floatIp['id']." ".$floatIp["status"]."<br>";
 }
+echo "</br>";
 
 
+// Liste des routeurs
+echo "Liste des routeurs : </br>";
+$networkLayer3->action("listRouters");
+$listRouters =  json_decode($App->show(), true)["NetworkLayer3"];
+foreach ($listRouters as $router){
+	echo $router['name']." ".$router['id']."<br>";
+	if(strcmp($router['name'], "Test")){
+		$id = $router['id'];
+	}
+}
+echo "</br>";
+
+
+// get floatingip
+echo "Get router : </br>";
+$App->setPostParam('id', $id);
+$networkLayer3->action("getRouter");
+$getRouter =  json_decode($App->show(), true)["NetworkLayer3"];
+echo $getRouter['id']."<br>";
+echo "</br>";
+
+
+/*
+// Création d'un routeur'		
+$opt = array();
+$optGate = array();
+$optGate['networkId'] = "251b4641-20ff-4a72-8549-1758788b51ce";
+$opt['externalGatewayInfo'] = $optGate;
+$opt['name'] = "Test";
+$App->setPostParam('opt', $opt);
+$networkLayer3->action("createRouter");
+$r =  json_decode($App->show(), true)["NetworkLayer3"];
+if(!isset($r)){
+	echo "Erreur pendant la création</br>";
+}
+echo "</br>";
+*/
+
+
+/*
+// Suppression d'un routeur
+$App->setPostParam('id', $id);
+$networkLayer3->action("deleteRouter");
+echo "</br>";
+*/
+
+
+// Liste des routeurs
+echo "Liste des routeurs : </br>";
+$networkLayer3->action("listRouters");
+$listRouters =  json_decode($App->show(), true)["NetworkLayer3"];
+foreach ($listRouters as $router){
+	echo $router['name']." ".$router['id']."<br>";
+}
+
 ?>
\ No newline at end of file
diff --git a/server/core/NetworkLayer3.php b/server/core/NetworkLayer3.php
index 28d27b4..30e8a78 100755
--- a/server/core/NetworkLayer3.php
+++ b/server/core/NetworkLayer3.php
@@ -89,7 +89,7 @@ class networkLayer3 {
 	/**
 	* Create a new floating IP adress
 	*
-	* @param array $opt Options for the floating ip creation (floatingipo and floating network id are required, others are optionals)
+	* @param array $opt Options for the floating ip creation (floatingNetworkId is required)
 	*
 	* @return floatingip
 	*/
@@ -108,19 +108,14 @@ class networkLayer3 {
 				$this->app->setOutput("NetworkLayer3", $floatingip);
 			}
 		}catch(BadResponseError $e){
-			echo $e."</br>";
 			$this->app->getErrorInstance()->BadResponseHandler($e);
         }catch(UserInputError $e){
-        	echo $e."</br>";
 			$this->app->getErrorInstance()->UserInputHandler($e);
         }catch(BaseError $e){
-        	echo $e."</br>";
 			$this->app->getErrorInstance()->BaseErrorHandler($e);
         }catch(NotImplementedError $e){
-        	echo $e."</br>";
 			$this->app->getErrorInstance()->NotImplementedHandler($e);
         }catch(Exception $e){
-        	echo $e->getMessage()."</br>";
         	$this->app->getErrorInstance()->OtherException($e);
         }
 	}
@@ -150,7 +145,7 @@ class networkLayer3 {
 			// Verification if id exists
 			$result = null;
 			foreach ($res as $f) {
-				if(strcmp($res['id'], $id)){
+				if(strcmp($f->id, $id)){
 					$result = $f;
 				
 				}
@@ -162,7 +157,6 @@ class networkLayer3 {
 				$res = $this->libClass->getFloatingIp($id);
 				$this->app->setOutput("NetworkLayer3", $res);
 			}
-
 		}catch(BadResponseError $e){
 			$this->app->getErrorInstance()->BadResponseHandler($e);
         }catch(UserInputError $e){
@@ -181,7 +175,7 @@ class networkLayer3 {
 	*
 	* @param id the id of the floatingip to update
 	* 
-	* @return Image
+	* @return void
 	*/
 	private function updateFloatingIp(){
 		$id = $this->app->getPostParam("id");
@@ -201,7 +195,7 @@ class networkLayer3 {
 			// Verification if id exists
 			$result = null;
 			foreach ($res as $f) {
-				if(strcmp($res['id'], $id)){
+				if(strcmp($f->id, $id)){
 					$result = $f;
 				
 				}
@@ -212,8 +206,6 @@ class networkLayer3 {
 			}else{
 				$result->update();
 			}
-			
-
 		}catch(BadResponseError $e){
 			$this->app->getErrorInstance()->BadResponseHandler($e);
         }catch(UserInputError $e){
@@ -251,7 +243,7 @@ class networkLayer3 {
 			// Verification if id exists
 			$result = null;
 			foreach ($res as $f) {
-				if(strcmp($res['id'], $id)){
+				if(strcmp($f->id, $id)){
 					$result = $f;
 				
 				}
@@ -300,7 +292,7 @@ class networkLayer3 {
 			// Verification if id exists
 			$result = null;
 			foreach ($res as $f) {
-				if(strcmp($res['id'], $id)){
+				if(strcmp($f->id, $id)){
 					$result = $f;
 				
 				}
@@ -323,4 +315,217 @@ class networkLayer3 {
         	$this->app->getErrorInstance()->OtherException($e);
         }
 	}
+
+
+
+	/**
+	* Create a new router
+	*
+	* @param array $opt Options for the new router 
+	*					externalGatewayInfo[] required (only the param networkId in the tab)
+	*					adminStateUp (optionnal)
+	*					name (optionnal)
+	*
+	* @return router
+	*/
+	private function createRouter(){
+		$opt = $this->app->getPostParam("opt");
+
+		if(!isset($opt)){
+			$this->app->setOutput("Error", "Incorrect parameter opt");
+		}
+		try{
+			$router = $this->libClass->createRouter($opt);
+
+			if(!isset($router)){
+				$this->app->setOutput("Error", "Unknowing error during floating ip creation");
+			}else{
+				$this->app->setOutput("NetworkLayer3", $router);
+			}
+		}catch(BadResponseError $e){
+			$this->app->getErrorInstance()->BadResponseHandler($e);
+        }catch(UserInputError $e){
+			$this->app->getErrorInstance()->UserInputHandler($e);
+        }catch(BaseError $e){
+			$this->app->getErrorInstance()->BaseErrorHandler($e);
+        }catch(NotImplementedError $e){
+			$this->app->getErrorInstance()->NotImplementedHandler($e);
+        }catch(Exception $e){
+        	$this->app->getErrorInstance()->OtherException($e);
+        }
+	}
+
+
+	/**
+	* List routers
+	* 
+	* @return list of the routers
+	*/
+	private function listRouters(){
+		try{
+			$result = array();
+			$l = $this->libClass->listRouters();
+			foreach ($l as $tmp) {
+				$result[] = $tmp;
+			}
+
+			$this->app->setOutput("NetworkLayer3", $result);
+		}catch(BadResponseError $e){
+			$this->app->getErrorInstance()->BadResponseHandler($e);
+        }catch(UserInputError $e){
+			$this->app->getErrorInstance()->UserInputHandler($e);
+        }catch(BaseError $e){
+			$this->app->getErrorInstance()->BaseErrorHandler($e);
+        }catch(NotImplementedError $e){
+			$this->app->getErrorInstance()->NotImplementedHandler($e);
+        }catch(Exception $e){
+        	$this->app->getErrorInstance()->OtherException($e);
+        }
+	}
+
+
+	/**
+	* Show router details
+	*
+	* @param String id the id of the router
+	*
+	* @return router details
+	*/
+	private function getRouter(){
+		$id = $this->app->getPostParam("id");
+		if(!isset($id)){
+			$this->app->setOutput("Error", "Incorrect parameter opt");
+		}
+		try{
+			// List of routers
+			$res = array();
+			$l = $this->libClass->listRouters();
+			foreach ($l as $tmp) {
+				$res[] = $tmp;
+			}
+
+			// Verification if id exists
+			$result = null;
+			foreach ($res as $f) {
+				if(strcmp($f->id, $id)){
+					$result = $f;
+				}
+			}
+
+			if(!isset($result)){ // If id doesn't exists
+				$this->app->setOutput("Error", "Unknow id");
+			}else{ // If id exists
+				$res = $this->libClass->getRouter($id);
+				$this->app->setOutput("NetworkLayer3", $res);
+			}
+		}catch(BadResponseError $e){
+			$this->app->getErrorInstance()->BadResponseHandler($e);
+        }catch(UserInputError $e){
+			$this->app->getErrorInstance()->UserInputHandler($e);
+        }catch(BaseError $e){
+			$this->app->getErrorInstance()->BaseErrorHandler($e);
+        }catch(NotImplementedError $e){
+			$this->app->getErrorInstance()->NotImplementedHandler($e);
+        }catch(Exception $e){
+        	$this->app->getErrorInstance()->OtherException($e);
+        }
+	}
+
+
+	/**
+	* Delete a router
+	*
+	* @param string router the router to delete
+	*
+	* @return void
+	*/
+	private function deleteRouter(){
+		$id = $this->app->getPostParam("id");
+
+		if(!isset($id)){
+			$this->app->setOutput("Error", "Incorrect parameter opt");
+		}
+		try{
+			// List of routers
+			$res = array();
+			$l = $this->libClass->listRouters();
+			foreach ($l as $tmp) {
+				$res[] = $tmp;
+			}
+
+			// Verification if id exists
+			$result = null;
+			foreach ($res as $f) {
+				if(strcmp($f->id, $id)){
+					$result = $f;
+				}
+			}
+
+			if(!isset($result)){ // If id doesn't exists
+				$this->app->setOutput("Error", "Unknowing router id");
+			}else{
+				$result->delete(); 
+			}
+		}catch(BadResponseError $e){
+			$this->app->getErrorInstance()->BadResponseHandler($e);
+        }catch(UserInputError $e){
+			$this->app->getErrorInstance()->UserInputHandler($e);
+        }catch(BaseError $e){
+			$this->app->getErrorInstance()->BaseErrorHandler($e);
+        }catch(NotImplementedError $e){
+			$this->app->getErrorInstance()->NotImplementedHandler($e);
+        }catch(Exception $e){
+        	$this->app->getErrorInstance()->OtherException($e);
+        }
+	}
+
+
+	/**
+	* Update router
+	*
+	* @param id the id of the floatingip to update
+	* 
+	* @return void
+	*/
+	private function updateRouter(){
+		$id = $this->app->getPostParam("id");
+
+		if(!isset($id)){
+			$this->app->setOutput("Error", "Incorrect parameter opt");
+		}
+		try{
+
+			// List of floating IPs
+			$res = array();
+			$l = $this->libClass->listRouters();
+			foreach ($l as $tmp) {
+				$res[] = $tmp;
+			}
+
+			// Verification if id exists
+			$result = null;
+			foreach ($res as $f) {
+				if(strcmp($f->id, $id)){
+					$result = $f;
+				
+				}
+			}
+
+			if(!isset($result)){ // If id doesn't exists
+				$this->app->setOutput("Error", "Unknowing floatingip id");
+			}else{
+				$result->update();
+			}
+		}catch(BadResponseError $e){
+			$this->app->getErrorInstance()->BadResponseHandler($e);
+        }catch(UserInputError $e){
+			$this->app->getErrorInstance()->UserInputHandler($e);
+        }catch(BaseError $e){
+			$this->app->getErrorInstance()->BaseErrorHandler($e);
+        }catch(NotImplementedError $e){
+			$this->app->getErrorInstance()->NotImplementedHandler($e);
+        }catch(Exception $e){
+        	$this->app->getErrorInstance()->OtherException($e);
+        }
+	}
 }

From 0fc14b5761e558680aecc57e4d1ae8075121f01e Mon Sep 17 00:00:00 2001
From: Yoggzo <yogg@epsina.com>
Date: Thu, 21 Apr 2016 23:57:37 +0200
Subject: [PATCH 12/13] structure of Automating

---
 server/Test/automatingTests.php | 54 ++++++------------------
 server/core/Automating.php      | 73 +++++++++++++++++++--------------
 2 files changed, 56 insertions(+), 71 deletions(-)

diff --git a/server/Test/automatingTests.php b/server/Test/automatingTests.php
index e8e8475..8088102 100755
--- a/server/Test/automatingTests.php
+++ b/server/Test/automatingTests.php
@@ -1,48 +1,20 @@
 <?php
 include('InitTest.php');
-include_once("../core/Image.php");
-include_once("../core/Compute.php");
-include_once("../core/Network.php");
-//include_once("../core/Automating.php");
-include_once("../core/NetworkLayer3.php");
+include_once("../core/Automating.php");
 
-$image = new Image($App);
-$compute = new Compute($App);
-$networkLayer3 = new NetworkLayer3($App);
-//$automating = new Automating($App);
+$automating = new Automating($App);
 
-// Liste des serveurs
-echo "Liste des serveurs : </br>";
-$compute->action("listServers");
-$servers = json_decode($App->show(), true)["Servers"];
-$id = null;
-foreach($servers as $server){
-	echo $server['name']." ".$server['id']." ".$server['ipv4']."<br>";
-	if(strcmp($server['name'], "bob")){
-		$id = $server['id'];
-	}	
-}
-echo "</br>";
-
-
-//Liste des networks
-echo "Liste des network : </br>";
-$network->action("list_network_ids");
-$servers = json_decode($App->show(), true)["ListNetworkIds"];
-$id = null;
-foreach($servers as $server){
-	echo $server."<br>";
-}
-echo "</br>";
-
-
-// liste des floatingip
-echo "Liste des floatingip : </br>";
-$networkLayer3->action("listFloatingIp");
-$listFloatingIp =  json_decode($App->show(), true)["NetworkLayer3"];
-foreach ($listFloatingIp as $floatIp){
-	echo $floatIp['floatingIpAddress']." ".$floatIp['id']." ".$floatIp["status"]."<br>";
-}
+//$id = // id du réseau 
 
+/*
+// Création serveur avec ip publique
+echo "Test création serveur avec ip publique : </br>";
+$App->setPostParam('networkId', $id);
+$App->setPostParam('imageName', "ImageTest");
+$App->setPostParam('serverName', "ServerTest");
+$App->setPostParam('flavor', 1);
+$compute->action("createPublicServer");
+$servers = json_decode($App->show(), true)["Automating"];
+*/
 
 ?>
\ No newline at end of file
diff --git a/server/core/Automating.php b/server/core/Automating.php
index 4e212e7..fb42702 100755
--- a/server/core/Automating.php
+++ b/server/core/Automating.php
@@ -10,20 +10,18 @@
 * @todo Complete the functions with errors detection and finish the descriptions
 */
 
-include("CoreInterface.php");
 include("Image.php");
 include("Network.php");
 include("Compute.php");
-include("NetworkLayer3");
+include("NetworkLayer3.php");
 
-class automating implements Core{
+class automating{
 
 	/** @var App $app protected, contains the main app object */
-	protected $appCompute;
-	protected $appImage;
-	protected $appNetwork;
-	protected $appIdentity;
-	protected $appNetworkLayer3;
+	protected $compute;
+	protected $image;
+	protected $network;
+	protected $networkLayer3;
 	protected $app;
 	
 	/**
@@ -34,15 +32,11 @@ class automating implements Core{
 	* @return
 	*/
 	public function __construct($app){
-		if(!isset($app)){
-			$this->app->setOutput("Error", "Parameter app missing.");
-		}
-		$this->appCompute = $appCompute;
-		$this->appImage = $appImage;
-		$this->appNetwork = $appNetwork;
-		$this->appIdentity = $appIdentity;
-		$this->appNetworkLayer3 = $appNetworkLayer3;
 		$this->app = $app;
+		$compute = new Compute($app);
+		$image = new Image($app);
+		$network = new Network($app);
+		$networkLayer3 = new NetworkLayer3($app);
 	}
 
 	/**
@@ -59,14 +53,16 @@ class automating implements Core{
 	/**
 	* create a new server and associate a public ip
 	*
+	* @param String $networkId the id of the network where the server will be created
 	* @param String $imageName name of the new image
 	* @param String $serverName name ofthe new server
 	* @param String $flavor kind of server
 	*	
 	* @return void
 	*/
-	private function createServer()
+	private function createPublicServer()
 	{
+		$networkId = $this->app->getPostParam('networkId');
 		$imageName = $this->app->getPostParam('imageName');
 		$serverName = $this->app->getPostParam('serverName');
 		$flavor = $this->app->getPostParam('flavor');
@@ -84,27 +80,44 @@ class automating implements Core{
 			// Création image
 			$opt = array();
 			$opt['name'] = $imageName;
-			$this->appImage->setPostParam('opt' $opt);	
-			$this->appImage->createImage();
+			$image->setPostParam('opt', $opt);	
+			$image->action("createImage");
 			$image = json_decode($this->app->show(), true)["Images"];
 
 			// Création server
-			$this->appCompute->setPostParam('name', $serverName);
-			$this->appCompute->setPostParam('imageId', $image['id']);
-			$this->appCompute->setPostParam('flavorId', $flavor);
-			$this->appCompute->createServer();
+			$compute->setPostParam('name', $serverName);
+			$compute->setPostParam('imageId', $image['id']);
+			$compute->setPostParam('flavorId', $flavor);
+			$compute->action("createServer");
 			$server = json_decode($this->app->show(), true)["Compute"];
 
-			// Ajout adresse IP public
-			$optIp = array();
-			$opt['floatingip'] = null; //new floatingip(); ???
-			$opt['floating_network_id'] = $server['id'];
-			$this->appFloatingIp->setPostParam('opt', $optIp);	
-			$this->appFloatingIp->create(); 
+			// liste des adresses ip publiques diponibles
+			$networkLayer3->action("listFloatingIp"); 
+			$listFloatingIp =  json_decode($App->show(), true)["NetworkLayer3"];
+			$ip = null;
+			foreach ($listFloatingIp as $f) {
+				if(strcmp($f['status'], "DOWN")){
+					$ip = $f;
+				}
+			}
+
+			// Si pas d'ip publique disponible on en créé une
+			if(!isset($ip)){ 
+				// Ajout adresse IP public
+				$optIp = array();
+				$opt['floatingNetworkId'] = $networkId;
+				$floatingIp->setPostParam('opt', $optIp);	
+				$networkLayer3->action("createFloatingIp");
+				$ip = json_decode($App->show(), true)["NetworkLayer3"];
+			}
+
+			// Association de l'ip publique au serveur	
+			/*
+			* API non diponible pour le moment
+			*/  
 
 		}
 	}
-
 }
 
 ?>

From 477dc821824b422c11d0d34b644de4b68a596510 Mon Sep 17 00:00:00 2001
From: EoleDev <EoleDev@outlook.fr>
Date: Tue, 26 Apr 2016 17:35:32 +0200
Subject: [PATCH 13/13] Nettoyage

---
 server/config.inc.php      |   2 +-
 server/core/App.php        |   3 -
 server/core/Network.php~   | 952 -------------------------------------
 server/core/Plugin.php     |  13 -
 server/core/Plugin_Api.php |  24 -
 server/create_serv.php     |  55 ---
 6 files changed, 1 insertion(+), 1048 deletions(-)
 delete mode 100755 server/core/Network.php~
 delete mode 100755 server/core/Plugin.php
 delete mode 100755 server/core/Plugin_Api.php
 delete mode 100755 server/create_serv.php

diff --git a/server/config.inc.php b/server/config.inc.php
index 636ee5e..aa10504 100755
--- a/server/config.inc.php
+++ b/server/config.inc.php
@@ -5,7 +5,7 @@
 	
 	$config["modules_enabled"] = "";
 	$config["urlAuth"] = "http://148.60.11.31:5000/v3";
-	$config["tokenTime"] = 60 //miunte = 60 //miuntess
+	$config["tokenTime"] = 60 //minute = 60
 ?>
 
 	
diff --git a/server/core/App.php b/server/core/App.php
index 32ad016..114d945 100755
--- a/server/core/App.php
+++ b/server/core/App.php
@@ -1,5 +1,4 @@
 <?php
-include_once("core/Plugin_Api.php");
 include_once("core/LibOverride/genTokenOptions.php");
 include_once("core/ErrorManagement.php");
 
@@ -11,7 +10,6 @@ use OpenCloud\Common\Error\UserInputError;
 class App{
 	
 	protected $openstack;
-	protected $pluginsApi;
 	protected $postParams;
 	protected $tokenClass;
 	protected $tokenPost;
@@ -23,7 +21,6 @@ class App{
 		$this->tokenPost = NULL;
 		$this->tokenClass = new genTokenOptions($args);
 		$this->openstack = new OpenStack\OpenStack(['authUrl' => $args["authUrl"]]);
-		$this->pluginsApi = plugin_api::getInstance();
 		$this->errorClass = new errorManagement($this);
 		$this->output = array();
 		$this->postParams = $_POST;
diff --git a/server/core/Network.php~ b/server/core/Network.php~
deleted file mode 100755
index 65de962..0000000
--- a/server/core/Network.php~
+++ /dev/null
@@ -1,952 +0,0 @@
-<?php
-
-class network{ 
-	
-	protected $app;
-	
-	protected $libClass;
-	
-	
-
-	
-
-	
-	public function __construct($app){
-		$this->app = $app;
-		$this->libClass = $app->getLibClass("network");
-		
-	}
-
-
-	public function action($action){
-		
-		 $this->{$action.""}();
-		
-	}
-
-	
-	public function create_network()
-	{
-		$options = array();
-		if (isset($this->app->getPostParam("name")))
-		{
-			$options['name'] = $this->app->getPostParam("name"); 
-		}
-		if (isset($this->app->getPostParam("adminStateUp")))
-		{
-			$options['adminStateUp'] = $this->app->getPostParam("adminStateUp"); 
-		}
-		if (isset($this->app->getPostParam("shared")))
-		{
-			$options['shared'] = $this->app->getPostParam("shared"); 
-		}
-		if (isset($this->app->getPostParam("tenantId")))
-		{
-			$options['tenantId'] = $this->app->getPostParam("tenantId"); 
-		}
-		try
-		{
-		$network = $this->libClass->createNetworks($options);
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		 }
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}		
-
-		
-	}
-
-	public function create_subnet()
-	{	$options = array();
-		if (isset($this->app->getPostParam("networkId")))
-		{
-			$options['networkId'] = $networkId; 
-		}
-		if (isset($this->app->getPostParam("ipVersion")))
-		{
-			$options['ipVersion'] = $this->app->getPostParam("ipVersion"); 
-		}
-		if (isset($this->app->getPostParam("cidr")))
-		{
-			$options['cidr'] = $this->app->getPostParam("cidr"); 
-		}
-		if (isset($this->app->getPostParam("tenantId")))
-		{
-			$options['tenantId'] = $this->app->getPostParam("tenantId"); 
-		}
-		if (isset($this->app->getPostParam("name")))
-		{
-			$options['name'] = $$this->app->getPostParam("name"); 
-		}
-		if (isset($this->app->getPostParam("gatewayIp")))
-		{
-			$options['gatewayIp'] = $this->app->getPostParam("gatewayIp"); 
-		}
-		if (isset($this->app->getPostParam("dnsNameservers")))
-		{
-			$options['dnsNameservers'] = $this->app->getPostParam("dnsNameservers"); 
-		}
-		if (isset($this->app->getPostParam("allocationPools")))
-		{
-			$options['allocationPools'] = $this->app->getPostParam("allocationPools"); 
-		}
-		if (isset($this->app->getPostParam("hostRoutes")))
-		{
-			$options['hostRoutes'] = $this->app->getPostParam("hostRoutes"); 
-		}
-		if (isset($this->app->getPostParam("enableDhcp")))
-		{
-			$options['enableDhcp'] = $this->app->getPostParam("enableDhcp"); 
-		}
-		if (isset($this->app->getPostParam("tenantId")))
-		{
-			$options['tenantId'] = $this->app->getPostParam("tenantId"); 
-		}
-		
-		try
-		{
-		$subnet = $this->libClass->createSubnet($options);
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		 }
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}	
-
-		
-	}
-	
-	public function list_network_ids()
-	{
-		try
-		{
-			$ln = $this->libClass->listNetworks();
-		
-			$list_ids = array();
-
-		
-			foreach($ln as $n)
-			{
-			
-				$list_ids[] =  $n->id;
-		
-
-			}
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		 }
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}	
-
-	$this->app->setOutput("ListNetworkIds", $list_ids);
-	}
-
-	public function list_network_names()
-	{
-		try
-		{
-			$ln = $this->libClass->listNetworks();
-		
-			$list_names = array();
-
-		
-			foreach($ln as $n)
-			{
-			
-				$list_names[] =  $n->name;
-		
-
-			}
-		
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		 }
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}	
-
-	$this->app->setOutput("ListNetworkNames", $list_names);
-	}
-
-	public function list_cidr()
-	{
-		try
-		{
-				$ls = $this->libClass->listSubnets();
-				$list_cidr = array();
-				foreach ($ls as $subnet)
-				 {
-		     		
-					$list_cidr[] = $subnet->cidr;
-				 }
-
-				$this->app->setOutput("ListCidr", $list_cidr);
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		 }
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}	
-	}
-	
-	public function getNetwork()
-	{
-		$network="";
-		
-		try
-		{	$newtork = $this->libClass->getNetwork($this->app->getPostParam("networkId"));
-			$network->retrieve();
-
-			
-		}
-
-		
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		 }
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}	
-
-	$this->app->setOutput("Network", $network);
-	}
-
-	public function getNetwork($netId)
-	{
-		$network="";
-		
-		try
-		{	$newtork = $this->libClass->getNetwork($netId);
-			$network->retrieve();
-
-			
-		}
-
-		
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		 }
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}	
-
-	return $network;
-	}
-
-	public function getSubnet()
-	{
-		$sbnet="";
-		
-		try
-		{	$subnet = $this->libClass->getSubnet($this->app->getPostParam("subnetId"));
-			$subnet->retrieve();
-
-			
-		}
-
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		 }
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}	
-		$this->app->setOutput("Subnet", subnet);
-	
-	}
-
-	public function getSubnet($subnetId)
-	{
-		$subnet="";
-		
-		try
-		{	$subnet = $this->libClass->getSubnet($subnetId);
-			$subnet->retrieve();
-
-			
-		}
-
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		 }
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}	
-		return $subnet;
-	
-	}		
-
-        public function updateNetwork()
-     	{	
-		$options = array();
-		if(isset($this->app->getPostParam("name")))
-		{
-			$options['name'] = $this->app->getPostParam("name");	
-		}
-		if(isset($this->app->getPostParam("shared")))
-		{
-			$options['shared'] = $this->app->getPostParam("shared");	
-		}
-		if(isset($this->app->getPostParam("adminStateUp")))
-		{
-			$options['adminStateUp'] = $this->app->getPostParam("adminStateUp");	
-		}
-		try
-		{		
-			$network = getNetwork($this->app->getPostParam("networkId"));
-		
-			$network->update($options);
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		 }
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}	
-	}
-	
-	public function updateSubnet()
-     	{	
-		$options = array();
-		if(isset($this->app->getPostParam("name")))
-		{
-			$options['name'] = $this->app->getPostParam("name");	
-		}
-		if(isset($this->app->getPostParam("networkId")))
-		{
-			$options['networkId'] = $this->app->getPostParam("networkId");	
-		}
-		if(isset($this->app->getPostParam("ipVersion")))
-		{
-			$options['ipVersion'] = $this->app->getPostParam("ipVersion");	
-		}
-		if(isset($this->app->getPostParam("cidr")))
-		{
-			$options['cidr'] = $this->app->getPostParam("cidr");	
-		}
-		try
-		{
-			$subnet = getSubnet($this->app->getPostParam("networkId"));
-		
-			$subnet->update($options);
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		 }
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}	
-	}
-
-	public function deleteNetwork()
-     	{
-		try
-		{
-				
-			$network = getNetwork($this->app->getPostParam("networkId"));
-			$network->delete();
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		 }
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}	
-	}
-
-	public function deleteSubnet()
-     	{
-		try
-		{		
-			$subnet = getNetwork($this->app->getPostParam("subnetId"));
-			$subnet->delete();
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		 }
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}	
-	}
-
-	public function createPort()
-	{
-		$options = array();
-		if (isset($this->app->getPostParam("networkId")))
-		{
-			$options['networkId'] = $this->app->getPostParam("networkId"); 
-		}
-		if (isset($this->app->getPostParam("name")))
-		{
-			$options['name'] = $this->app->getPostParam("name"); 
-		}
-		if (isset($this->app->getPostParam("adminStateUp")))
-		{
-			$options['adminStateUp'] = $this->app->getPostParam("adminStateUp"); 
-		}
-		if (isset($this->app->getPostParam("macAddress")))
-		{
-			$options['macAddress'] = $this->app->getPostParam("macAddress"); 
-		}
-		if (isset($this->app->getPostParam("fixedIps")))
-		{
-			$options['fixedIps'] = $this->app->getPostParam("fixedIps"); 
-		}
-		if (isset($this->app->getPostParam("deviceId")))
-		{
-			$options['deviceId'] = $this->app->getPostParam("deviceId"); 
-		}
-		if (isset($this->app->getPostParam("deviceOwner")))
-		{
-			$options['deviceOwner'] = $this->app->getPostParam("deviceOwner"); 
-		}
-		if (isset($this->app->getPostParam("securityGroups")))
-		{
-			$options['securityGroups'] = $this->app->getPostParam("securityGroups"); 
-		}
-		if (isset($this->app->getPostParam("tenantId")))
-		{
-			$options['tenantId'] = $this->app->getPostParam("tenantId"); 
-		}
-		try
-		{
-			$this->libClass->createPort($options);	
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		 }
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}	
-	}
-
-	public function listPorts()
-	{
-		try
-		{		
-			$this->app->setOutput("listPorts", $this->libClass->listPorts()); 
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		}
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}
-	}
-
-	public function getPort()
-	{
-		try
-		{
-			$port = $this->libClass->getport($this->app->getPostParam("portId"));
-			$this->app->setOutput("Port", $port);
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		}
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}
-	
-	}
-
-	public function getPort($portId)
-	{
-		try
-		{
-			$port = $this->libClass->getport($portId);
-			return $port;
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		}
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}
-	
-	}		
-
-	public function updatePort()
-	{
-		$options = array();
-		
-		if (isset($this->app->getPostParam("networkId")))
-		{
-			$options['networkId'] = $this->app->getPostParam("networkId"); 
-		}
-		if (isset($this->app->getPostParam("name")))
-		{
-			$options['name'] =$this->app->getPostParam("name"); 
-		}
-		if (isset($this->app->getPostParam("adminStateUp")))
-		{
-			$options['adminStateUp'] =$this->app->getPostParam("adminStateUp"); 
-		}
-		if (isset($this->app->getPostParam("macAddress")))
-		{
-			$options['macAddress'] = $this->app->getPostParam("macAddress"); 
-		}
-		if (isset($this->app->getPostParam("fixedIps")))
-		{
-			$options['fixedIps'] = $this->app->getPostParam("fixedIps"); 
-		}
-		if (isset($this->app->getPostParam("deviceId")))
-		{
-			$options['deviceId'] = $this->app->getPostParam("deviceId"); 
-		}
-		if (isset($this->app->getPostParam("deviceOwner")))
-		{
-			$options['deviceOwner'] = $this->app->getPostParam("deviceOwner"); 
-		}
-		if (isset($this->app->getPostParam("networkId")))
-		{
-			$options['securityGroups'] = $this->app->getPostParam("securityGroups"); 
-		}
-		if (isset($this->app->getPostParam("tenantId")))
-		{
-			$options['tenantId'] = $this->app->getPostParam("tenantId"); 
-		}
-		try
-		{
-			$port = getPort($this->app->getPostParam("networkId"));
-			$port->update($options);
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		}
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}	
-	}
-
-	public function deletePort()
-     	{
-		
-		try
-		{
-			$port = getPort($this->app->getPostParam("portId"));
-			$port->delete();
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		}
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}
-	}
-	
-	public function createSecurityGroup()
-	{
-		$options = array();
-		if (isset($this->app->getPostParam("name")))
-		{
-			$options['name'] = $this->app->getPostParam("name"); 
-		}
-		if (isset($this->app->getPostParam("description")))
-		{
-			$options['description'] = $this->app->getPostParam("description"); 
-		}
-		try
-		{
-			$this->libClass->createSecurityGroup($options);
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		}
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}
-	
-	}
-
-	public function createSecurityGroupRule()
-	{
-		$options = array();
-		if (isset($this->app->getPostParam("securityGroupId")))
-		{
-			$options['securityGroupId'] = $this->app->getPostParam("securityGroupId"); 
-		}
-		if (isset($this->app->getPostParam("direction")))
-		{
-			$options['direction'] = $this->app->getPostParam("direction"); 
-		}
-		if (isset($this->app->getPostParam("ethertype")))
-		{
-			$options['ethertype'] = $this->app->getPostParam("ethertype"); 
-		}
-		if (isset($this->app->getPostParam("portRangeMin")))
-		{
-			$options['portRangeMin'] = $this->app->getPostParam("portRangeMin"); 
-		}
-		if (isset($this->app->getPostParam("portRangeMax")))
-		{
-			$options['portRangeMax'] = $this->app->getPostParam("portRangeMax"); 
-		}
-		if (isset($this->app->getPostParam("protocol")))
-		{
-			$options['protocol'] = $this->app->getPostParam("protocol"); 
-		}
-		if (isset($this->app->getPostParam("remoteGroupId")))
-		{
-			$options['remoteGroupId'] = $this->app->getPostParam("remoteGroupId"); 
-		}
-		if (isset($this->app->getPostParam("remoteIpPrefix")))
-		{
-			$options['remoteIpPrefix'] = $this->app->getPostParam("remoteIpPrefix"); 
-		}
-		try
-		{
-			$this->libClass->createSecurityGroupRule($options);
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		}
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}
-	}
-
-
-	public function listSecurityGroupe()
-	{
-		try
-		{
-			$this->app->setOutput("listSecurityGroups", $this->libClass->listSecurityGroups());
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		}
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}
-	}
-
-	public function listSecurityGroupeRule()
-	{
-		try
-		{
-		 
-		$this->app->setOutput("listSecurityGroupeRule", $this->libClass->listSecurityGroupRules());
-
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		}
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}
-	}
-
-	public function getSecurityGroupe()
-	{
-		try
-		{
-			$securityGroupe = $this->libClass->getSecurityGroupe($this->app->getPostParam("securityGroupeId"));
-			$this->app->setOutput("securityGroupe", $securityGroupe);
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		}
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}
-	
-	}
-
-	public function getSecurityGroupe($securityGroupeId)
-	{
-		try
-		{
-			$securityGroupe = $this->libClass->getSecurityGroupe($securityGroupeId);
-			return $securityGroupe;
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		}
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}
-	
-	}
-
-	public function deleteSecurityGroupe()
-     	{	
-		try
-		{
-		
-			$securityGroupe = getSecurityGroupe($this->app->getPostParam("securityGroupeId"));
-			$securityGroupe->delete();
-		}
-		catch(BadResponseError $e)
-		{
-			$this->app->getErrorInstance->BadResponseHandler($e);
-       		}
-		catch(UserInputError $e)
-		{
-			$this->app->getErrorInstance->UserInputHandler($e);
-        	}
-		catch(BaseError $e)
-		{
-			$this->app->getErrorInstance->BaseErrorHandler($e);
-       		}
-		catch(NotImplementedError $e)
-		{
-			$this->app->getErrorInstance->NotImplementedHandler($e);
-        	}
-	}	
diff --git a/server/core/Plugin.php b/server/core/Plugin.php
deleted file mode 100755
index e6fd8a7..0000000
--- a/server/core/Plugin.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-
-abstract class plugin{
-
-	public $api;
-
-	public function __construct($api){
-
-		$this->api = $api;
-
-	}
-
-}
diff --git a/server/core/Plugin_Api.php b/server/core/Plugin_Api.php
deleted file mode 100755
index 20ffd0c..0000000
--- a/server/core/Plugin_Api.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-//Init plugin directory
-/*if (!defined('PLUGINS_DIR')) {
-    define('PLUGINS_DIR', INSTALL_PATH . 'plugins/');
-}*/
-
-class plugin_api{
-
-	static protected $instance;
-
-	protected function __construct(){
-
-	}
-
-	static function getInstance(){
-		
-		if(!self::$instance){
-			self::$instance = new plugin_api();
-		}
-
-		return self::$instance;
-	}
-}
diff --git a/server/create_serv.php b/server/create_serv.php
deleted file mode 100755
index da39842..0000000
--- a/server/create_serv.php
+++ /dev/null
@@ -1,55 +0,0 @@
-<?php
-
-ini_set('display_errors', 1);
-date_default_timezone_set("Europe/Paris");
-require 'vendor/autoload.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);
-	$compute=$openstack->computeV2(["region" => "RegionOne"]);
-	$servers = $compute->listServers(true);
-	foreach($servers as $server)
-	{
-		$monserv = $server;
-		echo $server->name."<br>";
-	}
-	echo "<br><br>";
-
-	$images = $compute->ListImages();
-
-	$monim = "";
-	foreach($images as $image)
-	{ 		
-
-				
-			$monim = $image;
-			echo $image->name."<br>";		
-			break;
-		
-		
-		
-		
-	}
-
-	$flavors = $compute->ListFlavors();
-
-	echo "<br><br>";
-
-	$monflav = "";
-
-	foreach($flavors as $flavor)
-	{		
-	
-			$monflav=$flavor;
-			echo $flavor->name."<br>";
-			break;
-	}	
-
- 	$response= $compute->createServer(array('name' => "TestOthmane2",'imageId' => $monim->id , 'flavorId'=>$monflav->id , "networks" => array
-  	(  array("uuid"=> "251b4641-20ff-4a72-8549-1758788b51ce"))));
-
-
-