diff options
| author | root <root@kabir-PC> | 2016-03-02 01:34:10 +0100 |
|---|---|---|
| committer | root <root@kabir-PC> | 2016-03-02 01:34:10 +0100 |
| commit | 70fcf3553abb4a25672ee198dafb89e430e2bd79 (patch) | |
| tree | a2266ed9d7b9192ecb08f5d6eda496c300ebd7e0 /server/core | |
| parent | 38ba61c6eebadb79a23044b06671fd7c73975516 (diff) | |
ajout des fonctions
Diffstat (limited to 'server/core')
| -rw-r--r-- | server/core/Network.php | 98 |
1 files changed, 97 insertions, 1 deletions
diff --git a/server/core/Network.php b/server/core/Network.php index 2e09508..6363fdb 100644 --- a/server/core/Network.php +++ b/server/core/Network.php @@ -94,5 +94,101 @@ class network{ return $list_names; } + //option array() + public function getNetwork($idNet) + { + $network=""; + + try + { $newtork = $networking->getNetwork($idNet); + $network->retrieve(); + + + } + + catch (OpenStack\Common\Error\BadResponseError $e) + { + $network = "Id non existant "; + } + catch (Exception $e) + { + $network = 'Exception reçue : ', $e->getMessage(), "\n"; + } + + return $network; + } + + public function getSubnet($idSub) + { + $sbnet=""; + + try + { $subnet = $networking->getSubnet($idSub); + $subnet->retrieve(); + + + } + + catch (OpenStack\Common\Error\BadResponseError $e) + { + $sbnet = "Id non existant "; + } + catch (Exception $e) + { + $sbnet = 'Exception reçue : ', $e->getMessage(), "\n"; + } + + return $sbnet; + } + + public function updateNetwork($idNet,$name,$shared,$adminStateUp) + { + $network = getNetwork($idNet); + if(!is_null($name)) + { + $network->name = $name; + } + if(!is_null($shared)) + { + $network->shared = $shared; + } + if(!is_null($adminStateUp)) + { + $network->adminStateUp = $shared; + } + $network->update(); + } - + public function updateSubnet($idSub,$name,$networkId,$ipVersion,$cidr) + { + $subnet = getNetwork($idSub); + if(!is_null($name)) + { + $subnet->name = $name; + } + if(!is_null($networkId)) + { + $subnet->networkId = $networkId; + } + if(!is_null($ipVersion)) + { + $subnet->ipVersion = $ipVersion; + } + if(!is_null($cidr)) + { + $subnet->cidr = $cidr; + } + $subnet->update(); + } + + public function deleteNetwork($idNet) + { + $network = getNetwork($idNet); + $network->delete(); + } + + public function deleteSubnet($idSub) + { + $subnet = getNetwork($idSub); + $subnet->delete(); + } |
