display idnetwork
This commit is contained in:
parent
6e9df92ea8
commit
1eff9ee90b
3 changed files with 86 additions and 0 deletions
25
server/Test/DisplayNetIds.php
Normal file
25
server/Test/DisplayNetIds.php
Normal file
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
date_default_timezone_set("Europe/Paris");
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
$options = Array();
|
||||
$options["user"] = Array("name"=>"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);
|
||||
$networking = $openstack->networkingV2(["region"=>"RegionOne"]);
|
||||
$ln = $networking->listNetworks();
|
||||
|
||||
|
||||
// affiche les id des reseaux qu on a
|
||||
foreach($ln as $n)
|
||||
{
|
||||
//var_dump($n);
|
||||
echo $n->id;
|
||||
echo "<br><br>";
|
||||
|
||||
}
|
||||
|
||||
|
31
server/Test/create_network.php
Normal file
31
server/Test/create_network.php
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?php
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
date_default_timezone_set("Europe/Paris");
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
$options = Array();
|
||||
$options["user"] = Array("name"=>"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);
|
||||
$networking = $openstack->networkingV2(["region"=>"RegionOne"]);
|
||||
$ln = $networking->listNetworks();
|
||||
|
||||
|
||||
|
||||
|
||||
$op = array(
|
||||
'networks' =>
|
||||
array(
|
||||
'name' => 'TestOthmane',
|
||||
'shared' => true,
|
||||
'adminStateUp' => true,
|
||||
));
|
||||
$array = $networking->createNetworks($op);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
30
server/Test/create_subnet.php
Normal file
30
server/Test/create_subnet.php
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
date_default_timezone_set("Europe/Paris");
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
$options = Array();
|
||||
$options["user"] = Array("name"=>"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);
|
||||
$networking = $openstack->networkingV2(["region"=>"RegionOne"]);
|
||||
$ln = $networking->listNetworks();
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$array = $networking->createSubnet(array(
|
||||
'name' => 'SubOthmane',
|
||||
'networkId' => '5f78d3c1-1f53-4be7-897b-cf3c797961e0',
|
||||
'ipVersion' => 4,
|
||||
'cidr' => '192.168.0.0/24'
|
||||
));
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Add table
Reference in a new issue