summaryrefslogtreecommitdiff
path: root/server/core
diff options
context:
space:
mode:
Diffstat (limited to 'server/core')
-rwxr-xr-x[-rw-r--r--]server/core/Automating.php103
-rwxr-xr-x[-rw-r--r--]server/core/CoreInterface.php0
-rwxr-xr-xserver/core/LibOverride/genTokenOptions.php8
-rwxr-xr-x[-rw-r--r--]server/core/LibOverride/projectTokenData/demo0
-rwxr-xr-x[-rw-r--r--]server/core/Network.php44
-rwxr-xr-x[-rw-r--r--]server/core/Network.php~0
-rwxr-xr-x[-rw-r--r--]server/core/Plugin.php0
-rwxr-xr-x[-rw-r--r--]server/core/Plugin_Api.php0
-rwxr-xr-x[-rw-r--r--]server/core/Readme.txt0
9 files changed, 56 insertions, 99 deletions
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