From 94629aeaf523f391f09ef18c1b2ca639e0b02d08 Mon Sep 17 00:00:00 2001 From: Yoggzo Date: Tue, 19 Apr 2016 23:57:03 +0200 Subject: tentative ip publique --- server/Test/automatingTests.php | 65 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 4 deletions(-) (limited to 'server/Test') 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 :
"; $compute->action("listServers"); $servers = json_decode($App->show(), true)["Servers"]; +$id = null; foreach($servers as $server){ - echo $server['name']." ".$server['id']."
"; + echo $server['name']." ".$server['id']." ".$server['ipv4']."
"; + if(strcmp($server['name'], "bob")){ + $id = $server['id']; + } } +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 floatingip +echo "Liste des floatingip :
"; +$floatingIp->action("listFloatingIp"); +$listFloatingIp = json_decode($App->show(), true)["FloatingIp"]; +$ip = null; +foreach ($listFloatingIp as $floatIp){ + echo $floatIp['floatingIpAddress']." ".$floatIp['id']." ".$floatIp["status"]."
"; + $ip = $floatIp; +} + +echo "
"; + +// 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
"; +} +else{ + foreach ($float as $f) { + echo $f." "; + } + echo "
"; +} + + +echo "
"; // liste des floatingip +echo "Liste des floatingip :
"; $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"]."
"; + echo $floatIp['floatingIpAddress']." ".$floatIp['id']." ".$floatIp["status"]."
"; } + + ?> \ No newline at end of file -- cgit v1.2.3