summaryrefslogtreecommitdiff
path: root/server/core
diff options
context:
space:
mode:
Diffstat (limited to 'server/core')
-rw-r--r--server/core/Network.php880
-rw-r--r--server/core/Network.php~952
2 files changed, 1644 insertions, 188 deletions
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 @@
+<?php
+
+class network{
+
+ protected $app;
+
+ protected $libClass;
+
+
+
+
+
+
+ public function __construct($app){
+ $this->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);
+ }
+ }