diff options
Diffstat (limited to 'server')
23 files changed, 81 insertions, 113 deletions
diff --git a/server/Readme.md b/server/Readme.md index fa1f266..fa1f266 100644..100755 --- a/server/Readme.md +++ b/server/Readme.md diff --git a/server/Test/DisplayListCidr.php b/server/Test/DisplayListCidr.php index 119b218..119b218 100644..100755 --- a/server/Test/DisplayListCidr.php +++ b/server/Test/DisplayListCidr.php diff --git a/server/Test/DisplayNetIds.php b/server/Test/DisplayNetIds.php index ade15e4..ade15e4 100644..100755 --- a/server/Test/DisplayNetIds.php +++ b/server/Test/DisplayNetIds.php diff --git a/server/Test/computeTest.php b/server/Test/computeTest.php index 3ce1f2e..3ce1f2e 100644..100755 --- a/server/Test/computeTest.php +++ b/server/Test/computeTest.php diff --git a/server/Test/create_network.php b/server/Test/create_network.php index c267322..c267322 100644..100755 --- a/server/Test/create_network.php +++ b/server/Test/create_network.php diff --git a/server/Test/create_subnet.php b/server/Test/create_subnet.php index 644a77d..644a77d 100644..100755 --- a/server/Test/create_subnet.php +++ b/server/Test/create_subnet.php diff --git a/server/Test/genTokenOptionsTest.php b/server/Test/genTokenOptionsTest.php index f7d0ee4..f7d0ee4 100644..100755 --- a/server/Test/genTokenOptionsTest.php +++ b/server/Test/genTokenOptionsTest.php diff --git a/server/Test/getIdNetwork.php b/server/Test/getIdNetwork.php index 1e38627..1e38627 100644..100755 --- a/server/Test/getIdNetwork.php +++ b/server/Test/getIdNetwork.php diff --git a/server/Test/getNetwork.php b/server/Test/getNetwork.php index 4c76480..4c76480 100644..100755 --- a/server/Test/getNetwork.php +++ b/server/Test/getNetwork.php diff --git a/server/Test/imageTests.php b/server/Test/imageTests.php index 4adec08..a99fbd7 100644..100755 --- a/server/Test/imageTests.php +++ b/server/Test/imageTests.php @@ -14,7 +14,7 @@ $opt['name'] = "Test"; $opt['tags'] = ['test', 'openstack']; //$opt['containerFormat'] = 'ami'; //$opt['diskFormat'] = 'iso'; -$opt['visibility'] = 'public'; +//$opt['visibility'] = 'public'; $opt['minDisk'] = 1; $opt['protected'] = false; $opt['minRam'] = 10; @@ -25,30 +25,39 @@ $retCreate = json_decode($App->show(), true)["Images"]; $idNew = $retCreate['id']; */ -/* -// Delete Image -$App->setPostParam('id', $idNew); -$image->action("deleteImage"); -*/ + + // Liste images $image->action("listImage"); $im = $App->show(); $images = json_decode($im, true)["Images"]; -echo "List images :</br>"; +$res; +echo "List images :</br></br>"; foreach($images as $i){ - echo $i['name']."</br>"; // Nom + $name = $i['name']; + if(strcmp($name,"Test") == 0) + { + $res = $i['id']; + } + echo $name."</br>"; // Nom echo $i['status']."</br>"; // Status $id = $i['id']; // Id echo $id."</br>"; - foreach ($i['tags'] as $tag) { // Tags + /*foreach ($i['tags'] as $tag) { // Tags echo $tag."</br>"; - } + }*/ echo "</br>"; } +// Delete Image + /* +$App->setPostParam('id', $res); +$image->action("deleteImage"); +*/ +/* // Details images echo "Détail image :</br>"; $App->setPostParam('id', $id); @@ -56,7 +65,7 @@ $image->action("detailsImage"); $retDetails = json_decode($App->show(), true)["Images"]; echo $retDetails['id']."</br>"; echo "</br>"; - +*/ /* // Download image @@ -66,18 +75,20 @@ $image->action("downloadImage"); // Desactivate Images +/* echo "Desactivate image : </br>"; echo $id."</br>"; $App->setPostParam('id', $id); $err = $image->action("desactivateImage"); echo "</br>"; +*/ +// Reactivate Images /* -// Resactivate Images echo $id."</br>"; -$App->setPostParam('id', $id); -$err = $image->action("resactivateImage"); +$App->setPostParam('id', $res); +$image->action("reactivateImage"); */ diff --git a/server/composer.phar b/server/composer.phar Binary files differindex 0281237..0281237 100644..100755 --- a/server/composer.phar +++ b/server/composer.phar diff --git a/server/config.inc.php b/server/config.inc.php index 636ee5e..636ee5e 100644..100755 --- a/server/config.inc.php +++ b/server/config.inc.php diff --git a/server/core/Automating.php b/server/core/Automating.php index df6e829..4a6a0b4 100644..100755 --- a/server/core/Automating.php +++ b/server/core/Automating.php @@ -22,6 +22,7 @@ class automating implements Core{ protected $appImage; protected $appNetwork; protected $appIdentity; + protected $app; /** * Our library's app constructor for all server app objects @@ -38,6 +39,7 @@ class automating implements Core{ $this->appImage = $appImage; $this->appNetwork = $appNetwork; $this->appIdentity = $appIdentity; + $this->app = $app; } /** @@ -53,92 +55,47 @@ class automating implements Core{ public function script() { - appImage->setPostParam("A_REMPLIR_PAR_Evan","VALEUR"); + $opt = Array(); + $opt['name'] = getPostParam('name'); + + appImage->setPostParam('opt' $opt); appImage->createImage(); - appImage->create_network(); - appImage->list_network_ids(); - appImage->create_subnet(); + + 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 - * - * @param $name the name of the new image - * @param $falvor_id the id of the flavor it will be used to create the new server - * - * @return Image the new image created - */ - private function createImageOnNewServer(){ - try{ - /* POURRI - $image = new Image($this->app); - $compute = new Compute($this->app); - - $name = $this->app->getPostParam("name"); - $falvor_id = $this->app->getPostParam("falvor_id"); // Compris entre 1 et 5 (1=petit serveur, 5=gros serveur) - - $opt = Array(); - $opt['name'] = $name; - $opt['visibility'] = 'public'; - $opt['minDisk'] = 100; // A VOIR - $opt['minRam'] = 128; // A VOIR - $opt['protected'] = false; - - $this->app->setPostParam("opt", $opt); - - $image->action("createImage"); - $res = json_decode($this->app->show(), true)["Images"]; - + + private function createServer() + { + $imageName = $this->app->getPostParam('imageName'); + $serverName = $this->app->getPostParam('serverName'); + $flavor = $this->app->getPostParam('flavor'); - $this->app->setPostParam("name", $name); - $this->app->setPostParam("imageId", $res['id']); - $this->app->setPostParam("flavorId", $falvor_id); + // Création image + $opt = Array(); + $opt['name'] = $imageName; + $this->app->setPostParam('opt' $opt); + $this->appImage->createImage(); + $image = json_decode($this->app->show(), true)["Images"]; - $compute->action("createServer"); - */ - }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); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } - //$this->app->setOutput("Auto", $res); - } + // Création server + $this->app->setPostParam('name', $serverName); + $this->app->setPostParam('imageId', $image['id']); + $this->app->setPostParam('flavorId', $flavor); + $this->appNetwork->createServer(); + // Ajout adresse IP public - /** - * Create a new image on an existing server - * - * @param $name the name of the new image - * @param $server_id the id of the server - * - * @return Image the new image created - */ - private function createImageOnServer(){ - try{ - - }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); - }catch(Exception $e){ - $this->app->getErrorInstance()->OtherException($e); - } } } diff --git a/server/core/CoreInterface.php b/server/core/CoreInterface.php index ed0d959..ed0d959 100644..100755 --- a/server/core/CoreInterface.php +++ b/server/core/CoreInterface.php diff --git a/server/core/LibOverride/genTokenOptions.php b/server/core/LibOverride/genTokenOptions.php index f8b6e20..394db31 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(){ @@ -389,7 +389,7 @@ class genTokenOptions $token->catalog = new Models\Catalog($this->httpClient, $api); $token->catalog->services = []; - + foreach($Saved["catalog"] as $key => $service){ $tmp = new Models\Service($this->httpClient, $api); diff --git a/server/core/LibOverride/projectTokenData/demo b/server/core/LibOverride/projectTokenData/demo index 95d1e10..95d1e10 100644..100755 --- a/server/core/LibOverride/projectTokenData/demo +++ b/server/core/LibOverride/projectTokenData/demo diff --git a/server/core/Network.php b/server/core/Network.php index a4e0939..ad0cbaf 100644..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 { diff --git a/server/core/Network.php~ b/server/core/Network.php~ index 65de962..65de962 100644..100755 --- a/server/core/Network.php~ +++ b/server/core/Network.php~ diff --git a/server/core/Plugin.php b/server/core/Plugin.php index e6fd8a7..e6fd8a7 100644..100755 --- a/server/core/Plugin.php +++ b/server/core/Plugin.php diff --git a/server/core/Plugin_Api.php b/server/core/Plugin_Api.php index 20ffd0c..20ffd0c 100644..100755 --- a/server/core/Plugin_Api.php +++ b/server/core/Plugin_Api.php diff --git a/server/core/Readme.txt b/server/core/Readme.txt index 8d1c8b6..8d1c8b6 100644..100755 --- a/server/core/Readme.txt +++ b/server/core/Readme.txt diff --git a/server/create_serv.php b/server/create_serv.php index da39842..da39842 100644..100755 --- a/server/create_serv.php +++ b/server/create_serv.php diff --git a/server/modules/Readme.txt b/server/modules/Readme.txt index 8d1c8b6..8d1c8b6 100644..100755 --- a/server/modules/Readme.txt +++ b/server/modules/Readme.txt |
