istic-openstack/server/Test/imageTests.php

65 lines
1.2 KiB
PHP
Raw Normal View History

<?php
2016-03-02 16:00:46 +01:00
include('InitTest.php');
include_once("../core/Image.php");
2016-03-23 15:46:57 +01:00
include_once("../core/Compute.php");
2016-01-31 11:36:58 +01:00
2016-02-11 20:38:15 +01:00
$image = new Image($App);
2016-03-23 15:46:57 +01:00
$compute = new Compute($App);
2016-01-31 13:00:04 +01:00
$opt = Array();
$opt['name'] = "Test";
$opt['tags'] = ['test', 'openstack'];
//$opt['containerFormat'] = 'ami';
//$opt['diskFormat'] = 'iso';
2016-01-31 13:00:04 +01:00
$opt['visibility'] = 'public';
$opt['minDisk'] = 1;
$opt['protected'] = false;
2016-01-31 13:00:04 +01:00
$opt['minRam'] = 10;
//$App->setPostParam('id', 'sdfihlus154dfhj');
2016-03-21 10:19:26 +01:00
//$err = $image->action("createImage");
2016-02-11 20:06:50 +01:00
2016-01-31 11:36:58 +01:00
//Liste des images
2016-03-02 16:00:46 +01:00
$image->action("listImage");
$im = $App->show();
$images = json_decode($im, true)["Images"];
echo "Images présentes :";
echo "</br>";
foreach($images as $i){
$recup = $i;
echo $recup['name'];
echo "</br>";
//echo $recup['id'];
}
echo "</br>";
2016-03-23 15:46:57 +01:00
echo "Flavors: ";
echo "</br>";
2016-03-21 10:19:26 +01:00
2016-03-23 15:46:57 +01:00
$compute->action("listFlavors");
$flavors = json_decode($App->show(), true)["Flavors"];
foreach($flavors as $f){
echo "Id=".$f['id'].", ";
echo "name=".$f['name'].", ";
echo "ram=".$f['ram'].", ";
echo "disk=".$f['disk'].", ";
echo "vcpus=".$f['vcpus'];
echo "</br>";
}
2016-03-21 10:19:26 +01:00
/*
$App->setPostParam('id', 354);
$err = $image->action("deleteImage");
$temp = $App->show();
$ret = json_decode($temp, true)["Images"];
echo $ret['id'];
*/
2016-01-31 11:36:58 +01:00
2016-01-31 18:28:09 +01:00
2016-01-31 11:36:58 +01:00
?>