diff options
| author | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2016-03-30 14:14:10 +0200 |
|---|---|---|
| committer | manzerbredes <loic.guegan_secondary@yahoo.fr> | 2016-03-30 14:14:10 +0200 |
| commit | 237b627bf6cdf31e8923fc67653a73b6b9978540 (patch) | |
| tree | 20449eb6aee87f582639ad6e3bd5dcf3dc06ecfa /server/core | |
| parent | f4da4f285a4689e1d4eb8bb7d800d6570dfba6d0 (diff) | |
| parent | b6ffc16d78e3fd22f9d728d45cef1c78c182cc1f (diff) | |
Merge branch 'develop' into loic
Diffstat (limited to 'server/core')
| -rwxr-xr-x | server/core/Automating.php | 48 | ||||
| -rwxr-xr-x | server/core/Compute.php | 12 | ||||
| -rwxr-xr-x | server/core/LibOverride/genTokenOptions.php | 8 | ||||
| -rwxr-xr-x | server/core/Network.php | 44 |
4 files changed, 68 insertions, 44 deletions
diff --git a/server/core/Automating.php b/server/core/Automating.php index 7f2c654..1eef72c 100755 --- a/server/core/Automating.php +++ b/server/core/Automating.php @@ -5,7 +5,7 @@ * @version 1.0 Initialisation of this file * @since 1.0 Core application's file * -* @author Evan Pisani 'yogg at epsina . com' +* @author Evan Pisani 'yogg at epsina . com' et bhupi * * @todo Complete the functions with errors detection and finish the descriptions */ @@ -16,25 +16,28 @@ include("Network.php"); include("Compute.php"); class automating implements Core{ + /** @var App $app protected, contains the main app object */ - protected $app; - - /** @var OpenStack\Identity $libClass protected, contains the library Identity object */ - protected $libClass; + protected $appCompute; + protected $appImage; + protected $appNetwork; + protected $appIdentity; /** - * Image constructor + * Our library's app constructor for all server app objects * - * @param App $app the main app object + * @param App $app the main app object, e.g. compute, image, network, etc. * - * @return Image + * @return */ public function __construct($app){ if(!isset($app)){ - $this->app->setOutput("Error", "Incorrect parameter app"); + $this->app->setOutput("Error", "Parameter app missing."); } - $this->app = $app; - $this->libClass = $app->getLibClass("Automating"); + $this->appCompute = $appCompute; + $this->appImage = $appImage; + $this->appNetwork = $appNetwork; + $this->appIdentity = $appIdentity; } /** @@ -48,6 +51,27 @@ class automating implements Core{ $this->{$action.""}(); } + public function script() + { + $opt = Array(); + $opt['name'] = getPostParam('name'); + + appImage->setPostParam('opt' $opt); + appImage->createImage(); + + appNetwork->create_network(); + appnetwork->list_network_ids(); + appNetwork->create_subnet(); + + appCompute->listFlavors(); //to show all flavors with detail. + appCompute->listImages(); //to show all images with detail and to verify that the image was created successfully by the call above. + + appCompute->setPostParam("name","Test"); + appCompute->setPostParam("imageId","CREATED_ABOVE"); + appCompute->setPostParam("flavorId","1"); + appCompute->createServer(); + + } /** * Create a new image on a new server * @@ -124,4 +148,4 @@ class automating implements Core{ } } -?>
\ No newline at end of file +?> diff --git a/server/core/Compute.php b/server/core/Compute.php index e72abf9..4a7fe6c 100755 --- a/server/core/Compute.php +++ b/server/core/Compute.php @@ -170,7 +170,7 @@ class compute try{ $serverId = $this->app->getPostParam("serverId"); if(!isset($serverId)){ - $this->app->setOutput("Error", "Server ID is missing, son!"); + $this->app->setOutput("Error", "Server ID is missing!"); return; } $opt = array('id' => $serverId); @@ -204,7 +204,7 @@ class compute try{ $flavorId = $this->app->getPostParam("flavorId"); if(!isset($serverId)){ - $this->app->setOutput("Error", "Flavor ID is missing, son!"); + $this->app->setOutput("Error", "Flavor ID is missing!"); return; } $opt = array('id' => $flavorId); @@ -238,7 +238,7 @@ class compute try{ $imageId = $this->app->getPostParam("imageId"); if(!isset($serverId)){ - $this->app->setOutput("Error", "Image ID is missing, son!"); + $this->app->setOutput("Error", "Image ID is missing!"); return; } $opt = array('id' => $imageId); @@ -274,7 +274,7 @@ class compute $imageId = $this->app->getPostParam("imageId"); $flavorId = $this->app->getPostParam("flavorId"); if(!isset($name) || !isset($imageId) || !isset($flavorId)){ - $this->app->setOutput("Error", "No, we don't let you create a server without a name OR image ID OR flavor ID."); + $this->app->setOutput("Error", "Server name OR image ID OR flavor ID is missing."); return; } $opt = array('name' => $name, 'imageId' => $imageId, 'flavorId' => $flavorId); @@ -353,7 +353,7 @@ class compute try{ $serverId = $this->app->getPostParam("serverId"); if(!isset($serverId)){ - $this->app->setOutput("Error", "Server ID is missing, son!"); + $this->app->setOutput("Error", "Server ID is missing!"); return; } $opt = array('id' => $serverId); @@ -422,7 +422,7 @@ class compute try{ $serverId = $this->app->getPostParam("serverId"); if(!isset($serverId)){ - $this->app->setOutput("Error", "Server ID is missing, son!"); + $this->app->setOutput("Error", "Server ID is missing!"); return; } $opt = array('id' => $serverId); diff --git a/server/core/LibOverride/genTokenOptions.php b/server/core/LibOverride/genTokenOptions.php index 4733c5a..1fbee06 100755 --- a/server/core/LibOverride/genTokenOptions.php +++ b/server/core/LibOverride/genTokenOptions.php @@ -51,9 +51,9 @@ class genTokenOptions } public function checkToken(){ - //error_log($this->backup['time'], 0); - //return $this->backup['time'] > time(); - return true; + //error_log(print_r($this->backup['time'], true), 0); + return $this->backup['time'] > time(); + //return true; } public function genIdentityToken(){ @@ -386,7 +386,7 @@ class genTokenOptions $token->catalog = new Models\Catalog($this->httpClient, $api); $token->catalog->services = []; - error_log(print_r($Saved["catalog"], true), 0); + //error_log(print_r($Saved["catalog"], true), 0); foreach($Saved["catalog"] as $key => $service){ $tmp = new Models\Service($this->httpClient, $api); diff --git a/server/core/Network.php b/server/core/Network.php index a4e0939..ad0cbaf 100755 --- a/server/core/Network.php +++ b/server/core/Network.php @@ -69,7 +69,7 @@ class network{ * * @return void */ - public function create_network() + private function create_network() { $options = array(); // check the name if it is null @@ -136,7 +136,7 @@ class network{ * @return void */ - public function create_subnet() + private function create_subnet() { $options = array(); if (isset($this->app->getPostParam("networkId"))) { @@ -213,7 +213,7 @@ class network{ * @return List of Networks ID */ - public function list_network_ids() + private function list_network_ids() { try { @@ -256,7 +256,7 @@ class network{ * @return List of Networks name */ - public function list_network_names() + private function list_network_names() { try { @@ -298,7 +298,7 @@ class network{ * * @return List of SUBNETS CIDR */ - public function list_cidr() + private function list_cidr() { try { @@ -335,7 +335,7 @@ class network{ * @return Network */ retrieve a specific network - public function getNetwork() + private function getNetwork() { $network=""; @@ -409,7 +409,7 @@ class network{ * @param subnetId ID of subnet which we want to get * @return subnet */ - public function getSubnet() + private function getSubnet() { $sbnet=""; @@ -487,7 +487,7 @@ class network{ * @return void **/ - public function updateNetwork() + private function updateNetwork() { $options = array(); if(isset($this->app->getPostParam("name"))) @@ -545,7 +545,7 @@ class network{ * @return void **/ - public function updateSubnet() + private function updateSubnet() { $options = array(); if(isset($this->app->getPostParam("name"))) @@ -597,7 +597,7 @@ class network{ * * @return void **/ - public function deleteNetwork() + private function deleteNetwork() { try { @@ -632,7 +632,7 @@ class network{ * * @return void **/ - public function deleteSubnet() + private function deleteSubnet() { try { @@ -673,7 +673,7 @@ class network{ * @return void */ - public function createPort() + private function createPort() { $options = array(); if (isset($this->app->getPostParam("networkId"))) @@ -740,7 +740,7 @@ class network{ * @return List of ports */ - public function listPorts() + private function listPorts() { try { @@ -770,7 +770,7 @@ class network{ * @return port */ - public function getPort() + private function getPort() { try { @@ -845,7 +845,7 @@ class network{ * * @return void */ - public function updatePort() + private function updatePort() { $options = array(); @@ -914,7 +914,7 @@ class network{ * @return void */ - public function deletePort() + private function deletePort() { try @@ -949,7 +949,7 @@ class network{ * @return void */ - public function createSecurityGroup() + private function createSecurityGroup() { $options = array(); if (isset($this->app->getPostParam("name"))) @@ -997,7 +997,7 @@ class network{ * * @return void */ - public function createSecurityGroupRule() + private function createSecurityGroupRule() { $options = array(); if (isset($this->app->getPostParam("securityGroupId"))) @@ -1061,7 +1061,7 @@ class network{ * @return List of Security Groupes */ - public function listSecurityGroupe() + private function listSecurityGroupe() { try { @@ -1092,7 +1092,7 @@ class network{ * @return List of Security Groupe Rules */ - public function listSecurityGroupeRule() + private function listSecurityGroupeRule() { try { @@ -1124,7 +1124,7 @@ class network{ * @return securityGroupe */ - public function getSecurityGroupe() + private function getSecurityGroupe() { try { @@ -1186,7 +1186,7 @@ class network{ * @param securityGroupeId ID of security Groupe which we want to get * @return void */ - public function deleteSecurityGroupe() + private function deleteSecurityGroupe() { try { |
