modification in structure for ip and routers
This commit is contained in:
parent
94ce37f517
commit
3f6af0b644
7 changed files with 30 additions and 59 deletions
|
@ -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);
|
||||
|
|
|
@ -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>";
|
||||
}
|
|
@ -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>";
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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){
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue