tentative ip publique
This commit is contained in:
parent
438b9b4dcd
commit
94629aeaf5
3 changed files with 111 additions and 7 deletions
|
@ -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>";
|
||||
}
|
||||
|
||||
|
||||
?>
|
Loading…
Add table
Add a link
Reference in a new issue