From 6a3f770c762de4decfbb483bb8212ea44ffc44d1 Mon Sep 17 00:00:00 2001 From: Yoggzo Date: Tue, 19 Apr 2016 18:27:27 +0200 Subject: add init FloatingIp --- server/core/App.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'server/core/App.php') 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; } } -- cgit v1.2.3 From 3f6af0b6446725462362de94f09daf9a723b130d Mon Sep 17 00:00:00 2001 From: Yoggzo Date: Thu, 21 Apr 2016 21:51:46 +0200 Subject: modification in structure for ip and routers --- server/Test/AppTestClass.php | 2 +- server/Test/NetworkLayer3Tests.php | 88 ++++++++++ server/Test/automatingTests.php | 40 +---- server/Test/floatingIpTests.php | 88 ---------- server/core/App.php | 2 +- server/core/Automating.php | 5 +- server/core/FloatingIp.php | 326 ------------------------------------- server/core/NetworkLayer3.php | 326 +++++++++++++++++++++++++++++++++++++ server/index.php | 6 +- 9 files changed, 427 insertions(+), 456 deletions(-) create mode 100644 server/Test/NetworkLayer3Tests.php delete mode 100644 server/Test/floatingIpTests.php delete mode 100755 server/core/FloatingIp.php create mode 100755 server/core/NetworkLayer3.php (limited to 'server/core/App.php') 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/NetworkLayer3Tests.php b/server/Test/NetworkLayer3Tests.php new file mode 100644 index 0000000..b827a51 --- /dev/null +++ b/server/Test/NetworkLayer3Tests.php @@ -0,0 +1,88 @@ +"; +$compute->action("listServers"); +$servers = json_decode($App->show(), true)["Servers"]; +$id = null; +foreach($servers as $server){ + echo $server['name']." ".$server['id']." ".$server['ipv4']."
"; + if(strcmp($server['name'], "bob")){ + $id = $server['id']; + } +} +echo "
"; + + +// Liste des networks +echo "Liste des network :
"; +$network->action("list_network_ids"); +$servers = json_decode($App->show(), true)["ListNetworkIds"]; +$id = null; +foreach($servers as $server){ + echo $server."
"; +} +echo "
"; + + +// Liste des floatingip +echo "Liste des floatingip :
"; +$networkLayer3->action("listFloatingIp"); +$listFloatingIp = json_decode($App->show(), true)["NetworkLayer3"]; +$id = null; +foreach ($listFloatingIp as $floatIp){ + echo $floatIp['floatingIpAddress']." ".$floatIp['id']." ".$floatIp["status"]."
"; + $id = $floatIp['id']; +} +echo "
"; + + +// Liste des floatingip +echo "Get floatingip :
"; +$App->setPostParam('id', $id); +$networkLayer3->action("getFloatingIp"); +$getFloatingIp = json_decode($App->show(), true)["NetworkLayer3"]; +echo $getFloatingIp['id']."
"; +echo "
"; + + +/* +// Création d'une ip flotante +$opt = array(); +$opt['floatingNetworkId'] = "251b4641-20ff-4a72-8549-1758788b51ce"; + +$App->setPostParam('opt', $opt); +$networkLayer3->action("createFloatingIp"); +$float = json_decode($App->show(), true)["NetworkLayer3"]; +if(!isset($float)){ + echo "Erreur pendant la création
"; +} +echo "
"; +*/ + +/* +// Suppression d'une ip flotante +$App->setPostParam('id', $id); +$networkLayer3->action("deleteFloatingIp"); +*/ + +// Liste des floatingip +echo "Liste des floatingip :
"; +$networkLayer3->action("listFloatingIp"); +$listFloatingIp = json_decode($App->show(), true)["NetworkLayer3"]; +foreach ($listFloatingIp as $floatIp){ + echo $floatIp['floatingIpAddress']." ".$floatIp['id']." ".$floatIp["status"]."
"; +} + + +?> \ No newline at end of file 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 "
"; -/* -// Liste des ports -echo "Liste des ports :
"; -$network->action("listPorts"); -$ports = json_decode($App->show(), true)["Network"]; -foreach ($ports as $p) { - echo $p["fixedIps"]."
"; -} -*/ + //Liste des networks echo "Liste des network :
"; $network->action("list_network_ids"); @@ -44,32 +35,11 @@ foreach($servers as $server){ } echo "
"; -/* -// 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
"; -} -echo "
"; -*/ - - // liste des floatingip echo "Liste des floatingip :
"; -$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"]."
"; } diff --git a/server/Test/floatingIpTests.php b/server/Test/floatingIpTests.php deleted file mode 100644 index 191de46..0000000 --- a/server/Test/floatingIpTests.php +++ /dev/null @@ -1,88 +0,0 @@ -"; -$compute->action("listServers"); -$servers = json_decode($App->show(), true)["Servers"]; -$id = null; -foreach($servers as $server){ - echo $server['name']." ".$server['id']." ".$server['ipv4']."
"; - if(strcmp($server['name'], "bob")){ - $id = $server['id']; - } -} -echo "
"; - - -// Liste des networks -echo "Liste des network :
"; -$network->action("list_network_ids"); -$servers = json_decode($App->show(), true)["ListNetworkIds"]; -$id = null; -foreach($servers as $server){ - echo $server."
"; -} -echo "
"; - - -// Liste des floatingip -echo "Liste des floatingip :
"; -$floatingIp->action("listFloatingIp"); -$listFloatingIp = json_decode($App->show(), true)["FloatingIp"]; -$id = null; -foreach ($listFloatingIp as $floatIp){ - echo $floatIp['floatingIpAddress']." ".$floatIp['id']." ".$floatIp["status"]."
"; - $id = $floatIp['id']; -} -echo "
"; - - -// Liste des floatingip -echo "Get floatingip :
"; -$App->setPostParam('id', $id); -$floatingIp->action("getFloatingIp"); -$getFloatingIp = json_decode($App->show(), true)["FloatingIp"]; -echo $getFloatingIp['id']."
"; -echo "
"; - - -/* -// 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
"; -} -echo "
"; -*/ - -/* -// Suppression d'une ip flotante -$App->setPostParam('id', $id); -$floatingIp->action("deleteFloatingIp"); -*/ - -// Liste des floatingip -echo "Liste des floatingip :
"; -$floatingIp->action("listFloatingIp"); -$listFloatingIp = json_decode($App->show(), true)["FloatingIp"]; -foreach ($listFloatingIp as $floatIp){ - echo $floatIp['floatingIpAddress']." ".$floatIp['id']." ".$floatIp["status"]."
"; -} - - -?> \ No newline at end of file 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/FloatingIp.php deleted file mode 100755 index cdbb64b..0000000 --- a/server/core/FloatingIp.php +++ /dev/null @@ -1,326 +0,0 @@ -app->setOutput("Error", "Incorrect parameter app"); - } - $this->app = $app; - $this->libClass = $app->getLibClass("FloatingIp"); - } - - - /** - * Execute an action - * - * @param String $action name of another function of this class - * - * @return void - */ - public function action($action){ - $this->{$action.""}(); - } - - - /** - * List floatingip - * - * @return list of the floatingip - */ - private function listFloatingIp(){ - try{ - $result = array(); - $l = $this->libClass->listFloatingIps(); - error_log(var_export($l, true), 0); - foreach ($l as $tmp) { - $result[] = $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 - * - * @param array $opt Options for the floating ip creation (floatingipo and floating network id are required, others are optionals) - * - * @return floatingip - */ - private function createFloatingIp(){ - $opt = $this->app->getPostParam("opt"); - - if(!isset($opt)){ - $this->app->setOutput("Error", "Incorrect parameter opt"); - } - try{ - $floatingip = $this->libClass->createFloatingIp($opt); - - if(!isset($floatingip)){ - $this->app->setOutput("Error", "Unknowing error during floating ip creation"); - }else{ - $this->app->setOutput("FloatingIp", $floatingip); - } - }catch(BadResponseError $e){ - echo $e."
"; - $this->app->getErrorInstance()->BadResponseHandler($e); - }catch(UserInputError $e){ - echo $e."
"; - $this->app->getErrorInstance()->UserInputHandler($e); - }catch(BaseError $e){ - echo $e."
"; - $this->app->getErrorInstance()->BaseErrorHandler($e); - }catch(NotImplementedError $e){ - echo $e."
"; - $this->app->getErrorInstance()->NotImplementedHandler($e); - }catch(Exception $e){ - echo $e->getMessage()."
"; - $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{ - // 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($result)){ // If id doesn't exists - $this->app->setOutput("Error", "Unknow id"); - }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){ - $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 floating ip - * - * @param id the id of the floatingip to update - * - * @return Image - */ - private function updateFloatingIp(){ - $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->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($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); - } - } - - /** - * Delete a floating ip - * - * @param string floatingip_id the floating-ip id to delete - * - * @return void - */ - private function deleteFloatingIp(){ - $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->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($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){ - $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); - } - } - - - /** - * Retrieve a floating ip - * - * @param string floatingip_id the floating-ip id to retrieve - * - * @return void - */ - private function retrieveFloatingIp(){ - $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->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($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){ - $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); - } - } -} diff --git a/server/core/NetworkLayer3.php b/server/core/NetworkLayer3.php new file mode 100755 index 0000000..28d27b4 --- /dev/null +++ b/server/core/NetworkLayer3.php @@ -0,0 +1,326 @@ +app->setOutput("Error", "Incorrect parameter app"); + } + $this->app = $app; + $this->libClass = $app->getLibClass("NetworkLayer3"); + } + + + /** + * Execute an action + * + * @param String $action name of another function of this class + * + * @return void + */ + public function action($action){ + $this->{$action.""}(); + } + + + /** + * List floatingip + * + * @return list of the floatingip + */ + private function listFloatingIp(){ + try{ + $result = array(); + $l = $this->libClass->listFloatingIps(); + error_log(var_export($l, true), 0); + 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); + } + } + + /** + * 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) + * + * @return floatingip + */ + private function createFloatingIp(){ + $opt = $this->app->getPostParam("opt"); + + if(!isset($opt)){ + $this->app->setOutput("Error", "Incorrect parameter opt"); + } + try{ + $floatingip = $this->libClass->createFloatingIp($opt); + + if(!isset($floatingip)){ + $this->app->setOutput("Error", "Unknowing error during floating ip creation"); + }else{ + $this->app->setOutput("NetworkLayer3", $floatingip); + } + }catch(BadResponseError $e){ + echo $e."
"; + $this->app->getErrorInstance()->BadResponseHandler($e); + }catch(UserInputError $e){ + echo $e."
"; + $this->app->getErrorInstance()->UserInputHandler($e); + }catch(BaseError $e){ + echo $e."
"; + $this->app->getErrorInstance()->BaseErrorHandler($e); + }catch(NotImplementedError $e){ + echo $e."
"; + $this->app->getErrorInstance()->NotImplementedHandler($e); + }catch(Exception $e){ + echo $e->getMessage()."
"; + $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{ + // 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($result)){ // If id doesn't exists + $this->app->setOutput("Error", "Unknow id"); + }else{ // If id exists + $res = $this->libClass->getFloatingIp($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); + } + } + + /** + * Update floating ip + * + * @param id the id of the floatingip to update + * + * @return Image + */ + private function updateFloatingIp(){ + $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->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($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); + } + } + + /** + * Delete a floating ip + * + * @param string floatingip_id the floating-ip id to delete + * + * @return void + */ + private function deleteFloatingIp(){ + $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->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($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){ + $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); + } + } + + + /** + * Retrieve a floating ip + * + * @param string floatingip_id the floating-ip id to retrieve + * + * @return void + */ + private function retrieveFloatingIp(){ + $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->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($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){ + $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); + } + } +} 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; -- cgit v1.2.3 From 477dc821824b422c11d0d34b644de4b68a596510 Mon Sep 17 00:00:00 2001 From: EoleDev Date: Tue, 26 Apr 2016 17:35:32 +0200 Subject: 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 (limited to 'server/core/App.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 @@ 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 @@ -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 @@ -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 @@ -"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."
"; - } - echo "

"; - - $images = $compute->ListImages(); - - $monim = ""; - foreach($images as $image) - { - - - $monim = $image; - echo $image->name."
"; - break; - - - - - } - - $flavors = $compute->ListFlavors(); - - echo "

"; - - $monflav = ""; - - foreach($flavors as $flavor) - { - - $monflav=$flavor; - echo $flavor->name."
"; - break; - } - - $response= $compute->createServer(array('name' => "TestOthmane2",'imageId' => $monim->id , 'flavorId'=>$monflav->id , "networks" => array - ( array("uuid"=> "251b4641-20ff-4a72-8549-1758788b51ce")))); - - - -- cgit v1.2.3