From 154d49d1089d34ada6744556cca8028d1ec11430 Mon Sep 17 00:00:00 2001 From: root Date: Tue, 23 Feb 2016 21:36:07 +0100 Subject: la premiere version de la classe netork --- server/core/Network.php | 104 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 103 insertions(+), 1 deletion(-) (limited to 'server/core/Network.php') 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 @@ - +] + * + * @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; + } + + -- cgit v1.2.3 From 38ba61c6eebadb79a23044b06671fd7c73975516 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 24 Feb 2016 19:42:01 +0100 Subject: modification dans network --- server/core/Network.php | 35 +++++++++++++++-------------------- 1 file changed, 15 insertions(+), 20 deletions(-) (limited to 'server/core/Network.php') diff --git a/server/core/Network.php b/server/core/Network.php index 38e20be..2e09508 100644 --- a/server/core/Network.php +++ b/server/core/Network.php @@ -6,34 +6,29 @@ class network{ protected $libClass; - protected $networking; + - protected $actions = array(); + - /** - * Image constructor - * - * @param App $app the main app object - * - * @throws [Type] [] - * - * @return Image - */ - public function __construct($app, $openstack){ + public function __construct($app){ $this->app = $app; - $this->libClass = $app->getLibClass("networkingV2"); - $this->networking = $openstack->networkingV2(["region"=>"RegionOne"]); + $this->libClass = $app->getLibClass("network"); + } - + public function action($action){ + + $this->{$action.""}(); + + } public function create_network(array $options) { - $network = $networking->createNetworks($options); + $network = $this->libClass->createNetworks($options); return $network; @@ -42,7 +37,7 @@ class network{ public function create_subnet(array $options) { - $subnet = $networking->createSubnet($options); + $subnet = $this->libClass->createSubnet($options); return $subnet; @@ -51,7 +46,7 @@ class network{ public function list_network_ids() { - $ln = $networking->listNetworks(); + $ln = $this->libClass->listNetworks(); $list_ids = array(); @@ -70,7 +65,7 @@ class network{ public function list_network_names() { - $ln = $networking->listNetworks(); + $ln = $this->libClass->listNetworks(); $list_names = array(); @@ -89,7 +84,7 @@ class network{ public function list_cidr() { - $ls = $networking->listSubnets(); + $ls = $this->libClass->listSubnets(); $list_cidr = array(); foreach ($ls as $subnet) { -- cgit v1.2.3 From 70fcf3553abb4a25672ee198dafb89e430e2bd79 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 2 Mar 2016 01:34:10 +0100 Subject: ajout des fonctions --- server/Test/getIdNetwork.php | 34 +++++++++++++++ server/Test/getNetwork.php | 26 ++++++++++++ server/core/Network.php | 98 +++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 157 insertions(+), 1 deletion(-) create mode 100644 server/Test/getIdNetwork.php create mode 100644 server/Test/getNetwork.php (limited to 'server/core/Network.php') diff --git a/server/Test/getIdNetwork.php b/server/Test/getIdNetwork.php new file mode 100644 index 0000000..1e38627 --- /dev/null +++ b/server/Test/getIdNetwork.php @@ -0,0 +1,34 @@ +"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"]); + + $ls = $networking->getNetwork('5f78d3c1-1f53-4be7-897b-cf3c797961e0'); +try{ +$ls->retrieve(); + + + +echo "oui";} + + catch (OpenStack\Common\Error\BadResponseError $e){ +echo "non"; } + + + + + + + + + + + diff --git a/server/Test/getNetwork.php b/server/Test/getNetwork.php new file mode 100644 index 0000000..4c76480 --- /dev/null +++ b/server/Test/getNetwork.php @@ -0,0 +1,26 @@ +"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"]); + $ls = $networking->listNetworks(); + + foreach ($ls as $subnet) { + echo $subnet->id."
"; +} + + + + + + + + + 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(); + } -- cgit v1.2.3 From a51bcad21a526b5077f52bb8e12417e4b921f06b Mon Sep 17 00:00:00 2001 From: root Date: Tue, 8 Mar 2016 00:26:20 +0100 Subject: terminaison des fonctions --- server/core/Network.php | 276 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 265 insertions(+), 11 deletions(-) (limited to 'server/core/Network.php') diff --git a/server/core/Network.php b/server/core/Network.php index 6363fdb..75ba2fd 100644 --- a/server/core/Network.php +++ b/server/core/Network.php @@ -25,18 +25,77 @@ class network{ } - public function create_network(array $options) + public function create_network($name,$adminStateUp,$shared,$tenantId) { - + $options = array(); + if (!is_null($name)) + { + $options['name'] = $name; + } + if (!is_null($adminStateUp)) + { + $options['adminStateUp'] = $adminStateUp; + } + if (!is_null($shared)) + { + $options['shared'] = $shared; + } + if (!is_null($tenantId)) + { + $options['tenantId'] = $tenantId; + } $network = $this->libClass->createNetworks($options); return $network; } - public function create_subnet(array $options) - { - + public function create_subnet($networkId,$ipVersion,$cidr,$name,$gatewayIp,$dnsNameservers,$allocationPools,$hostRoutes,$enableDhcp,$tenantId) + { $options = array(); + if (!is_null($networkId)) + { + $options['networkId'] = $networkId; + } + if (!is_null($ipVersion)) + { + $options['ipVersion'] = $ipVersion; + } + if (!is_null($cidr)) + { + $options['cidr'] = $cidr; + } + if (!is_null($tenantId)) + { + $options['tenantId'] = $tenantId; + } + if (!is_null($name)) + { + $options['name'] = $name; + } + if (!is_null($gatewayIp)) + { + $options['gatewayIp'] = $gatewayIp; + } + if (!is_null($dnsNameservers)) + { + $options['dnsNameservers'] = $dnsNameservers; + } + if (!is_null($allocationPools)) + { + $options['allocationPools'] = $allocationPools; + } + if (!is_null($hostRoutes)) + { + $options['hostRoutes'] = $hostRoutes; + } + if (!is_null($enableDhcp)) + { + $options['enableDhcp'] = $enableDhcp; + } + if (!is_null($tenantId)) + { + $options['tenantId'] = $tenantId; + } $subnet = $this->libClass->createSubnet($options); @@ -100,7 +159,7 @@ class network{ $network=""; try - { $newtork = $networking->getNetwork($idNet); + { $newtork = $this->libClass->getNetwork($idNet); $network->retrieve(); @@ -123,22 +182,22 @@ class network{ $sbnet=""; try - { $subnet = $networking->getSubnet($idSub); + { $subnet = $this->libClass->getSubnet($idSub); $subnet->retrieve(); - + return $sbnet; } catch (OpenStack\Common\Error\BadResponseError $e) { - $sbnet = "Id non existant "; + echo "Id non existant "; } catch (Exception $e) { - $sbnet = 'Exception reçue : ', $e->getMessage(), "\n"; + echo 'Exception reçue : ', $e->getMessage(), "\n"; } - return $sbnet; + } public function updateNetwork($idNet,$name,$shared,$adminStateUp) @@ -192,3 +251,198 @@ class network{ $subnet = getNetwork($idSub); $subnet->delete(); } + + public function createPort($networkId,$name,$adminStateUp,$macAddress,$fixedIps,$deviceId,$deviceOwner,$securityGroups,$tenantId) + { + $options = array(); + if (!is_null($networkId)) + { + $options['networkId'] = $networkId; + } + if (!is_null($name)) + { + $options['name'] = $name; + } + if (!is_null($adminStateUp)) + { + $options['adminStateUp'] = $adminStateUp; + } + if (!is_null($macAddress)) + { + $options['macAddress'] = $macAddress; + } + if (!is_null($fixedIps)) + { + $options['fixedIps'] = $fixedIps; + } + if (!is_null($deviceId)) + { + $options['deviceId'] = $deviceId; + } + if (!is_null($deviceOwner)) + { + $options['deviceOwner'] = $deviceOwner; + } + if (!is_null($securityGroups)) + { + $options['securityGroups'] = $securityGroups; + } + if (!is_null($tenantId)) + { + $options['tenantId'] = $tenantId; + } + + $this->libClass->createPort($options); + } + + public function listPorts() + { + return $this->libClass->listPorts(); + } + + public function getPort($portId) + { + try + { + $port = $this->libClass->getport($portId); + return $port; + } + catch (Exception $e) + { + echo 'id fourni non disponible'; + } + + } + + public function updatePort($networkId,$name,$adminStateUp,$macAddress,$fixedIps,$deviceId,$deviceOwner,$securityGroups,$tenantId) + { + $options = array(); + if (!is_null($networkId)) + { + $options['networkId'] = $networkId; + } + if (!is_null($name)) + { + $options['name'] = $name; + } + if (!is_null($adminStateUp)) + { + $options['adminStateUp'] = $adminStateUp; + } + if (!is_null($macAddress)) + { + $options['macAddress'] = $macAddress; + } + if (!is_null($fixedIps)) + { + $options['fixedIps'] = $fixedIps; + } + if (!is_null($deviceId)) + { + $options['deviceId'] = $deviceId; + } + if (!is_null($deviceOwner)) + { + $options['deviceOwner'] = $deviceOwner; + } + if (!is_null($securityGroups)) + { + $options['securityGroups'] = $securityGroups; + } + if (!is_null($tenantId)) + { + $options['tenantId'] = $tenantId; + } + + $this->libClass->update($options); + } + + public function deletePort($portId) + { + $port = getPort($portId); + $port->delete(); + } + + public function createSecurityGroup($name,$description) + { + $options = array(); + if (!is_null($name)) + { + $options['name'] = $name; + } + if (!is_null($description)) + { + $options['description'] = $description; + } + + $this->libClass->createSecurityGroup($options); + } + + public function createSecurityGroupRule($securityGroupId,$direction,$ethertype,$portRangeMin,$portRangeMax,$protocol,$remoteGroupId,$remoteIpPrefix) + { + $options = array(); + if (!is_null($securityGroupId)) + { + $options['securityGroupId'] = $securityGroupId; + } + if (!is_null($direction)) + { + $options['direction'] = $direction; + } + if (!is_null($ethertype)) + { + $options['ethertype'] = $ethertype; + } + if (!is_null($portRangeMin)) + { + $options['portRangeMin'] = $portRangeMin; + } + if (!is_null($portRangeMax)) + { + $options['portRangeMax'] = $portRangeMax; + } + if (!is_null($protocol)) + { + $options['protocol'] = $protocol; + } + if (!is_null($remoteGroupId)) + { + $options['remoteGroupId'] = $remoteGroupId; + } + if (!is_null($remoteIpPrefix)) + { + $options['remoteIpPrefix'] = $remoteIpPrefix; + } + $this->libClass->createSecurityGroupRule($options); + } + + + public function listSecurityGroupe() + { + return $this->libClass->listSecurityGroups(); + } + + public function listSecurityGroupeRule() + { + return $this->libClass->listSecurityGroupRules(); + } + + public function getSecurityGroupe($securityGroupeId) + { + try + { + $securityGroupe = $this->libClass->getSecurityGroupe($securityGroupeId); + return $securityGroupe; + } + catch (Exception $e) + { + echo 'id fourni non disponible'; + } + + } + + public function deleteSecurityGroupe($securityGroupeId) + { + $securityGroupe = getSecurityGroupe($securityGroupeId); + $securityGroupe->delete(); + } -- cgit v1.2.3 From 20f8eb41d3ae5e53fd4bb53e55f0627ff7b7f15c Mon Sep 17 00:00:00 2001 From: Othmane Kabir <16008902@e003m10.istic.univ-rennes1.fr> Date: Wed, 9 Mar 2016 16:13:20 +0100 Subject: commit finale --- server/core/Network.php | 880 +++++++++++++++++++++++++++++++++---------- server/core/Network.php~ | 952 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1644 insertions(+), 188 deletions(-) create mode 100644 server/core/Network.php~ (limited to 'server/core/Network.php') diff --git a/server/core/Network.php b/server/core/Network.php index 75ba2fd..65de962 100644 --- a/server/core/Network.php +++ b/server/core/Network.php @@ -25,279 +25,595 @@ class network{ } - public function create_network($name,$adminStateUp,$shared,$tenantId) + public function create_network() { $options = array(); - if (!is_null($name)) + if (isset($this->app->getPostParam("name"))) { - $options['name'] = $name; + $options['name'] = $this->app->getPostParam("name"); } - if (!is_null($adminStateUp)) + if (isset($this->app->getPostParam("adminStateUp"))) { - $options['adminStateUp'] = $adminStateUp; + $options['adminStateUp'] = $this->app->getPostParam("adminStateUp"); } - if (!is_null($shared)) + if (isset($this->app->getPostParam("shared"))) { - $options['shared'] = $shared; + $options['shared'] = $this->app->getPostParam("shared"); } - if (!is_null($tenantId)) + if (isset($this->app->getPostParam("tenantId"))) { - $options['tenantId'] = $tenantId; + $options['tenantId'] = $this->app->getPostParam("tenantId"); } + try + { $network = $this->libClass->createNetworks($options); - + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } - return $network; + } - public function create_subnet($networkId,$ipVersion,$cidr,$name,$gatewayIp,$dnsNameservers,$allocationPools,$hostRoutes,$enableDhcp,$tenantId) + public function create_subnet() { $options = array(); - if (!is_null($networkId)) + if (isset($this->app->getPostParam("networkId"))) { $options['networkId'] = $networkId; } - if (!is_null($ipVersion)) + if (isset($this->app->getPostParam("ipVersion"))) { - $options['ipVersion'] = $ipVersion; + $options['ipVersion'] = $this->app->getPostParam("ipVersion"); } - if (!is_null($cidr)) + if (isset($this->app->getPostParam("cidr"))) { - $options['cidr'] = $cidr; + $options['cidr'] = $this->app->getPostParam("cidr"); } - if (!is_null($tenantId)) + if (isset($this->app->getPostParam("tenantId"))) { - $options['tenantId'] = $tenantId; + $options['tenantId'] = $this->app->getPostParam("tenantId"); } - if (!is_null($name)) + if (isset($this->app->getPostParam("name"))) { - $options['name'] = $name; + $options['name'] = $$this->app->getPostParam("name"); } - if (!is_null($gatewayIp)) + if (isset($this->app->getPostParam("gatewayIp"))) { - $options['gatewayIp'] = $gatewayIp; + $options['gatewayIp'] = $this->app->getPostParam("gatewayIp"); } - if (!is_null($dnsNameservers)) + if (isset($this->app->getPostParam("dnsNameservers"))) { - $options['dnsNameservers'] = $dnsNameservers; + $options['dnsNameservers'] = $this->app->getPostParam("dnsNameservers"); } - if (!is_null($allocationPools)) + if (isset($this->app->getPostParam("allocationPools"))) { - $options['allocationPools'] = $allocationPools; + $options['allocationPools'] = $this->app->getPostParam("allocationPools"); } - if (!is_null($hostRoutes)) + if (isset($this->app->getPostParam("hostRoutes"))) { - $options['hostRoutes'] = $hostRoutes; + $options['hostRoutes'] = $this->app->getPostParam("hostRoutes"); } - if (!is_null($enableDhcp)) + if (isset($this->app->getPostParam("enableDhcp"))) { - $options['enableDhcp'] = $enableDhcp; + $options['enableDhcp'] = $this->app->getPostParam("enableDhcp"); } - if (!is_null($tenantId)) + if (isset($this->app->getPostParam("tenantId"))) { - $options['tenantId'] = $tenantId; + $options['tenantId'] = $this->app->getPostParam("tenantId"); } - $subnet = $this->libClass->createSubnet($options); + try + { + $subnet = $this->libClass->createSubnet($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } - return $subnet; + } public function list_network_ids() { + try + { + $ln = $this->libClass->listNetworks(); - $ln = $this->libClass->listNetworks(); - - $list_ids = array(); + $list_ids = array(); - foreach($ln as $n) - { + foreach($ln as $n) + { - $list_ids[] = $n->id; + $list_ids[] = $n->id; + } } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } - return $list_ids; + $this->app->setOutput("ListNetworkIds", $list_ids); } public function list_network_names() { + try + { + $ln = $this->libClass->listNetworks(); - $ln = $this->libClass->listNetworks(); - - $list_names = array(); + $list_names = array(); - foreach($ln as $n) - { + foreach($ln as $n) + { - $list_names[] = $n->name; + $list_names[] = $n->name; + } + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } - return $list_names; + $this->app->setOutput("ListNetworkNames", $list_names); } public function list_cidr() { - - $ls = $this->libClass->listSubnets(); - $list_cidr = array(); - foreach ($ls as $subnet) - { - - $list_cidr[] = $subnet->cidr; - } - - return $list_names; + try + { + $ls = $this->libClass->listSubnets(); + $list_cidr = array(); + foreach ($ls as $subnet) + { + + $list_cidr[] = $subnet->cidr; + } + + $this->app->setOutput("ListCidr", $list_cidr); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } - //option array() - public function getNetwork($idNet) + + public function getNetwork() { $network=""; try - { $newtork = $this->libClass->getNetwork($idNet); + { $newtork = $this->libClass->getNetwork($this->app->getPostParam("networkId")); $network->retrieve(); } - catch (OpenStack\Common\Error\BadResponseError $e) + + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) { - $network = "Id non existant "; - } - catch (Exception $e) + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) { - $network = 'Exception reçue : ', $e->getMessage(), "\n"; + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + $this->app->setOutput("Network", $network); + } + + public function getNetwork($netId) + { + $network=""; + + try + { $newtork = $this->libClass->getNetwork($netId); + $network->retrieve(); + + } + + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + return $network; } - public function getSubnet($idSub) + public function getSubnet() { $sbnet=""; try - { $subnet = $this->libClass->getSubnet($idSub); + { $subnet = $this->libClass->getSubnet($this->app->getPostParam("subnetId")); $subnet->retrieve(); - return $sbnet; + } - catch (OpenStack\Common\Error\BadResponseError $e) + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) { - echo "Id non existant "; - } - catch (Exception $e) + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) { - echo 'Exception reçue : ', $e->getMessage(), "\n"; + $this->app->getErrorInstance->NotImplementedHandler($e); + } + $this->app->setOutput("Subnet", subnet); + + } + + public function getSubnet($subnetId) + { + $subnet=""; + + try + { $subnet = $this->libClass->getSubnet($subnetId); + $subnet->retrieve(); + + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + return $subnet; - } + } - public function updateNetwork($idNet,$name,$shared,$adminStateUp) - { - $network = getNetwork($idNet); - if(!is_null($name)) + public function updateNetwork() + { + $options = array(); + if(isset($this->app->getPostParam("name"))) { - $network->name = $name; + $options['name'] = $this->app->getPostParam("name"); } - if(!is_null($shared)) + if(isset($this->app->getPostParam("shared"))) { - $network->shared = $shared; + $options['shared'] = $this->app->getPostParam("shared"); } - if(!is_null($adminStateUp)) + if(isset($this->app->getPostParam("adminStateUp"))) { - $network->adminStateUp = $shared; + $options['adminStateUp'] = $this->app->getPostParam("adminStateUp"); } - $network->update(); + try + { + $network = getNetwork($this->app->getPostParam("networkId")); + + $network->update($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } - public function updateSubnet($idSub,$name,$networkId,$ipVersion,$cidr) - { - $subnet = getNetwork($idSub); - if(!is_null($name)) + public function updateSubnet() + { + $options = array(); + if(isset($this->app->getPostParam("name"))) { - $subnet->name = $name; + $options['name'] = $this->app->getPostParam("name"); } - if(!is_null($networkId)) + if(isset($this->app->getPostParam("networkId"))) { - $subnet->networkId = $networkId; + $options['networkId'] = $this->app->getPostParam("networkId"); } - if(!is_null($ipVersion)) + if(isset($this->app->getPostParam("ipVersion"))) { - $subnet->ipVersion = $ipVersion; + $options['ipVersion'] = $this->app->getPostParam("ipVersion"); } - if(!is_null($cidr)) + if(isset($this->app->getPostParam("cidr"))) { - $subnet->cidr = $cidr; + $options['cidr'] = $this->app->getPostParam("cidr"); } - $subnet->update(); + try + { + $subnet = getSubnet($this->app->getPostParam("networkId")); + + $subnet->update($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } - public function deleteNetwork($idNet) + public function deleteNetwork() { - $network = getNetwork($idNet); - $network->delete(); + try + { + + $network = getNetwork($this->app->getPostParam("networkId")); + $network->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } - public function deleteSubnet($idSub) + public function deleteSubnet() { - $subnet = getNetwork($idSub); - $subnet->delete(); + try + { + $subnet = getNetwork($this->app->getPostParam("subnetId")); + $subnet->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } - public function createPort($networkId,$name,$adminStateUp,$macAddress,$fixedIps,$deviceId,$deviceOwner,$securityGroups,$tenantId) + public function createPort() { $options = array(); - if (!is_null($networkId)) + if (isset($this->app->getPostParam("networkId"))) { - $options['networkId'] = $networkId; + $options['networkId'] = $this->app->getPostParam("networkId"); } - if (!is_null($name)) + if (isset($this->app->getPostParam("name"))) { - $options['name'] = $name; + $options['name'] = $this->app->getPostParam("name"); } - if (!is_null($adminStateUp)) + if (isset($this->app->getPostParam("adminStateUp"))) { - $options['adminStateUp'] = $adminStateUp; + $options['adminStateUp'] = $this->app->getPostParam("adminStateUp"); } - if (!is_null($macAddress)) + if (isset($this->app->getPostParam("macAddress"))) { - $options['macAddress'] = $macAddress; + $options['macAddress'] = $this->app->getPostParam("macAddress"); } - if (!is_null($fixedIps)) + if (isset($this->app->getPostParam("fixedIps"))) { - $options['fixedIps'] = $fixedIps; + $options['fixedIps'] = $this->app->getPostParam("fixedIps"); } - if (!is_null($deviceId)) + if (isset($this->app->getPostParam("deviceId"))) { - $options['deviceId'] = $deviceId; + $options['deviceId'] = $this->app->getPostParam("deviceId"); } - if (!is_null($deviceOwner)) + if (isset($this->app->getPostParam("deviceOwner"))) { - $options['deviceOwner'] = $deviceOwner; + $options['deviceOwner'] = $this->app->getPostParam("deviceOwner"); } - if (!is_null($securityGroups)) + if (isset($this->app->getPostParam("securityGroups"))) { - $options['securityGroups'] = $securityGroups; + $options['securityGroups'] = $this->app->getPostParam("securityGroups"); } - if (!is_null($tenantId)) + if (isset($this->app->getPostParam("tenantId"))) { - $options['tenantId'] = $tenantId; + $options['tenantId'] = $this->app->getPostParam("tenantId"); } - - $this->libClass->createPort($options); + try + { + $this->libClass->createPort($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } public function listPorts() { - return $this->libClass->listPorts(); + try + { + $this->app->setOutput("listPorts", $this->libClass->listPorts()); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function getPort() + { + try + { + $port = $this->libClass->getport($this->app->getPostParam("portId")); + $this->app->setOutput("Port", $port); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } public function getPort($portId) @@ -307,124 +623,280 @@ class network{ $port = $this->libClass->getport($portId); return $port; } - catch (Exception $e) + catch(BadResponseError $e) { - echo 'id fourni non disponible'; - } + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } - } + } - public function updatePort($networkId,$name,$adminStateUp,$macAddress,$fixedIps,$deviceId,$deviceOwner,$securityGroups,$tenantId) + public function updatePort() { $options = array(); - if (!is_null($networkId)) + + if (isset($this->app->getPostParam("networkId"))) { - $options['networkId'] = $networkId; + $options['networkId'] = $this->app->getPostParam("networkId"); } - if (!is_null($name)) + if (isset($this->app->getPostParam("name"))) { - $options['name'] = $name; + $options['name'] =$this->app->getPostParam("name"); } - if (!is_null($adminStateUp)) + if (isset($this->app->getPostParam("adminStateUp"))) { - $options['adminStateUp'] = $adminStateUp; + $options['adminStateUp'] =$this->app->getPostParam("adminStateUp"); } - if (!is_null($macAddress)) + if (isset($this->app->getPostParam("macAddress"))) { - $options['macAddress'] = $macAddress; + $options['macAddress'] = $this->app->getPostParam("macAddress"); } - if (!is_null($fixedIps)) + if (isset($this->app->getPostParam("fixedIps"))) { - $options['fixedIps'] = $fixedIps; + $options['fixedIps'] = $this->app->getPostParam("fixedIps"); } - if (!is_null($deviceId)) + if (isset($this->app->getPostParam("deviceId"))) { - $options['deviceId'] = $deviceId; + $options['deviceId'] = $this->app->getPostParam("deviceId"); } - if (!is_null($deviceOwner)) + if (isset($this->app->getPostParam("deviceOwner"))) { - $options['deviceOwner'] = $deviceOwner; + $options['deviceOwner'] = $this->app->getPostParam("deviceOwner"); } - if (!is_null($securityGroups)) + if (isset($this->app->getPostParam("networkId"))) { - $options['securityGroups'] = $securityGroups; + $options['securityGroups'] = $this->app->getPostParam("securityGroups"); } - if (!is_null($tenantId)) + if (isset($this->app->getPostParam("tenantId"))) { - $options['tenantId'] = $tenantId; + $options['tenantId'] = $this->app->getPostParam("tenantId"); } - - $this->libClass->update($options); + try + { + $port = getPort($this->app->getPostParam("networkId")); + $port->update($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } - public function deletePort($portId) + public function deletePort() { - $port = getPort($portId); - $port->delete(); + + try + { + $port = getPort($this->app->getPostParam("portId")); + $port->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } - public function createSecurityGroup($name,$description) + public function createSecurityGroup() { $options = array(); - if (!is_null($name)) + if (isset($this->app->getPostParam("name"))) { - $options['name'] = $name; + $options['name'] = $this->app->getPostParam("name"); } - if (!is_null($description)) + if (isset($this->app->getPostParam("description"))) { - $options['description'] = $description; + $options['description'] = $this->app->getPostParam("description"); } - - $this->libClass->createSecurityGroup($options); + try + { + $this->libClass->createSecurityGroup($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } - public function createSecurityGroupRule($securityGroupId,$direction,$ethertype,$portRangeMin,$portRangeMax,$protocol,$remoteGroupId,$remoteIpPrefix) + public function createSecurityGroupRule() { $options = array(); - if (!is_null($securityGroupId)) + if (isset($this->app->getPostParam("securityGroupId"))) { - $options['securityGroupId'] = $securityGroupId; + $options['securityGroupId'] = $this->app->getPostParam("securityGroupId"); } - if (!is_null($direction)) + if (isset($this->app->getPostParam("direction"))) { - $options['direction'] = $direction; + $options['direction'] = $this->app->getPostParam("direction"); } - if (!is_null($ethertype)) + if (isset($this->app->getPostParam("ethertype"))) { - $options['ethertype'] = $ethertype; + $options['ethertype'] = $this->app->getPostParam("ethertype"); } - if (!is_null($portRangeMin)) + if (isset($this->app->getPostParam("portRangeMin"))) { - $options['portRangeMin'] = $portRangeMin; + $options['portRangeMin'] = $this->app->getPostParam("portRangeMin"); } - if (!is_null($portRangeMax)) + if (isset($this->app->getPostParam("portRangeMax"))) { - $options['portRangeMax'] = $portRangeMax; + $options['portRangeMax'] = $this->app->getPostParam("portRangeMax"); } - if (!is_null($protocol)) + if (isset($this->app->getPostParam("protocol"))) { - $options['protocol'] = $protocol; + $options['protocol'] = $this->app->getPostParam("protocol"); } - if (!is_null($remoteGroupId)) + if (isset($this->app->getPostParam("remoteGroupId"))) { - $options['remoteGroupId'] = $remoteGroupId; + $options['remoteGroupId'] = $this->app->getPostParam("remoteGroupId"); } - if (!is_null($remoteIpPrefix)) + if (isset($this->app->getPostParam("remoteIpPrefix"))) { - $options['remoteIpPrefix'] = $remoteIpPrefix; + $options['remoteIpPrefix'] = $this->app->getPostParam("remoteIpPrefix"); } - $this->libClass->createSecurityGroupRule($options); + try + { + $this->libClass->createSecurityGroupRule($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } public function listSecurityGroupe() { - return $this->libClass->listSecurityGroups(); + try + { + $this->app->setOutput("listSecurityGroups", $this->libClass->listSecurityGroups()); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } public function listSecurityGroupeRule() { - return $this->libClass->listSecurityGroupRules(); + try + { + + $this->app->setOutput("listSecurityGroupeRule", $this->libClass->listSecurityGroupRules()); + + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function getSecurityGroupe() + { + try + { + $securityGroupe = $this->libClass->getSecurityGroupe($this->app->getPostParam("securityGroupeId")); + $this->app->setOutput("securityGroupe", $securityGroupe); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } public function getSecurityGroupe($securityGroupeId) @@ -434,15 +906,47 @@ class network{ $securityGroupe = $this->libClass->getSecurityGroupe($securityGroupeId); return $securityGroupe; } - catch (Exception $e) + catch(BadResponseError $e) { - echo 'id fourni non disponible'; - } + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } - public function deleteSecurityGroupe($securityGroupeId) - { - $securityGroupe = getSecurityGroupe($securityGroupeId); - $securityGroupe->delete(); + public function deleteSecurityGroupe() + { + try + { + + $securityGroupe = getSecurityGroupe($this->app->getPostParam("securityGroupeId")); + $securityGroupe->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } } diff --git a/server/core/Network.php~ b/server/core/Network.php~ new file mode 100644 index 0000000..65de962 --- /dev/null +++ b/server/core/Network.php~ @@ -0,0 +1,952 @@ +app = $app; + $this->libClass = $app->getLibClass("network"); + + } + + + public function action($action){ + + $this->{$action.""}(); + + } + + + public function create_network() + { + $options = array(); + if (isset($this->app->getPostParam("name"))) + { + $options['name'] = $this->app->getPostParam("name"); + } + if (isset($this->app->getPostParam("adminStateUp"))) + { + $options['adminStateUp'] = $this->app->getPostParam("adminStateUp"); + } + if (isset($this->app->getPostParam("shared"))) + { + $options['shared'] = $this->app->getPostParam("shared"); + } + if (isset($this->app->getPostParam("tenantId"))) + { + $options['tenantId'] = $this->app->getPostParam("tenantId"); + } + try + { + $network = $this->libClass->createNetworks($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + + } + + public function create_subnet() + { $options = array(); + if (isset($this->app->getPostParam("networkId"))) + { + $options['networkId'] = $networkId; + } + if (isset($this->app->getPostParam("ipVersion"))) + { + $options['ipVersion'] = $this->app->getPostParam("ipVersion"); + } + if (isset($this->app->getPostParam("cidr"))) + { + $options['cidr'] = $this->app->getPostParam("cidr"); + } + if (isset($this->app->getPostParam("tenantId"))) + { + $options['tenantId'] = $this->app->getPostParam("tenantId"); + } + if (isset($this->app->getPostParam("name"))) + { + $options['name'] = $$this->app->getPostParam("name"); + } + if (isset($this->app->getPostParam("gatewayIp"))) + { + $options['gatewayIp'] = $this->app->getPostParam("gatewayIp"); + } + if (isset($this->app->getPostParam("dnsNameservers"))) + { + $options['dnsNameservers'] = $this->app->getPostParam("dnsNameservers"); + } + if (isset($this->app->getPostParam("allocationPools"))) + { + $options['allocationPools'] = $this->app->getPostParam("allocationPools"); + } + if (isset($this->app->getPostParam("hostRoutes"))) + { + $options['hostRoutes'] = $this->app->getPostParam("hostRoutes"); + } + if (isset($this->app->getPostParam("enableDhcp"))) + { + $options['enableDhcp'] = $this->app->getPostParam("enableDhcp"); + } + if (isset($this->app->getPostParam("tenantId"))) + { + $options['tenantId'] = $this->app->getPostParam("tenantId"); + } + + try + { + $subnet = $this->libClass->createSubnet($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + + } + + public function list_network_ids() + { + try + { + $ln = $this->libClass->listNetworks(); + + $list_ids = array(); + + + foreach($ln as $n) + { + + $list_ids[] = $n->id; + + + } + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + $this->app->setOutput("ListNetworkIds", $list_ids); + } + + public function list_network_names() + { + try + { + $ln = $this->libClass->listNetworks(); + + $list_names = array(); + + + foreach($ln as $n) + { + + $list_names[] = $n->name; + + + } + + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + $this->app->setOutput("ListNetworkNames", $list_names); + } + + public function list_cidr() + { + try + { + $ls = $this->libClass->listSubnets(); + $list_cidr = array(); + foreach ($ls as $subnet) + { + + $list_cidr[] = $subnet->cidr; + } + + $this->app->setOutput("ListCidr", $list_cidr); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function getNetwork() + { + $network=""; + + try + { $newtork = $this->libClass->getNetwork($this->app->getPostParam("networkId")); + $network->retrieve(); + + + } + + + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + $this->app->setOutput("Network", $network); + } + + public function getNetwork($netId) + { + $network=""; + + try + { $newtork = $this->libClass->getNetwork($netId); + $network->retrieve(); + + + } + + + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + return $network; + } + + public function getSubnet() + { + $sbnet=""; + + try + { $subnet = $this->libClass->getSubnet($this->app->getPostParam("subnetId")); + $subnet->retrieve(); + + + } + + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + $this->app->setOutput("Subnet", subnet); + + } + + public function getSubnet($subnetId) + { + $subnet=""; + + try + { $subnet = $this->libClass->getSubnet($subnetId); + $subnet->retrieve(); + + + } + + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + return $subnet; + + } + + public function updateNetwork() + { + $options = array(); + if(isset($this->app->getPostParam("name"))) + { + $options['name'] = $this->app->getPostParam("name"); + } + if(isset($this->app->getPostParam("shared"))) + { + $options['shared'] = $this->app->getPostParam("shared"); + } + if(isset($this->app->getPostParam("adminStateUp"))) + { + $options['adminStateUp'] = $this->app->getPostParam("adminStateUp"); + } + try + { + $network = getNetwork($this->app->getPostParam("networkId")); + + $network->update($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function updateSubnet() + { + $options = array(); + if(isset($this->app->getPostParam("name"))) + { + $options['name'] = $this->app->getPostParam("name"); + } + if(isset($this->app->getPostParam("networkId"))) + { + $options['networkId'] = $this->app->getPostParam("networkId"); + } + if(isset($this->app->getPostParam("ipVersion"))) + { + $options['ipVersion'] = $this->app->getPostParam("ipVersion"); + } + if(isset($this->app->getPostParam("cidr"))) + { + $options['cidr'] = $this->app->getPostParam("cidr"); + } + try + { + $subnet = getSubnet($this->app->getPostParam("networkId")); + + $subnet->update($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function deleteNetwork() + { + try + { + + $network = getNetwork($this->app->getPostParam("networkId")); + $network->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function deleteSubnet() + { + try + { + $subnet = getNetwork($this->app->getPostParam("subnetId")); + $subnet->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function createPort() + { + $options = array(); + if (isset($this->app->getPostParam("networkId"))) + { + $options['networkId'] = $this->app->getPostParam("networkId"); + } + if (isset($this->app->getPostParam("name"))) + { + $options['name'] = $this->app->getPostParam("name"); + } + if (isset($this->app->getPostParam("adminStateUp"))) + { + $options['adminStateUp'] = $this->app->getPostParam("adminStateUp"); + } + if (isset($this->app->getPostParam("macAddress"))) + { + $options['macAddress'] = $this->app->getPostParam("macAddress"); + } + if (isset($this->app->getPostParam("fixedIps"))) + { + $options['fixedIps'] = $this->app->getPostParam("fixedIps"); + } + if (isset($this->app->getPostParam("deviceId"))) + { + $options['deviceId'] = $this->app->getPostParam("deviceId"); + } + if (isset($this->app->getPostParam("deviceOwner"))) + { + $options['deviceOwner'] = $this->app->getPostParam("deviceOwner"); + } + if (isset($this->app->getPostParam("securityGroups"))) + { + $options['securityGroups'] = $this->app->getPostParam("securityGroups"); + } + if (isset($this->app->getPostParam("tenantId"))) + { + $options['tenantId'] = $this->app->getPostParam("tenantId"); + } + try + { + $this->libClass->createPort($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function listPorts() + { + try + { + $this->app->setOutput("listPorts", $this->libClass->listPorts()); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function getPort() + { + try + { + $port = $this->libClass->getport($this->app->getPostParam("portId")); + $this->app->setOutput("Port", $port); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + } + + public function getPort($portId) + { + try + { + $port = $this->libClass->getport($portId); + return $port; + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + } + + public function updatePort() + { + $options = array(); + + if (isset($this->app->getPostParam("networkId"))) + { + $options['networkId'] = $this->app->getPostParam("networkId"); + } + if (isset($this->app->getPostParam("name"))) + { + $options['name'] =$this->app->getPostParam("name"); + } + if (isset($this->app->getPostParam("adminStateUp"))) + { + $options['adminStateUp'] =$this->app->getPostParam("adminStateUp"); + } + if (isset($this->app->getPostParam("macAddress"))) + { + $options['macAddress'] = $this->app->getPostParam("macAddress"); + } + if (isset($this->app->getPostParam("fixedIps"))) + { + $options['fixedIps'] = $this->app->getPostParam("fixedIps"); + } + if (isset($this->app->getPostParam("deviceId"))) + { + $options['deviceId'] = $this->app->getPostParam("deviceId"); + } + if (isset($this->app->getPostParam("deviceOwner"))) + { + $options['deviceOwner'] = $this->app->getPostParam("deviceOwner"); + } + if (isset($this->app->getPostParam("networkId"))) + { + $options['securityGroups'] = $this->app->getPostParam("securityGroups"); + } + if (isset($this->app->getPostParam("tenantId"))) + { + $options['tenantId'] = $this->app->getPostParam("tenantId"); + } + try + { + $port = getPort($this->app->getPostParam("networkId")); + $port->update($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function deletePort() + { + + try + { + $port = getPort($this->app->getPostParam("portId")); + $port->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function createSecurityGroup() + { + $options = array(); + if (isset($this->app->getPostParam("name"))) + { + $options['name'] = $this->app->getPostParam("name"); + } + if (isset($this->app->getPostParam("description"))) + { + $options['description'] = $this->app->getPostParam("description"); + } + try + { + $this->libClass->createSecurityGroup($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + } + + public function createSecurityGroupRule() + { + $options = array(); + if (isset($this->app->getPostParam("securityGroupId"))) + { + $options['securityGroupId'] = $this->app->getPostParam("securityGroupId"); + } + if (isset($this->app->getPostParam("direction"))) + { + $options['direction'] = $this->app->getPostParam("direction"); + } + if (isset($this->app->getPostParam("ethertype"))) + { + $options['ethertype'] = $this->app->getPostParam("ethertype"); + } + if (isset($this->app->getPostParam("portRangeMin"))) + { + $options['portRangeMin'] = $this->app->getPostParam("portRangeMin"); + } + if (isset($this->app->getPostParam("portRangeMax"))) + { + $options['portRangeMax'] = $this->app->getPostParam("portRangeMax"); + } + if (isset($this->app->getPostParam("protocol"))) + { + $options['protocol'] = $this->app->getPostParam("protocol"); + } + if (isset($this->app->getPostParam("remoteGroupId"))) + { + $options['remoteGroupId'] = $this->app->getPostParam("remoteGroupId"); + } + if (isset($this->app->getPostParam("remoteIpPrefix"))) + { + $options['remoteIpPrefix'] = $this->app->getPostParam("remoteIpPrefix"); + } + try + { + $this->libClass->createSecurityGroupRule($options); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + + public function listSecurityGroupe() + { + try + { + $this->app->setOutput("listSecurityGroups", $this->libClass->listSecurityGroups()); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function listSecurityGroupeRule() + { + try + { + + $this->app->setOutput("listSecurityGroupeRule", $this->libClass->listSecurityGroupRules()); + + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } + + public function getSecurityGroupe() + { + try + { + $securityGroupe = $this->libClass->getSecurityGroupe($this->app->getPostParam("securityGroupeId")); + $this->app->setOutput("securityGroupe", $securityGroupe); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + } + + public function getSecurityGroupe($securityGroupeId) + { + try + { + $securityGroupe = $this->libClass->getSecurityGroupe($securityGroupeId); + return $securityGroupe; + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + + } + + public function deleteSecurityGroupe() + { + try + { + + $securityGroupe = getSecurityGroupe($this->app->getPostParam("securityGroupeId")); + $securityGroupe->delete(); + } + catch(BadResponseError $e) + { + $this->app->getErrorInstance->BadResponseHandler($e); + } + catch(UserInputError $e) + { + $this->app->getErrorInstance->UserInputHandler($e); + } + catch(BaseError $e) + { + $this->app->getErrorInstance->BaseErrorHandler($e); + } + catch(NotImplementedError $e) + { + $this->app->getErrorInstance->NotImplementedHandler($e); + } + } -- cgit v1.2.3 From 1342db60283cb61a1c3810993575d35b9fb33ac0 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 23 Mar 2016 11:22:12 +0100 Subject: insertion des commentaires --- server/core/Network.php | 301 ++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 281 insertions(+), 20 deletions(-) (limited to 'server/core/Network.php') diff --git a/server/core/Network.php b/server/core/Network.php index 65de962..a4e0939 100644 --- a/server/core/Network.php +++ b/server/core/Network.php @@ -1,13 +1,42 @@ {$action.""}(); } - + /** + * Create a new network + * + * @param String name A human-readable name for the network. This name might not be unique + * @param String adminStateUp The administrative state of network. If false (down), the network does not forward packets + * @param String shared Specifies whether the network resource can be accessed by any tenant + * @param String tenantId Owner of network. Only admin users can specify a tenant ID other than their own + * + * @return void + */ public function create_network() { $options = array(); + // check the name if it is null if (isset($this->app->getPostParam("name"))) { $options['name'] = $this->app->getPostParam("name"); } + // check the adminStateUp if it is null if (isset($this->app->getPostParam("adminStateUp"))) { $options['adminStateUp'] = $this->app->getPostParam("adminStateUp"); } + // check the shared if it is null if (isset($this->app->getPostParam("shared"))) { $options['shared'] = $this->app->getPostParam("shared"); } + // check the tenantId if it is null if (isset($this->app->getPostParam("tenantId"))) { $options['tenantId'] = $this->app->getPostParam("tenantId"); } try { - $network = $this->libClass->createNetworks($options); + $network = $this->libClass->createNetworks($options); } catch(BadResponseError $e) { @@ -68,6 +116,26 @@ class network{ } + /** + * Create a new subnet + * + * @param String networkId A Network this subnet is associated with + * @param String ipVersion IP version (4 or 6) + * @param String cidr CIDR representing the IP address range for this subnet Exmple X.Y.W.Z/12 + * @param String tenantId Owner of network. Only admin users can specify a tenant ID other than their own + * @param String name A human-readable name for the subnet. This name might not be unique + * @param String gatewayIp IP address of the default gateway used by devices on this subnet + * @param String dnsNameservers DNS nameservers used by hosts in this subnet + * @param String enableDhcp Specifies whether DHCP is enabled for this subnet + * @param String hostRoutes Routes that should be used by devices with IP addresses from this subnet (not including the local subnet route) + * @param BOOLEAN enableDhcp Specifies whether DHCP is enabled for this subnet + * @param String allocationPools Subranges of the CIDR available for dynamic allocation to ports + * + * + * + * @return void + */ + public function create_subnet() { $options = array(); if (isset($this->app->getPostParam("networkId"))) @@ -139,6 +207,12 @@ class network{ } + /** + * List the ID of the NETWORKS + * + * @return List of Networks ID + */ + public function list_network_ids() { try @@ -176,6 +250,12 @@ class network{ $this->app->setOutput("ListNetworkIds", $list_ids); } + /** + * List the name of the NETWORKS + * + * @return List of Networks name + */ + public function list_network_names() { try @@ -213,7 +293,11 @@ class network{ $this->app->setOutput("ListNetworkNames", $list_names); } - + /** + * List the CIDR of the SUBNETS + * + * @return List of SUBNETS CIDR + */ public function list_cidr() { try @@ -245,7 +329,12 @@ class network{ $this->app->getErrorInstance->NotImplementedHandler($e); } } - + /** + * retrieve a specific network + * @param networkId ID of network which we want to get + * @return Network + */ + retrieve a specific network public function getNetwork() { $network=""; @@ -277,8 +366,13 @@ class network{ $this->app->setOutput("Network", $network); } - - public function getNetwork($netId) + + /** + * internal function + * @param String netId ID of network which we want to get + * @return Network + */ + private function getNetwork($netId) { $network=""; @@ -310,6 +404,11 @@ class network{ return $network; } + /** + * retrieve a specific subnet + * @param subnetId ID of subnet which we want to get + * @return subnet + */ public function getSubnet() { $sbnet=""; @@ -340,8 +439,12 @@ class network{ $this->app->setOutput("Subnet", subnet); } - - public function getSubnet($subnetId) + /** + * internal function + * @param String subnetId ID of subnet which we want to get + * @return subnet + */ + private function getSubnet($subnetId) { $subnet=""; @@ -371,6 +474,18 @@ class network{ return $subnet; } + + /** + * Update a network given + * + * @param String name A human-readable name for the network. This name might not be unique + * @param String adminStateUp The administrative state of network. If false (down), the network does not forward packets + * @param String shared Specifies whether the network resource can be accessed by any tenant + * @param String tenantId Owner of network. Only admin users can specify a tenant ID other than their own + * + * + * @return void + **/ public function updateNetwork() { @@ -411,6 +526,25 @@ class network{ } } + /** + * Update a subnet given + * + * @param String networkId A Network this subnet is associated with + * @param String ipVersion IP version (4 or 6) + * @param String cidr CIDR representing the IP address range for this subnet Exmple X.Y.W.Z/12 + * @param String tenantId Owner of network. Only admin users can specify a tenant ID other than their own + * @param String name A human-readable name for the subnet. This name might not be unique + * @param String gatewayIp IP address of the default gateway used by devices on this subnet + * @param String dnsNameservers DNS nameservers used by hosts in this subnet + * @param String enableDhcp Specifies whether DHCP is enabled for this subnet + * @param String hostRoutes Routes that should be used by devices with IP addresses from this subnet (not including the local subnet route) + * @param BOOLEAN enableDhcp Specifies whether DHCP is enabled for this subnet + * @param String allocationPools Subranges of the CIDR available for dynamic allocation to ports + * + * + * @return void + **/ + public function updateSubnet() { $options = array(); @@ -453,7 +587,16 @@ class network{ $this->app->getErrorInstance->NotImplementedHandler($e); } } - + + /** + * Delete a network given + * + * @param String networkId ID if network which we want to delete + + * + * + * @return void + **/ public function deleteNetwork() { try @@ -479,7 +622,16 @@ class network{ $this->app->getErrorInstance->NotImplementedHandler($e); } } - + + /** + * Delete a subnet given + * + * @param String subnetId ID if network which we want to delete + + * + * + * @return void + **/ public function deleteSubnet() { try @@ -505,6 +657,22 @@ class network{ } } + /** + * Create a new port + * + * @param String networkId Network this port is associated with + * @param String name A human-readable name for the port. This name might not be unique + * @param String adminStateUp The administrative state of port. If false (down), the port does not forward packets + * @param String macAddress MAC address to use on this port + * @param String fixedIps IP addresses for this port + * @param String deviceId Identifies the device (for example, virtual server) using this port + * @param String deviceOwner Identifies the entity (for example, DHCP agent) using this port + * @param String securityGroups Specifies the IDs of any security groups associated with this port + * @param String tenantId Owner of the port. Only admin users can specify a tenant ID other than their own. + * + * @return void + */ + public function createPort() { $options = array(); @@ -565,6 +733,12 @@ class network{ $this->app->getErrorInstance->NotImplementedHandler($e); } } + + /** + * List the of ports + * + * @return List of ports + */ public function listPorts() { @@ -590,6 +764,12 @@ class network{ } } + /** + * retrieve a specific port given + * @param portId ID of port which we want to get + * @return port + */ + public function getPort() { try @@ -616,7 +796,14 @@ class network{ } - public function getPort($portId) + /** + * internal function + * retrieve a specific port given + * @param portId ID of port which we want to get + * @return port + */ + + private function getPort($portId) { try { @@ -642,6 +829,22 @@ class network{ } + + /** + * Update port given + * + * @param String networkId Network this port is associated with + * @param String name A human-readable name for the port. This name might not be unique + * @param String adminStateUp The administrative state of port. If false (down), the port does not forward packets + * @param String macAddress MAC address to use on this port + * @param String fixedIps IP addresses for this port + * @param String deviceId Identifies the device (for example, virtual server) using this port + * @param String deviceOwner Identifies the entity (for example, DHCP agent) using this port + * @param String securityGroups Specifies the IDs of any security groups associated with this port + * @param String tenantId Owner of the port. Only admin users can specify a tenant ID other than their own. + * + * @return void + */ public function updatePort() { $options = array(); @@ -704,7 +907,13 @@ class network{ $this->app->getErrorInstance->NotImplementedHandler($e); } } - + /** + * Delete a port given + * + * @param String portId id of port which we wante to delete + + * @return void + */ public function deletePort() { @@ -731,6 +940,15 @@ class network{ } } + /** + * Create a new security groupe + * + * @param String name A human-readable name for the security group. This name might not be unique + * @param String description Description of the security group + * + * @return void + */ + public function createSecurityGroup() { $options = array(); @@ -764,7 +982,21 @@ class network{ } } - + + /** + * Create a new security groupe + * + * @param String securityGroupId The security group ID to associate with this security group rule. + * @param String direction The direction in which the security group rule is applied. For a compute instance, an ingress security group * rule is applied to incoming (ingress) traffic for that instance. An egress rule is applied to traffic leaving the instance. + * @param String ethertype Must be IPv4 or IPv6, and addresses represented in CIDR must match the ingress or egress rules. + * @param String portRangeMin The minimum port number in the range that is matched by the security group rule. If the protocol is TCP or UDP, this value must be less than or equal to the value of the portRangeMax attribute. If the protocol is ICMP, this value must be an ICMP type + *@param String portRangeMax The maximum port number in the range that is matched by the security group rule. If the protocol is TCP or UDP, this value must be less than or equal to the value of the portRangeMax attribute. If the protocol is ICMP, this value must be an ICMP type. + *@param String protocol The protocol that is matched by the security group rule + *@param String remoteGroupId The remote group ID to be associated with this security group rule. You can specify either remoteGroupId or remoteGroupPrefix + *@param String remoteIpPrefix The remote IP prefix to be associated with this security group rule. You can specify either remoteGroupId or remoteGroupPrefix + * + * @return void + */ public function createSecurityGroupRule() { $options = array(); @@ -822,6 +1054,12 @@ class network{ } } + + /** + * List of Security Groupes + * + * @return List of Security Groupes + */ public function listSecurityGroupe() { @@ -846,6 +1084,13 @@ class network{ $this->app->getErrorInstance->NotImplementedHandler($e); } } + + + /** + * List of Security Groupe Rules + * + * @return List of Security Groupe Rules + */ public function listSecurityGroupeRule() { @@ -872,6 +1117,12 @@ class network{ $this->app->getErrorInstance->NotImplementedHandler($e); } } + + /** + * retrieve a specific Security Groupe given + * @param securityGroupeId ID of security Groupe which we want to get + * @return securityGroupe + */ public function getSecurityGroupe() { @@ -898,8 +1149,14 @@ class network{ } } - - public function getSecurityGroupe($securityGroupeId) + + /** + * internal function + * retrieve a specific Security Groupe given + * @param securityGroupeId ID of security Groupe which we want to get + * @return securityGroupe + */ + private function getSecurityGroupe($securityGroupeId) { try { @@ -924,7 +1181,11 @@ class network{ } } - + /** + * Delete a specific Security Groupe given + * @param securityGroupeId ID of security Groupe which we want to get + * @return void + */ public function deleteSecurityGroupe() { try -- cgit v1.2.3