diff options
| author | root <root@kabir-PC> | 2016-02-23 21:36:07 +0100 |
|---|---|---|
| committer | root <root@kabir-PC> | 2016-02-23 21:36:07 +0100 |
| commit | 154d49d1089d34ada6744556cca8028d1ec11430 (patch) | |
| tree | e4924c33cffbd27537f1100af19d0445d24f9ff0 /server/core/Network.php | |
| parent | 5665d317db7763650e7827c20f6fe131bcce9ad3 (diff) | |
la premiere version de la classe netork
Diffstat (limited to 'server/core/Network.php')
| -rw-r--r-- | server/core/Network.php | 104 |
1 files changed, 103 insertions, 1 deletions
diff --git a/server/core/Network.php b/server/core/Network.php index 8d1c8b6..38e20be 100644 --- a/server/core/Network.php +++ b/server/core/Network.php @@ -1 +1,103 @@ - +<?php + +class network{ + + protected $app; + + protected $libClass; + + protected $networking; + + protected $actions = array(); + + + /** + * Image constructor + * + * @param App $app the main app object + * + * @throws [Type] [<description>] + * + * @return Image + */ + public function __construct($app, $openstack){ + $this->app = $app; + $this->libClass = $app->getLibClass("networkingV2"); + $this->networking = $openstack->networkingV2(["region"=>"RegionOne"]); + } + + + + + + public function create_network(array $options) + { + + $network = $networking->createNetworks($options); + + + return $network; + } + + public function create_subnet(array $options) + { + + $subnet = $networking->createSubnet($options); + + + return $subnet; + } + + public function list_network_ids() + { + + $ln = $networking->listNetworks(); + + $list_ids = array(); + + + foreach($ln as $n) + { + + $list_ids[] = $n->id; + + + } + + return $list_ids; + } + + public function list_network_names() + { + + $ln = $networking->listNetworks(); + + $list_names = array(); + + + foreach($ln as $n) + { + + $list_names[] = $n->name; + + + } + + return $list_names; + } + + public function list_cidr() + { + + $ls = $networking->listSubnets(); + $list_cidr = array(); + foreach ($ls as $subnet) + { + + $list_cidr[] = $subnet->cidr; + } + + return $list_names; + } + + |
