@@ -249,6 +251,11 @@ function _device_set_maintenance_mode ($device_id, $enable = "true") {
*/
function _device_set_maintenance_mode_v15_3 ($device_id, $enable = "true") {
+ if (isset($enable) && ($enable === true|| $enable ==='true' || $enable == 1 )){
+ $enable = 'true'; //we should put a string 'true' or 'false' into request, 1 ou 0 don't work
+ }else{
+ $enable = 'false';
+ }
$msa_rest_api = "device/maintenance/{$device_id}?enable={$enable}";
$curl_cmd = create_msa_operation_request(OP_POST, $msa_rest_api);
$response = perform_curl_operation($curl_cmd, "SET DEVICE MAINTENANCE MODE on MSA v15.3");
diff --git a/Reference/Common/Library/email_rest.php b/Reference/Common/Library/email_rest.php
index 99497a75e..b88fe970f 100755
--- a/Reference/Common/Library/email_rest.php
+++ b/Reference/Common/Library/email_rest.php
@@ -8,10 +8,16 @@
*/
function _email_send ($from, $to, $subject = "", $content = "", $cc = "", $bcc = "") {
- $msa_rest_api = "email/send?from={$from}&to={$to}&subject={$subject}&cc={$cc}&bcc={$bcc}";
- $curl_cmd = create_msa_operation_request(OP_POST, $msa_rest_api, $content);
- $response = perform_curl_operation($curl_cmd, "SEND EMAIL");
- return $response;
+ $subject = urlencode($subject);
+ $msa_rest_api = "email/send?from={$from}&to={$to}&subject={$subject}&cc={$cc}&bcc={$bcc}";
+ $email_content = "";
+ if ($content !== "") {
+ $email_content = array('content' => $content);
+ $email_content = json_encode($email_content);
+ }
+ $curl_cmd = create_msa_operation_request(OP_POST, $msa_rest_api, $email_content);
+ $response = perform_curl_operation($curl_cmd, "SEND EMAIL");
+ return $response;
}
?>
diff --git a/Reference/Common/Library/lookup_rest.php b/Reference/Common/Library/lookup_rest.php
index 8e6c0691b..fb6e34937 100755
--- a/Reference/Common/Library/lookup_rest.php
+++ b/Reference/Common/Library/lookup_rest.php
@@ -111,4 +111,30 @@ function _lookup_list_sec_nodes () {
return $response;
}
+/**
+ * Get SecEngine Node by Device Id
+ *
+ * curl -u ncroot:ubiqube -XGET http://localhost:10080/ubi-api-rest/lookup/v1/sec-node-by-device-id/{device_id}
+ * "ipV6Mask": "64",
+ * "id": 1,
+ * "haStatusSecNode": 1,
+ * "haStatusRepNode": 0,
+ * "name": "ACS",
+ * "logAddress": "10.31.1.5",
+ * "smsAddress": "127.0.0.1",
+ * "alive": true
+ */
+function _lookup_get_sec_node_by_device_id ($device_id) {
+ $msa_rest_api = "lookup/v1/sec-node-by-device-id/{$device_id}";
+ $curl_cmd = create_msa_operation_request(OP_GET, $msa_rest_api);
+ $response = perform_curl_operation($curl_cmd, "GET SEC NODE BY DEVICE ID");
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ return $response;
+ }
+ $response = prepare_json_response(ENDED, ENDED_SUCCESSFULLY, $response['wo_newparams']['response_body']);
+ return $response;
+}
+
?>
\ No newline at end of file
diff --git a/Reference/Common/Library/msa_common.php b/Reference/Common/Library/msa_common.php
index ec51d546d..af8a8b8f3 100755
--- a/Reference/Common/Library/msa_common.php
+++ b/Reference/Common/Library/msa_common.php
@@ -20,6 +20,9 @@
require_once LIBRARY_DIR . 'customer_rest.php';
require_once LIBRARY_DIR . 'operator_rest.php';
require_once LIBRARY_DIR . 'widget_portal_rest.php';
+require_once LIBRARY_DIR . 'asset_rest.php';
+require_once LIBRARY_DIR . '../constants.php';
+#require_once LIBRARY_DIR . 'conf_profile_rest.php';
/**
* Import objects for a device
@@ -82,6 +85,7 @@ function synchronize_objects_and_verify_response ($device_id, $connection_timeou
return $response;
}
$message = "";
+ $wo_newparams = array();
foreach ($response['wo_newparams'] as $object) {
$object_newparam['wo_newparams'] = $object;
$response = verify_response($object_newparam, $device_id, CMD_SYNCHRONIZE);
@@ -177,6 +181,7 @@ function verify_response($response, $device_id, $command_name, $comment = '') {
}
else {
if ($command_name === CMD_SYNCHRONIZE) {
+ $wo_newparams = json_decode($message, true);
$obj_name = substr($message, 2);
$obj_name = substr($obj_name, 0, strpos($obj_name, "\""));
$message = $obj_name;
@@ -526,7 +531,7 @@ function wait_for_provisioning_completion ($device_id, $process_params, $sleep_t
* @param unknown $process_params
* @return mixed|unknown
*/
-function wait_for_pushconfig_completion ($device_id, $process_params, $ignore_messages = array(), $timeout = PUSH_CONFIG_TIMEOUT) {
+function wait_for_pushconfig_completion ($device_id, $process_params, $ignore_messages = array(), $timeout = PUSH_CONFIG_TIMEOUT, $upd_task_execution = true) {
$wo_newparams = array();
$status = '';
@@ -558,7 +563,9 @@ function wait_for_pushconfig_completion ($device_id, $process_params, $ignore_me
else {
$wo_comment_print = $wo_comment;
}
- update_asynchronous_task_details($process_params, $check_pushconfig_status_message . $wo_comment_print);
+ if ($upd_task_execution) {
+ update_asynchronous_task_details($process_params, $check_pushconfig_status_message . $wo_comment_print);
+ }
if ($status === ENDED) {
break;
}
@@ -722,6 +729,7 @@ function wait_for_ssh_status ($ip_address, $port_no = SSH_DEFAULT_PORT_NO, $proc
/**
* Execute a shell cmd and wait for a particular output string
+ * If the $expected_output_string is empty, we are waiting the output of the command is empty (used for stop ping monitoring, the device should be disaspear from sdlist)
*
* @param unknown $cmd
* @param unknown $expected_output_string
@@ -747,9 +755,15 @@ function execute_linux_command_and_wait_for_output ($cmd, $expected_output_strin
}
logToFile("Command : $cmd");
logToFile("Output : $output");
- sleep(LINUX_CMD_OUTPUT_CHECK_SLEEP);
+ if ($total_sleeptime>0) {
+ sleep(LINUX_CMD_OUTPUT_CHECK_SLEEP);
+ }else{
+ //the first times, we sleep only 1 seconde to have the time to see the display
+ sleep(1);
+ }
$total_sleeptime += LINUX_CMD_OUTPUT_CHECK_SLEEP;
$wo_comment = "Command : $cmd\nOutput : $output\n";
+ $wo_comment = preg_replace('#Forti(\w+)\S+#','Device', $wo_comment); //Replace the Word "Forti*" with Device
update_asynchronous_task_details($process_params, $check_cmd_output_message . $wo_comment);
if ($total_sleeptime > $timeout) {
$wo_comment .= "The expected output string was not available in the command output within $timeout seconds.\nHence, Ending the Process as Failure.";
@@ -779,7 +793,6 @@ function wait_for_process_completion ($process_id, $process_params, $sleep_time
}
$process_task_status = $response['wo_newparams']['status']['processTaskStatus'];
$process_task_count = count($process_task_status);
-
$service_id = $response['wo_newparams']['serviceId']['id'];
$service_name = $response['wo_newparams']['serviceId']['name'];
$process_id = $response['wo_newparams']['processId']['id'];
@@ -798,9 +811,17 @@ function wait_for_process_completion ($process_id, $process_params, $sleep_time
//In processTaskStatus we don't see all available tasks before all tasks are finished, there are filled one after one when they are finished individually.
//We want write into logs the running task and each task already ended.
+ if ($process_status!== ENDED){
+ update_asynchronous_task_details($process_params, implode('',$update_async_task_details) );
+ //wait $sleep_time secondes before to check the status
+ sleep($sleep_time);
+ }
+
while ($process_status === RUNNING) { //status of the whole tasks, it will be ended when all tasks are ended.
$response = _orchestration_get_process_instance($process_id);
$response = json_decode($response, true);
+ logToFile(debug_dump($response , "msa_common.php process_id=$process_id, sleep_time=$sleep_time _orchestration_get_process_instance22=\n"));
+
if ($response['wo_status'] !== ENDED) {
$response = json_encode($response);
return $response;
@@ -833,18 +854,13 @@ function wait_for_process_completion ($process_id, $process_params, $sleep_time
$tasks_already_displayed[$order][$order_status]=1;
}
}
- $update_async_task_details_string='';
- foreach ($update_async_task_details as $detail){
- $update_async_task_details_string .= $detail;
- }
- update_asynchronous_task_details($process_params, $update_async_task_details_string);
+ update_asynchronous_task_details($process_params, implode('',$update_async_task_details));
if ($process_status!== ENDED){
sleep($sleep_time);
}
}
- //$response = prepare_json_response(ENDED, ENDED_SUCCESSFULLY, $wo_newparams);
$response = prepare_json_response(ENDED, ENDED_SUCCESSFULLY, $response['wo_newparams']);
return $response;
}
@@ -989,9 +1005,83 @@ function msa_execute_service_by_reference_and_wait_for_completion ($external_ref
}
$context['executed_service_id'] = $service_id;
$context[$service_name][$service_id]['context'] = $response['wo_newparams'];
+ //$context[$service_name][0]['context'] = $response;
+ }
+}
+
+/**
+ * Poll Device Backup Status and wait for it's completion
+ *
+ * @param unknown $device_id
+ * @param unknown $process_params
+ * @return mixed|unknown
+ */
+function wait_for_backup_completion ($device_id, $process_params, $timeout = DEVICE_BACKUP_TIMEOUT) {
+
+ $wo_newparams = array();
+ $status = '';
+ $wo_comment = "";
+ $total_sleeptime = 0;
+ $check_backup_status_message = "Checking Device $device_id Backup Status (every " . DEVICE_BACKUP_CHECK_SLEEP . " seconds";
+ $check_backup_status_message .= ", timeout = $timeout seconds) :\n";
+ while ($status !== ENDED) {
+
+ $response = _device_get_backup_status_by_device_id($device_id);
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ return $response;
+ }
+ $status = $response['wo_newparams']['status'];
+ $message = $response['wo_newparams']['message'];
+ $revision_id = $response['wo_newparams']['revisionId'];
+ logToFile("BACKUP STATUS : $status");
+ logToFile("BACKUP MESSAGE : $message");
+ logToFile("BACKUP REVISION ID : $revision_id");
+
+ $wo_comment = "Backup Status : " . $status;
+ $wo_comment .= "\nBackup Message : $message\n";
+ $wo_comment .= "\nBackup Revision Id : $revision_id\n";
+ update_asynchronous_task_details($process_params, $check_backup_status_message . $wo_comment);
+ if ($status === ENDED) {
+ break;
+ }
+ else if ($status === FAILED) {
+ $response = prepare_json_response(FAILED, $message, $wo_newparams, true);
+ return $response;
+ }
+ sleep(DEVICE_BACKUP_CHECK_SLEEP);
+ $total_sleeptime += DEVICE_BACKUP_CHECK_SLEEP;
+ if ($total_sleeptime > $timeout) {
+ $wo_comment .= "The Device $device_id Backup could not be completed within $timeout seconds.\nHence, Ending the Process as Failure.";
+ $response = prepare_json_response(FAILED, $wo_comment, $wo_newparams, true);
+ return $response;
+ }
}
+ $response = prepare_json_response(ENDED, $wo_comment, $wo_newparams);
+ return $response;
}
+function msa_push_config_and_wait_for_completion ($device_id, $configuration, $ignore_messages = array(), $timeout = PUSH_CONFIG_TIMEOUT) {
+
+ global $context;
+ $response = _device_do_push_configuration_by_id($device_id, $configuration);
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ task_error($response['wo_comment']);
+ }
+
+ $response = wait_for_pushconfig_completion($device_id, $context, $ignore_messages, $timeout);
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ task_error($response['wo_comment']);
+ }
+
+ // Return pushconfig status message
+ $pushconfig_status_message = $response['wo_comment'];
+ $pushconfig_status_message = substr($pushconfig_status_message, strpos($pushconfig_status_message, "Push Config Message : ") + strlen("Push Config Message : "));
+ return $pushconfig_status_message;
+}
?>
\ No newline at end of file
diff --git a/Reference/Common/Library/orchestration_rest.php b/Reference/Common/Library/orchestration_rest.php
index 8cfbdae94..d708e91dc 100755
--- a/Reference/Common/Library/orchestration_rest.php
+++ b/Reference/Common/Library/orchestration_rest.php
@@ -19,6 +19,24 @@ function _orchestration_list_service_instances ($ubiqube_id) {
return $response;
}
+
+/** list_service_instances for MSA in v15_3
+ * curl -u ncroot:ubiqube -XGET http://localhost:10080/ubi-api-rest/orchestration/{ubiqubeId}/service/instance
+ */
+function _orchestration_list_service_instances_v15_3 ($ubiqube_id) {
+ // $msa_rest_api = "orchestration/{$ubiqube_id}/service/instance";
+ $msa_rest_api = "orchestration/service/instance/{$ubiqube_id}";
+ $curl_cmd = create_msa_operation_request(OP_GET, $msa_rest_api);
+ $response = perform_curl_operation($curl_cmd, "LIST SERVICE INSTANCES");
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ return $response;
+ }
+ $response = prepare_json_response(ENDED, ENDED_SUCCESSFULLY, $response['wo_newparams']['response_body']);
+ return $response;
+}
+
/**
* curl -u ncroot:ubiqube -XGET http://localhost:10080/ubi-api-rest/orchestration/{ubiqubeId}/service/instance/{serviceId}
*/
@@ -98,6 +116,20 @@ function _orchestration_update_service_variable ($service_id, $variable_name, $v
return $response;
}
+
+/**
+ * curl -u ncroot:ubiqube -XDELETE http://localhost:10080/ubi-api-rest/orchestration/v1/services/{$service_id}/service-variables/{$variable_name}
+ */
+function _orchestration_delete_service_context_variable ($service_id, $variable_name) {
+ #DELETE GIVEN VARIABLE IN THE CONTEXT FOR GIVENT SERVICE ID.
+ # Rq one array is store in the context in many variables like tab.niv1.niv2 pour $context['tab']['niv1']['niv2'], so we have to delete all variables names to delete the array.
+ $msa_rest_api = "orchestration/v1/services/{$service_id}/service-variables/{$variable_name}";
+ $curl_cmd = create_msa_operation_request(OP_DELETE, $msa_rest_api);
+ $response = perform_curl_operation($curl_cmd, "DELETE GIVEN VARIABLE IN CONTEXT FOR GIVENT SERVICE ID");
+ return $response;
+}
+
+
/**
* curl -u ncroot:ubiqube -XDELETE http://localhost:10080/ubi-api-rest/orchestration/{ubiqubeId}/service/instance/{serviceId}
*/
@@ -109,6 +141,18 @@ function _orchestration_delete_service_instance_by_id ($ubiqube_id, $service_id)
return $response;
}
+
+/** Delete instance in V15.3
+ * curl -u ncroot:ubiqube -XDELETE http://localhost:10080/ubi-api-rest/orchestration//service/instance/{ubiqubeId}/{serviceId}
+ */
+function _orchestration_delete_service_instance_by_id_v15_3 ($ubiqube_id, $service_id) {
+
+ $msa_rest_api = "orchestration/service/instance/{$ubiqube_id}/{$service_id}";
+ $curl_cmd = create_msa_operation_request(OP_DELETE, $msa_rest_api);
+ $response = perform_curl_operation($curl_cmd, "DELETE SERVICE INSTANCE BY SERVICE ID");
+ return $response;
+}
+
/**
* curl -u ncroot:ubiqube -XGET http://localhost:10080/ubi-api-rest/orchestration/{ubiqubeId}/process/instances?serviceName={serviceName}&processName={processName}
*/
@@ -136,7 +180,7 @@ function _orchestration_list_process_instance ($ubiqube_id, $service_name, $proc
*/
function _orchestration_execute_service ($ubiqube_id, $service_name, $process_name, $json_body = "{}") {
- $msa_rest_api = "orchestration/service/execute/{$ubiqube_id}?serviceName={$service_name}&processName={$process_name}";
+ $msa_rest_api = "orchestration/service/execute/{$ubiqube_id}?serviceName={$service_name}&processName={$process_name}&serviceInstance=0";
$curl_cmd = create_msa_operation_request(OP_POST, $msa_rest_api, $json_body);
$response = perform_curl_operation($curl_cmd, "EXECUTE SERVICE");
$response = json_decode($response, true);
@@ -148,18 +192,26 @@ function _orchestration_execute_service ($ubiqube_id, $service_name, $process_na
return $response;
}
+/**
+ curl -u ncroot:ubiqube -XPOST http://localhost:10080/ubi-api-rest/orchestration/process/execute/{ubiqubeId}/{serviceId}?processName={processName} -d '
+ {
+ "var1": "val1",
+ "var2": "val2"
+ }
+ '
+ */
function _orchestration_launch_process_instance ($ubiqube_id, $service_id, $process_name, $json_body = "") {
- $msa_rest_api = "orchestration/process/execute/{$ubiqube_id}/{$service_id}?processName={$process_name}";
- $curl_cmd = create_msa_operation_request(OP_POST, $msa_rest_api, $json_body);
- $response = perform_curl_operation($curl_cmd, "LAUNCH PROCESS INSTANCE");
- $response = json_decode($response, true);
- if ($response['wo_status'] !== ENDED) {
- $response = json_encode($response);
- return $response;
- }
- $response = prepare_json_response(ENDED, ENDED_SUCCESSFULLY, $response['wo_newparams']['response_body']);
- return $response;
+ $msa_rest_api = "orchestration/process/execute/{$ubiqube_id}/{$service_id}?processName={$process_name}";
+ $curl_cmd = create_msa_operation_request(OP_POST, $msa_rest_api, $json_body);
+ $response = perform_curl_operation($curl_cmd, "LAUNCH PROCESS INSTANCE");
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ return $response;
+ }
+ $response = prepare_json_response(ENDED, ENDED_SUCCESSFULLY, $response['wo_newparams']['response_body']);
+ return $response;
}
@@ -193,7 +245,7 @@ function _orchestration_execute_service_by_instance ($ubiqube_id, $service_insta
'
*/
function _orchestration_launch_sub_process ($ubiqube_id, $service_instance, $service_name, $process_name, $json_body = "{}") {
- $msa_rest_api = "orchestration/subprocess/execute/{$ubiqube_id}?serviceName={$service_name}&processName={$process_name}&serviceInstance={$service_instance}";
+ $msa_rest_api = "orchestration/process/execute/{$ubiqube_id}/{$service_instance}?processName={$process_name}";
$curl_cmd = create_msa_operation_request(OP_POST, $msa_rest_api, $json_body);
$response = perform_curl_operation($curl_cmd, "EXECUTE SERVICE");
$response = json_decode($response, true);
@@ -305,5 +357,30 @@ function _orchestration_service_detach ($ubiqube_id, $service_uri) {
$response = perform_curl_operation($curl_cmd, "DETACH SERVICE FROM CUSTOMER");
return $response;
}
+/**
+ * curl -u ncroot:ubiqube -X POST http://localhost:10080/ubi-api-rest/orchestration/{ubiqubeId}/service/instance/search -d
+ * {
+ * "services_to_search":{
+ * "service_name" : "Process/Reference/Sampe/Firewall",
+ * "service_name" : "Process/UBI/Test_Management/Test_Management"
+ * },
+ * "service_instance_id":"12345",
+ * "service_external_reference":"MSASID12345",
+ * "process_instance_id":"1234",
+ * "service_execution_status":"Running",
+ * "service_variables":{
+ * "ipaddress":"1.2.3.4",
+ * "mask":"255.255.255.0",
+ * "deviceId":"MSA123"
+ * }
+ * }
+ */
+function _orchestration_service_search ($ubiqube_id, $json_body = "{}") {
+
+ $msa_rest_api = "orchestration/{$ubiqube_id}/service/instance/search";
+ $curl_cmd = create_msa_operation_request(OP_POST, $msa_rest_api, $json_body);
+ $response = perform_curl_operation($curl_cmd, "RUN WORKFLOW SEARCH");
+ return $response;
+}
?>
diff --git a/Reference/Common/Library/order_command_rest.php b/Reference/Common/Library/order_command_rest.php
index 904c94ce3..a5f1881ab 100755
--- a/Reference/Common/Library/order_command_rest.php
+++ b/Reference/Common/Library/order_command_rest.php
@@ -27,6 +27,31 @@ function _order_command_execute ($device_id, $command_name, $object_parameters,
return $response;
}
+/**
+ * REST endpoint available in MSA NB
+ * ex:
+ curl -u ncroot:ubiqube -XPUT http://localhost:10080/ubi-api-rest/ordercommand/store/configuration/657/UPDATE -d '{
+ "deviceId": 657,
+ "commandName": "UPDATE",
+ "objectParameters": {
+ "subnet": "mySubnet"
+ }
+ }'
+ */
+function _order_command_store_configuration ($device_id, $command_name, $object_parameters, $connection_timeout = 60, $max_time = 60) {
+
+ $msa_rest_api = "ordercommand/store/configuration/{$device_id}/{$command_name}";
+ $curl_cmd = create_msa_operation_request(OP_PUT, $msa_rest_api, $object_parameters);
+ $response = perform_curl_operation($curl_cmd, "STORE CONFIGURATION");
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ return $response;
+ }
+ $response = prepare_json_response(ENDED, ENDED_SUCCESSFULLY, $response['wo_newparams']['response_body']);
+ return $response;
+}
+
/**
curl -u ncroot:ubiqube -XPOST http://localhost:10080/ubi-api-rest/ordercommand/get/configuration/657/UPDATE -d '{
@@ -62,7 +87,7 @@ function _order_command_generate_configuration ($device_id, $command_name, $obje
* @param unknown $device_id
* @return unknown
*/
-function _order_command_synchronize ($device_id, $connection_timeout = 300, $max_time = 300) {
+function _order_command_synchronize ($device_id, $connection_timeout = OBJECTS_SYNCHRONIZATION_CONNECTION_TIMEOUT, $max_time = OBJECTS_SYNCHRONIZATION_MAX_TIME) {
$msa_rest_api = "ordercommand/synchronize/{$device_id}";
$curl_cmd = create_msa_operation_request(OP_POST, $msa_rest_api, "", $connection_timeout, $max_time);
diff --git a/Reference/Common/Library/profile_rest.php b/Reference/Common/Library/profile_rest.php
index ddb92a04b..3d460f8a1 100755
--- a/Reference/Common/Library/profile_rest.php
+++ b/Reference/Common/Library/profile_rest.php
@@ -90,6 +90,51 @@ function _profile_configuration_delete_by_id ($customer_id, $profile_id) {
return $response;
}
+
+/**
+ * Create new Monitoring profile
+ *
+ * /usr/bin/curl -isw 'HTTP_CODE=%{http_code}' -u ncroot:$PWD --connect-timeout 60 --max-time 60 -H "Content-Type: application/json" -X POST 'http://127.0.0.1:80/ubi-api-rest/profile/v1/create' -d '{"actorId": "46", "customerId": "56", "externalReference": "MON", "name": "MON", "type": "M"}'
+ *
+ * the output :
+ * "id": 0, "prefix": "string", "ubiId": "string", "name": "string", "externalReference": "string", "operatorId": 0, "displayName": "string", "displayNameForJsps": "string", "type": "string", "profileType": "string", "customerId": 0
+ */
+
+function _profile_monitoring_create ($manager_id, $customer_id, $monitoring_profile_reference, $monitoring_profile_reference){
+
+ $msa_rest_api = "profile/v1/create";
+ $param= array ("actorId" => $manager_id,
+ "customerId" => $customer_id,
+ "externalReference" => $monitoring_profile_reference,
+ "name" => $monitoring_profile_reference,
+ "type" => 'M' );
+ $json = json_encode($param);
+ $curl_cmd = create_msa_operation_request(OP_POST, $msa_rest_api, $json);
+ $response = perform_curl_operation($curl_cmd, "Create new Monitory Profil $monitoring_profile_reference to operator ");
+ return $response;
+}
+
+
+
+/**
+ * Attach Monitoring profile to customer by external reference
+ * /usr/bin/curl -isw 'HTTP_CODE=%{http_code}' -u ncroot:$p --connect-timeout 60 --max-time 60 -H "Content-Type: application/json" -X POST 'http://127.0.0.1:80/ubi-api-rest/profile/v1/ecl2_0v2-80/attach/M80'
+ * output {
+ "wo_status": "ENDED",
+ "wo_comment": "The monitoring profile M80 is attached to ecl2_0v2-80.\n",
+ "wo_newparams": {................
+ *
+ */
+
+function _profile_monitoring_attach_to_customer ($customer_ext_reference,$monitoring_profile_reference){
+
+ $msa_rest_api = "profile/v1/$customer_ext_reference/attach/$monitoring_profile_reference";
+ $curl_cmd = create_msa_operation_request(OP_POST, $msa_rest_api);
+ $response = perform_curl_operation($curl_cmd, "Attach monitoring profile $monitoring_profile_reference to $customer_ext_reference");
+ return $response;
+}
+
+
/**
* Export Monitoring Profile
*
diff --git a/Reference/Common/Library/repository_rest.php b/Reference/Common/Library/repository_rest.php
index a5a5473de..770c4a5a7 100755
--- a/Reference/Common/Library/repository_rest.php
+++ b/Reference/Common/Library/repository_rest.php
@@ -72,6 +72,19 @@ function _repository_add_customer ($uri) {
return $response;
}
+/**
+ * curl -u ncroot:ubiqube -XPOST 'http://MSA_IP/ubi-api-rest/repository/comment?uri={file_uri}&comment={comment}'
+ */
+function _repository_file_update_comment ($file_uri, $comment) {
+
+ $encoded_comment = urlencode($comment);
+ $encoded_uri = urlencode($file_uri);
+ $msa_rest_api = "repository/comment?uri={$encoded_uri}&comment={$encoded_comment}";
+ $curl_cmd = create_msa_operation_request(OP_POST, $msa_rest_api);
+ $response = perform_curl_operation($curl_cmd, "UPDATE REPOSITORY FILE COMMENT");
+ return $response;
+}
+
/**
* curl -u ncroot:NCROOT_PWD -XDELETE "http://localhost:10080/ubi-api-rest/repository/customer?uri={uri}"
*/
@@ -210,6 +223,24 @@ function _repository_list_files ($uri) {
return $response;
}
+/**
+ * curl -u ncroot:ubiqube -XGET 'http://MSA_IP/ubi-api-rest/repository/meta_value?uri={file_uri}&meta_key={meta_key}'
+ */
+function _repository_read_meta_value ($file_uri, $meta_key) {
+
+ $msa_rest_api = "repository/meta_value?uri={$file_uri}&meta_key={$meta_key}";
+ $curl_cmd = create_msa_operation_request(OP_GET, $msa_rest_api);
+ $response = perform_curl_operation($curl_cmd, "READ REPOSITORY META FILE KEY VALUE");
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ return $response;
+ }
+ $response = prepare_json_response(ENDED, ENDED_SUCCESSFULLY, $response['wo_newparams']['response_body']);
+ return $response;
+}
+
+
/**
* curl -u ncroot:NCROOT_PWD -XGET "http://localhost:10080/ubi-api-rest/repository/v2/resource/workflow?uri={uri}"
*/
diff --git a/Reference/Common/Library/user_rest.php b/Reference/Common/Library/user_rest.php
index 0aaceaf90..6393349f8 100755
--- a/Reference/Common/Library/user_rest.php
+++ b/Reference/Common/Library/user_rest.php
@@ -74,6 +74,24 @@ function _manager_read_by_id ($manager_id) {
return $response;
}
+/**
+ * curl -u ncroot:Ub1qub3 -XGET http://localhost:80/ubi-api-rest/lookup/managers
+ *
+ */
+function _get_all_manager () {
+
+ $msa_rest_api = "lookup/managers";
+ $curl_cmd = create_msa_operation_request(OP_GET, $msa_rest_api);
+ $response = perform_curl_operation($curl_cmd, "GET ALL MANAGERS");
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ return $response;
+ }
+ $response = prepare_json_response(ENDED, ENDED_SUCCESSFULLY, $response['wo_newparams']['response_body']);
+ return $response;
+}
+
/**
curl -u ncroot:ubiqube -X GET http://localhost:8080/ubi-api-rest/user/reference/ADMIN_MAN
@@ -114,16 +132,31 @@ function _manager_read_by_login ($manager_login) {
/**
* Attach Customers to Manager
- *
+ * $manager_reference
+ * $customer_references should be a php array like ["customerReference": "ABC", "customerReference": "XYZ"]
* curl -u ncroot:ubiqube -XPUT http://localhost:10080/ubi-api-rest/user/manager/{managerReference}/customers/attach -d '["customerReference": "ABC", "customerReference": "XYZ"]'
*/
function _manager_attach_customers ($manager_reference, $customer_references) {
- $msa_rest_api = "user/manager/{$manager_reference}/customers/attach";
- $curl_cmd = create_msa_operation_request(OP_PUT, $msa_rest_api, $customer_references);
- $response = perform_curl_operation($curl_cmd, "ATTACH CUSTOMERS TO MANAGER");
- return $response;
+ $msa_rest_api = "user/manager/{$manager_reference}/customers/attach";
+ $json = '['.json_encode($customer_references).']';
+ $curl_cmd = create_msa_operation_request(OP_PUT, $msa_rest_api, $json);
+ $response = perform_curl_operation($curl_cmd, "ATTACH CUSTOMERS TO MANAGER");
+ return $response;
+}
+
+
+/**
+ * For the given manager, set the given delegationId to the given customer
+ * curl -u ncroot:ubiqube -XPUT -XPUT "http://MSA_IP/ubi-api-rest/delegation/{delegationId}/{managerId}/{customerId}"
+ */
+function _manager_set_delegation_to_customer ($delegationId, $managerId, $customerId) {
+ $msa_rest_api = "delegation/{$delegationId}/{$managerId}/{$customerId}";
+ $curl_cmd = create_msa_operation_request(OP_PUT, $msa_rest_api);
+ $response = perform_curl_operation($curl_cmd, "For MANAGER set the delegation for the given customer");
+ return $response;
}
+
/**
* Detach Customers from Manager
*
@@ -148,4 +181,15 @@ function _manager_update_password ($manager_id, $password) {
return $response;
}
+/**
+* Update Manager Delegation Profile
+*
+* curl -X PUT "https://10.30.18.222/user/v1/updateManagerDelegationProfile?managerId=111&delegationProfile=122&callerLogin=ddd" -H "accept: application/json"
+**/
+function _manager_update_delegation_profile ($manager_id, $delegation_profile_id, $caller_login) {
+ $msa_rest_api = "user/v1/updateManagerDelegationProfile?managerId={$manager_id}&delegationProfile={$delegation_profile_id}&callerLogin={$caller_login}";
+ $curl_cmd = create_msa_operation_request(OP_PUT, $msa_rest_api);
+ $response = perform_curl_operation($curl_cmd, "UPDATE MANAGER DELEGATION PROFILE");
+ return $response;
+}
?>
\ No newline at end of file
diff --git a/Reference/Common/common.php b/Reference/Common/common.php
index 6cc5e508f..20b24ed4f 100755
--- a/Reference/Common/common.php
+++ b/Reference/Common/common.php
@@ -149,4 +149,18 @@ function task_warning($message) {
exit;
}
+function task_error_with_email ($from, $email_recipients, $email_subject, $email_content) {
+ global $context;
+ logTofile(debug_dump($email_content, "Error message :\n"));
+ _email_send($from, $email_recipients, $email_subject, $email_content);
+ $response = prepare_json_response(FAILED, $email_content, $context, true);
+ echo $response;
+ exit;
+}
+
+
+
+
+
+
?>
diff --git a/Reference/Common/utility.php b/Reference/Common/utility.php
index b7d4fff64..f73c6f89b 100755
--- a/Reference/Common/utility.php
+++ b/Reference/Common/utility.php
@@ -175,6 +175,7 @@ function _get_variable_by_name($name) {
return null;
}
+
/**
* Execute a shell command
* @param unknown $cmd
@@ -542,6 +543,10 @@ function update_asynchronous_task_details($args, $details) {
$TASKID = $args['TASKID'];
$EXECNUMBER = $args['EXECNUMBER'];
+ $details = preg_replace ("/\"/",' ',$details); //remove " to prevent somme error
+ $details = preg_replace ("/\'/",' ',$details); //remove ' to prevent somme error
+ $details = preg_replace ("/\(/",' ',$details); //remove ( to prevent somme error
+ $details = preg_replace ("/\)/",' ',$details); //remove ) to prevent somme error
logToFile("UPDATE PROCESS SCRIPT DETAILS : $PROCESSINSTANCEID $TASKID $EXECNUMBER \"{$details}\"\n");
$response = _orchestration_update_process_script_details($PROCESSINSTANCEID, $TASKID, $EXECNUMBER, $details);
}
diff --git a/Reference/Common/workflows_common.php b/Reference/Common/workflows_common.php
index 3e78e0f5c..992aaeb6a 100755
--- a/Reference/Common/workflows_common.php
+++ b/Reference/Common/workflows_common.php
@@ -58,8 +58,12 @@ function msa_micro_service_variables_to_workflow_variables ($micro_service_uri)
$micro_service_variables = $object_definition->ObjectDefinition->variables;
*/
- $xml = simplexml_load_file(MICRO_SERVICES_HOME_DIR . $micro_service_uri);
- $micro_service_defition = json_decode(json_encode($xml), true);
+ if (preg_match("/^CommandDefinition/", $micro_service_uri, $match)){
+ $xml = simplexml_load_file(FMC_REPOSITORY_DIRECTORY . $micro_service_uri);
+ }else{
+ $xml = simplexml_load_file(MICRO_SERVICES_HOME_DIR . $micro_service_uri);
+ }
+ $micro_service_defition = json_decode(json_encode($xml), true);
$variables = $micro_service_defition['variables']['variable'];
$micro_service_variables = array();
@@ -408,7 +412,11 @@ function msa_micro_service_variables_to_workflow_variables_with_mapping ($micro_
function msa_micro_service_information_to_workflow_variables ($micro_service_uri) {
$micro_service_information = array();
- $xml = simplexml_load_file(MICRO_SERVICES_HOME_DIR . $micro_service_uri);
+ if (preg_match("/^CommandDefinition/", $micro_service_uri, $match)){
+ $xml = simplexml_load_file(FMC_REPOSITORY_DIRECTORY . $micro_service_uri);
+ }else{
+ $xml = simplexml_load_file(MICRO_SERVICES_HOME_DIR . $micro_service_uri);
+ }
$micro_service_defition = json_decode(json_encode($xml), true);
$micro_service_information = $micro_service_defition['information'];
diff --git a/Reference/Customer/Kibana/.meta_Process_Create_Report_Dashboard b/Reference/Customer/Kibana/.meta_Process_Create_Report_Dashboard
new file mode 100644
index 000000000..6da2a29ab
--- /dev/null
+++ b/Reference/Customer/Kibana/.meta_Process_Create_Report_Dashboard
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Customer/Kibana/.meta_Process_Delete_Dashboard b/Reference/Customer/Kibana/.meta_Process_Delete_Dashboard
new file mode 100644
index 000000000..767808ccd
--- /dev/null
+++ b/Reference/Customer/Kibana/.meta_Process_Delete_Dashboard
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Customer/Kibana/.meta_Process_Update_Dashboard b/Reference/Customer/Kibana/.meta_Process_Update_Dashboard
new file mode 100644
index 000000000..5647cbe49
--- /dev/null
+++ b/Reference/Customer/Kibana/.meta_Process_Update_Dashboard
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Customer/Kibana/.meta_Task_Search_Dashboard_Template_Selected.php b/Reference/Customer/Kibana/.meta_Task_Search_Dashboard_Template_Selected.php
new file mode 100644
index 000000000..fad434804
--- /dev/null
+++ b/Reference/Customer/Kibana/.meta_Task_Search_Dashboard_Template_Selected.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Customer/Kibana/.meta_kibana_dashboard.xml b/Reference/Customer/Kibana/.meta_kibana_dashboard.xml
new file mode 100644
index 000000000..201a16097
--- /dev/null
+++ b/Reference/Customer/Kibana/.meta_kibana_dashboard.xml
@@ -0,0 +1,43 @@
+
+
+
+
diff --git a/Reference/Customer/Kibana/Process_Create_Report_Dashboard/.meta_Task_Recovering_and_Filtering.php b/Reference/Customer/Kibana/Process_Create_Report_Dashboard/.meta_Task_Recovering_and_Filtering.php
new file mode 100644
index 000000000..6fb3638ac
--- /dev/null
+++ b/Reference/Customer/Kibana/Process_Create_Report_Dashboard/.meta_Task_Recovering_and_Filtering.php
@@ -0,0 +1,42 @@
+
+
+
+
diff --git a/Reference/Customer/Kibana/Process_Create_Report_Dashboard/.meta_Task_Recoving_and_Filtring.php b/Reference/Customer/Kibana/Process_Create_Report_Dashboard/.meta_Task_Recoving_and_Filtring.php
new file mode 100644
index 000000000..604269b37
--- /dev/null
+++ b/Reference/Customer/Kibana/Process_Create_Report_Dashboard/.meta_Task_Recoving_and_Filtring.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Reference/Customer/Kibana/Process_Create_Report_Dashboard/.meta_Task_Search_Dashboard_Template_Selected.php b/Reference/Customer/Kibana/Process_Create_Report_Dashboard/.meta_Task_Search_Dashboard_Template_Selected.php
new file mode 100644
index 000000000..fbe0a5abb
--- /dev/null
+++ b/Reference/Customer/Kibana/Process_Create_Report_Dashboard/.meta_Task_Search_Dashboard_Template_Selected.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Reference/Customer/Kibana/Process_Create_Report_Dashboard/.meta_Task_Send_the_new_template_to_ES.php b/Reference/Customer/Kibana/Process_Create_Report_Dashboard/.meta_Task_Send_the_new_template_to_ES.php
new file mode 100644
index 000000000..c192d5640
--- /dev/null
+++ b/Reference/Customer/Kibana/Process_Create_Report_Dashboard/.meta_Task_Send_the_new_template_to_ES.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Reference/Customer/Kibana/Process_Create_Report_Dashboard/Task_Search_Dashboard_Template_Selected.php b/Reference/Customer/Kibana/Process_Create_Report_Dashboard/Task_Search_Dashboard_Template_Selected.php
new file mode 100644
index 000000000..a26864f40
--- /dev/null
+++ b/Reference/Customer/Kibana/Process_Create_Report_Dashboard/Task_Search_Dashboard_Template_Selected.php
@@ -0,0 +1,223 @@
+\d+)/',$context['device_id'],$device_id_number);
+$context['device_id_number']=$device_id_number[1];
+$context['cmd']="/opt/ubi-jentreprise/bin/api/device/readDeviceById.sh ".$context['device_id_number'];
+$response_cmd= shell_exec($context['cmd']);
+preg_match('#\n(.*)\n#',$response_cmd, $out);
+$context['device_ip']=$out[1];
+
+}
+
+
+
+
+/* Recover IP Address for Kibana */
+
+define('HOST_KIBANA', 'UBI_ES_KIBANA_IP');
+$_KIBANA=get_vars_value(HOST_KIBANA);
+preg_match('#(.*):#',$_KIBANA,$_KIBANA);
+$context['kibanaIpAddress']=$_KIBANA[1];
+
+
+/* Recover Port Number for Kibana */
+
+$_KIBANA=get_vars_value(HOST_KIBANA);
+preg_match('#:(.*)#',$_KIBANA,$_KIBANA);
+$context['kibanaPort']=$_KIBANA[1];
+
+
+/**
+curl -XPOST "10.30.18.116:5601/api/saved_objects/_export" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'
+{
+ "objects": [
+ {
+ "type": "dashboard",
+ "id": "template_dashboard"
+ }
+ ]
+}
+'
+**/
+
+/* *** Recove ES ip address **** */
+define('HOST_ES', 'UBI_ES_WEBPORTAL_ENDPOINT');
+$_H=get_vars_value(HOST_ES);
+$context['ipAddress']=$_H;
+
+
+
+/* ** recove customer_id) ** */
+preg_match('/(?\d+)/',$context['UBIQUBEID'],$matches);
+$context['customer_id']=$matches[1];
+
+
+/* ***** to hash Url Customer Dashboard ***** */
+$context['Hash']=sha1(uniqid($context['customer_id'] . mt_rand(), true));
+
+
+
+/* ** Url and Method to Find selected Dashboard **** */
+$context['searchingURI']='http://'.$context['ipAddress'].':'.$context['port'].'/api/saved_objects/_export';
+
+$body_request='
+{
+ "objects": [
+ {
+ "type": "'.$context['type'].'",
+ "id": "'.$context['template name'].'"
+ }
+ ]
+}
+';
+
+
+
+$context['f']='/tmp/file_kibana_'.$context['Hash'].'.ndjson';
+$fp = fopen($context['f'], "w");
+
+$ci = curl_init();
+ curl_setopt($ci, CURLOPT_URL,$context['searchingURI']);
+ curl_setopt($ci, CURLOPT_TIMEOUT, 200);
+ curl_setopt($ci, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ci, CURLOPT_FORBID_REUSE, 0);
+ curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'POST');
+ curl_setopt($ci, CURLOPT_POSTFIELDS, $body_request);
+ curl_setopt($ci, CURLOPT_HTTPHEADER, array('kbn-xsrf: true','Content-Type: application/json'));
+ $result= curl_exec($ci);
+ fwrite($fp, $result);
+
+/* Store the result in a variable */
+$context['result']=$result;
+
+
+
+/* ** Store Kibana Url ***/
+
+$context['kibanaUrl']='http://'.$context['kibanaIpAddress'].':'.$context['kibanaPort'].'/app/kibana#/dashboard/'.$context['Hash'].'/';
+
+
+$check=json_decode($result,true);
+if(!isset($check['statusCode'])){
+
+ task_exit(ENDED, "Template ID found");
+}
+
+ else{
+
+ task_exit(WARNING, 'Template ID not found => '.$result.'');
+}
+
+//task_exit(ENDED, $result);
+
+?>
\ No newline at end of file
diff --git a/Reference/Customer/Kibana/Process_Create_Report_Dashboard/Task_Send_the_new_template_to_ES.php b/Reference/Customer/Kibana/Process_Create_Report_Dashboard/Task_Send_the_new_template_to_ES.php
new file mode 100644
index 000000000..fd8b4deb4
--- /dev/null
+++ b/Reference/Customer/Kibana/Process_Create_Report_Dashboard/Task_Send_the_new_template_to_ES.php
@@ -0,0 +1,196 @@
+
\ No newline at end of file
diff --git a/Reference/Customer/Kibana/Process_Delete_Dashboard/.meta_Task_Delete_Dashboard.php b/Reference/Customer/Kibana/Process_Delete_Dashboard/.meta_Task_Delete_Dashboard.php
new file mode 100644
index 000000000..06dbf4b22
--- /dev/null
+++ b/Reference/Customer/Kibana/Process_Delete_Dashboard/.meta_Task_Delete_Dashboard.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Reference/Customer/Kibana/Process_Delete_Dashboard/Task_Delete_Dashboard.php b/Reference/Customer/Kibana/Process_Delete_Dashboard/Task_Delete_Dashboard.php
new file mode 100644
index 000000000..b8e46e811
--- /dev/null
+++ b/Reference/Customer/Kibana/Process_Delete_Dashboard/Task_Delete_Dashboard.php
@@ -0,0 +1,34 @@
+
\ No newline at end of file
diff --git a/Reference/Customer/Kibana/Process_Update_Dashboard/.meta_Task_Recove_and_filter_for_Updating.php b/Reference/Customer/Kibana/Process_Update_Dashboard/.meta_Task_Recove_and_filter_for_Updating.php
new file mode 100644
index 000000000..2e32a3ad8
--- /dev/null
+++ b/Reference/Customer/Kibana/Process_Update_Dashboard/.meta_Task_Recove_and_filter_for_Updating.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Reference/Customer/Kibana/Process_Update_Dashboard/.meta_Task_Recovering_and_filtering_for_Updating.php b/Reference/Customer/Kibana/Process_Update_Dashboard/.meta_Task_Recovering_and_filtering_for_Updating.php
new file mode 100644
index 000000000..6e1657455
--- /dev/null
+++ b/Reference/Customer/Kibana/Process_Update_Dashboard/.meta_Task_Recovering_and_filtering_for_Updating.php
@@ -0,0 +1,42 @@
+
+
+
+
diff --git a/Reference/Customer/Kibana/Process_Update_Dashboard/.meta_Task_Search_Dashboard_Selected_for_Updating.php b/Reference/Customer/Kibana/Process_Update_Dashboard/.meta_Task_Search_Dashboard_Selected_for_Updating.php
new file mode 100644
index 000000000..7fc237939
--- /dev/null
+++ b/Reference/Customer/Kibana/Process_Update_Dashboard/.meta_Task_Search_Dashboard_Selected_for_Updating.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Reference/Customer/Kibana/Process_Update_Dashboard/.meta_Task_Send_back_template_to_ES_for_Updating.php b/Reference/Customer/Kibana/Process_Update_Dashboard/.meta_Task_Send_back_template_to_ES_for_Updating.php
new file mode 100644
index 000000000..73a325870
--- /dev/null
+++ b/Reference/Customer/Kibana/Process_Update_Dashboard/.meta_Task_Send_back_template_to_ES_for_Updating.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Reference/Customer/Kibana/Process_Update_Dashboard/Task_Search_Dashboard_Selected_for_Updating.php b/Reference/Customer/Kibana/Process_Update_Dashboard/Task_Search_Dashboard_Selected_for_Updating.php
new file mode 100644
index 000000000..20ff11e79
--- /dev/null
+++ b/Reference/Customer/Kibana/Process_Update_Dashboard/Task_Search_Dashboard_Selected_for_Updating.php
@@ -0,0 +1,201 @@
+\d+)/',$context['device_id'],$device_id_number);
+$context['device_id_number']=$device_id_number[1];
+$context['cmd']="/opt/ubi-jentreprise/bin/api/device/readDeviceById.sh ".$context['device_id_number'];
+$response_cmd= shell_exec($context['cmd']);
+preg_match('#\n(.*)\n#',$response_cmd, $out);
+$context['device_ip']=$out[1];
+
+}
+
+
+
+
+/* Recover IP Address for Kibana */
+
+define('HOST_KIBANA', 'UBI_ES_KIBANA_IP');
+$_KIBANA=get_vars_value(HOST_KIBANA);
+preg_match('#(.*):#',$_KIBANA,$_KIBANA);
+$context['kibanaIpAddress']=$_KIBANA[1];
+
+
+/* Recover Port Number for Kibana */
+
+$_KIBANA=get_vars_value(HOST_KIBANA);
+preg_match('#:(.*)#',$_KIBANA,$_KIBANA);
+$context['kibanaPort']=$_KIBANA[1];
+
+
+/**
+curl -XPOST "10.30.18.116:5601/api/saved_objects/_export" -H 'kbn-xsrf: true' -H 'Content-Type: application/json' -d'
+{
+ "objects": [
+ {
+ "type": "dashboard",
+ "id": "template_dashboard"
+ }
+ ]
+}
+'
+**/
+
+/* *** Recove ES ip address **** */
+define('HOST_ES', 'UBI_ES_WEBPORTAL_ENDPOINT');
+$_H=get_vars_value(HOST_ES);
+$context['ipAddress']=$_H;
+
+
+
+/* ** recove customer_id) ** */
+preg_match('/(?\d+)/',$context['UBIQUBEID'],$matches);
+$context['customer_id']=$matches[1];
+
+
+
+
+/* ** Url and Method to Find selected Dashboard **** */
+$context['searchingURI']='http://'.$context['ipAddress'].':'.$context['port'].'/api/saved_objects/_export';
+
+$body_request='
+{
+ "objects": [
+ {
+ "type": "'.$context['type'].'",
+ "id": "'.$context['template name'].'"
+ }
+ ]
+}
+';
+
+
+
+$context['f']='/tmp/file_kibana_'.$context['Hash'].'.ndjson';
+$fp = fopen($context['f'], "w");
+
+$ci = curl_init();
+ curl_setopt($ci, CURLOPT_URL,$context['searchingURI']);
+ curl_setopt($ci, CURLOPT_TIMEOUT, 200);
+ curl_setopt($ci, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($ci, CURLOPT_FORBID_REUSE, 0);
+ curl_setopt($ci, CURLOPT_CUSTOMREQUEST, 'POST');
+ curl_setopt($ci, CURLOPT_POSTFIELDS, $body_request);
+ curl_setopt($ci, CURLOPT_HTTPHEADER, array('kbn-xsrf: true','Content-Type: application/json'));
+ $result= curl_exec($ci);
+ fwrite($fp, $result);
+
+/* Store the result in a variable */
+$context['result']=$result;
+
+/* ** Store Kibana Url ***/
+
+$context['kibanaUrl']='http://'.$context['kibanaIpAddress'].':'.$context['kibanaPort'].'/app/kibana#/dashboard/'.$context['Hash'].'/';
+
+$check=json_decode($result,true);
+if(!isset($check['statusCode'])){
+
+ task_exit(ENDED, "Template ID found");
+}
+
+ else{
+
+ task_exit(WARNING, 'Template ID not found => '.$result.'');
+}
+
+
+//task_exit(ENDED, $result);
+
+?>
\ No newline at end of file
diff --git a/Reference/Customer/Kibana/Process_Update_Dashboard/Task_Send_back_template_to_ES_for_Updating.php b/Reference/Customer/Kibana/Process_Update_Dashboard/Task_Send_back_template_to_ES_for_Updating.php
new file mode 100644
index 000000000..62a7b67f4
--- /dev/null
+++ b/Reference/Customer/Kibana/Process_Update_Dashboard/Task_Send_back_template_to_ES_for_Updating.php
@@ -0,0 +1,206 @@
+
\ No newline at end of file
diff --git a/Reference/Customer/Kibana/kibana_dashboard.xml b/Reference/Customer/Kibana/kibana_dashboard.xml
new file mode 100644
index 000000000..de6576d0b
--- /dev/null
+++ b/Reference/Customer/Kibana/kibana_dashboard.xml
@@ -0,0 +1,274 @@
+
+
+ true
+
+ dashboardName
+ 5
+ TRANSACTION
+ Dashboard
+ /images/eclipseIcons/page_obj.gif
+ Deploy Dashboard
+ 10000
+ 0
+ 5
+ false
+ false
+ false
+ 5
+
+
+
+
+
+
+
+
+ template_default
+ template_Email_Overview
+ template_WEB
+ template_USER
+ template_URL
+ template_NF_BYTES_IP_PORT
+ template_Event_Alarm
+ template_Event_Alarm_Rule
+ template_Events_Per_Traffic
+ template_NF_Counter
+
+ Select available dashboards on Kibana or write the name of your created dashboard (based on the dashboard url)
+
+
+ Name of your duplicated dashbaoard from your selected dashboard template
+
+
+
+
+
+
+
+
+
+ Basic
+ Advanced
+
+
+
+
+ - Advanced : your write all fields and their values with operators ( OR, AND ) in Advanced filter input
+
+- Basic : you have Basic Fitler table that you can put fields and select your operator. Then you can decide if you want to apply your filter directly or just save it
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Write your filter in according index fields (ex. port:<50 OR protocol:UDP)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ &&
+ ||
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ service
+ device
+
+
+
+
+ In according your selection, the dashboard that your are going to deploy will be display in the appropriated tab
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ Create Dashboard
+ CREATE
+
+
+
+
+ /opt/fmc_repository/Process/Reference/Customer/Kibana/Process_Create_Report_Dashboard/
+ Search Dashboard Template Selected
+
+
+ /opt/fmc_repository/Process/Reference/Customer/Kibana/Process_Create_Report_Dashboard/
+ Send the new template to ES
+
+
+
+
+
+ 5
+ Delete Dashboard
+ DELETE
+
+ /opt/fmc_repository/Process/Reference/Customer/Kibana/Process_Delete_Dashboard/
+ Delete Dashboard
+
+
+
+
+
+ 5
+ Update Dashboard
+ UPDATE
+
+
+
+
+ /opt/fmc_repository/Process/Reference/Customer/Kibana/Process_Update_Dashboard/
+ Search Dashboard Selected for Updating
+
+
+ /opt/fmc_repository/Process/Reference/Customer/Kibana/Process_Update_Dashboard/
+ Send back template to ES for Updating
+
+
+
+
diff --git a/Reference/Device_Data_File/.meta_Device_Data_File.xml b/Reference/Device_Data_File/.meta_Device_Data_File.xml
new file mode 100644
index 000000000..de45c0c57
--- /dev/null
+++ b/Reference/Device_Data_File/.meta_Device_Data_File.xml
@@ -0,0 +1,37 @@
+
+
+
+
diff --git a/Reference/Device_Data_File/.meta_Process_Delete_File b/Reference/Device_Data_File/.meta_Process_Delete_File
new file mode 100644
index 000000000..c3fb50f75
--- /dev/null
+++ b/Reference/Device_Data_File/.meta_Process_Delete_File
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Device_Data_File/.meta_Process_Delete_The_Instance b/Reference/Device_Data_File/.meta_Process_Delete_The_Instance
new file mode 100644
index 000000000..54021ec71
--- /dev/null
+++ b/Reference/Device_Data_File/.meta_Process_Delete_The_Instance
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Device_Data_File/.meta_Process_Send_File b/Reference/Device_Data_File/.meta_Process_Send_File
new file mode 100644
index 000000000..417e497dc
--- /dev/null
+++ b/Reference/Device_Data_File/.meta_Process_Send_File
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Device_Data_File/.meta_Process_Update b/Reference/Device_Data_File/.meta_Process_Update
new file mode 100644
index 000000000..809b470eb
--- /dev/null
+++ b/Reference/Device_Data_File/.meta_Process_Update
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Device_Data_File/Device_Data_File.xml b/Reference/Device_Data_File/Device_Data_File.xml
new file mode 100644
index 000000000..8f530847f
--- /dev/null
+++ b/Reference/Device_Data_File/Device_Data_File.xml
@@ -0,0 +1,116 @@
+
+
+ true
+
+ service_id
+ 5
+
+ /images/eclipseIcons/page_obj.gif
+ Device Data File
+ 10000
+ 5
+ false
+ false
+ false
+ 5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ Send File
+
+ false
+ CREATE
+
+
+
+
+ /opt/fmc_repository/Process/Reference/Device_Data_File/Process_Send_File/Tasks/
+ File Found
+
+
+ /opt/fmc_repository/Process/Reference/Device_Data_File/Process_Send_File/Tasks/
+ File Sent
+
+
+
+ 5
+ Update
+
+ false
+ UPDATE
+
+
+
+
+ /opt/fmc_repository/Process/Reference/Device_Data_File/Process_Update/Tasks/
+ File Found
+
+
+ /opt/fmc_repository/Process/Reference/Device_Data_File/Process_Update/Tasks/
+ File Sent
+
+
+
+ 5
+ Delete File
+
+ false
+ UPDATE
+
+ /opt/fmc_repository/Process/Reference/Device_Data_File/Process_Delete_File/Tasks/
+ File Found
+
+
+ /opt/fmc_repository/Process/Reference/Device_Data_File/Process_Delete_File/Tasks/
+ File Deleted
+
+
+
+ 5
+ Delete The Instance
+
+ false
+ DELETE
+
+
diff --git a/Reference/Device_Data_File/Process_Delete_File/.meta_Tasks b/Reference/Device_Data_File/Process_Delete_File/.meta_Tasks
new file mode 100644
index 000000000..f69701ec4
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Delete_File/.meta_Tasks
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Device_Data_File/Process_Delete_File/Tasks/.meta_Task_File_Deleted.php b/Reference/Device_Data_File/Process_Delete_File/Tasks/.meta_Task_File_Deleted.php
new file mode 100644
index 000000000..c0ec313d4
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Delete_File/Tasks/.meta_Task_File_Deleted.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Reference/Device_Data_File/Process_Delete_File/Tasks/.meta_Task_File_Found.php b/Reference/Device_Data_File/Process_Delete_File/Tasks/.meta_Task_File_Found.php
new file mode 100644
index 000000000..e9b725ab1
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Delete_File/Tasks/.meta_Task_File_Found.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Reference/Device_Data_File/Process_Delete_File/Tasks/Task_File_Deleted.php b/Reference/Device_Data_File/Process_Delete_File/Tasks/Task_File_Deleted.php
new file mode 100644
index 000000000..1c69d9c2f
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Delete_File/Tasks/Task_File_Deleted.php
@@ -0,0 +1,73 @@
+ /dev/null";
+
+
+
+$response_cmd= shell_exec($cmd);
+
+preg_match('#Done\s+(.*)\s+Done#',$response_cmd, $out);
+
+
+if ( ! isset($out[1])) {
+ $out[1] ='null';
+}
+
+$file1=$out[1];
+
+
+if ($file1==$context['file_to_delete'])
+{
+
+$cmd="sshpass -p ".$context['password']." ssh -o StrictHostKeyChecking=no ".$context['user']."@".$context['device_ip']." shell rm ".$context['file_to_delete']." 2> /dev/null";
+
+$response_cmd= shell_exec($cmd);
+
+preg_match('#Done\s+(.*)\s+Done#',$response_cmd, $out);
+$file1=$out[1];
+
+if($file1==""){
+task_exit(ENDED, "File Deleted");
+
+}
+
+else
+{
+task_exit(WARNING, "Error");
+}
+
+}
+
+else
+{
+task_exit(WARNING, "Error");
+}
+
+
+
+
+
+?>
\ No newline at end of file
diff --git a/Reference/Device_Data_File/Process_Delete_File/Tasks/Task_File_Found.php b/Reference/Device_Data_File/Process_Delete_File/Tasks/Task_File_Found.php
new file mode 100644
index 000000000..63d338545
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Delete_File/Tasks/Task_File_Found.php
@@ -0,0 +1,56 @@
+ /dev/null";
+
+
+
+$response_cmd= shell_exec($cmd);
+
+preg_match('#Done\s+(.*)\s+Done#',$response_cmd, $out);
+
+
+if ( ! isset($out[1])) {
+ $out[1] ='null';
+}
+
+$file1=$out[1];
+
+
+if ($file1==$context['file_to_delete'])
+{
+task_exit(ENDED, "File Found");
+}
+
+else
+{
+task_exit(WARNING, "Error");
+}
+
+
+?>
\ No newline at end of file
diff --git a/Reference/Device_Data_File/Process_Send_File/.meta_Tasks b/Reference/Device_Data_File/Process_Send_File/.meta_Tasks
new file mode 100644
index 000000000..4e1154810
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Send_File/.meta_Tasks
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Device_Data_File/Process_Send_File/Tasks/.meta_Task_Destination_Found.php b/Reference/Device_Data_File/Process_Send_File/Tasks/.meta_Task_Destination_Found.php
new file mode 100644
index 000000000..24168de1a
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Send_File/Tasks/.meta_Task_Destination_Found.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Reference/Device_Data_File/Process_Send_File/Tasks/.meta_Task_File_Found.php b/Reference/Device_Data_File/Process_Send_File/Tasks/.meta_Task_File_Found.php
new file mode 100644
index 000000000..0379f6c4e
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Send_File/Tasks/.meta_Task_File_Found.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Reference/Device_Data_File/Process_Send_File/Tasks/.meta_Task_File_Sent.php b/Reference/Device_Data_File/Process_Send_File/Tasks/.meta_Task_File_Sent.php
new file mode 100644
index 000000000..e27518ee9
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Send_File/Tasks/.meta_Task_File_Sent.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Reference/Device_Data_File/Process_Send_File/Tasks/Task_Destination_Found.php b/Reference/Device_Data_File/Process_Send_File/Tasks/Task_Destination_Found.php
new file mode 100644
index 000000000..85bcb34b0
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Send_File/Tasks/Task_Destination_Found.php
@@ -0,0 +1,30 @@
+
\ No newline at end of file
diff --git a/Reference/Device_Data_File/Process_Send_File/Tasks/Task_File_Found.php b/Reference/Device_Data_File/Process_Send_File/Tasks/Task_File_Found.php
new file mode 100644
index 000000000..fd28ddee5
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Send_File/Tasks/Task_File_Found.php
@@ -0,0 +1,55 @@
+
\ No newline at end of file
diff --git a/Reference/Device_Data_File/Process_Send_File/Tasks/Task_File_Sent.php b/Reference/Device_Data_File/Process_Send_File/Tasks/Task_File_Sent.php
new file mode 100644
index 000000000..aff0a8031
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Send_File/Tasks/Task_File_Sent.php
@@ -0,0 +1,48 @@
+\d+)/',$context['device'],$device_id_number);
+$context['device_id_number']=$device_id_number[1];
+$context['cmd']="/opt/ubi-jentreprise/bin/api/device/readDeviceById.sh ".$context['device_id_number'];
+$response_cmd= shell_exec($context['cmd']);
+preg_match('#\n(.*)\n#',$response_cmd, $out);
+$context['device_ip']=$out[1];
+
+
+// $cmd="scp ".$context['src_file']." ".$context['user']."@".$context['device_ip'].":".$context['dst_file'];
+$cmd="sshpass -p ".$context['password']." scp -o StrictHostKeyChecking=no ".$context['src_file']." ".$context['user']."@".$context['device_ip'].":".$context['dst_file']." 2> /dev/null";
+
+shell_exec($cmd);
+
+task_exit(ENDED, "OK, Check the first task in the Live Console");
+
+?>
\ No newline at end of file
diff --git a/Reference/Device_Data_File/Process_Update/.meta_Tasks b/Reference/Device_Data_File/Process_Update/.meta_Tasks
new file mode 100644
index 000000000..239b1ddc0
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Update/.meta_Tasks
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Device_Data_File/Process_Update/Tasks/.meta_Task_Destination_Found.php b/Reference/Device_Data_File/Process_Update/Tasks/.meta_Task_Destination_Found.php
new file mode 100644
index 000000000..440c2bf5d
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Update/Tasks/.meta_Task_Destination_Found.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Reference/Device_Data_File/Process_Update/Tasks/.meta_Task_File_Found.php b/Reference/Device_Data_File/Process_Update/Tasks/.meta_Task_File_Found.php
new file mode 100644
index 000000000..00533574e
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Update/Tasks/.meta_Task_File_Found.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Reference/Device_Data_File/Process_Update/Tasks/.meta_Task_File_Sent.php b/Reference/Device_Data_File/Process_Update/Tasks/.meta_Task_File_Sent.php
new file mode 100644
index 000000000..10036d60d
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Update/Tasks/.meta_Task_File_Sent.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Reference/Device_Data_File/Process_Update/Tasks/Task_Destination_Found.php b/Reference/Device_Data_File/Process_Update/Tasks/Task_Destination_Found.php
new file mode 100644
index 000000000..eb6d2c29e
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Update/Tasks/Task_Destination_Found.php
@@ -0,0 +1,79 @@
+ FAIL [Don't proceed]
+ * Such cases need to be handled as per the Task logic
+ */
+check_mandatory_param('var_name');
+
+/**
+ * $context => Service Context variable per Service Instance
+ * All the user-inputs of Tasks are automatically stored in $context
+ * Also, any new variables should be stored in $context which are used across Service Instance
+ * The variables stored in $context can be used across all the Tasks and Processes of a particular Service
+ * Update $context array [add/update/delete variables] as per requirement
+ *
+ * ENTER YOUR CODE HERE
+ */
+$context['var_name2'] = $context['var_name2'] + 1;
+
+/**
+ * Format of the Task response :
+ * JSON format : {"wo_status":"status","wo_comment":"comment","wo_newparams":{json_body}}
+ * wo_status : ENDED [Green color] or FAILED [Red color] or WARNING [Orange color]
+ * -> While the Task is Running [means no response returned yet], task status is RUNNING [Blue color]
+ * -> When status is returned as FAILED, the Orchestration Engine stops the Process Execution from this Task
+ * wo_comment : Appropriate Comment to display as per the success/failure of the Task
+ * wo_newparams : json_body parameters returned from this Task
+ *
+ * Function prepare_json_response() takes care of Creating a Json response from inputs
+ * This function definiton can be found at : /opt/fmc_repository/Process/Reference/Common/utility.php
+ * NOTE : For 'wo_newparams', always pass "$context" [whether wo_status is ENDED/FAILED/WARNING to preserve it across Service Instance]
+ * -> Last argument "true" mentions whether the json_response to be Logged in the logfile : /opt/jboss/latest/logs/process.log
+ * -> If not passed, it's "false"
+ *
+ * The response "$ret" should be echoed from the Task "echo $ret" which is read by Orchestration Engine
+ * In case of FAILURE/WARNING, the Task can be Terminated by calling "exit" as per Logic
+ */
+if ($context['var_name2'] % 2 === 0) {
+ $ret = prepare_json_response(FAILED, 'Task Failed', $context, true);
+ echo "$ret\n";
+ exit;
+}
+
+/**
+ * End of the task do not modify after this point
+ */
+task_exit(ENDED, "Task OK");
+
+?>
\ No newline at end of file
diff --git a/Reference/Device_Data_File/Process_Update/Tasks/Task_File_Found.php b/Reference/Device_Data_File/Process_Update/Tasks/Task_File_Found.php
new file mode 100644
index 000000000..a126e0507
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Update/Tasks/Task_File_Found.php
@@ -0,0 +1,63 @@
+
\ No newline at end of file
diff --git a/Reference/Device_Data_File/Process_Update/Tasks/Task_File_Sent.php b/Reference/Device_Data_File/Process_Update/Tasks/Task_File_Sent.php
new file mode 100644
index 000000000..b430e23ae
--- /dev/null
+++ b/Reference/Device_Data_File/Process_Update/Tasks/Task_File_Sent.php
@@ -0,0 +1,48 @@
+\d+)/',$context['device'],$device_id_number);
+$context['device_id_number']=$device_id_number[1];
+$context['cmd']="/opt/ubi-jentreprise/bin/api/device/readDeviceById.sh ".$context['device_id_number'];
+$response_cmd= shell_exec($context['cmd']);
+preg_match('#\n(.*)\n#',$response_cmd, $out);
+$context['device_ip']=$out[1];
+
+
+// $cmd="scp ".$context['src_file']." ".$context['user']."@".$context['device_ip'].":".$context['dst_file'];
+$cmd="sshpass -p ".$context['password']." scp -o StrictHostKeyChecking=no ".$context['src_file']." ".$context['user']."@".$context['device_ip'].":".$context['dst_file']." 2> /dev/null";
+
+shell_exec($cmd);
+
+
+
+task_exit(ENDED, "OK, Check the first task in the Live Console");
+
+?>
\ No newline at end of file
diff --git a/Reference/Device_Management/.meta_Device_Management_List.xml b/Reference/Device_Management/.meta_Device_Management_List.xml
new file mode 100644
index 000000000..83f442afe
--- /dev/null
+++ b/Reference/Device_Management/.meta_Device_Management_List.xml
@@ -0,0 +1,37 @@
+
+
+
+
diff --git a/Reference/Device_Management/.meta_Process_Get_Device_List b/Reference/Device_Management/.meta_Process_Get_Device_List
new file mode 100644
index 000000000..fd67db18c
--- /dev/null
+++ b/Reference/Device_Management/.meta_Process_Get_Device_List
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Device_Management/.meta_Process_Get_Device_List_Update b/Reference/Device_Management/.meta_Process_Get_Device_List_Update
new file mode 100644
index 000000000..6884ba7be
--- /dev/null
+++ b/Reference/Device_Management/.meta_Process_Get_Device_List_Update
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Device_Management/.meta_Process_Move_to_Trash b/Reference/Device_Management/.meta_Process_Move_to_Trash
new file mode 100644
index 000000000..5798192e6
--- /dev/null
+++ b/Reference/Device_Management/.meta_Process_Move_to_Trash
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Device_Management/.meta_Process_Update_Device_List b/Reference/Device_Management/.meta_Process_Update_Device_List
new file mode 100644
index 000000000..e76ed1951
--- /dev/null
+++ b/Reference/Device_Management/.meta_Process_Update_Device_List
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Device_Management/Device_Management_List.xml b/Reference/Device_Management/Device_Management_List.xml
new file mode 100644
index 000000000..5de9fcd57
--- /dev/null
+++ b/Reference/Device_Management/Device_Management_List.xml
@@ -0,0 +1,62 @@
+
+
+ true
+
+ service_id
+ 5
+ TRANSACTION
+
+ /images/eclipseIcons/page_obj.gif
+ Device Management List
+ 10000
+ 0
+ 5
+ false
+ false
+ false
+ 5
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ Get Device List
+
+ false
+ CREATE
+
+ /opt/fmc_repository/Process/Reference/Device_Management/Process_Get_Device_List/Tasks/
+ Get Device List
+
+
+
+
+ 5
+ Move to Trash
+
+ false
+ DELETE
+
+
+
+ 5
+ Update Device List
+
+ false
+ UPDATE
+
+ /opt/fmc_repository/Process/Reference/Device_Management/Process_Update_Device_List/Tasks/
+ Update Device List
+
+
+
+
diff --git a/Reference/Device_Management/Process_Get_Device_List/.meta_Tasks b/Reference/Device_Management/Process_Get_Device_List/.meta_Tasks
new file mode 100644
index 000000000..006474f76
--- /dev/null
+++ b/Reference/Device_Management/Process_Get_Device_List/.meta_Tasks
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Device_Management/Process_Get_Device_List/Tasks/.meta_Task_Get_Device_List.php b/Reference/Device_Management/Process_Get_Device_List/Tasks/.meta_Task_Get_Device_List.php
new file mode 100644
index 000000000..eff09175f
--- /dev/null
+++ b/Reference/Device_Management/Process_Get_Device_List/Tasks/.meta_Task_Get_Device_List.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Reference/Device_Management/Process_Get_Device_List/Tasks/Task_Get_Device_List.php b/Reference/Device_Management/Process_Get_Device_List/Tasks/Task_Get_Device_List.php
new file mode 100644
index 000000000..013db9636
--- /dev/null
+++ b/Reference/Device_Management/Process_Get_Device_List/Tasks/Task_Get_Device_List.php
@@ -0,0 +1,84 @@
+ to avoid error display characters (accent..) with excel file import
+
+fprintf($file, chr(0xEF).chr(0xBB).chr(0xBF));
+
+foreach($lines as $line){
+
+fputcsv($file, $line,$delimiter);
+
+}
+
+fclose($file);
+
+
+$res = prepare_json_response(ENDED, "Devices details fetched successfully.", $context, true);
+echo $res;
+
+
+?>
\ No newline at end of file
diff --git a/Reference/Device_Management/Process_Update_Device_List/.meta_Tasks b/Reference/Device_Management/Process_Update_Device_List/.meta_Tasks
new file mode 100644
index 000000000..5821564e4
--- /dev/null
+++ b/Reference/Device_Management/Process_Update_Device_List/.meta_Tasks
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Device_Management/Process_Update_Device_List/Tasks/.meta_Task_Update_Device_List.php b/Reference/Device_Management/Process_Update_Device_List/Tasks/.meta_Task_Update_Device_List.php
new file mode 100644
index 000000000..c0fa75c15
--- /dev/null
+++ b/Reference/Device_Management/Process_Update_Device_List/Tasks/.meta_Task_Update_Device_List.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Reference/Device_Management/Process_Update_Device_List/Tasks/Task_Update_Device_List.php b/Reference/Device_Management/Process_Update_Device_List/Tasks/Task_Update_Device_List.php
new file mode 100644
index 000000000..fd8aa82be
--- /dev/null
+++ b/Reference/Device_Management/Process_Update_Device_List/Tasks/Task_Update_Device_List.php
@@ -0,0 +1,85 @@
+ to avoid error display characters (accent..) with excel file import
+
+fprintf($file, chr(0xEF).chr(0xBB).chr(0xBF));
+
+foreach($lines as $line){
+
+fputcsv($file, $line,$delimiter);
+
+}
+
+fclose($file);
+
+
+$res = prepare_json_response(ENDED, "Devices details fetched successfully.", $context, true);
+echo $res;
+
+
+?>
\ No newline at end of file
diff --git a/Reference/FORTINET/.meta_Tasks b/Reference/FORTINET/.meta_Tasks
new file mode 100644
index 000000000..80c8946fe
--- /dev/null
+++ b/Reference/FORTINET/.meta_Tasks
@@ -0,0 +1,39 @@
+
+
+
+
diff --git a/Reference/FORTINET/Tasks/.meta_Task_fortigate_execute_ping.php b/Reference/FORTINET/Tasks/.meta_Task_fortigate_execute_ping.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/FORTINET/Tasks/.meta_Task_fortigate_execute_ping.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/FORTINET/Tasks/.meta_Task_fortigate_port_ip_update.php b/Reference/FORTINET/Tasks/.meta_Task_fortigate_port_ip_update.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/FORTINET/Tasks/.meta_Task_fortigate_port_ip_update.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/FORTINET/Tasks/.meta_Task_fortigate_reboot.php b/Reference/FORTINET/Tasks/.meta_Task_fortigate_reboot.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/FORTINET/Tasks/.meta_Task_fortigate_reboot.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/FORTINET/Tasks/.meta_Task_fortigate_stop.php b/Reference/FORTINET/Tasks/.meta_Task_fortigate_stop.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/FORTINET/Tasks/.meta_Task_fortigate_stop.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/FORTINET/Tasks/.meta_Task_fortigate_update_execute.php b/Reference/FORTINET/Tasks/.meta_Task_fortigate_update_execute.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/FORTINET/Tasks/.meta_Task_fortigate_update_execute.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/FORTINET/Tasks/Task_fortigate_execute_ping.php b/Reference/FORTINET/Tasks/Task_fortigate_execute_ping.php
new file mode 100644
index 000000000..ece5e888f
--- /dev/null
+++ b/Reference/FORTINET/Tasks/Task_fortigate_execute_ping.php
@@ -0,0 +1,56 @@
+ $PROCESSINSTANCEID,
+ 'EXECNUMBER' => $EXECNUMBER,
+ 'TASKID' => $TASKID);
+
+$device_id = substr($context['device_id'], 3);
+$ip_address = $context['ip_address'];
+
+$configuration = "execute ping $ip_address";
+$response = _device_do_push_configuration_by_id($device_id, $configuration);
+$response = json_decode($response, true);
+if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ echo $response;
+ exit;
+}
+
+$response = wait_for_pushconfig_completion($device_id, $process_params);
+$response = json_decode($response, true);
+if ($response['wo_status'] !== ENDED) {
+ $context['ping_response'] = "Not Available";
+ $context['ping_status'] = "Not Available";
+ $response = prepare_json_response(FAILED, $response['wo_comment'] . "\nPING Status : Not Available", $context, true);
+ echo $response;
+ exit;
+}
+$pushconfig_status_message = $response['wo_comment'];
+$context['ping_response'] = substr($pushconfig_status_message, strpos($pushconfig_status_message, "Push Config Message : ")
+ + strlen("Push Config Message : "));
+
+if (strpos($pushconfig_status_message, "100% packet loss") !== false) {
+ $pushconfig_status_message .= "PING Status : " . FAILED;
+ $context['ping_status'] = FAILED;
+}
+else {
+ $pushconfig_status_message .= "PING Status : " . STATUS_OK;
+ $context['ping_status'] = STATUS_OK;
+}
+$response = prepare_json_response(ENDED, $pushconfig_status_message, $context, true);
+echo $response;
+?>
\ No newline at end of file
diff --git a/Reference/FORTINET/Tasks/Task_fortigate_port_ip_update.php b/Reference/FORTINET/Tasks/Task_fortigate_port_ip_update.php
new file mode 100644
index 000000000..56b06018c
--- /dev/null
+++ b/Reference/FORTINET/Tasks/Task_fortigate_port_ip_update.php
@@ -0,0 +1,59 @@
+ $PROCESSINSTANCEID,
+ 'EXECNUMBER' => $EXECNUMBER,
+ 'TASKID' => $TASKID);
+
+$operator_prefix = $context['operator_prefix'];
+$device_id = substr($context['device_id'], 3);
+$ip_address = $context['ip_address'];
+$netmask = $context['netmask'];
+$interface = $context['interface'];
+
+$command1 = "config system interface";
+$command2 = "edit $interface";
+$command3 = "set ip $ip_address $netmask";
+$command4 = "end";
+$configuration = "$command1\n$command2\n$command3\n$command4";
+$response = _device_do_push_configuration_by_id($device_id, $configuration);
+$response = json_decode($response, true);
+if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ echo $response;
+ exit;
+}
+
+$timeout_prompt = $operator_prefix . $device_id . " # ";
+if ($interface == 'port1'){
+ //for port1, we lost the connection when we change the IP, we get 'timeout, buffer received'
+ $timeout_ignone_messasges = array("timeout, buffer received", "timeout, $timeout_prompt not found", "timeout, # not found");
+}else{
+ $timeout_ignone_messasges = array("timeout, $timeout_prompt not found", "timeout, # not found");
+}
+$response = wait_for_pushconfig_completion($device_id, $process_params, $timeout_ignone_messasges);
+$response = json_decode($response, true);
+if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ echo $response;
+ exit;
+}
+$pushconfig_status_message = $response['wo_comment'];
+
+$response = prepare_json_response(ENDED, "IP Address $ip_address-$netmask updated successfully on Interface $interface on the Fortigate Device $device_id.\n$pushconfig_status_message",
+ $context, true);
+echo $response;
+
+?>
\ No newline at end of file
diff --git a/Reference/FORTINET/Tasks/Task_fortigate_reboot.php b/Reference/FORTINET/Tasks/Task_fortigate_reboot.php
new file mode 100644
index 000000000..56cfe843f
--- /dev/null
+++ b/Reference/FORTINET/Tasks/Task_fortigate_reboot.php
@@ -0,0 +1,43 @@
+ $PROCESSINSTANCEID,
+ 'EXECNUMBER' => $EXECNUMBER,
+ 'TASKID' => $TASKID);
+$device_id = substr($context['device_id'], 3);
+
+$configuration = "execute reboot";
+$response = _device_do_push_configuration_by_id($device_id, $configuration);
+$response = json_decode($response, true);
+if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ echo $response;
+ exit;
+}
+
+$timeout_ignone_messasge = "closed by peer";
+$response = wait_for_pushconfig_completion($device_id, $process_params, $timeout_ignone_messasge);
+$response = json_decode($response, true);
+if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ echo $response;
+ exit;
+}
+$pushconfig_status_message = $response['wo_comment'];
+
+$response = prepare_json_response(ENDED, "Fortigate Device $device_id Rebooted Successfully.\n$pushconfig_status_message",
+ $context, true);
+echo $response;
+
+?>
\ No newline at end of file
diff --git a/Reference/FORTINET/Tasks/Task_fortigate_stop.php b/Reference/FORTINET/Tasks/Task_fortigate_stop.php
new file mode 100644
index 000000000..70e95e844
--- /dev/null
+++ b/Reference/FORTINET/Tasks/Task_fortigate_stop.php
@@ -0,0 +1,43 @@
+ $PROCESSINSTANCEID,
+ 'EXECNUMBER' => $EXECNUMBER,
+ 'TASKID' => $TASKID);
+$device_id = substr($context['device_id'], 3);
+
+$configuration = "execute shutdown";
+$response = _device_do_push_configuration_by_id($device_id, $configuration);
+$response = json_decode($response, true);
+if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ echo $response;
+ exit;
+}
+
+$timeout_ignone_messasge = "closed by peer";
+$response = wait_for_pushconfig_completion($device_id, $process_params, $timeout_ignone_messasge);
+$response = json_decode($response, true);
+if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ echo $response;
+ exit;
+}
+$pushconfig_status_message = $response['wo_comment'];
+
+$response = prepare_json_response(ENDED, "Fortigate Device $device_id Shutdown Successfully.\n$pushconfig_status_message",
+ $context, true);
+echo $response;
+
+?>
\ No newline at end of file
diff --git a/Reference/FORTINET/Tasks/Task_fortigate_update_execute.php b/Reference/FORTINET/Tasks/Task_fortigate_update_execute.php
new file mode 100644
index 000000000..7c0e9958f
--- /dev/null
+++ b/Reference/FORTINET/Tasks/Task_fortigate_update_execute.php
@@ -0,0 +1,43 @@
+ $PROCESSINSTANCEID,
+ 'EXECNUMBER' => $EXECNUMBER,
+ 'TASKID' => $TASKID);
+$device_id = substr($context['device_id'], 3);
+
+$configuration = "execute update-now";
+$response = _device_do_push_configuration_by_id($device_id, $configuration);
+$response = json_decode($response, true);
+if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ echo $response;
+ exit;
+}
+
+#$timeout_ignone_messasge = "closed by peer";
+$response = wait_for_pushconfig_completion($device_id, $process_params);
+$response = json_decode($response, true);
+if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ echo $response;
+ exit;
+}
+$pushconfig_status_message = $response['wo_comment'];
+
+$response = prepare_json_response(ENDED, "Fortigate Device $device_id Updated Successfully.\n$pushconfig_status_message",
+ $context, true);
+echo $response;
+
+?>
\ No newline at end of file
diff --git a/Reference/Heat/.meta_Process_Deploy b/Reference/Heat/.meta_Process_Deploy
new file mode 100644
index 000000000..d2daaaafe
--- /dev/null
+++ b/Reference/Heat/.meta_Process_Deploy
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Heat/.meta_Process_Undeploy b/Reference/Heat/.meta_Process_Undeploy
new file mode 100644
index 000000000..03523023c
--- /dev/null
+++ b/Reference/Heat/.meta_Process_Undeploy
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Heat/.meta_SampleCirrosHeat.xml b/Reference/Heat/.meta_SampleCirrosHeat.xml
new file mode 100644
index 000000000..b0031cf04
--- /dev/null
+++ b/Reference/Heat/.meta_SampleCirrosHeat.xml
@@ -0,0 +1,37 @@
+
+
+
+
diff --git a/Reference/Heat/.meta_TaskLaunchStack.php b/Reference/Heat/.meta_TaskLaunchStack.php
new file mode 100644
index 000000000..de7552b4f
--- /dev/null
+++ b/Reference/Heat/.meta_TaskLaunchStack.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/Heat/.meta_TaskRemoveStack.php b/Reference/Heat/.meta_TaskRemoveStack.php
new file mode 100644
index 000000000..307b75f01
--- /dev/null
+++ b/Reference/Heat/.meta_TaskRemoveStack.php
@@ -0,0 +1,43 @@
+
+
+
+
diff --git a/Reference/Heat/.meta_getFloatingIp.php b/Reference/Heat/.meta_getFloatingIp.php
new file mode 100644
index 000000000..26c5bb41b
--- /dev/null
+++ b/Reference/Heat/.meta_getFloatingIp.php
@@ -0,0 +1,43 @@
+
+
+
+
diff --git a/Reference/Heat/Process_Deploy/.keep b/Reference/Heat/Process_Deploy/.keep
new file mode 100644
index 000000000..e69de29bb
diff --git a/Reference/Heat/Process_Undeploy/.keep b/Reference/Heat/Process_Undeploy/.keep
new file mode 100644
index 000000000..e69de29bb
diff --git a/Reference/Heat/SampleCirrosHeat.xml b/Reference/Heat/SampleCirrosHeat.xml
new file mode 100644
index 000000000..180a89754
--- /dev/null
+++ b/Reference/Heat/SampleCirrosHeat.xml
@@ -0,0 +1,142 @@
+
+
+
+ service_id
+ 5
+ Default
+ /images/repository/CommandDefinition/icons/ServerPool.png
+ Cirros Heat
+ 10000
+ 1
+ 0
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ repository.uploader.Process.default
+
+
+ 5
+ Deploy
+ CREATE
+
+
+
+ Launch Heat Template
+
+
+
+ Get Floating IP
+
+
+
+ Create VNF in MSActivator
+
+
+
+ Provisione VNF
+
+
+
+
+ 5
+ Undeploy
+ DELETE
+
+
+
+ Remove Stack
+
+
+
+ Remove VNF
+
+
+
diff --git a/Reference/Heat/TaskLaunchStack.php b/Reference/Heat/TaskLaunchStack.php
new file mode 100644
index 000000000..e0134d575
--- /dev/null
+++ b/Reference/Heat/TaskLaunchStack.php
@@ -0,0 +1,52 @@
+
\ No newline at end of file
diff --git a/Reference/Heat/TaskRemoveStack.php b/Reference/Heat/TaskRemoveStack.php
new file mode 100644
index 000000000..d782514c6
--- /dev/null
+++ b/Reference/Heat/TaskRemoveStack.php
@@ -0,0 +1,20 @@
+
\ No newline at end of file
diff --git a/Reference/Heat/getFloatingIp.php b/Reference/Heat/getFloatingIp.php
new file mode 100644
index 000000000..9aac23a18
--- /dev/null
+++ b/Reference/Heat/getFloatingIp.php
@@ -0,0 +1,16 @@
+
\ No newline at end of file
diff --git a/Reference/MSActivator/Device/.meta_Task_msa_device_backup.php b/Reference/MSActivator/Device/.meta_Task_msa_device_backup.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/MSActivator/Device/.meta_Task_msa_device_backup.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/MSActivator/Device/Task_msa_device_backup.php b/Reference/MSActivator/Device/Task_msa_device_backup.php
new file mode 100644
index 000000000..70c29d314
--- /dev/null
+++ b/Reference/MSActivator/Device/Task_msa_device_backup.php
@@ -0,0 +1,39 @@
+ $PROCESSINSTANCEID,
+ 'EXECNUMBER' => $EXECNUMBER,
+ 'TASKID' => $TASKID);
+
+$device_id = substr($context['device_id'], 3);
+$response = _device_do_backup($device_id, $process_params);
+$response = json_decode($response, true);
+if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ echo $response;
+ exit;
+}
+
+$response = wait_for_backup_completion($device_id, $process_params);
+$response = json_decode($response, true);
+if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ echo $response;
+ exit;
+}
+$backup_status_message = $response['wo_comment'];
+
+$response = prepare_json_response(ENDED, "Device $device_id Backup completed successfully.\n" . $backup_status_message, $context, true);
+echo $response;
+
+?>
\ No newline at end of file
diff --git a/Reference/MSActivator/Device/Task_msa_device_delete.php b/Reference/MSActivator/Device/Task_msa_device_delete.php
index d6ec4f43c..3c151f1b6 100755
--- a/Reference/MSActivator/Device/Task_msa_device_delete.php
+++ b/Reference/MSActivator/Device/Task_msa_device_delete.php
@@ -18,10 +18,16 @@ function list_args() {
$response = _device_delete($device_id);
$response = json_decode($response, true);
if ($response['wo_status'] !== ENDED) {
- $response['wo_status'] = WARNING;
- $response = json_encode($response);
- echo $response;
- exit;
+ if (isset($response['wo_comment']) && preg_match("/not found in database/i",$response['wo_comment'],$match)){
+ //Device not found in the MSA Database
+ $response = prepare_json_response(ENDED, "OK, MSA Device $device_id not found in DB", $context, true);
+ echo $response;
+ }else{
+ $response['wo_status'] = WARNING;
+ $response = json_encode($response);
+ echo $response;
+ exit;
+ }
}
$response = prepare_json_response(ENDED, "MSA Device $device_id deleted successfully.", $context, true);
diff --git a/Reference/MSActivator/Device/Task_msa_management_ip_update.php b/Reference/MSActivator/Device/Task_msa_management_ip_update.php
index c3e6dee3b..d1a124543 100755
--- a/Reference/MSActivator/Device/Task_msa_management_ip_update.php
+++ b/Reference/MSActivator/Device/Task_msa_management_ip_update.php
@@ -20,6 +20,27 @@ function list_args()
echo $response;
exit;
}
+
+//check if ip is update in the sec-engine side
+$sec_ip_address = "";
+for($i=0; $i<5; $i++){
+ sleep(2);
+ $output = shell_exec("/opt/dms/bin/oradns --id ".$context['device_id']);
+ //example output - ECL480 ip 10.30.19.237 ext ip 10.30.19.237 interface type E (port1-port1) ip type S (UP 31 sec old - 6 pings left)
+ if($output != null){
+ $details = explode(" ", $output);
+ $sec_ip_address = $details[2];
+ if($sec_ip_address == $ip_address){
+ break;
+ }
+ }
+}
+
+if($sec_ip_address != $ip_address){
+ $response = prepare_json_response(FAILED, "Update Management IP $ip_address failed on Sec Engine side, check batchupdate", $context, true);
+ echo $response;
+ exit;
+}
$response = prepare_json_response(ENDED, "Management IP $ip_address updated successfully on MSA Device $device_id.", $context, true);
echo $response;
diff --git a/Reference/MSActivator/DeviceConfiguration/.meta_Task_msa_list_files_attached_to_device.php b/Reference/MSActivator/DeviceConfiguration/.meta_Task_msa_list_files_attached_to_device.php
new file mode 100644
index 000000000..63d652f4c
--- /dev/null
+++ b/Reference/MSActivator/DeviceConfiguration/.meta_Task_msa_list_files_attached_to_device.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/MSActivator/DeviceConfiguration/.meta_Task_msa_list_files_config_profile.php b/Reference/MSActivator/DeviceConfiguration/.meta_Task_msa_list_files_config_profile.php
new file mode 100644
index 000000000..4200bd58a
--- /dev/null
+++ b/Reference/MSActivator/DeviceConfiguration/.meta_Task_msa_list_files_config_profile.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/MSActivator/DeviceConfiguration/Task_msa_list_files_attached_to_device.php b/Reference/MSActivator/DeviceConfiguration/Task_msa_list_files_attached_to_device.php
new file mode 100644
index 000000000..990664546
--- /dev/null
+++ b/Reference/MSActivator/DeviceConfiguration/Task_msa_list_files_attached_to_device.php
@@ -0,0 +1,27 @@
+
\ No newline at end of file
diff --git a/Reference/MSActivator/DeviceConfiguration/Task_msa_list_files_config_profile.php b/Reference/MSActivator/DeviceConfiguration/Task_msa_list_files_config_profile.php
new file mode 100644
index 000000000..a476f462a
--- /dev/null
+++ b/Reference/MSActivator/DeviceConfiguration/Task_msa_list_files_config_profile.php
@@ -0,0 +1,52 @@
+(\d+)\<\/configurationProfileId\>/',$result,$match))
+{
+ $response = prepare_json_response(FAILED, "Listing Files Attached From Config Profile Failed" , $context, true);
+ echo $response;
+ exit;
+}
+
+$config_profile_id = $match[1];
+
+if ($config_profile_id == 0){
+ $response = prepare_json_response(ENDED, "No Config Profiles Attached to the device", $context, true);
+ echo $response;
+ exit;
+}
+
+$cmd = "bash /opt/ubi-jentreprise/bin/api/deviceconfiguration/listFilesByConfigurationProfileId.sh $config_profile_id|grep return";
+
+logToFile("COMMAND TO GET PROFILE FILES:" .$cmd."\n");
+$result = shell_exec ("$cmd");
+
+if(preg_match_all('/\(.*)\<\/return\>/',$result,$uris) == 0)
+{
+ $response = prepare_json_response(FAILED, "Listing Files Attached From Config Profile Failed" , $context, true);
+ echo $response;
+ exit;
+}
+
+if(!isset($context['device_objects_uri']))
+{
+ $context['device_objects_uri'] = array();
+}
+
+foreach($uris[1] as $uri)
+{
+ array_push($context['device_objects_uri'], $uri);
+}
+
+$response = prepare_json_response(ENDED, "Files Attached From Config Profile listed Successfully", $context, true);
+echo $response;
+
+?>
diff --git a/Reference/OPENSTACK/Library/OBMF/nova_obmf.php b/Reference/OPENSTACK/Library/OBMF/nova_obmf.php
index f602918b8..75f45013f 100755
--- a/Reference/OPENSTACK/Library/OBMF/nova_obmf.php
+++ b/Reference/OPENSTACK/Library/OBMF/nova_obmf.php
@@ -16,7 +16,7 @@ function _nova_server_create ($device_id, $server_name, $networks,
$server_array['key'] = $key;
$server_array['config_drive'] = $config_drive;
$server_array['user_data'] = $user_data;
- if ($availability_zone !== "") {
+ if (!empty($availability_zone)) {
$array['availability_zone'] = $availability_zone;
}
if (!empty($security_groups)) {
diff --git a/Reference/OPENSTACK/Library/REST/cinder_rest.php b/Reference/OPENSTACK/Library/REST/cinder_rest.php
index cf80e7859..cb5ce75e3 100755
--- a/Reference/OPENSTACK/Library/REST/cinder_rest.php
+++ b/Reference/OPENSTACK/Library/REST/cinder_rest.php
@@ -2,8 +2,8 @@
require_once '/opt/fmc_repository/Process/Reference/OPENSTACK/Library/REST/utility.php';
-#curl -i -k https://10.1.144.119/v2/abcde/volumes -X POST
-#-H "X-Auth-Token:42946664fc6e41e392bb7ee51a9160b9" -H "Accept: application/json"
+#curl -i -k https://xxxxx/v2/abcde/volumes -X POST
+#-H "X-Auth-Token:yyyyy" -H "Accept: application/json"
#-H "Content-Type: application/json" -d '{"volume":{"name":"abc","size":40,
#"availability_zone":"nova","multiattach":"false","bootable":"fales"}}'
function _cinder_volume_create ($cinder_endpoint, $auth_token, $name, $size,
@@ -54,7 +54,7 @@ function _cinder_volume_update ($cinder_endpoint, $auth_token, $volume_id, $name
$array = array();
$array['name'] = $name;
$array['description'] = $description;
- $array['metadata'] = $metadata;
+ //$array['metadata'] = $metadata; //optional, prevent error with openstack juno patch
$array['tenant_id'] = $tenant_id;
$volume_array = array('volume' => $array);
diff --git a/Reference/OPENSTACK/Library/REST/glance_rest.php b/Reference/OPENSTACK/Library/REST/glance_rest.php
new file mode 100644
index 000000000..49a80cf4f
--- /dev/null
+++ b/Reference/OPENSTACK/Library/REST/glance_rest.php
@@ -0,0 +1,59 @@
+
diff --git a/Reference/OPENSTACK/Library/REST/keystone_rest.php b/Reference/OPENSTACK/Library/REST/keystone_rest.php
index eb8a5f131..d41820fe7 100755
--- a/Reference/OPENSTACK/Library/REST/keystone_rest.php
+++ b/Reference/OPENSTACK/Library/REST/keystone_rest.php
@@ -2,7 +2,7 @@
require_once '/opt/fmc_repository/Process/Reference/OPENSTACK/Library/REST/utility.php';
-#export TEST_TOKEN=`curl -si 'http://ct-int-vip:25357/v3/auth/tokens' -X OP_POST -H 'Accept: application/json'
+#export TEST_TOKEN=`curl -si 'http://xxxxxx/v3/auth/tokens' -X OP_POST -H 'Accept: application/json'
#-H 'Content-type: application/json'
#-d '{'auth': {'identity': {'methods': ['password'], 'password': {'user': {'domain': {'name': 'Default'},
#'name': 'abc', 'password': 'abc'}}}, 'scope': {'project': {'domain': {'name': 'Default'},
@@ -11,13 +11,13 @@ function _keystone_project_scoped_token_get ($keystone_endpoint, $userdomain, $u
$scopedomain, $projectname) {
$array = array();
- //$array['domain'] = array('id' => $userdomain);
- $array['domain'] = array('name' => $userdomain);
+ $array['domain'] = array('id' => $userdomain);
+ //$array['domain'] = array('name' => $userdomain);
$array['user'] = array('domain' => $array['domain'], 'name' => $username, 'password' => $password);
$array['password'] = array('user' => $array['user']);
- //$array['domain'] = array('id' => $scopedomain);
- $array['domain'] = array('name' => $scopedomain);
+ $array['domain'] = array('id' => $scopedomain);
+ //$array['domain'] = array('name' => $scopedomain);
$array['project'] = array('domain' => $array['domain'], 'id' => $projectname);
$array['scope'] = array('project' => $array['project']);
@@ -32,7 +32,7 @@ function _keystone_project_scoped_token_get ($keystone_endpoint, $userdomain, $u
return $response;
}
-#export ADMIN_TOKEN=`curl -si -X OP_POST http://ct-int-vip:25357/v3/auth/tokens -H "Accept: application/json"
+#export ADMIN_TOKEN=`curl -si -X OP_POST http://xxxxxxxxxx/v3/auth/tokens -H "Accept: application/json"
#-H "Content-type: application/json" -d '{"auth": {"identity": {"methods": ["password"],
#"password": {"user": {"domain": {"name": "dmnAdmin"}, "name": "usrDmnAdmin", "password": "xxxxxxxx"}}},
#"scope": {"domain": {"name": "Default"}}}}' | grep X-Subject-Token | awk '{print $2}' | sed 's/\r//'`;echo $ADMIN_TOKEN
@@ -57,7 +57,7 @@ function _keystone_domain_scoped_token_get ($keystone_endpoint, $userdomain, $us
return $response;
}
-#curl -si 'http://10.1.144.111:35357/v2.0/tokens' -H "Content-type: application/json"
+#curl -si 'http://xxxxxxxxxxxxxxx/v2.0/tokens' -H "Content-type: application/json"
#-d '{ "auth": {"tenantId": "1234", "passwordCredentials" : {"username": "admin", "password": "admin123"}}}'
function _keystone_v2_token_get ($keystone_endpoint, $username, $password, $tenant_id) {
@@ -79,7 +79,7 @@ function _keystone_v2_token_get ($keystone_endpoint, $username, $password, $tena
return $response;
}
-#curl -i -X OP_POST http://ct-int-vip:25357/v3/users -H "X-Auth-Token: ${ADMIN_TOKEN}" -H "Accept: application/json"
+#curl -i -X OP_POST http://xxxxxxxxxxx/v3/users -H "X-Auth-Token: ${ADMIN_TOKEN}" -H "Accept: application/json"
#-H "Content-type: application/json" -d
#'{"user": {"domain_id": "v2AccessDomain", "enabled": true,"name": "abc"}}'
function _keystone_user_create ($keystone_endpoint, $auth_token, $domain_id, $name, $enabled = "true") {
@@ -104,7 +104,7 @@ function _keystone_user_create ($keystone_endpoint, $auth_token, $domain_id, $na
return $response;
}
-#url -i -X PATCH http://ct-int-vip:25357/v3/users/c02b1913b277410784c6956e24360141 -H "X-Auth-Token: ${ADMIN_TOKEN}"
+#url -i -X PATCH http://xxxxxxxx/v3/users/c02b1913b277410784c6956e24360141 -H "X-Auth-Token: ${ADMIN_TOKEN}"
#-H "Accept: application/json" -H "Content-type: application/json" -d '{"user": {"password": "abc"}}'
function _keystone_user_password_update ($keystone_endpoint, $auth_token, $user_id, $password) {
@@ -125,7 +125,7 @@ function _keystone_user_password_update ($keystone_endpoint, $auth_token, $user_
return $response;
}
-#curl -i -X OP_POST http://ct-int-vip:25357/v3/projects -H "X-Auth-Token: ${ADMIN_TOKEN}" -H "Accept: application/json"
+#curl -i -X OP_POST http://xxxxxxxxx/v3/projects -H "X-Auth-Token: ${ADMIN_TOKEN}" -H "Accept: application/json"
#-H "Content-type: application/json" -d
#'{"project": {"enabled": true, "domain_id": "v2AccessDomain", "description": null,"name": "abc"}}'
function _keystone_project_create ($keystone_endpoint, $auth_token, $domain_id, $name, $enabled = "true", $description = "") {
@@ -150,7 +150,7 @@ function _keystone_project_create ($keystone_endpoint, $auth_token, $domain_id,
return $response;
}
-#curl -i -X OP_PUT http://ct-int-vip:25357/v3/projects/${PJID}/users/$USERID/roles/$ROLEID -H "X-Auth-Token: ${ADMIN_TOKEN}"
+#curl -i -X OP_PUT http://xxxxxxxxxxx/v3/projects/${PJID}/users/$USERID/roles/$ROLEID -H "X-Auth-Token: ${ADMIN_TOKEN}"
#-H "Accept: application/json" -H "Content-type: application/json"
function _keystone_user_role_add ($keystone_endpoint, $auth_token, $tenant_id, $user_id, $role_id) {
diff --git a/Reference/OPENSTACK/Library/REST/neutron_rest.php b/Reference/OPENSTACK/Library/REST/neutron_rest.php
index 2ccecda7e..8ed7cbdef 100755
--- a/Reference/OPENSTACK/Library/REST/neutron_rest.php
+++ b/Reference/OPENSTACK/Library/REST/neutron_rest.php
@@ -2,7 +2,7 @@
require_once '/opt/fmc_repository/Process/Reference/OPENSTACK/Library/REST/utility.php';
-#curl -i http://ot1-contrail-int-vip:9696/v2.0/networks.json -X OP_POST -H "X-Auth-Token: ${TEST_TOKEN}"
+#curl -i http://xxxxxxxxx:9696/v2.0/networks.json -X OP_POST -H "X-Auth-Token: ${TEST_TOKEN}"
#-H "Accept: application/json" -H "Content-Type: application/json" -d
#'{"network": {"name": "abc", "admin_state_up": true}}'
function _neutron_network_create ($neutron_endpoint, $auth_token, $name, $admin_state_up = true) {
@@ -26,7 +26,96 @@ function _neutron_network_create ($neutron_endpoint, $auth_token, $name, $admin_
return $response;
}
-#curl -i http://ot1-contrail-int-vip:9696/v2.0/subnets.json -X OP_POST -H "X-Auth-Token: ${TEST_TOKEN}"
+/**
+*
+* Get Networks
+*
+**/
+
+function _neutron_subnets_from_name($neutron_endpoint, $auth_token, $networks)
+{
+ $openstack_rest_api = "{$neutron_endpoint}/v2.0/networks";
+ $curl_cmd = create_openstack_operation_request(OP_GET, $openstack_rest_api, $auth_token);
+
+ $response = perform_curl_operation($curl_cmd, "GET NETWORKS");
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ return json_encode($response);
+ }
+
+ $response = stripslashes($response['wo_newparams']['response_body']);
+ $subnets = array();
+ if (isset($networks) && ! empty($networks)) {
+ foreach ($networks as &$network) {
+ $nets = json_decode($response, true);
+ foreach ($nets['networks'] as &$net) {
+ if ($net['name'] == $network) {
+ $subnets[] = $net['subnets'];
+ }
+ }
+ }
+ }
+ return prepare_json_response(ENDED, ENDED_SUCCESSFULLY, json_encode($subnets));
+}
+
+function _neutron_networks_from_name($neutron_endpoint, $auth_token, $networks)
+{
+ $openstack_rest_api = "{$neutron_endpoint}/v2.0/networks";
+ $curl_cmd = create_openstack_operation_request(OP_GET, $openstack_rest_api, $auth_token);
+
+ $response = perform_curl_operation($curl_cmd, "GET NETWORKS");
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ return json_encode($response);
+ }
+
+ $response = stripslashes($response['wo_newparams']['response_body']);
+ $network_list = array();
+ if (isset($networks) && ! empty($networks)) {
+ foreach ($networks as &$network) {
+ $nets = json_decode($response, true);
+ foreach ($nets['networks'] as &$net) {
+ if ($net['name'] == $network) {
+ $network_list[] = $net['id'];
+ }
+ }
+ }
+ }
+ return prepare_json_response(ENDED, ENDED_SUCCESSFULLY, json_encode($network_list));
+}
+
+/***
+* GET routers
+*
+**/
+function _neutron_routers_by_routers_name($neutron_endpoint, $auth_token, $routers)
+{
+ $openstack_rest_api = "{$neutron_endpoint}/v2.0/routers";
+ $curl_cmd = create_openstack_operation_request(OP_GET, $openstack_rest_api, $auth_token);
+
+ $response = perform_curl_operation($curl_cmd, "GET ROUTERS");
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ return json_encode($response);
+ }
+
+ $response = stripslashes($response['wo_newparams']['response_body']);
+ $router_list = array();
+ if (isset($routers) && ! empty($routers)) {
+ foreach ($routers as &$router) {
+ $rts = json_decode($response, true);
+ foreach ($rts['routers'] as &$rt) {
+ if ($rt['name'] == $router) {
+ $router_list[] = $rt['id'];
+ }
+ }
+ }
+ }
+ return prepare_json_response(ENDED, ENDED_SUCCESSFULLY, json_encode($router_list));
+}
+
+
+#curl -i http://xxxxxxxxx:9696/v2.0/subnets.json -X OP_POST -H "X-Auth-Token: ${TEST_TOKEN}"
#-H "Accept: application/json" -H "Content-Type: application/json"
#-d '{"subnet": {"network_id": "abc", "ip_version": 4,"cidr": "192.168.100.0/24"}}'
function _neutron_subnet_create ($neutron_endpoint, $auth_token, $network_id, $ip_version, $cidr) {
@@ -51,7 +140,7 @@ function _neutron_subnet_create ($neutron_endpoint, $auth_token, $network_id, $i
return $response;
}
-#curl -i http://ot1-contrail-int-vip:9696/v2.0/ports.json -X OP_POST -H "X-Auth-Token: ${TEST_TOKEN}"
+#curl -i http://xxxxxxxxx:9696/v2.0/ports.json -X OP_POST -H "X-Auth-Token: ${TEST_TOKEN}"
#-H "Accept: application/json" -H "Content-Type: application/json"
#-d '{"port": {"network_id": "abc", "fixed_ips":[{"subnet_id":"abc",
#"ip_address": "1.2.3.4"}], admin_state_up": true}}'
@@ -81,7 +170,7 @@ function _neutron_port_create ($neutron_endpoint, $auth_token, $network_id, $por
return $response;
}
-#curl -i -X POST http://10.31.1.123:9696/v2.0/ports.json -H "User-Agent: python-neutronclient"
+#curl -i -X POST http://xxxxxxxxx:9696/v2.0/ports.json -H "User-Agent: python-neutronclient"
#-H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: 12445"
#-d '{"ports": [{"name": "temp1", "admin_state_up": false, "network_id": "1233"},
#{"name": "temp2", "admin_state_up": false, "network_id": "21345"}]}'
@@ -103,7 +192,7 @@ function _neutron_bulk_ports_create ($neutron_endpoint, $auth_token, $ports) {
return $response;
}
-#curl -i -X PUT http://10.31.1.123:9696/v2.0/ports/ec20daad-4d01-464c-bb1c-242bcc150488.json -H "User-Agent: python-neutronclient"
+#curl -i -X PUT http://xxxxxxxxx:9696/v2.0/ports/ec20daad-4d01-464c-bb1c-242bcc150488.json -H "User-Agent: python-neutronclient"
#-H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: TOKEN_REDACTED"
#-d '{"port": {"allowed_address_pairs": [{"ip_address": "192.168.1.0/24"}]}}'
function _neutron_port_update_allowed_ipaddress_pairs ($neutron_endpoint, $auth_token, $port_id, $allowed_address_pairs = array()) {
@@ -126,7 +215,7 @@ function _neutron_port_update_allowed_ipaddress_pairs ($neutron_endpoint, $auth_
return $response;
}
-#curl -i -X PUT http://10.31.1.123:9696/v2.0/ports/ec20daad-4d01-464c-bb1c-242bcc150488.json -H "User-Agent: python-neutronclient"
+#curl -i -X PUT http://xxxxxxxxx:9696/v2.0/ports/ec20daad-4d01-464c-bb1c-242bcc150488.json -H "User-Agent: python-neutronclient"
#-H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: a2e24794f42646218e01c1cb042ecde5"
#-d '{"port": {"fixed_ips": [{"subnet_id" : "2f30f680-2c26-48c6-b96b-1e429646f949","ip_address":"192.168.1.20"}]}}'
function _neutron_port_update_fixed_ips ($neutron_endpoint, $auth_token, $port_id, $fixed_ips) {
@@ -149,7 +238,7 @@ function _neutron_port_update_fixed_ips ($neutron_endpoint, $auth_token, $port_i
return $response;
}
-#curl -i -X PUT http://10.31.1.125:9696/v2.0/ports/15f0bd4b-aeef-415a-afaf-1ae8314533f8.json -H "User-Agent: python-neutronclient"
+#curl -i -X PUT http://xxxxxxxxx:9696/v2.0/ports/15f0bd4b-aeef-415a-afaf-1ae8314533f8.json -H "User-Agent: python-neutronclient"
#-H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: TOKEN_REDACTED" -d '{"port": {"name": "mgt_port"}}'
function _neutron_port_update_name ($neutron_endpoint, $auth_token, $port_id, $port_name) {
@@ -171,7 +260,7 @@ function _neutron_port_update_name ($neutron_endpoint, $auth_token, $port_id, $p
return $response;
}
-#curl -i http://10.1.144.111:9696/v2.0/ports/e9783bb4-6d72-47d5-9d4b-4042806d03ae -X DELETE
+#curl -i http://xxxxxxxxx:9696/v2.0/ports/e9783bb4-6d72-47d5-9d4b-4042806d03ae -X DELETE
#-H "X-Auth-Token:a116a2fdbe7949e189e4207b95285161" -H "Accept: application/json"
#-H "Content-Type: application/json"
function _neutron_port_delete ($neutron_endpoint, $auth_token, $port_id) {
@@ -183,7 +272,7 @@ function _neutron_port_delete ($neutron_endpoint, $auth_token, $port_id) {
return $response;
}
-#curl -g -i -X PUT http://10.31.1.13:9696/v2.0/ports/6c6e9331-0cdf-4fd0-ac48-7fcad356d800.json
+#curl -g -i -X PUT http://xxxxxxxxx:9696/v2.0/ports/6c6e9331-0cdf-4fd0-ac48-7fcad356d800.json
#-H "User-Agent: python-neutronclient" -H "Content-Type: application/json" -H "Accept: application/json"
#-H "X-Auth-Token: {SHA1}b691726e88b30f007c535fe18214f82227480e55"
#-d '{"port": {"port_security_enabled": "False", "security_groups": []}}'
@@ -207,7 +296,7 @@ function _neutron_disable_port_security ($neutron_endpoint, $auth_token, $port_i
return $response;
}
-#curl -g -i -X POST http://10.31.1.13:9696/v2.0/floatingips.json -H "User-Agent: python-neutronclient"
+#curl -g -i -X POST http://xxxxxxxxx:9696/v2.0/floatingips.json -H "User-Agent: python-neutronclient"
#-H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token:
#{SHA1}1c28f029a9d8e72173b724404c1e04ce1cc5a473"
#-d '{"floatingip": {"floating_network_id": "fa700a48-724f-470a-a4e4-eaf84ae93af2",
@@ -244,7 +333,7 @@ function _neutron_floatingip_create ($neutron_endpoint, $auth_token, $network_id
return $response;
}
-#curl -i http://ot1-contrail-int-vip:9696/v2.0/security-group-rules -X OP_POST -H "X-Auth-Token: ${TEST_TOKEN}"
+#curl -i http://xxxxxxxxx:9696/v2.0/security-group-rules -X OP_POST -H "X-Auth-Token: ${TEST_TOKEN}"
#-H "Accept: application/json" -H "Content-Type: application/json"
#-d '{"security_group_rule":{"remote_group_id":null,"direction":"ingress",
#"security_group_id":"d952ec52-2bb9-4c03-9d6e-6185e2acf0e2","ethertype":"IPv4"}}'
@@ -271,7 +360,7 @@ function _neutron_security_group_rule_create ($neutron_endpoint, $auth_token, $s
return $response;
}
-#curl -g -i -X PUT http://10.31.1.13:9696/v2.0/ports/609915ac-1925-414e-98f0-d047a37031dc.json
+#curl -g -i -X PUT http://xxxxxxxxx:9696/v2.0/ports/609915ac-1925-414e-98f0-d047a37031dc.json
#-H "User-Agent: python-neutronclient" -H "Content-Type: application/json" -H "Accept: application/json"
#-H "X-Auth-Token: {SHA1}391fc66fe5043964a2f862e729aafefc9f01b3e7" -d
#'{"port": {"security_groups": ["e25e9e23-ac8a-4706-9ee5-d7026b59d7e7"]}}'
@@ -293,7 +382,7 @@ function _neutron_attach_security_groups_to_port ($neutron_endpoint, $auth_token
return $response;
}
-#curl -g -i -X PUT http://10.31.1.13:9696/v2.0/floatingips/bec23045-e6d4-4530-bbaf-240a270f66e2.json
+#curl -g -i -X PUT http://xxxxxxxxx:9696/v2.0/floatingips/bec23045-e6d4-4530-bbaf-240a270f66e2.json
#-H "User-Agent: python-neutronclient" -H "Content-Type: application/json" -H "Accept: application/json"
#-H "X-Auth-Token: {SHA1}96e3f409c10e636c1814ec54afdd1ad144cf7abd"
#-d '{"floatingip": {"fixed_ip_address": "10.0.0.15", "port_id": "609915ac-1925-414e-98f0-d047a37031dc"}}'
@@ -320,7 +409,7 @@ function _neutron_associate_floatingip_to_port ($neutron_endpoint, $auth_token,
return $response;
}
-#curl -i -X PUT http://10.31.1.123:9696/v2.0/floatingips/b1a2147f-364a-41d5-943c-56e38326b796.json -H "User-Agent: python-neutronclient"
+#curl -i -X PUT http://xxxxxxxxx:9696/v2.0/floatingips/b1a2147f-364a-41d5-943c-56e38326b796.json -H "User-Agent: python-neutronclient"
#-H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: TOKEN_REDACTED" -d '{"floatingip": {"port_id": null}}'
function _neutron_disassociate_floatingip_from_port ($neutron_endpoint, $auth_token, $floatingip_id) {
@@ -342,7 +431,7 @@ function _neutron_disassociate_floatingip_from_port ($neutron_endpoint, $auth_to
return $response;
}
-#curl -g -i -X PUT http://10.31.1.13:9696/v2.0/subnets/51328b1e-b2ec-4aa6-a298-fec3d63fc651.json
+#curl -g -i -X PUT http://xxxxxxxxx:9696/v2.0/subnets/51328b1e-b2ec-4aa6-a298-fec3d63fc651.json
#-H "User-Agent: python-neutronclient" -H "Content-Type: application/json" -H "Accept: application/json"
#-H "X-Auth-Token: {SHA1}d66bbaa920a056afe96fea6dd6061804d3b7e2cc" -d '{"subnet": {"gateway_ip": "123.0.0.254"}}'
function _neutron_subnet_update_gateway_ip ($neutron_endpoint, $auth_token, $subnet_id, $gateway_ip = "") {
@@ -364,7 +453,7 @@ function _neutron_subnet_update_gateway_ip ($neutron_endpoint, $auth_token, $sub
return $response;
}
-#curl -g -i -X PUT http://10.31.1.13:9696/v2.0/routers/fa477dec-b343-4f60-a13d-0fc250d5055e/add_router_interface.json
+#curl -g -i -X PUT http://xxxxxxxxx:9696/v2.0/routers/fa477dec-b343-4f60-a13d-0fc250d5055e/add_router_interface.json
#-H "User-Agent: python-neutronclient" -H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token:
#{SHA1}42b7493353205b58cb99edf705e8b9efc0d1d7dd" -d '{"subnet_id": "51328b1e-b2ec-4aa6-a298-fec3d63fc651"}'
function _neutron_router_interface_add ($neutron_endpoint, $auth_token, $router_id, $subnet_id) {
@@ -385,7 +474,7 @@ function _neutron_router_interface_add ($neutron_endpoint, $auth_token, $router_
return $response;
}
-#curl -g -i -X PUT http://10.31.1.13:9696/v2.0/routers/fa477dec-b343-4f60-a13d-0fc250d5055e/remove_router_interface.json
+#curl -g -i -X PUT http://xxxxxxxxx:9696/v2.0/routers/fa477dec-b343-4f60-a13d-0fc250d5055e/remove_router_interface.json
#-H "User-Agent: python-neutronclient" -H "Content-Type: application/json" -H "Accept: application/json"
#-H "X-Auth-Token: {SHA1}2720b29fb37bcd3f1029b641b704c02a16b86abf" -d '{"subnet_id": "51328b1e-b2ec-4aa6-a298-fec3d63fc651"}'
function _neutron_router_interface_delete ($neutron_endpoint, $auth_token, $router_id, $subnet_id) {
@@ -406,7 +495,7 @@ function _neutron_router_interface_delete ($neutron_endpoint, $auth_token, $rout
return $response;
}
-#curl -g -i -X PUT http://10.31.1.13:9696/v2.0/subnets/51328b1e-b2ec-4aa6-a298-fec3d63fc651.json -H "User-Agent: python-neutronclient"
+#curl -g -i -X PUT http://xxxxxxxxx:9696/v2.0/subnets/51328b1e-b2ec-4aa6-a298-fec3d63fc651.json -H "User-Agent: python-neutronclient"
#-H "Content-Type: application/json" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}7c57e21b97ef05a3fb2e7bc1e4ce6001d2bda97c"
#-d '{"subnet": {"allocation_pools": [{"start": "123.0.0.10", "end": "123.0.0.20"}, {"start": "123.0.0.21", "end": "123.0.0.25"}]}}'
function _neutron_subnet_update_allocation_pools ($neutron_endpoint, $auth_token, $subnet_id, $allocation_pools) {
@@ -454,4 +543,4 @@ function _neutron_get_public_networks($neutron_endpoint, $auth_token) {
$response = prepare_json_response(ENDED, ENDED_SUCCESSFULLY, $response['wo_newparams']['response_body']);
return $response;
}
-?>
+
diff --git a/Reference/OPENSTACK/Library/REST/nova_rest.php b/Reference/OPENSTACK/Library/REST/nova_rest.php
index d6f460f61..5755a9e42 100755
--- a/Reference/OPENSTACK/Library/REST/nova_rest.php
+++ b/Reference/OPENSTACK/Library/REST/nova_rest.php
@@ -2,8 +2,8 @@
require_once '/opt/fmc_repository/Process/Reference/OPENSTACK/Library/REST/utility.php';
-#curl -i http://10.1.144.111:8774/v2/ebd239c789994f3a88d6da7083098851/flavors -X POST
-#-H "X-Auth-Token:fb7317fa0c3c43949ccbe9de55dfba85" -H "Accept: application/json" -H "Content-type: application/json"
+#curl -i http://xxxxx:8774/v2/ebd239c789994f3a88d6da7083098851/flavors -X POST
+#-H "X-Auth-Token:yyyyy" -H "Accept: application/json" -H "Content-type: application/json"
# -d '{"flavor" :{ "name":"test-flavor2","ram":1024,"vcpus":2,"disk":10,"os-flavor-access:is_public": false}}'
function _nova_flavor_create ($nova_endpoint, $auth_token, $tenant_id, $ram, $vcpus, $disk, $name = "", $is_public = false) {
@@ -31,13 +31,13 @@ function _nova_flavor_create ($nova_endpoint, $auth_token, $tenant_id, $ram, $vc
}
-#curl -i http://ct-int-vip:28774/v2/${PJID}/servers -X POST -H "X-Auth-Token: ${TEST_TOKEN}"
+#curl -i http://xxxx:28774/v2/${PJID}/servers -X POST -H "X-Auth-Token: ${TEST_TOKEN}"
#-H "Accept: application/json" -H "Content-Type: application/json" -d
-#'{ "server": { "availability_zone": "ote-lab1","flavorRef": "120","imageRef":"6a0de364-7fef-4e02-9e6e-2b4d3bead6fd",
+#'{ "server": { "availability_zone": "ote-lab1","flavorRef": "120","imageRef":"xxx",
#"max_count": 1,"min_count": 1,"name": "vyatta_other_tenant_07",
-#"networks":[{"uuid":"a4000cdf-835b-4ec0-942d-a456a3b4f495","port_id":"7dceafe1-ef96-4047-b717-dc354eb48ea2"}]}}'
+#"networks":[{"uuid":"a4000cdf-835b-4ec0-942d-a456a3b4f495","port_id":"xxxx"}]}}'
function _nova_server_create ($nova_endpoint, $auth_token, $name, $flavor, $image,
- $networks, $availability_zone = "", $user_data = "",
+ $networks, $availability_zone = "", $user_data = "", $config_drive = "",
$security_groups = array(), $min_count = 1, $max_count = 1) {
$array = array();
@@ -45,12 +45,15 @@ function _nova_server_create ($nova_endpoint, $auth_token, $name, $flavor, $imag
$array['flavorRef'] = $flavor;
$array['imageRef'] = $image;
$array['networks'] = $networks;
- if ($availability_zone !== "") {
+ if (!empty($availability_zone)) {
$array['availability_zone'] = $availability_zone;
}
- if ($user_data !== "") {
+ if (!empty($user_data)) {
$array['user_data'] = $user_data;
}
+ if (!empty($config_drive)) {
+ $array['config_drive'] = $config_drive;
+ }
if (!empty($security_groups)) {
$array['security_groups'] = $security_groups;
}
@@ -73,9 +76,9 @@ function _nova_server_create ($nova_endpoint, $auth_token, $name, $flavor, $imag
return $response;
}
-#curl -g -i -X PUT http://10.31.1.13:8774/v2/5b57e85c3a4e4cc3ae81ea2a503e1d6e/servers/d4e139f8-2cd2-4519-9e3c-32fb6d22fadd
+#curl -g -i -X PUT http://xxxx:8774/v2/ c3ae81ea2a503e1d6e/servers/ 2cd2-4519-9e3c-32fb6d22fadd
#-H "User-Agent: python-novaclient" -H "Content-Type: application/json" -H "Accept: application/json"
-#-H "X-Auth-Token: 1dbf7ef4000d44f98348cf828a5f4448" -d '{"server": {"name": "cirros"}}'
+#-H "X-Auth-Token: xxxx" -d '{"server": {"name": "cirros"}}'
function _nova_server_update_name ($nova_endpoint, $auth_token, $server_id, $server_name) {
$array = array();
@@ -96,8 +99,8 @@ function _nova_server_update_name ($nova_endpoint, $auth_token, $server_id, $ser
return $response;
}
-#curl -g -i -X DELETE http://10.31.1.13:8774/v2/689b343425824ee3a491a05d01f628e3/servers/bc7d8f1e-a479-483b-85a5-a85db9eb60a4
-#-H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}30ff76ffd347c2dda6389a46a9206250eeb14422"
+#curl -g -i -X DELETE http://xxxx:8774/v2/689b343425824ee3a491a05d01f628e3/servers/xxxxxxxxxx0a4
+#-H "User-Agent: python-novaclient" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}xxx"
function _nova_server_delete ($nova_endpoint, $auth_token, $server_id) {
$openstack_rest_api = "{$nova_endpoint}/servers/{$server_id}";
@@ -107,7 +110,7 @@ function _nova_server_delete ($nova_endpoint, $auth_token, $server_id) {
return $response;
}
-#curl -i http://ct-int-vip:28774/v2/${PJID}/servers/1234/action -X POST -H "X-Auth-Token: ${TEST_TOKEN}"
+#curl -i http://xxxxxx:28774/v2/${PJID}/servers/1234/action -X POST -H "X-Auth-Token: ${TEST_TOKEN}"
#-H "Accept: application/json" -H "Content-Type: application/json" -d '{"resize": {"flavorRef": "120"}}'
function _nova_server_resize ($nova_endpoint, $auth_token, $server_id, $resize_flavor_id) {
@@ -137,10 +140,10 @@ function _nova_server_resize_confirm ($nova_endpoint, $auth_token, $server_id) {
return $response;
}
-#curl -g -i -X POST http://10.31.1.13:8774/v2/689b343425824ee3a491a05d01f628e3/servers/
-#43ef02a3-d596-4969-9139-09d39f1c95e5/action -H "User-Agent: python-novaclient"
+#curl -g -i -X POST http://xxxxxxxxx:8774/v2/689b343425824ee3a491a05d01f628e3/servers/
+# -9139-09d39f1c95e5/action -H "User-Agent: python-novaclient"
#-H "Content-Type: application/json" -H "Accept: application/json"
-#-H "X-Auth-Token: {SHA1}8d1fe213446613da45441bd53596c852e00913ef" -d '{"reboot": {"type": "SOFT"}}'
+#-H "X-Auth-Token: {SHA1} 45441bd53596c852e00913ef" -d '{"reboot": {"type": "SOFT"}}'
function _nova_server_reboot ($nova_endpoint, $auth_token, $server_id, $type = "SOFT") {
$array = array();
@@ -154,9 +157,9 @@ function _nova_server_reboot ($nova_endpoint, $auth_token, $server_id, $type = "
return $response;
}
-#curl -i 'http://10.31.1.123:8774/v2/e470fd6ea0834192ab05c17930bee22c/servers/362b95bf-da62-4c52-b39a-547aa79b78ee/action'
+#curl -i 'http://xxxxxxxx:8774/v2/e470fd6ea0834192ab05c17930bee22c/servers/-4c52-b39a-547aa79b78ee/action'
# -X POST -H "Accept: application/json" -H "Content-Type: application/json" -H "User-Agent: python-novaclient"
-#-H "X-Auth-Project-Id: ntt" -H "X-Auth-Token: {SHA1}eecb49db110434af8a563c44718e6d1a25e1d613" -d '{"os-start": null}'
+#-H "X-Auth-Project-Id: " -H "X-Auth-Token: {SHA1}63c44718e6d1a25e1d613" -d '{"os-start": null}'
function _nova_server_start ($nova_endpoint, $auth_token, $server_id) {
$array = array();
@@ -181,9 +184,9 @@ function _nova_server_stop ($nova_endpoint, $auth_token, $server_id) {
return $response;
}
-#curl -g -i -X POST http://10.31.1.13:8774/v2/fe268fd218aa42868063b7cf34855899/servers/
+#curl -g -i -X POST http://xxxxxx:8774/v2/868063b7cf34855899/servers/
#46b85ef3-caad-4749-8e72-70939fbfd086/action -H "User-Agent: python-novaclient" -H "Content-Type: application/json"
-#-H "Accept: application/json" -H "X-Auth-Token: {SHA1}6bfc24a82d845208fcf652dd24622f95b5ca532d"
+#-H "Accept: application/json" -H "X-Auth-Token: {SHA1}5208fcf652dd24622f95b5ca532d"
#-d '{"addSecurityGroup": {"name": "secgrp_vnf_demo"}}'
function _nova_add_security_group ($nova_endpoint, $auth_token, $server_id, $security_group) {
@@ -198,9 +201,9 @@ function _nova_add_security_group ($nova_endpoint, $auth_token, $server_id, $sec
return $response;
}
-#curl -g -i -X POST http://10.31.1.13:8774/v2/fe268fd218aa42868063b7cf34855899/servers/
+#curl -g -i -X POST http://xxxxxxx:8774/v2/42868063b7cf34855899/servers/
#46b85ef3-caad-4749-8e72-70939fbfd086/action -H "User-Agent: python-novaclient" -H "Content-Type: application/json"
-#-H "Accept: application/json" -H "X-Auth-Token: {SHA1}33a8df4a62d6b9e3537d178e8fa43d789f48cc5a"
+#-H "Accept: application/json" -H "X-Auth-Token: {SHA1}9e3537d178e8fa43d789f48cc5a"
#-d '{"addFloatingIp": {"fixed_address": "192.168.2.7", "address": "10.30.19.27"}}'
function _nova_floating_ip_associate ($nova_endpoint, $auth_token, $server_id, $floatingip_address,
$fixed_address = "") {
@@ -219,9 +222,9 @@ function _nova_floating_ip_associate ($nova_endpoint, $auth_token, $server_id, $
return $response;
}
-#curl -g -i -X POST http://10.31.1.13:8774/v2/fe268fd218aa42868063b7cf34855899/servers/
+#curl -g -i -X POST http://xxxxxxxxx:8774/v2/8aa42868063b7cf34855899/servers/
#46b85ef3-caad-4749-8e72-70939fbfd086/action -H "User-Agent: python-novaclient" -H "Content-Type: application/json"
-#-H "Accept: application/json" -H "X-Auth-Token: {SHA1}df2bf9bb8cd667d0eee6f4e2cd8addbd79446a7c"
+#-H "Accept: application/json" -H "X-Auth-Token: {SHA1}667d0eee6f4e2cd8addbd79446a7c"
#-d '{"removeFloatingIp": {"address": "10.30.19.27"}}'
function _nova_floating_ip_disassociate ($nova_endpoint, $auth_token, $server_id, $floatingip_address) {
@@ -236,11 +239,11 @@ function _nova_floating_ip_disassociate ($nova_endpoint, $auth_token, $server_id
return $response;
}
-#curl -i http://ct-int-vip:28774/v2/${PJID}/servers/${SVID}/os-interface -X POST -H "X-Auth-Token: ${TEST_TOKEN}"
+#curl -i http://xxxxxxxxx:28774/v2/${PJID}/servers/${SVID}/os-interface -X POST -H "X-Auth-Token: ${TEST_TOKEN}"
#-H "Accept: application/json" -H "Content-Type: application/json" -d '{"interfaceAttachment":{"port_id":"1234"}}'
-#curl -i http://ct-int-vip:28774/v2/${PJID}/servers/${SVID}/os-interface -X POST -H "X-Auth-Token: ${TEST_TOKEN}"
+#curl -i http://xxxxxxxxx:28774/v2/${PJID}/servers/${SVID}/os-interface -X POST -H "X-Auth-Token: ${TEST_TOKEN}"
#-H "Accept: application/json" -H "Content-Type: application/json" -d
-#'{"interfaceAttachment":{"net_id":"3b49fd97-caab-40ef-9fa6-4073d1639e7c","fixed_ips":[{"ip_address":"192.168.101.2"}]}}'
+#'{"interfaceAttachment":{"net_id":"ef-9fa6-4073d1639e7c","fixed_ips":[{"ip_address":"192.168.101.2"}]}}'
function _nova_interface_attach ($nova_endpoint, $auth_token, $server_id, $port_id = "",
$network_id = "", $fixed_ips = array()) {
@@ -269,7 +272,7 @@ function _nova_interface_attach ($nova_endpoint, $auth_token, $server_id, $port_
return $response;
}
-#curl -i http://ct-int-vip:28774/v2/${PJID}/servers/${SVID}/os-interface/12345 -X DELETE -H "X-Auth-Token:
+#curl -i http://xxxxxxxxx:28774/v2/${PJID}/servers/${SVID}/os-interface/12345 -X DELETE -H "X-Auth-Token:
#${TEST_TOKEN}" -H "Accept: application/json" -H "Content-Type: application/json"
function _nova_interface_detach ($nova_endpoint, $auth_token, $server_id, $port_id) {
@@ -280,9 +283,9 @@ function _nova_interface_detach ($nova_endpoint, $auth_token, $server_id, $port_
return $response;
}
-#curl -i 'http://10.31.1.125:8774/v2/5fd116d488644b84bd57fca22fb02587/servers/44916e9c-5f3e-4e2b-ae89-48f7b5c2d821/action' -X POST
-#-H "Accept: application/json" -H "Content-Type: application/json" -H "User-Agent: python-novaclient" -H "X-Auth-Project-Id: NTTCom"
-#-H "X-Auth-Token: {SHA1}d4563d73b930b0e7bd37c17ab078887da0a64dd4" -d '{"os-getVNCConsole": {"type": "novnc"}}'
+#curl -i 'http://xxxxxxxxx:8774/v2/6d488644b84bd57fca22fb02587/servers/f3e-4e2b-ae89-48f7b5c2d821/action' -X POST
+#-H "Accept: application/json" -H "Content-Type: application/json" -H "User-Agent: python-novaclient" -H "X-Auth-Project-Id: "
+#-H "X-Auth-Token: {SHA1}930b0e7bd37c17ab078887da0a64dd4" -d '{"os-getVNCConsole": {"type": "novnc"}}'
# Type of vnc console ("novnc" or "xvpvnc").
function _nova_get_vnc_console ($nova_endpoint, $auth_token, $server_id, $console_type) {
@@ -303,10 +306,10 @@ function _nova_get_vnc_console ($nova_endpoint, $auth_token, $server_id, $consol
return $response;
}
-#curl -i -k https://10.1.144.116/v2/abcd/servers/abcd/os-volume_attachments -X POST
+#curl -i -k https://xxxxxxxxxv2/abcd/servers/abcd/os-volume_attachments -X POST
#-H "X-Auth-Token:42946664fc6e41e392bb7ee51a9160b9" -H "Accept: application/json"
#-H "Content-Type: application/json"
-#-d '{"volumeAttachment":{"volumeId":"b009c52c-97bd-4da4-916c-b2d4c90a85f4"}}'
+#-d '{"volumeAttachment":{"volumeId":"d-4da4-916c-b2d4c90a85f4"}}'
function _nova_volume_attach ($nova_endpoint, $auth_token, $server_id, $volume_id, $device = null) {
$array = array();
@@ -327,7 +330,7 @@ function _nova_volume_attach ($nova_endpoint, $auth_token, $server_id, $volume_i
return $response;
}
-#curl -i -k https://10.1.144.116/v2/abcd/servers/abcd/os-volume_attachments/sdasd -X DELETE
+#curl -i -k https://xxxxxxxxxv2/abcd/servers/abcd/os-volume_attachments/sdasd -X DELETE
#-H "X-Auth-Token:f16eb9820b4941879379e166e93e27c7" -H "Accept: application/json"
#-H "Content-Type: application/json"
function _nova_volume_detach ($nova_endpoint, $auth_token, $server_id, $volume_id) {
@@ -339,4 +342,122 @@ function _nova_volume_detach ($nova_endpoint, $auth_token, $server_id, $volume_i
return $response;
}
-?>
\ No newline at end of file
+/**
+* VNF Live migration from hostA to hostX of the Openstack VIM.
+*
+* curl --tlsv1.2 -i -sw 'HTTP_CODE=%{http_code}' --connect-timeout 50 --max-time 50 -X POST -H "X-Auth-Token: gAAAAABdel44SS-FrqBKUdIEthbnsIH-R9cXfO307WcU3bz47fjJw1rxqLdaN4P08uw9U9P1UcB-9Qg-NAk3_FvmXD71tHmyyWYje-m2D1GFxF5WtuGZ3S0n7TsbkeIBLOoJt6bUQ45O0X9qrq9CAJtBWBoDr-SvKMrIup0nAOvlt0e09h_UINo" -H "Content-Type: application/json" -k 'http://xxxxxxxxx:8774/v2.1/df1f081bf2d345099e6bb53f6b9407ff/servers/22b555e1-2fe2-45d6-ace1-e5cad4d34db5/action' -d '{
+ "os-migrateLive": {
+ "host": "openstack2.ubiqube.com",
+ "block_migration": "false",
+ "disk_over_commit": false
+ }
+}'
+**/
+function _nova_os_migration_live($nova_endpoint, $auth_token, $server_id, $host, $block_migration = "false", $disk_over_commit = "false")
+{
+ $array = array();
+ $array['host'] = $host;
+ $array['block_migration'] = $block_migration;
+ $array['disk_over_commit'] = $disk_over_commit;
+ $os_migrate_live_array = array(
+ 'os-migrateLive' => $array
+ );
+ $json = json_encode($os_migrate_live_array);
+
+ $openstack_rest_api = "{$nova_endpoint}/servers/{$server_id}/action";
+ $curl_cmd = create_openstack_operation_request(OP_POST, $openstack_rest_api, $auth_token, $json);
+ $response = perform_curl_operation($curl_cmd, "SERVER LIVE MIGRATION");
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ return json_encode($response);
+ }
+ return prepare_json_response(ENDED, ENDED_SUCCESSFULLY, $response);
+}
+
+/*
+ * {
+ * "evacuate": {
+ * "host": "b419863b7d814906a68fb31703c0dbd6",
+ * "adminPass": "MySecretPass",
+ * "onSharedStorage": "False"
+ * }
+ * }
+ */
+function _nova_os_evacuate($nova_endpoint, $auth_token, $server_id, $host)
+{
+ $array = array();
+ $array['onSharedStorage'] = "False";
+ $os_evacuate_array = array(
+ 'evacuate' => $array
+ );
+ $json = json_encode($os_evacuate_array);
+
+ $openstack_rest_api = "{$nova_endpoint}/servers/{$server_id}/action";
+ $curl_cmd = create_openstack_operation_request(OP_POST, $openstack_rest_api, $auth_token, $json);
+ $response = perform_curl_operation($curl_cmd, "SERVER EVACUATE");
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ return json_encode($response);
+ }
+
+ return prepare_json_response(ENDED, ENDED_SUCCESSFULLY, $response);
+}
+
+
+/**
+* GET VIM hosts list (hypervisors).
+*
+* curl --tlsv1.2 -i -sw 'HTTP_CODE=%{http_code}' --connect-timeout 50 --max-time 50 -X GET -H "X-Auth-Token: gAAAAABdel44SS-FrqBKUdIEthbnsIH-R9cXfO307WcU3bz47fjJw1rxqLdaN4P08uw9U9P1UcB-9Qg-NAk3_FvmXD71tHmyyWYje-m2D1GFxF5WtuGZ3S0n7TsbkeIBLOoJt6bUQ45O0X9qrq9CAJtBWBoDr-SvKMrIup0nAOvlt0e09h_UINo" -H "Content-Type: application/json" -k 'http://xxxxxxxxx:8774/v2.1/os-hypervisors'
+*
+**/
+function _nova_os_hypervisors($nova_endpoint, $auth_token)
+{
+ $openstack_rest_api = "{$nova_endpoint}/os-hypervisors";
+ $curl_cmd = create_openstack_operation_request(OP_GET, $openstack_rest_api, $auth_token);
+ $response = perform_curl_operation($curl_cmd, "GET OS HYPERVISORS");
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ return json_encode($response);
+ }
+ return prepare_json_response(ENDED, ENDED_SUCCESSFULLY, $response['wo_newparams']['response_body']);
+}
+
+
+ /**
+* GET VIM hosts list (hypervisors).
+*
+* curl --tlsv1.2 -i -sw 'HTTP_CODE=%{http_code}' --connect-timeout 50 --max-time 50 -X GET -H "X-Auth-Token: gAAAAABdel44SS-FrqBKUdIEthbnsIH-R9cXfO307WcU3bz47fjJw1rxqLdaN4P08uw9U9P1UcB-9Qg-NAk3_FvmXD71tHmyyWYje-m2D1GFxF5WtuGZ3S0n7TsbkeIBLOoJt6bUQ45O0X9qrq9CAJtBWBoDr-SvKMrIup0nAOvlt0e09h_UINo" -H "Content-Type: application/json" -k 'http://xxxxxxxxx:8774/v2.1/os-hypervisors'
+*
+**/
+function _nova_os_hypervisors_list_detail($nova_endpoint, $auth_token)
+{
+ $openstack_rest_api = "{$nova_endpoint}/os-hypervisors/detail";
+ $curl_cmd = create_openstack_operation_request(OP_GET, $openstack_rest_api, $auth_token);
+ $response = perform_curl_operation($curl_cmd, "GET OS HYPERVISORS DETAIL");
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ return json_encode($response);
+ }
+ return prepare_json_response(ENDED, ENDED_SUCCESSFULLY, $response['wo_newparams']['response_body']);
+}
+
+
+/**
+* GET VIM host details by ID.
+*
+* curl --tlsv1.2 -i -sw 'HTTP_CODE=%{http_code}' --connect-timeout 50 --max-time 50 -X GET -H "X-Auth-Token: gAAAAABdel44SS-FrqBKUdIEthbnsIH-R9cXfO307WcU3bz47fjJw1rxqLdaN4P08uw9U9P1UcB-9Qg-NAk3_FvmXD71tHmyyWYje-m2D1GFxF5WtuGZ3S0n7TsbkeIBLOoJt6bUQ45O0X9qrq9CAJtBWBoDr-SvKMrIup0nAOvlt0e09h_UINo" -H "Content-Type: application/json" -k 'http://xxxxxxxxx:8774/v2.1/os-hypervisors/8'
+*
+**/
+function _nova_os_hypervisor_details_by_id($nova_endpoint, $auth_token, $hypervisor_id)
+{
+ $openstack_rest_api = "{$nova_endpoint}/os-hypervisors/{$hypervisor_id}";
+ $curl_cmd = create_openstack_operation_request(OP_GET, $openstack_rest_api, $auth_token);
+ $response = perform_curl_operation($curl_cmd, "GET OS HYPERVISORS DETAILS");
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ return json_encode($response);
+ }
+ return prepare_json_response(ENDED, ENDED_SUCCESSFULLY, $response['wo_newparams']);
+}
+
+
diff --git a/Reference/OPENSTACK/Library/REST/openstack_common_rest.php b/Reference/OPENSTACK/Library/REST/openstack_common_rest.php
index 534b6635e..77c935260 100755
--- a/Reference/OPENSTACK/Library/REST/openstack_common_rest.php
+++ b/Reference/OPENSTACK/Library/REST/openstack_common_rest.php
@@ -4,8 +4,9 @@
require_once '/opt/fmc_repository/Process/Reference/OPENSTACK/Library/REST/cinder_rest.php';
require_once '/opt/fmc_repository/Process/Reference/OPENSTACK/Library/REST/neutron_rest.php';
require_once '/opt/fmc_repository/Process/Reference/OPENSTACK/Library/REST/keystone_rest.php';
+require_once '/opt/fmc_repository/Process/Reference/OPENSTACK/Library/REST/glance_rest.php';
-#curl -i http://ot1-contrail-int-vip:9696/v2.0/subnets.json -X GET -H "X-Auth-Token: ${TEST_TOKEN}"
+#curl -i http://xxxxxxxxx:9696/v2.0/subnets.json -X GET -H "X-Auth-Token: ${TEST_TOKEN}"
#-H "Accept: application/json" -H "Content-Type: application/json"
function object_get ($object_name, $auth_token, $openstack_rest_api) {
@@ -20,7 +21,7 @@ function object_get ($object_name, $auth_token, $openstack_rest_api) {
return $response;
}
-#curl -i http://ot1-contrail-int-vip:9696/v2.0/networks/12345 -X DELETE -H "X-Auth-Token:
+#curl -i http://xxxxxxxxx:9696/v2.0/networks/12345 -X DELETE -H "X-Auth-Token:
#${TEST_TOKEN}" -H "Accept: application/json" -H "Content-Type: application/json"
function object_delete ($object_name, $auth_token, $openstack_rest_api) {
@@ -97,10 +98,18 @@ function wait_for_server_status ($nova_endpoint, $auth_token, $server_id, $statu
}
if ($server_status === ERROR) {
logToFile("SERVER CREATION/ACTION FAILED.");
- $message = $response['fault']['message'];
- $code = $response['fault']['code'];
- $details = $response['fault']['details'];
- $wo_comment = "Server Status : $server_status\nMessage : $message\nCODE : $code\nDetails: $details";
+ if (isset($response['fault']) && is_array($response['fault']) && isset($response['fault']['message']) && isset($response['fault']['code'])){
+ $message = $response['fault']['message'];
+ $code = $response['fault']['code'];
+ if (isset($response['fault']['details']) && !empty($response['fault']['details'])) {
+ $details = $response['fault']['details'];
+ } else {
+ $details = '';
+ }
+ $wo_comment = "Server Status : $server_status\nMessage : $message\nCODE : $code\nDetails: $details";
+ }else{
+ $wo_comment = "Server Status : $server_status";
+ }
$response = prepare_json_response(FAILED, $wo_comment, $wo_newparams, true);
return $response;
}
@@ -489,7 +498,7 @@ function get_server_interface_details ($auth_token, $nova_endpoint, $neutron_end
return $response;
}
-#curl -g -i -X GET http://10.31.1.13:9696/v2.0/ports.json?device_id=fa477dec-b343-4f60-a13d-0fc250d5055e
+#curl -g -i -X GET http://xxxxxxxxx:9696/v2.0/ports.json?device_id=fa477dec-b343-4f60-a13d-0fc250d5055e
#-H "User-Agent: python-neutronclient" -H "Accept: application/json" -H "X-Auth-Token: {SHA1}74ae9bf825ea9d16061f66518d0b9effa78f0785"
function router_interface_list ($neutron_endpoint, $auth_token, $router_id) {
@@ -570,6 +579,17 @@ function get_port_id_from_subnet_and_ip_address ($auth_token, $neutron_endpoint,
return $response;
}
+/**
+*
+* GET subnet ids from network.
+*
+*
+*/
+function get_subnet_ids_from_network($auth_token, $neutron_endpoint, $network)
+{
+ $response = object_get("networks", $auth_token, "{$neutron_endpoint}/v2.0/networks/{$network}");
+ return json_decode($response, true);
+}
/**
* Get Subnet details from network and IP address
*
@@ -781,11 +801,11 @@ function remove_all_router_interfaces ($auth_token, $neutron_endpoint, $router)
$index = 0;
foreach ($router_interfaces as $router_interface) {
- $device_owner = $router_interfaces['device_owner'];
+ $device_owner = $router_interface['device_owner'];
$device_id = $router_interface['device_id'];
if ($device_owner === "network:router_interface" && $device_id === $router) {
- $response = _neutron_router_interface_delete($neutron_endpoint, $auth_token, $router, $subnet_id);
$subnet_id = $router_interface['fixed_ips'][0]['subnet_id'];
+ _neutron_router_interface_delete($neutron_endpoint, $auth_token, $router, $subnet_id);
$router_interface_subnets[$index]['subnet_id'] = $subnet_id;
$ip_address = $router_interface['fixed_ips'][0]['ip_address'];
$subnet_gateway_ips[$index++]['ip_address'] = $ip_address;
@@ -813,7 +833,7 @@ function _list_stacks_resources ($stacks_endpoint, $auth_token, $stack_name, $st
return $response;
}
-#curl -i http://ct-int-vip:28774/v2/${PJID}/servers/${server_id} -X GET -H "X-Auth-Token:
+#curl -i http://xxxxxxxxx:28774/v2/${PJID}/servers/${server_id} -X GET -H "X-Auth-Token:
#${TEST_TOKEN}" -H "Accept: application/json" -H "Content-Type: application/json"
function _nova_get_server_details ($nova_endpoint, $auth_token, $server_id) {
@@ -824,4 +844,27 @@ function _nova_get_server_details ($nova_endpoint, $auth_token, $server_id) {
return $response;
}
+#curl -i http://xxxxxxxxx:28774/v2/${PJID}/flavors/${flavor_id} -X GET -H "X-Auth-Token:
+#${TEST_TOKEN}" -H "Accept: application/json" -H "Content-Type: application/json"
+function _nova_get_flavor_details ($nova_endpoint, $auth_token, $flavor_id) {
+
+ $openstack_rest_api = "{$nova_endpoint}/flavors/{$flavor_id}";
+ $curl_cmd = create_openstack_operation_request(OP_GET, $openstack_rest_api, $auth_token);
+
+ $response = perform_curl_operation($curl_cmd, "FLAVOR GET DETAILS");
+ return $response;
+}
+
+
+#curl -i http://xxxxxxxxx:28774/v2/${PJID}/flavors/detail -X GET -H "X-Auth-Token:
+#${TEST_TOKEN}" -H "Accept: application/json" -H "Content-Type: application/json"
+function _nova_get_flavors_with_details ($nova_endpoint, $auth_token) {
+
+ $openstack_rest_api = "{$nova_endpoint}/flavors/detail";
+ $curl_cmd = create_openstack_operation_request(OP_GET, $openstack_rest_api, $auth_token);
+
+ $response = perform_curl_operation($curl_cmd, "FLAVORS GET LIST WITH DETAILS");
+ return $response;
+}
+
?>
diff --git a/Reference/OPENSTACK/Library/REST/orchestration_rest.php b/Reference/OPENSTACK/Library/REST/orchestration_rest.php
index 2c08128f3..9e88d5227 100755
--- a/Reference/OPENSTACK/Library/REST/orchestration_rest.php
+++ b/Reference/OPENSTACK/Library/REST/orchestration_rest.php
@@ -1,22 +1,19 @@
-
+
diff --git a/Reference/OPENSTACK/Library/REST/utility.php b/Reference/OPENSTACK/Library/REST/utility.php
index d8ee6d568..68b3e39f8 100755
--- a/Reference/OPENSTACK/Library/REST/utility.php
+++ b/Reference/OPENSTACK/Library/REST/utility.php
@@ -13,19 +13,53 @@
* @return string
*/
function create_openstack_operation_request ($operation, $openstack_rest_api, $auth_token = "", $json_body = "",
- $connection_timeout = 60, $max_time = 60) {
+ $connection_timeout = OS_CURL_CONNECTION_TIMEOUT, $max_time = OS_CURL_MAX_TIME) {
global $CURL_CMD;
global $CURL_OPENSTACK;
- // curl -i http://ct-int-vip:28774/v2/${PJID}/servers -X POST -H "X-Auth-Token: ${TEST_TOKEN}" -H "Accept: application/json" -H "Content-Type: application/json" -d '{ "server": { "availability_zone": "ote-lab1","flavorRef": "120","imageRef":"0f0ba35a-1445-497f-8630-c8a1d0b97a87","max_count": 1,"min_count": 1,"name": "vyatta_other_tenant_03","networks":[{"uuid":"a4000cdf-835b-4ec0-942d-a456a3b4f495","port_id":"7dceafe1-ef96-4047-b717-dc354eb48ea2"},{"uuid":"3b49fd97-caab-40ef-9fa6-4073d1639e7c","port_id":"7dceafe1-ef96-4047-b717-dc354eb48ea2"}]}}'
- $curl_cmd = "{$CURL_CMD} {$CURL_OPENSTACK} -i -sw '\nHTTP_CODE=%{http_code}' --connect-timeout $connection_timeout --max-time $max_time -k '{$openstack_rest_api}' -X {$operation} -H \"Accept: application/json\" -H \"Content-Type: application/json\"";
+ global $OS_CURL_VERBOSE;
+ global $OS_CURL_RETRY_COUNT;
+ global $OS_CURL_RETRY_DELAY;
+ global $OS_CURL_RETRY_MAX_TIME;
+ global $context;
+
+ // curl -i http://xxxxxx:28774/v2/${PJID}/servers -X POST -H "X-Auth-Token: ${TEST_TOKEN}" -H "Accept: application/json" -H "Content-Type: application/json" -d '{ "server": { "availability_zone": "ote-lab1","flavorRef": "120","imageRef":"0f0ba35a-1445-497f-8630-c8a1d0b97a87","max_count": 1,"min_count": 1,"name": "vyatta_other_tenant_03","networks":[{"uuid":"a4000cdf-835b-4ec0-942d-a456a3b4f495","port_id":"7dceafe1-ef96-4047-b717-dc354eb48ea2"},{"uuid":"3b49fd97-caab-40ef-9fa6-4073d1639e7c","port_id":"7dceafe1-ef96-4047-b717-dc354eb48ea2"}]}}'
+// /usr/bin/curl --tlsv1.2 -i -sw '
+
+ $curl_cmd = "{$CURL_CMD} {$CURL_OPENSTACK} -i -sw '\nHTTP_CODE=%{http_code}' {$OS_CURL_VERBOSE} --connect-timeout $connection_timeout --max-time $max_time {$OS_CURL_RETRY_COUNT} {$OS_CURL_RETRY_DELAY} {$OS_CURL_RETRY_MAX_TIME} -k '{$openstack_rest_api}' -X {$operation} -H \"Accept: application/json\" -H \"Content-Type: application/json\"";
if ($auth_token !== "") {
+ //We can check if the Auth-Token(token_id) has expired
+ if (isset($context['token_id']) && isset($context['keystone_admin_endpoint']) && isset($context['user_domain_id']) && isset($context['admin_username']) && isset($context['admin_password']) && isset($context['project_domain_id']) && isset($context['admin_tenant_id']) ){
+ if (! isset($context['token_id_expire']) || (isset($context['token_id_expire']) && $context['token_id_expire'] < time()) ) {
+ //We should get a new token_id
+ $response = _keystone_project_scoped_token_get($context['keystone_admin_endpoint'], $context['user_domain_id'], $context['admin_username'],
+ $context['admin_password'], $context['project_domain_id'], $context['admin_tenant_id']);
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ $response = prepare_json_response(FAILED, $response['wo_comment'], $context, true);
+ echo $response;
+ exit;
+ }
+
+ $response_raw_headers = $response['wo_newparams']['response_raw_headers'];
+ $response_headers = http_parse_headers($response_raw_headers);
+ $context['token_id'] = $response_headers[X_SUBJECT_TOKEN];
+ $context['token_id_expire'] = time() + OPENSTACK_TOKEN_ID_EXPIRE_SEC; // expire in OPENSTACK_TOKEN_ID_EXPIRE_SEC secondes
+ $auth_token = $context['token_id'];
+ logToFile(__FILE__ . ' Get new token successfull, expire in '.OPENSTACK_TOKEN_ID_EXPIRE_SEC.' secondes');
+ }else{
+ logToFile(__FILE__ . ' Token not expired');
+ }
+ }else{
+ logToFile(__FILE__ . ' Can not check token_id expire date because missing datas, exist keystone_admin_endpoint='. isset($context['keystone_admin_endpoint']).', exist user_domain_id='.isset($context['user_domain_id']).', exist admin_username='.isset($context['admin_username']).', exist admin_password='.isset($context['admin_password']).', exist project_domain_id='.isset($context['project_domain_id']).', exist admin_tenant_id='.isset($context['admin_tenant_id']));
+ }
$curl_cmd .= " -H \"X-Auth-Token: {$auth_token}\"";
}
if ($json_body !== "") {
$curl_cmd .= " -d '" . pretty_print_json($json_body) . "'";
}
logToFile("Curl Request : $curl_cmd\n");
+ // Curl Request : /usr/bin/curl --tlsv1.2 -i -sw 'HTTP_CODE=%{http_code}' -v --connect-timeout 120 --max-time 120 --retry 3 --retry-delay 10 --retry-max-time 180 -k 'https://xxxxxx/v2.0/ports/84f29670-e90b-43b7-9051-2d595b71efe8' -X DELETE -H "Accept: application/json" -H "Content-Type: application/json" -H "X-Auth-Token: 9cb83397749145c0b1543e0..."
return $curl_cmd;
}
diff --git a/Reference/OPENSTACK/Library/constants.php b/Reference/OPENSTACK/Library/constants.php
index 3b9093e16..2464e92fb 100755
--- a/Reference/OPENSTACK/Library/constants.php
+++ b/Reference/OPENSTACK/Library/constants.php
@@ -1,4 +1,13 @@
+
diff --git a/Reference/OPENSTACK/Tasks/OBMF/Neutron/Task_openstack_get_available_floating_ip.php b/Reference/OPENSTACK/Tasks/OBMF/Neutron/Task_openstack_get_available_floating_ip.php
index f73951e20..0b1fc853f 100755
--- a/Reference/OPENSTACK/Tasks/OBMF/Neutron/Task_openstack_get_available_floating_ip.php
+++ b/Reference/OPENSTACK/Tasks/OBMF/Neutron/Task_openstack_get_available_floating_ip.php
@@ -14,8 +14,7 @@ function list_args()
check_mandatory_param('floating_ip_network');
check_mandatory_param('tenant');
-$openstack_device_id = $context['openstack_device_id'];
-$openstack_device_id = preg_replace('/\D/', '', $openstack_device_id);
+$openstack_device_id = substr($context['openstack_device_id'], 3);
$floating_ip_network = $context['floating_ip_network'];
$floating_ip_tenant = $context['tenant'];
diff --git a/Reference/OPENSTACK/Tasks/REST/Keystone/Task_openstack_keystone_v2_token_get.php b/Reference/OPENSTACK/Tasks/REST/Keystone/Task_openstack_keystone_v2_token_get.php
index 5bf710601..af460cb3f 100755
--- a/Reference/OPENSTACK/Tasks/REST/Keystone/Task_openstack_keystone_v2_token_get.php
+++ b/Reference/OPENSTACK/Tasks/REST/Keystone/Task_openstack_keystone_v2_token_get.php
@@ -32,6 +32,7 @@ function list_args()
$token_id = $response['wo_newparams']['access']['token']['id'];
$endpoints = $response['wo_newparams']['access']['serviceCatalog'];
$context['token_id'] = $token_id;
+$context['token_id_expire'] = time() + OPENSTACK_TOKEN_ID_EXPIRE_SEC; // expire in 5 minutes
$context['endpoints'] = seperate_endpoints_v2($endpoints);
$response = prepare_json_response(ENDED, "Token created successfully.\nToken Id : $token_id", $context, true);
echo $response;
diff --git a/Reference/OPENSTACK/Tasks/REST/Keystone/Task_openstack_project_scoped_token_get.php b/Reference/OPENSTACK/Tasks/REST/Keystone/Task_openstack_project_scoped_token_get.php
index 1072acc81..01c00c342 100755
--- a/Reference/OPENSTACK/Tasks/REST/Keystone/Task_openstack_project_scoped_token_get.php
+++ b/Reference/OPENSTACK/Tasks/REST/Keystone/Task_openstack_project_scoped_token_get.php
@@ -7,15 +7,22 @@ function list_args()
{
}
+check_mandatory_param('user_domain_id');
+check_mandatory_param('admin_username');
+check_mandatory_param('admin_password');
+check_mandatory_param('project_domain_id');
+check_mandatory_param('tenant_id');
+check_mandatory_param('keystone_public_endpoint');
+
$user_domain_id = $context['user_domain_id'];
-$username = $context['tenant_login'];
-$password = $context['tenant_password'];
+$admin_username = $context['admin_username'];
+$admin_password = $context['admin_password'];
$project_domain_id = $context['project_domain_id'];
$openstack_tenant_id = $context['tenant_id'];
-$keystone_endpoint = $context['keystone_public_endpoint'];
+$keystone_public_endpoint = $context['keystone_public_endpoint'];
-$response = _keystone_project_scoped_token_get($keystone_endpoint, $user_domain_id, $username,
- $password, $project_domain_id, $openstack_tenant_id);
+$response = _keystone_project_scoped_token_get($keystone_public_endpoint, $user_domain_id, $admin_username,
+ $admin_password, $project_domain_id, $openstack_tenant_id);
$response = json_decode($response, true);
if ($response['wo_status'] !== ENDED) {
$response = json_encode($response);
@@ -27,10 +34,9 @@ function list_args()
$response_headers = http_parse_headers($response_raw_headers);
$token_id = $response_headers[X_SUBJECT_TOKEN];
$context['token_id'] = $token_id;
+$context['token_id_expire'] = time() + OPENSTACK_TOKEN_ID_EXPIRE_SEC; // expire in 5 minutes
-$response_body_json = $response['wo_newparams']['response_body'];
-$response_body = json_decode($response_body_json, true);
-$endpoints = $response_body['token']['catalog'];
+$endpoints = $response['wo_newparams']['response_body']['token']['catalog'];
$context['endpoints'] = seperate_endpoints_v3($endpoints);
$response = prepare_json_response(ENDED, "Token created successfully.\nToken Id : $token_id", $context, true);
echo $response;
diff --git a/Reference/OPENSTACK/Tasks/REST/Nova/Task_openstack_server_stop.php b/Reference/OPENSTACK/Tasks/REST/Nova/Task_openstack_server_stop.php
index 0d034863f..913c0980e 100755
--- a/Reference/OPENSTACK/Tasks/REST/Nova/Task_openstack_server_stop.php
+++ b/Reference/OPENSTACK/Tasks/REST/Nova/Task_openstack_server_stop.php
@@ -1,44 +1,45 @@
$PROCESSINSTANCEID,
- 'EXECNUMBER' => $EXECNUMBER,
- 'TASKID' => $TASKID);
+$process_params = array(
+ 'PROCESSINSTANCEID' => $PROCESSINSTANCEID,
+ 'EXECNUMBER' => $EXECNUMBER,
+ 'TASKID' => $TASKID
+);
$server_id = $context['server_id'];
$token_id = $context['token_id'];
$endpoints = $context['endpoints'];
-
+
$nova_endpoint = $endpoints[NOVA]['endpoints'][0][ADMIN_URL];
$response = _nova_server_stop($nova_endpoint, $token_id, $server_id);
$response = json_decode($response, true);
if ($response['wo_status'] !== ENDED) {
$response = json_encode($response);
echo $response;
- exit;
+ exit();
}
-
+
$response = wait_for_server_status($nova_endpoint, $token_id, $server_id, SHUTOFF, $process_params);
$response = json_decode($response, true);
if ($response['wo_status'] !== ENDED) {
$response = json_encode($response);
echo $response;
- exit;
+ exit();
}
$server_status_comment = $response['wo_comment'];
$response = prepare_json_response(ENDED, "Openstack Server $server_id stopped successfully.\n$server_status_comment", $context, true);
echo $response;
-?>
+
diff --git a/Reference/PALOALTO/.meta_Library b/Reference/PALOALTO/.meta_Library
new file mode 100644
index 000000000..80c8946fe
--- /dev/null
+++ b/Reference/PALOALTO/.meta_Library
@@ -0,0 +1,39 @@
+
+
+
+
diff --git a/Reference/PALOALTO/.meta_Tasks b/Reference/PALOALTO/.meta_Tasks
new file mode 100644
index 000000000..80c8946fe
--- /dev/null
+++ b/Reference/PALOALTO/.meta_Tasks
@@ -0,0 +1,39 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Library/.meta_constants.php b/Reference/PALOALTO/Library/.meta_constants.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Library/.meta_constants.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Library/.meta_paloalto_generic_common.php b/Reference/PALOALTO/Library/.meta_paloalto_generic_common.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Library/.meta_paloalto_generic_common.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Library/.meta_paloalto_generic_obmf.php b/Reference/PALOALTO/Library/.meta_paloalto_generic_obmf.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Library/.meta_paloalto_generic_obmf.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Library/constants.php b/Reference/PALOALTO/Library/constants.php
new file mode 100644
index 000000000..21150000b
--- /dev/null
+++ b/Reference/PALOALTO/Library/constants.php
@@ -0,0 +1,8 @@
+
\ No newline at end of file
diff --git a/Reference/PALOALTO/Library/paloalto_generic_common.php b/Reference/PALOALTO/Library/paloalto_generic_common.php
new file mode 100644
index 000000000..cbcd12579
--- /dev/null
+++ b/Reference/PALOALTO/Library/paloalto_generic_common.php
@@ -0,0 +1,48 @@
+
\ No newline at end of file
diff --git a/Reference/PALOALTO/Library/paloalto_generic_obmf.php b/Reference/PALOALTO/Library/paloalto_generic_obmf.php
new file mode 100644
index 000000000..6ab773b73
--- /dev/null
+++ b/Reference/PALOALTO/Library/paloalto_generic_obmf.php
@@ -0,0 +1,315 @@
+
+ array($profile_name =>
+ array('decoder' => $decoder,
+ 'packet_capture' => $packet_capture,
+ 'description' => $description
+ )
+ )
+ );
+ $response = execute_command_and_verify_response($device_id, $command_name, $array, "CREATE ANTI-VIRUS USER PROFILE", 180, 180);
+ return $response;
+}
+function _paloalto_generic_url_filtering_user_profile ($device_id, $command_name, $profile_name,
+ $license_expired = "", $enable_container_page = "no",
+ $dynamic_url = "no", $log_container_page_only = "yes",
+ $alert = array(), $allow = array(), $block = array(),
+ $continue = array(), $override = array(),
+ $allow_list = array(), $block_list = array(),
+ $action = "block", $description = "") {
+
+ $url_filterting_user_profile_array = array();
+ $url_filterting_user_profile_array['licence_expired'] = $license_expired;
+ $url_filterting_user_profile_array['enable_container_page'] = $enable_container_page;
+ $url_filterting_user_profile_array['log_container_page_only'] = $log_container_page_only;
+ $url_filterting_user_profile_array['dynamic_url'] = $dynamic_url;
+ $url_filterting_user_profile_array['action'] = $action;
+ $url_filterting_user_profile_array['description'] = $description;
+ if (!empty($alert)) {
+ $url_filterting_user_profile_array['alert'] = $alert;
+ }
+ if (!empty($allow)) {
+ $url_filterting_user_profile_array['allow'] = $allow;
+ }
+ if (!empty($block)) {
+ $url_filterting_user_profile_array['block'] = $block;
+ }
+ if (!empty($continue)) {
+ $url_filterting_user_profile_array['continue'] = $continue;
+ }
+ if (!empty($override)) {
+ $url_filterting_user_profile_array['override'] = $override;
+ }
+ if (!empty($allow_list)) {
+ $url_filterting_user_profile_array['allow_list'] = $allow_list;
+ }
+ if (!empty($block_list)) {
+ $url_filterting_user_profile_array['block_list'] = $block_list;
+ }
+
+ $array = array('urlf_user_profile' =>
+ array($profile_name => $url_filterting_user_profile_array
+ )
+ );
+ $response = execute_command_and_verify_response($device_id, $command_name, $array, "CREATE URL-FILTERING USER PROFILE", 180, 180);
+ return $response;
+}
+function _paloalto_generic_profile_group ($device_id, $command_name, $profile_group_name, $anti_virus,
+ $anti_spyware, $vulnerability, $wildfire_analysis,
+ $url_filtering, $file_blocking, $data_filtering) {
+
+ $array = array('profile_group' =>
+ array($profile_group_name =>
+ array('virus' => $anti_virus,
+ 'spyware' => $anti_spyware,
+ 'vulnerability' => $vulnerability,
+ 'wildfire_analysis' => $wildfire_analysis,
+ 'url_filtering' => $url_filtering,
+ 'file_blocking' => $file_blocking,
+ 'data_filtering' => $data_filtering
+ )
+ )
+ );
+ $response = execute_command_and_verify_response($device_id, $command_name, $array, "CREATE PROFILE GROUP", 180, 180);
+ return $response;
+}
+function _paloalto_generic_address_ip_netmask ($device_id, $command_name, $name,
+ $address, $masklen) {
+
+ $array = array('address_ip_netmask' =>
+ array($name =>
+ array('address' => $address,
+ 'masklen' => $masklen
+ )
+ )
+ );
+ $response = execute_command_and_verify_response($device_id, $command_name, $array, "CREATE IP NETMASK", 180, 180);
+ return $response;
+}
+function _paloalto_generic_address_ip_range ($device_id, $command_name, $name,
+ $start_address, $end_address) {
+
+ $array = array('address_ip_range' =>
+ array($name =>
+ array('startaddress' => $start_address,
+ 'endaddress' => $end_address
+ )
+ )
+ );
+ $response = execute_command_and_verify_response($device_id, $command_name, $array, "CREATE IP RANGE", 180, 180);
+ return $response;
+}
+function _paloalto_generic_address_group ($device_id, $command_name, $address_group_name, $address_group_type,
+ $filter = "", $addresses = array()) {
+
+ $address_group_array = array();
+ $address_group_array['type'] = $address_group_type;
+ if ($address_group_type === "dynamic") {
+ $address_group_array['filter'] = $filter;
+ }
+ else if ($address_group_type === "static") {
+ $address_group_array['addresses'] = $addresses;
+ }
+
+ $array = array('address_group' =>
+ array($address_group_name => $address_group_array
+ )
+ );
+ $response = execute_command_and_verify_response($device_id, $command_name, $array, "CREATE ADDRESS GROUP", 180, 180);
+ return $response;
+}
+function _paloalto_generic_security_policy ($device_id, $command_name, $name,
+ $zone_from, $src_address, $zone_to, $dst_address,
+ $services, $action = "allow", $applications = array(),
+ $users = array(), $categories = array(),
+ $hip_profiles = array(), $profile_group = "",
+ $schedule = "", $log_start = "no", $log_end = "yes") {
+
+ $security_policy_array = array();
+ $security_policy_array['zone_from'] = $zone_from;
+ $security_policy_array['zone_to'] = $zone_to;
+ $security_policy_array['src_address'] = $src_address;
+ $security_policy_array['dst_address'] = $dst_address;
+ $security_policy_array['services'] = $services;
+ $security_policy_array['action'] = $action;
+
+ if ($profile_group !== "") {
+ $security_policy_array['profile_group'] = $profile_group;
+ }
+ if ($schedule !== "") {
+ $security_policy_array['schedule'] = $schedule;
+ }
+ if ($log_start !== "") {
+ $security_policy_array['log_start'] = $log_start;
+ }
+ if ($log_end !== "") {
+ $security_policy_array['log_end'] = $log_end;
+ }
+ if (!empty($applications)) {
+ $security_policy_array['application'] = $applications;
+ }
+ if (!empty($users)) {
+ $security_policy_array['users'] = $users;
+ }
+ if (!empty($categories)) {
+ $security_policy_array['categories'] = $categories;
+ }
+ if (!empty($hip_profiles)) {
+ $security_policy_array['hip_profile'] = $hip_profiles;
+ }
+
+ $array = array('policy_app' =>
+ array($name => $security_policy_array
+ )
+ );
+ $response = execute_command_and_verify_response($device_id, $command_name, $array, "CREATE SECURITY POLICY", 180, 180);
+ return $response;
+}
+function _paloalto_generic_vpn_phase1 ($device_id, $command_name, $name, $lifetime,
+ $encryption = array(), $hash = array(), $dhgroup = array(),
+ $lifetime_unit = "") {
+
+ $array = array('Phase1' =>
+ array($name =>
+ array('encryption' => $encryption,
+ 'hash' => $hash,
+ 'dhgroup' => $dhgroup,
+ 'lifetime' => $lifetime,
+ 'lifetime_unit' => $lifetime_unit
+ )
+ )
+ );
+ $response = execute_command_and_verify_response($device_id, $command_name, $array, "CREATE VPN PHASE-1", 180, 180);
+ return $response;
+}
+function _paloalto_generic_antivirus_service ($device_id, $command_name, $av_service_name,
+ $av_profile, $policy) {
+
+ $array = array('antivirus_service' =>
+ array($av_service_name =>
+ array('av_profile' => $av_profile,
+ 'policy' => $policy
+ )
+ )
+ );
+ $response = execute_command_and_verify_response($device_id, $command_name, $array, "CREATE ANTI-VIRUS SERVICE", 180, 180);
+ return $response;
+}
+
+//{"dns_servers":{"":{"primary":"6.6.6.6","secondary":"4.4.4.4"}}}
+function _paloalto_generic_dns_servers ($device_id, $command_name, $primary = "", $secondary = "") {
+
+ $dns_servers_array = array();
+ if ($primary !== "") {
+ $dns_servers_array['primary'] = $primary;
+ }
+ if ($secondary !== "") {
+ $dns_servers_array['secondary'] = $secondary;
+ }
+
+ if ($primary !== "" || $secondary !== "") {
+ $array = array('dns_servers' =>
+ array("" => $dns_servers_array)
+ );
+ }
+ else {
+ $array = array('dns_servers' => "");
+ }
+ $response = execute_command_and_verify_response($device_id, $command_name, $array, "SET DNS SERVERS", 180, 180);
+ return $response;
+}
+// {"license":{"":{"auth_code":"xyz"}}}
+function _paloalto_generic_license ($device_id, $command_name, $auth_code = "") {
+
+ $license_array = array();
+ if ($auth_code !== "") {
+ $license_array['auth_code'] = $auth_code;
+ $array = array('license' =>
+ array("" => $license_array)
+ );
+ }
+ else {
+ $array = array('license' => "");
+ }
+ $response = execute_command_and_verify_response($device_id, $command_name, $array, "SET LICENSE", 180, 180);
+ return $response;
+}
+
+function _paloalto_generic_ethernet ($device_id, $command_name, $ethernet_name, $interface_type) {
+
+ $array = array('ethernet' =>
+ array($ethernet_name =>
+ array('interface_type' => $interface_type
+ )
+ )
+ );
+ $response = execute_command_and_verify_response($device_id, $command_name, $array, "CREATE $interface_type INTERFACE", 180, 180);
+ return $response;
+}
+function _paloalto_generic_eth_tag ($device_id, $command_name, $ethernet_name, $subinterfaces) {
+
+ $array = array('eth_tag' =>
+ array($ethernet_name =>
+ array('vwireinterface' => $subinterfaces
+ )
+ )
+ );
+ $response = execute_command_and_verify_response($device_id, $command_name, $array, "CREATE VIRTUAL-WIRE SUB-INTERFACE", 180, 180);
+ return $response;
+}
+function _paloalto_generic_virtual_wire ($device_id, $command_name, $vwire_name, $interface1, $interface2,
+ $tag_allowed = "", $multicast_firewalling = "",
+ $link_state_pass_through = "") {
+
+ $array = array('vwire' =>
+ array($vwire_name =>
+ array('interface1' => $interface1,
+ 'interface2' => $interface2,
+ 'tag_allowed' => $tag_allowed,
+ 'multicast_firewalling' => $multicast_firewalling,
+ 'link_state_pass_through' => $link_state_pass_through
+ )
+ )
+ );
+ $response = execute_command_and_verify_response($device_id, $command_name, $array, "CREATE VIRTUAL-WIRE", 180, 180);
+ return $response;
+}
+function _paloalto_generic_zone ($device_id, $command_name, $zone_name, $zone_type, $zone_members) {
+
+ $array = array('zone' =>
+ array($zone_name =>
+ array('zone_type' => $zone_type,
+ 'members' => $zone_members
+ )
+ )
+ );
+ $response = execute_command_and_verify_response($device_id, $command_name, $array, "CREATE ZONE", 180, 180);
+ return $response;
+}
+
+function _paloalto_generic_dhcp_client ($device_id, $command_name, $send_hostname = "no",
+ $accept_dhcp_domain = "no", $send_client_id = "no",
+ $accept_dhcp_hostname = "no") {
+
+ $array = array('dhcp_client' =>
+ array("" =>
+ array('send_hostname' => $send_hostname,
+ 'accept_dhcp_domain' => $accept_dhcp_domain,
+ 'send_client_id' => $send_client_id,
+ 'accept_dhcp_hostname' => $accept_dhcp_hostname
+ )
+ )
+ );
+ $response = execute_command_and_verify_response($device_id, $command_name, $array, "CREATE DHCP-CLIENT", 180, 180);
+ return $response;
+}
+
+
+?>
\ No newline at end of file
diff --git a/Reference/PALOALTO/Tasks/.meta_Task_paloalto_auto_license.php b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_auto_license.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_auto_license.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_address_group.php b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_address_group.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_address_group.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_address_ip_netmask.php b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_address_ip_netmask.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_address_ip_netmask.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_address_ip_range.php b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_address_ip_range.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_address_ip_range.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_antivirus_user_profile.php b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_antivirus_user_profile.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_antivirus_user_profile.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_dhcp_client.php b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_dhcp_client.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_dhcp_client.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_dns_server.php b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_dns_server.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_dns_server.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_eth_vwire.php b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_eth_vwire.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_eth_vwire.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_profile_group.php b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_profile_group.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_profile_group.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_security_policy.php b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_security_policy.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_security_policy.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_url_filtering_user_profile.php b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_url_filtering_user_profile.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_url_filtering_user_profile.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_virtual_wire.php b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_virtual_wire.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_virtual_wire.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_vpn_phase1.php b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_vpn_phase1.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_vpn_phase1.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_zone.php b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_zone.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_create_zone.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Tasks/.meta_Task_paloalto_license_deactivate.php b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_license_deactivate.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_license_deactivate.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Tasks/.meta_Task_paloalto_wait_for_autocom_job_completion.php b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_wait_for_autocom_job_completion.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/.meta_Task_paloalto_wait_for_autocom_job_completion.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/PALOALTO/Tasks/Task_paloalto_auto_license.php b/Reference/PALOALTO/Tasks/Task_paloalto_auto_license.php
new file mode 100644
index 000000000..8f784aaef
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/Task_paloalto_auto_license.php
@@ -0,0 +1,30 @@
+
diff --git a/Reference/PALOALTO/Tasks/Task_paloalto_create_address_group.php b/Reference/PALOALTO/Tasks/Task_paloalto_create_address_group.php
new file mode 100644
index 000000000..33764b728
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/Task_paloalto_create_address_group.php
@@ -0,0 +1,45 @@
+
diff --git a/Reference/PALOALTO/Tasks/Task_paloalto_create_address_ip_netmask.php b/Reference/PALOALTO/Tasks/Task_paloalto_create_address_ip_netmask.php
new file mode 100644
index 000000000..537e47d32
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/Task_paloalto_create_address_ip_netmask.php
@@ -0,0 +1,34 @@
+
diff --git a/Reference/PALOALTO/Tasks/Task_paloalto_create_address_ip_range.php b/Reference/PALOALTO/Tasks/Task_paloalto_create_address_ip_range.php
new file mode 100644
index 000000000..e28165aaa
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/Task_paloalto_create_address_ip_range.php
@@ -0,0 +1,34 @@
+
diff --git a/Reference/PALOALTO/Tasks/Task_paloalto_create_antivirus_user_profile.php b/Reference/PALOALTO/Tasks/Task_paloalto_create_antivirus_user_profile.php
new file mode 100644
index 000000000..76276118f
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/Task_paloalto_create_antivirus_user_profile.php
@@ -0,0 +1,44 @@
+
diff --git a/Reference/PALOALTO/Tasks/Task_paloalto_create_dhcp_client.php b/Reference/PALOALTO/Tasks/Task_paloalto_create_dhcp_client.php
new file mode 100644
index 000000000..dade79fc1
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/Task_paloalto_create_dhcp_client.php
@@ -0,0 +1,46 @@
+
diff --git a/Reference/PALOALTO/Tasks/Task_paloalto_create_dns_server.php b/Reference/PALOALTO/Tasks/Task_paloalto_create_dns_server.php
new file mode 100644
index 000000000..765f660c8
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/Task_paloalto_create_dns_server.php
@@ -0,0 +1,43 @@
+
diff --git a/Reference/PALOALTO/Tasks/Task_paloalto_create_eth_vwire.php b/Reference/PALOALTO/Tasks/Task_paloalto_create_eth_vwire.php
new file mode 100644
index 000000000..30dd9c2c8
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/Task_paloalto_create_eth_vwire.php
@@ -0,0 +1,41 @@
+
diff --git a/Reference/PALOALTO/Tasks/Task_paloalto_create_profile_group.php b/Reference/PALOALTO/Tasks/Task_paloalto_create_profile_group.php
new file mode 100644
index 000000000..f8ade15f1
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/Task_paloalto_create_profile_group.php
@@ -0,0 +1,74 @@
+
diff --git a/Reference/PALOALTO/Tasks/Task_paloalto_create_security_policy.php b/Reference/PALOALTO/Tasks/Task_paloalto_create_security_policy.php
new file mode 100644
index 000000000..1f3e58454
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/Task_paloalto_create_security_policy.php
@@ -0,0 +1,91 @@
+
diff --git a/Reference/PALOALTO/Tasks/Task_paloalto_create_url_filtering_user_profile.php b/Reference/PALOALTO/Tasks/Task_paloalto_create_url_filtering_user_profile.php
new file mode 100644
index 000000000..b1fc110a1
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/Task_paloalto_create_url_filtering_user_profile.php
@@ -0,0 +1,91 @@
+
diff --git a/Reference/PALOALTO/Tasks/Task_paloalto_create_virtual_wire.php b/Reference/PALOALTO/Tasks/Task_paloalto_create_virtual_wire.php
new file mode 100644
index 000000000..ff87345b6
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/Task_paloalto_create_virtual_wire.php
@@ -0,0 +1,50 @@
+
diff --git a/Reference/PALOALTO/Tasks/Task_paloalto_create_vpn_phase1.php b/Reference/PALOALTO/Tasks/Task_paloalto_create_vpn_phase1.php
new file mode 100644
index 000000000..c3466dcf3
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/Task_paloalto_create_vpn_phase1.php
@@ -0,0 +1,41 @@
+
diff --git a/Reference/PALOALTO/Tasks/Task_paloalto_create_zone.php b/Reference/PALOALTO/Tasks/Task_paloalto_create_zone.php
new file mode 100644
index 000000000..eb8d0077e
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/Task_paloalto_create_zone.php
@@ -0,0 +1,34 @@
+
\ No newline at end of file
diff --git a/Reference/PALOALTO/Tasks/Task_paloalto_license_deactivate.php b/Reference/PALOALTO/Tasks/Task_paloalto_license_deactivate.php
new file mode 100644
index 000000000..e3078707a
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/Task_paloalto_license_deactivate.php
@@ -0,0 +1,25 @@
+
diff --git a/Reference/PALOALTO/Tasks/Task_paloalto_wait_for_autocom_job_completion.php b/Reference/PALOALTO/Tasks/Task_paloalto_wait_for_autocom_job_completion.php
new file mode 100644
index 000000000..34d02c8c6
--- /dev/null
+++ b/Reference/PALOALTO/Tasks/Task_paloalto_wait_for_autocom_job_completion.php
@@ -0,0 +1,31 @@
+ $PROCESSINSTANCEID,
+ 'EXECNUMBER' => $EXECNUMBER,
+ 'TASKID' => $TASKID);
+
+$device_id = substr($context['device_id'], 3);
+$response = wait_for_autocom_job_completion($device_id, $process_params);
+$response = json_decode($response, true);
+if ($response['wo_status'] !== ENDED) {
+ $response = json_encode($response);
+ echo $response;
+ exit;
+}
+$autocom_status_message = $response['wo_comment'];
+$response = prepare_json_response(ENDED, "AutoCom Job completed successfully on the PA Device $device_id\n$autocom_status_message", $context, true);
+echo $response;
+
+?>
diff --git a/Reference/README b/Reference/README
new file mode 100644
index 000000000..5dc90e181
--- /dev/null
+++ b/Reference/README
@@ -0,0 +1,3 @@
+These files are provided by UBIqube as examples and can be freely reused to build new objects, templates or orchestration services.
+
+UBIqube may change or update these files without any notification therefore it is advised to copy the files to a folder other than reference before doing any modification.
diff --git a/Reference/VMWARE/.meta_vRO b/Reference/VMWARE/.meta_vRO
new file mode 100644
index 000000000..9002eb411
--- /dev/null
+++ b/Reference/VMWARE/.meta_vRO
@@ -0,0 +1,39 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/.meta_Library b/Reference/VMWARE/vRO/.meta_Library
new file mode 100644
index 000000000..80c8946fe
--- /dev/null
+++ b/Reference/VMWARE/vRO/.meta_Library
@@ -0,0 +1,39 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/.meta_Tasks b/Reference/VMWARE/vRO/.meta_Tasks
new file mode 100644
index 000000000..80c8946fe
--- /dev/null
+++ b/Reference/VMWARE/vRO/.meta_Tasks
@@ -0,0 +1,39 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Library/.meta_REST b/Reference/VMWARE/vRO/Library/.meta_REST
new file mode 100644
index 000000000..db47d8a9b
--- /dev/null
+++ b/Reference/VMWARE/vRO/Library/.meta_REST
@@ -0,0 +1,39 @@
+
+
+
+
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Library/.meta_constants.php b/Reference/VMWARE/vRO/Library/.meta_constants.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/VMWARE/vRO/Library/.meta_constants.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Library/REST/.meta_execution_rest.php b/Reference/VMWARE/vRO/Library/REST/.meta_execution_rest.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/VMWARE/vRO/Library/REST/.meta_execution_rest.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Library/REST/.meta_interaction_presentation_rest.php b/Reference/VMWARE/vRO/Library/REST/.meta_interaction_presentation_rest.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/VMWARE/vRO/Library/REST/.meta_interaction_presentation_rest.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Library/REST/.meta_presentation_rest.php b/Reference/VMWARE/vRO/Library/REST/.meta_presentation_rest.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/VMWARE/vRO/Library/REST/.meta_presentation_rest.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Library/REST/.meta_utility.php b/Reference/VMWARE/vRO/Library/REST/.meta_utility.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/VMWARE/vRO/Library/REST/.meta_utility.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Library/REST/.meta_vmware_vro_common_rest.php b/Reference/VMWARE/vRO/Library/REST/.meta_vmware_vro_common_rest.php
new file mode 100644
index 000000000..b9e5360a9
--- /dev/null
+++ b/Reference/VMWARE/vRO/Library/REST/.meta_vmware_vro_common_rest.php
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Library/REST/execution_rest.php b/Reference/VMWARE/vRO/Library/REST/execution_rest.php
new file mode 100644
index 000000000..fc7f53e11
--- /dev/null
+++ b/Reference/VMWARE/vRO/Library/REST/execution_rest.php
@@ -0,0 +1,21 @@
+
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Library/REST/interaction_presentation_rest.php b/Reference/VMWARE/vRO/Library/REST/interaction_presentation_rest.php
new file mode 100644
index 000000000..191007f84
--- /dev/null
+++ b/Reference/VMWARE/vRO/Library/REST/interaction_presentation_rest.php
@@ -0,0 +1,21 @@
+
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Library/REST/presentation_rest.php b/Reference/VMWARE/vRO/Library/REST/presentation_rest.php
new file mode 100644
index 000000000..a6e5e106e
--- /dev/null
+++ b/Reference/VMWARE/vRO/Library/REST/presentation_rest.php
@@ -0,0 +1,21 @@
+
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Library/REST/utility.php b/Reference/VMWARE/vRO/Library/REST/utility.php
new file mode 100644
index 000000000..5d266607f
--- /dev/null
+++ b/Reference/VMWARE/vRO/Library/REST/utility.php
@@ -0,0 +1,87 @@
+hasNext()) {
+ $encoded_data .= "&";
+ }
+ }
+ $ait = new ArrayIterator(explode("/", $uri));
+ $cit = new CachingIterator($ait);
+ $uri_encoded = "";
+ foreach ($cit as $uri_path) {
+ $uri_encoded .= rawurlencode($uri_path);
+ if ($cit->hasNext()) {
+ $uri_encoded .= "/";
+ }
+ }
+ $url = "'https://{$VRO_HOST}:{$VRO_PORT}/vco/api/{$uri_encoded}?{$encoded_data}'";
+ }
+ else {
+ $ait = new ArrayIterator(explode("/", $vro_rest_api));
+ $cit = new CachingIterator($ait);
+ $uri_encoded = "";
+ foreach ($cit as $uri_path) {
+ $uri_encoded .= rawurlencode($uri_path);
+ if ($cit->hasNext()) {
+ $uri_encoded .= "/";
+ }
+ }
+ $url = "'https://{$VRO_HOST}:{$VRO_PORT}/vco/api/{$uri_encoded}'";
+ }
+
+ $content_type = "application/json";
+ $accept = "application/json";
+ if (strpos($json_body, "@") === 0) {
+ $content_type = "*/*";
+ }
+ else if (strpos($json_body, "file=") === 0) {
+ $content_type = "application/x-www-form-urlencoded";
+ }
+ $authorization = base64_encode($context['vcenter_username'] . ":" . $context['vcenter_password']);
+ $curl_cmd = "{$CURL_CMD} -iksw '\nHTTP_CODE=%{http_code}' -H \"Content-Type: {$content_type}\" -H \"Accept: {$accept}\" -H 'Authorization: Basic {$authorization}' --connect-timeout $connection_timeout --max-time $max_time -X {$operation} {$url}";
+ if ($json_body !== "") {
+ $curl_cmd .= " -d '" . pretty_print_json($json_body) . "'";
+ }
+ logToFile("Curl Request : $curl_cmd\n");
+ return $curl_cmd;
+}
+
+function vro_add_parameter_in_request (&$parameters, $name, $type, $value, $scope = "local", $description = "") {
+
+ $index = count($parameters);
+ $parameters[$index]['name'] = $name;
+ $parameters[$index]['type'] = $type;
+ $parameters[$index]['value'] = $value;
+ $parameters[$index]['scope'] = $scope;
+ $parameters[$index]['description'] = $description;
+}
+
+?>
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Library/REST/vmware_vro_common_rest.php b/Reference/VMWARE/vRO/Library/REST/vmware_vro_common_rest.php
new file mode 100644
index 000000000..eca3db1ea
--- /dev/null
+++ b/Reference/VMWARE/vRO/Library/REST/vmware_vro_common_rest.php
@@ -0,0 +1,106 @@
+ $timeout) {
+ $wo_comment .= "Workflow execution could not be completed within $timeout seconds.\nHence, Ending the Process as Failure.";
+ $response = prepare_json_response(FAILED, $wo_comment, $wo_newparams, true);
+ return $response;
+ }
+ }
+ $response = prepare_json_response(ENDED, $wo_comment, $wo_newparams);
+ return $response;
+}
+
+function vro_execute_workflow_and_wait_for_completion ($workflow_id, $parameters_array) {
+
+ global $context;
+
+ $response = _execution_start_workflow($workflow_id, $parameters_array);
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ $response = prepare_json_response(FAILED, $response['wo_comment'], $context, true);
+ echo $response;
+ exit;
+ }
+
+ $execution_id = vro_get_execution_id($response['wo_newparams']['response_raw_headers']);
+ $context['execution_id'] = $execution_id;
+
+ $response = vro_wait_for_workflow_completion($workflow_id, $execution_id);
+ $response = json_decode($response, true);
+ if ($response['wo_status'] !== ENDED) {
+ $response = prepare_json_response(FAILED, $response['wo_comment'], $context, true);
+ echo $response;
+ exit;
+ }
+ $context['output_parameters'] = $response['wo_newparams'];
+}
+
+?>
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Library/constants.php b/Reference/VMWARE/vRO/Library/constants.php
new file mode 100644
index 000000000..1ca850527
--- /dev/null
+++ b/Reference/VMWARE/vRO/Library/constants.php
@@ -0,0 +1,72 @@
+
diff --git a/Reference/VMWARE/vRO/Tasks/.meta_REST b/Reference/VMWARE/vRO/Tasks/.meta_REST
new file mode 100644
index 000000000..db47d8a9b
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/.meta_REST
@@ -0,0 +1,39 @@
+
+
+
+
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Tasks/REST/.meta_vCenter b/Reference/VMWARE/vRO/Tasks/REST/.meta_vCenter
new file mode 100644
index 000000000..80c8946fe
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/.meta_vCenter
@@ -0,0 +1,39 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/.meta_VM_Management b/Reference/VMWARE/vRO/Tasks/REST/vCenter/.meta_VM_Management
new file mode 100644
index 000000000..80c8946fe
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/.meta_VM_Management
@@ -0,0 +1,39 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Add_CD_ROM.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Add_CD_ROM.php
new file mode 100644
index 000000000..aecec21c3
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Add_CD_ROM.php
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Add_Disk.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Add_Disk.php
new file mode 100644
index 000000000..6fec0ed08
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Add_Disk.php
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Change_RAM.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Change_RAM.php
new file mode 100644
index 000000000..aecec21c3
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Change_RAM.php
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Create_Simple_VM.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Create_Simple_VM.php
new file mode 100644
index 000000000..5919b34e9
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Create_Simple_VM.php
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Create_Snapshot.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Create_Snapshot.php
new file mode 100644
index 000000000..b85f773c3
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Create_Snapshot.php
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Delete_VM.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Delete_VM.php
new file mode 100644
index 000000000..aecec21c3
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Delete_VM.php
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Get_VMs_by_Name.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Get_VMs_by_Name.php
new file mode 100644
index 000000000..aecec21c3
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Get_VMs_by_Name.php
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Mount_CD_ROM.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Mount_CD_ROM.php
new file mode 100644
index 000000000..f6ff5aed5
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Mount_CD_ROM.php
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Power_Off_VM.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Power_Off_VM.php
new file mode 100644
index 000000000..aecec21c3
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Power_Off_VM.php
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Reboot_VM.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Reboot_VM.php
new file mode 100644
index 000000000..aecec21c3
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Reboot_VM.php
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Register_VM.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Register_VM.php
new file mode 100644
index 000000000..2ab6fe17a
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Register_VM.php
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Remove_All_Snapshots.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Remove_All_Snapshots.php
new file mode 100644
index 000000000..c5c1c10ab
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Remove_All_Snapshots.php
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Resume_VM_And_Wait.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Resume_VM_And_Wait.php
new file mode 100644
index 000000000..aecec21c3
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Resume_VM_And_Wait.php
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Revert_To_Snapshot_And_Wait.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Revert_To_Snapshot_And_Wait.php
new file mode 100644
index 000000000..f6abee5bd
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Revert_To_Snapshot_And_Wait.php
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Run_SSH_Command.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Run_SSH_Command.php
new file mode 100644
index 000000000..ba00cea3e
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Run_SSH_Command.php
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Set_VM_Performance.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Set_VM_Performance.php
new file mode 100644
index 000000000..a0fdcac9d
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Set_VM_Performance.php
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Start_VM_And_Wait.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Start_VM_And_Wait.php
new file mode 100644
index 000000000..aecec21c3
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Start_VM_And_Wait.php
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Suspend_VM_And_Wait.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Suspend_VM_And_Wait.php
new file mode 100644
index 000000000..aecec21c3
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/.meta_Task_vRO_Suspend_VM_And_Wait.php
@@ -0,0 +1,21 @@
+
+
+
+
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Add_CD_ROM.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Add_CD_ROM.php
new file mode 100644
index 000000000..48edd297e
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Add_CD_ROM.php
@@ -0,0 +1,38 @@
+ array("type" => VC_VIRTUAL_MACHINE, "id" => $context['vm']));
+vro_add_parameter_in_request($parameters, 'vm', VC_VIRTUAL_MACHINE, $value);
+
+$value = array("boolean" => array("value" => filter_var($context['connectAtPowerOn'], FILTER_VALIDATE_BOOLEAN)));
+vro_add_parameter_in_request($parameters, 'connectAtPowerOn', 'boolean', $value);
+
+$value = array("string" => array("value" => $context['deviceType']));
+vro_add_parameter_in_request($parameters, 'deviceType', 'string', $value);
+
+$value = array("string" => array("value" => $context['filePath']));
+vro_add_parameter_in_request($parameters, 'filePath', 'string', $value);
+
+$parameters_array['parameters'] = $parameters;
+
+vro_execute_workflow_and_wait_for_completion(VRO_ADD_CD_ROM_V20, $parameters_array);
+
+$response = prepare_json_response(ENDED, "CD-ROM added succesfully.", $context, true);
+echo $response;
+
+?>
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Add_Disk.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Add_Disk.php
new file mode 100644
index 000000000..735794549
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Add_Disk.php
@@ -0,0 +1,56 @@
+ array("type" => VC_VIRTUAL_MACHINE, "id" => $context['vm']));
+vro_add_parameter_in_request($parameters, 'vm', VC_VIRTUAL_MACHINE, $value);
+
+$value = array("sdk-object" => array("type" => VC_DATASTORE, "id" => "{$vcenter_fqdn}/" . $context['datastore']));
+vro_add_parameter_in_request($parameters, 'datastore', VC_DATASTORE, $value);
+
+$value = array("number" => array("value" => $context['diskIndex']));
+vro_add_parameter_in_request($parameters, 'diskIndex', 'number', $value);
+
+$value = array("number" => array("value" => $context['diskSize']));
+vro_add_parameter_in_request($parameters, 'diskSize', 'number', $value);
+
+$value = array("sdk-object" => array("type" => VC_DISK_MODE, "id" => $context['diskMode']));
+vro_add_parameter_in_request($parameters, 'diskMode', VC_DISK_MODE, $value);
+
+$value = array("number" => array("value" => $context['scsiBusNumber']));
+vro_add_parameter_in_request($parameters, 'scsiBusNumber', 'number', $value);
+
+$value = array("boolean" => array("value" => filter_var($context['thinProvisioned'], FILTER_VALIDATE_BOOLEAN)));
+vro_add_parameter_in_request($parameters, 'thinProvisioned', 'boolean', $value);
+
+$parameters_array['parameters'] = $parameters;
+
+vro_execute_workflow_and_wait_for_completion(VRO_ADD_DISK_V20, $parameters_array);
+
+$response = prepare_json_response(ENDED, "Disk added successfully.", $context, true);
+echo $response;
+
+?>
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Change_RAM.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Change_RAM.php
new file mode 100644
index 000000000..02dd7eb9c
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Change_RAM.php
@@ -0,0 +1,30 @@
+ array("type" => VC_VIRTUAL_MACHINE, "id" => $context['vm']));
+vro_add_parameter_in_request($parameters, 'vm', VC_VIRTUAL_MACHINE, $value);
+
+$value = array("number" => array("value" => $context['memory']));
+vro_add_parameter_in_request($parameters, 'memory', 'number', $value);
+
+$parameters_array['parameters'] = $parameters;
+
+vro_execute_workflow_and_wait_for_completion(VRO_CHANGE_RAM_V20, $parameters_array);
+
+$response = prepare_json_response(ENDED, "RAM changed successfully.", $context, true);
+echo $response;
+
+?>
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Create_Simple_VM.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Create_Simple_VM.php
new file mode 100644
index 000000000..9f830d893
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Create_Simple_VM.php
@@ -0,0 +1,82 @@
+ array("value" => $context['vmName']));
+vro_add_parameter_in_request($parameters, 'vmName', 'string', $value);
+
+$value = array("sdk-object" => array("type" => VC_VM_GUEST_OS, "id" => $context['vmGuestOs']));
+vro_add_parameter_in_request($parameters, 'vmGuestOs', VC_VM_GUEST_OS, $value);
+
+$value = array("sdk-object" => array("type" => VC_VM_FOLDER, "id" => "{$vcenter_fqdn}/" . $context['vmFolder']));
+vro_add_parameter_in_request($parameters, 'vmFolder', VC_VM_FOLDER, $value);
+
+$value = array("sdk-object" => array("type" => VC_RESOURCE_POOL, "id" => "{$vcenter_fqdn}/" . $context['vmResourcePool']));
+vro_add_parameter_in_request($parameters, 'vmResourcePool', VC_RESOURCE_POOL, $value);
+
+$value = array("sdk-object" => array("type" => VC_HOST_SYSTEM, "id" => "{$vcenter_fqdn}/" . $context['vmHost']));
+vro_add_parameter_in_request($parameters, 'vmHost', VC_HOST_SYSTEM, $value);
+
+$value = array("number" => array("value" => intval($context['vmDiskSize'])));
+vro_add_parameter_in_request($parameters, 'vmDiskSize', 'number', $value);
+
+$value = array("number" => array("value" => intval($context['vmMemorySize'])));
+vro_add_parameter_in_request($parameters, 'vmMemorySize', 'number', $value);
+
+$value = array("number" => array("value" => intval($context['vmNbOfCpus'])));
+vro_add_parameter_in_request($parameters, 'vmNbOfCpus', 'number', $value);
+
+$value = array("sdk-object" => array("type" => VC_NETWORK, "id" => "{$vcenter_fqdn}/" . $context['vmNetwork']));
+vro_add_parameter_in_request($parameters, 'vmNetwork', VC_NETWORK, $value);
+
+$value = array("sdk-object" => array("type" => VC_DATASTORE, "id" => "{$vcenter_fqdn}/" . $context['vmDatastore']));
+vro_add_parameter_in_request($parameters, 'vmDatastore', VC_DATASTORE, $value);
+
+$value = array("boolean" => array("value" => filter_var($context['diskThinProvisioned'], FILTER_VALIDATE_BOOLEAN)));
+vro_add_parameter_in_request($parameters, 'diskThinProvisioned', 'boolean', $value);
+
+$parameters_array['parameters'] = $parameters;
+
+vro_execute_workflow_and_wait_for_completion(VRO_CREATE_SIMPLE_VM_V20, $parameters_array);
+
+$id_full = $context['output_parameters'][0]['value']['sdk-object']['id'];
+$context['vm'] = str_replace(",id:", "/", $id_full);
+$vm_id = substr($id_full, strpos($id_full, "id:") + 3);
+$context['vm_id'] = $vm_id;
+
+$response = prepare_json_response(ENDED, "VM created successfully.\nVM Id : $vm_id", $context, true);
+echo $response;
+
+?>
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Create_Snapshot.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Create_Snapshot.php
new file mode 100644
index 000000000..fc1e84292
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Create_Snapshot.php
@@ -0,0 +1,53 @@
+ array("type" => VC_VIRTUAL_MACHINE, "id" => $context['vm']));
+vro_add_parameter_in_request($parameters, 'vm', VC_VIRTUAL_MACHINE, $value);
+
+$value = array("string" => array("value" => $context['snapshot_name']));
+vro_add_parameter_in_request($parameters, 'name', 'string', $value);
+
+$value = array("string" => array("value" => $context['description']));
+vro_add_parameter_in_request($parameters, 'description', 'string', $value);
+
+$value = array("boolean" => array("value" => filter_var($context['snapshot_memory'], FILTER_VALIDATE_BOOLEAN)));
+vro_add_parameter_in_request($parameters, 'memory', 'boolean', $value);
+
+$value = array("boolean" => array("value" => filter_var($context['quiesce'], FILTER_VALIDATE_BOOLEAN)));
+vro_add_parameter_in_request($parameters, 'quiesce', 'boolean', $value);
+
+$parameters_array['parameters'] = $parameters;
+
+vro_execute_workflow_and_wait_for_completion(VRO_CREATE_SNAPSHOT_V20, $parameters_array);
+/**
+ * TODO : snapshot response
+ */
+$id_full = $context['output_parameters'][0]['value']['sdk-object']['id'];
+$context['snapshot'] = str_replace(",id:", "/", $id_full);
+$snapshot_id = substr($id_full, strpos($id_full, "id:") + 3);
+$context['snapshot_id'] = $snapshot_id;
+
+$response = prepare_json_response(ENDED, "Snapshot created successfully.\nSnapshot id : $snapshot_id", $context, true);
+echo $response;
+
+?>
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Delete_VM.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Delete_VM.php
new file mode 100644
index 000000000..1028ddf72
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Delete_VM.php
@@ -0,0 +1,30 @@
+ array("type" => VC_VIRTUAL_MACHINE, "id" => $context['vm']));
+vro_add_parameter_in_request($parameters, 'vm', VC_VIRTUAL_MACHINE, $value);
+
+$parameters_array['parameters'] = $parameters;
+
+vro_execute_workflow_and_wait_for_completion(VRO_DELETE_VM_V20, $parameters_array);
+
+$response = prepare_json_response(ENDED, "VM deleted successfully.", $context, true);
+echo $response;
+
+?>
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Get_VMs_by_Name.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Get_VMs_by_Name.php
new file mode 100644
index 000000000..2e89ce4f9
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Get_VMs_by_Name.php
@@ -0,0 +1,36 @@
+ array("value" => $context['criteria']));
+vro_add_parameter_in_request($parameters, 'criteria', 'string', $value);
+
+$parameters_array['parameters'] = $parameters;
+
+vro_execute_workflow_and_wait_for_completion(VRO_GET_VMS_BY_NAME_V102, $parameters_array);
+
+$context['vm'] = array();
+$index = 0;
+foreach ($context['output_parameters'][0]['value']['array']['elements'] as $element) {
+ $id_full = $element['sdk-object']['id'];
+ $vm_id = substr($id_full, strpos($id_full, "id:") + 3);
+ $context['vm'][$index]['id'] = $vm_id;
+ /**
+ * TODO : Need more info like VM name etc..?
+ */
+ $index++;
+}
+
+$context['vm_count'] = $index;
+
+task_exit(ENDED, "VM details fetched successfully.");
+
+?>
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Mount_CD_ROM.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Mount_CD_ROM.php
new file mode 100644
index 000000000..bf6013bb4
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Mount_CD_ROM.php
@@ -0,0 +1,38 @@
+ array("type" => VC_VIRTUAL_MACHINE, "id" => $context['vm']));
+vro_add_parameter_in_request($parameters, 'vm', VC_VIRTUAL_MACHINE, $value);
+
+$value = array("boolean" => array("value" => filter_var($context['connectAtPowerOn'], FILTER_VALIDATE_BOOLEAN)));
+vro_add_parameter_in_request($parameters, 'connectAtPowerOn', 'boolean', $value);
+
+$value = array("string" => array("value" => $context['deviceType']));
+vro_add_parameter_in_request($parameters, 'deviceType', 'string', $value);
+
+$value = array("string" => array("value" => $context['filePath']));
+vro_add_parameter_in_request($parameters, 'filePath', 'string', $value);
+
+$parameters_array['parameters'] = $parameters;
+
+vro_execute_workflow_and_wait_for_completion(VRO_MOUNT_CD_ROM_V32, $parameters_array);
+
+$response = prepare_json_response(ENDED, "CD-ROM mounted succesfully.", $context, true);
+echo $response;
+
+?>
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Power_Off_VM.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Power_Off_VM.php
new file mode 100644
index 000000000..bea26e5c6
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Power_Off_VM.php
@@ -0,0 +1,30 @@
+ array("type" => VC_VIRTUAL_MACHINE, "id" => $context['vm']));
+vro_add_parameter_in_request($parameters, 'vm', VC_VIRTUAL_MACHINE, $value);
+
+$parameters_array['parameters'] = $parameters;
+
+vro_execute_workflow_and_wait_for_completion(VRO_POWER_OFF_VM_AND_WAIT_V20, $parameters_array);
+
+$response = prepare_json_response(ENDED, "VM powered off successfully.", $context, true);
+echo $response;
+
+?>
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Reboot_VM.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Reboot_VM.php
new file mode 100644
index 000000000..948eac7a5
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Reboot_VM.php
@@ -0,0 +1,30 @@
+ array("type" => VC_VIRTUAL_MACHINE, "id" => $context['vm']));
+vro_add_parameter_in_request($parameters, 'vm', VC_VIRTUAL_MACHINE, $value);
+
+$parameters_array['parameters'] = $parameters;
+
+vro_execute_workflow_and_wait_for_completion(VRO_REBOOT_GUEST_OS_V20, $parameters_array);
+
+$response = prepare_json_response(ENDED, "VM rebooted successfully.", $context, true);
+echo $response;
+
+?>
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Register_VM.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Register_VM.php
new file mode 100644
index 000000000..c5c29e553
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Register_VM.php
@@ -0,0 +1,55 @@
+ array("type" => VC_VM_FOLDER, "id" => "{$vcenter_fqdn}/" . $context['folder']));
+vro_add_parameter_in_request($parameters, 'folder', VC_VM_FOLDER, $value);
+
+$value = array("string" => array("value" => $context['path']));
+vro_add_parameter_in_request($parameters, 'path', 'string', $value);
+
+$value = array("string" => array("value" => $context['name']));
+vro_add_parameter_in_request($parameters, 'name', 'string', $value);
+
+$value = array("boolean" => array("value" => filter_var($context['asTemplate'], FILTER_VALIDATE_BOOLEAN)));
+vro_add_parameter_in_request($parameters, 'asTemplate', 'boolean', $value);
+
+$value = array("sdk-object" => array("type" => VC_RESOURCE_POOL, "id" => "{$vcenter_fqdn}/" . $context['resourcePool']));
+vro_add_parameter_in_request($parameters, 'resourcePool', VC_RESOURCE_POOL, $value);
+
+$value = array("sdk-object" => array("type" => VC_HOST_SYSTEM, "id" => "{$vcenter_fqdn}/" . $context['host']));
+vro_add_parameter_in_request($parameters, 'host', VC_HOST_SYSTEM, $value);
+
+$parameters_array['parameters'] = $parameters;
+
+vro_execute_workflow_and_wait_for_completion(VRO_REGISTER_VM_V14, $parameters_array);
+
+$id_full = $context['output_parameters'][0]['value']['sdk-object']['id'];
+$context['registered_vm'] = str_replace(",id:", "/", $id_full);
+$vm_id = substr($id_full, strpos($id_full, "id:") + 3);
+$context['registered_vm_id'] = $vm_id;
+
+$response = prepare_json_response(ENDED, "VM registered successfully.\nVM Id : $vm_id", $context, true);
+echo $response;
+
+?>
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Remove_All_Snapshots.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Remove_All_Snapshots.php
new file mode 100644
index 000000000..830fd05fe
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Remove_All_Snapshots.php
@@ -0,0 +1,25 @@
+ array("type" => VC_VIRTUAL_MACHINE, "id" => $context['vm']));
+vro_add_parameter_in_request($parameters, 'vm', VC_VIRTUAL_MACHINE, $value);
+
+$parameters_array['parameters'] = $parameters;
+
+vro_execute_workflow_and_wait_for_completion(VRO_REMOVE_ALL_SNAPSHOTS_V20, $parameters_array);
+
+$response = prepare_json_response(ENDED, "Snapshots removed successfully.", $context, true);
+echo $response;
+
+?>
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Resume_VM_And_Wait.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Resume_VM_And_Wait.php
new file mode 100644
index 000000000..cde9413ae
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Resume_VM_And_Wait.php
@@ -0,0 +1,34 @@
+ array("type" => VC_VIRTUAL_MACHINE, "id" => $context['vm']));
+vro_add_parameter_in_request($parameters, 'vm', VC_VIRTUAL_MACHINE, $value);
+
+$value = array("sdk-object" => array("type" => VC_HOST_SYSTEM, "id" => $context['host']));
+vro_add_parameter_in_request($parameters, 'host', VC_HOST_SYSTEM, $value);
+
+$parameters_array['parameters'] = $parameters;
+
+vro_execute_workflow_and_wait_for_completion(VRO_RESUME_VM_AND_WAIT_V20, $parameters_array);
+
+$response = prepare_json_response(ENDED, "VM resumed successfully.", $context, true);
+echo $response;
+
+?>
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Revert_To_Snapshot_And_Wait.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Revert_To_Snapshot_And_Wait.php
new file mode 100644
index 000000000..046bd6c09
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Revert_To_Snapshot_And_Wait.php
@@ -0,0 +1,31 @@
+ array("type" => VC_VIRTUAL_MACHINE_SNAPSHOT, "id" => $context['snapshot']));
+vro_add_parameter_in_request($parameters, 'snapshot', VC_VIRTUAL_MACHINE_SNAPSHOT, $value);
+
+$value = array("sdk-object" => array("type" => VC_HOST_SYSTEM, "id" => "{$vcenter_fqdn}/" . $context['snapshot_revert_host']));
+vro_add_parameter_in_request($parameters, 'vmhost', VC_HOST_SYSTEM, $value);
+
+$parameters_array['parameters'] = $parameters;
+
+vro_execute_workflow_and_wait_for_completion(VRO_REVERT_TO_SNAPSHOT_AND_WAIT_V20, $parameters_array);
+
+$response = prepare_json_response(ENDED, "Snapshot reverted successfully to " . $context['snapshot'], $context, true);
+echo $response;
+
+?>
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Run_SSH_Command.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Run_SSH_Command.php
new file mode 100644
index 000000000..4868fe198
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Run_SSH_Command.php
@@ -0,0 +1,71 @@
+ array("value" => $context['hostNameOrIP']));
+vro_add_parameter_in_request($parameters, 'hostNameOrIP', 'string', $value);
+
+$value = array("number" => array("value" => $context['port']));
+vro_add_parameter_in_request($parameters, 'port', 'number', $value);
+
+$value = array("string" => array("value" => $context['username']));
+vro_add_parameter_in_request($parameters, 'username', 'string', $value);
+
+$value = array("SecureString" => array("value" => $context['password']));
+vro_add_parameter_in_request($parameters, 'password', 'SecureString', $value);
+
+$value = array("string" => array("value" => $context['cmd']));
+vro_add_parameter_in_request($parameters, 'cmd', 'string', $value);
+
+$value = array("boolean" => array("value" => filter_var($context['passwordAuthentication'], FILTER_VALIDATE_BOOLEAN)));
+vro_add_parameter_in_request($parameters, 'passwordAuthentication', 'boolean', $value);
+
+$value = array("Path" => array("value" => $context['vco_key_path']));
+vro_add_parameter_in_request($parameters, 'path', 'Path', $value);
+
+$value = array("SecureString" => array("value" => $context['passphrase']));
+vro_add_parameter_in_request($parameters, 'passphrase', 'SecureString', $value);
+
+$value = array("string" => array("value" => $context['encoding']));
+vro_add_parameter_in_request($parameters, 'encoding', 'string', $value);
+
+$parameters_array['parameters'] = $parameters;
+
+vro_execute_workflow_and_wait_for_completion(VRO_RUN_SSH_COMMAND_V9, $parameters_array);
+
+$result = $context['output_parameters']['result'];
+$context['result'] = $result;
+$output_text = $output_parameters['outputText'];
+$context['output_text'] = $output_text;
+$error_text = $output_parameters['errorText'];
+$context['error_text'] = $error_text;
+
+$wo_comment = "Result : $result\nOutput text : $output_text\nError text : $error_text";
+
+$response = prepare_json_response(ENDED, "SSH command executed successfully.\n$wo_comment", $context, true);
+echo $response;
+
+?>
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Set_VM_Performance.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Set_VM_Performance.php
new file mode 100644
index 000000000..35f18615b
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Set_VM_Performance.php
@@ -0,0 +1,80 @@
+ array("type" => VC_VIRTUAL_MACHINE, "id" => $context['vm']));
+vro_add_parameter_in_request($parameters, 'vm', VC_VIRTUAL_MACHINE, $value);
+
+$value = array("boolean" => array("value" => filter_var($context['setCPU'], FILTER_VALIDATE_BOOLEAN)));
+vro_add_parameter_in_request($parameters, 'setCPU', 'boolean', $value);
+
+$value = array("boolean" => array("value" => filter_var($context['setRAM'], FILTER_VALIDATE_BOOLEAN)));
+vro_add_parameter_in_request($parameters, 'setRAM', 'boolean', $value);
+
+$value = array("boolean" => array("value" => filter_var($context['setDisk'], FILTER_VALIDATE_BOOLEAN)));
+vro_add_parameter_in_request($parameters, 'setDisk', 'boolean', $value);
+
+$value = array("sdk-object" => array("type" => VC_SHARES_LEVEL, "id" => $context['cpuSharesLevel']));
+vro_add_parameter_in_request($parameters, 'cpuSharesLevel', VC_SHARES_LEVEL, $value);
+
+$value = array("number" => array("value" => $context['cpuShares']));
+vro_add_parameter_in_request($parameters, 'cpuShares', 'number', $value);
+
+$value = array("number" => array("value" => $context['cpuReservation']));
+vro_add_parameter_in_request($parameters, 'cpuReservation', 'number', $value);
+
+$value = array("number" => array("value" => $context['cpuLimit']));
+vro_add_parameter_in_request($parameters, 'cpuLimit', 'number', $value);
+
+$value = array("sdk-object" => array("type" => VC_SHARES_LEVEL, "id" => $context['ramSharesLevel']));
+vro_add_parameter_in_request($parameters, 'ramSharesLevel', VC_SHARES_LEVEL, $value);
+
+$value = array("number" => array("value" => $context['ramShares']));
+vro_add_parameter_in_request($parameters, 'ramShares', 'number', $value);
+
+$value = array("number" => array("value" => $context['ramReservation']));
+vro_add_parameter_in_request($parameters, 'ramReservation', 'number', $value);
+
+$value = array("number" => array("value" => $context['ramLimit']));
+vro_add_parameter_in_request($parameters, 'ramLimit', 'number', $value);
+
+$value = array("sdk-object" => array("type" => VC_SHARES_LEVEL, "id" => $context['diskSharesLevel']));
+vro_add_parameter_in_request($parameters, 'diskSharesLevel', VC_SHARES_LEVEL, $value);
+
+$value = array("number" => array("value" => $context['diskShares']));
+vro_add_parameter_in_request($parameters, 'diskShares', 'number', $value);
+
+$parameters_array['parameters'] = $parameters;
+
+vro_execute_workflow_and_wait_for_completion(VRO_SET_VM_PERFORMANCE_V30, $parameters_array);
+
+$response = prepare_json_response(ENDED, "VM Performance set successfully.", $context, true);
+echo $response;
+
+?>
\ No newline at end of file
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Start_VM_And_Wait.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Start_VM_And_Wait.php
new file mode 100644
index 000000000..0ee75653c
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Start_VM_And_Wait.php
@@ -0,0 +1,36 @@
+ array("type" => VC_VIRTUAL_MACHINE, "id" => $context['vm']));
+vro_add_parameter_in_request($parameters, 'vm', VC_VIRTUAL_MACHINE, $value);
+
+$value = array("sdk-object" => array("type" => VC_HOST_SYSTEM, "id" => "{$vcenter_fqdn}/" . $context['host']));
+vro_add_parameter_in_request($parameters, 'host', VC_HOST_SYSTEM, $value);
+
+$parameters_array['parameters'] = $parameters;
+
+vro_execute_workflow_and_wait_for_completion(VRO_START_VM_AND_WAIT_V31, $parameters_array);
+
+$response = prepare_json_response(ENDED, "VM started successfully.", $context, true);
+echo $response;
+
+?>
diff --git a/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Suspend_VM_And_Wait.php b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Suspend_VM_And_Wait.php
new file mode 100644
index 000000000..c485cf0bb
--- /dev/null
+++ b/Reference/VMWARE/vRO/Tasks/REST/vCenter/VM_Management/Task_vRO_Suspend_VM_And_Wait.php
@@ -0,0 +1,30 @@
+ array("type" => VC_VIRTUAL_MACHINE, "id" => $context['vm']));
+vro_add_parameter_in_request($parameters, 'vm', VC_VIRTUAL_MACHINE, $value);
+
+$parameters_array['parameters'] = $parameters;
+
+vro_execute_workflow_and_wait_for_completion(VRO_SUSPEND_VM_AND_WAIT_V20, $parameters_array);
+
+$response = prepare_json_response(ENDED, "VM supended successfully.", $context, true);
+echo $response;
+
+?>
\ No newline at end of file
diff --git a/Topology/.meta_Process_Call_For_Device b/Topology/.meta_Process_Call_For_Device
new file mode 100644
index 000000000..55c3942d6
--- /dev/null
+++ b/Topology/.meta_Process_Call_For_Device
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Topology/.meta_Process_Call_Service b/Topology/.meta_Process_Call_Service
new file mode 100644
index 000000000..55c3942d6
--- /dev/null
+++ b/Topology/.meta_Process_Call_Service
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Topology/.meta_Process_Create_View b/Topology/.meta_Process_Create_View
new file mode 100644
index 000000000..ea26ef15c
--- /dev/null
+++ b/Topology/.meta_Process_Create_View
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Topology/.meta_Process_Delete_View b/Topology/.meta_Process_Delete_View
new file mode 100644
index 000000000..1c5bee40f
--- /dev/null
+++ b/Topology/.meta_Process_Delete_View
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Topology/.meta_Process_Save b/Topology/.meta_Process_Save
new file mode 100644
index 000000000..d5e0cf50d
--- /dev/null
+++ b/Topology/.meta_Process_Save
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Topology/.meta_Process_Update_View b/Topology/.meta_Process_Update_View
new file mode 100644
index 000000000..a5907e48b
--- /dev/null
+++ b/Topology/.meta_Process_Update_View
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Topology/.meta_Topology.xml b/Topology/.meta_Topology.xml
new file mode 100644
index 000000000..f278c6cb2
--- /dev/null
+++ b/Topology/.meta_Topology.xml
@@ -0,0 +1,37 @@
+
+
+
+
diff --git a/Topology/.meta_Topology_Types b/Topology/.meta_Topology_Types
new file mode 100644
index 000000000..ea26ef15c
--- /dev/null
+++ b/Topology/.meta_Topology_Types
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Topology/Process_Call_For_Device/.meta_Tasks b/Topology/Process_Call_For_Device/.meta_Tasks
new file mode 100644
index 000000000..8ab4921ff
--- /dev/null
+++ b/Topology/Process_Call_For_Device/.meta_Tasks
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Topology/Process_Call_For_Device/Tasks/.meta_Task_Call_For_Devicephp b/Topology/Process_Call_For_Device/Tasks/.meta_Task_Call_For_Devicephp
new file mode 100644
index 000000000..4ac484a90
--- /dev/null
+++ b/Topology/Process_Call_For_Device/Tasks/.meta_Task_Call_For_Devicephp
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Topology/Process_Call_For_Device/Tasks/Task_Call_For_Device.php b/Topology/Process_Call_For_Device/Tasks/Task_Call_For_Device.php
new file mode 100644
index 000000000..7acb2a12c
--- /dev/null
+++ b/Topology/Process_Call_For_Device/Tasks/Task_Call_For_Device.php
@@ -0,0 +1,44 @@
+
\ No newline at end of file
diff --git a/Topology/Process_Create_View/.meta_Tasks b/Topology/Process_Create_View/.meta_Tasks
new file mode 100644
index 000000000..8ab4921ff
--- /dev/null
+++ b/Topology/Process_Create_View/.meta_Tasks
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Topology/Process_Create_View/Tasks/.meta_Task_Create.php b/Topology/Process_Create_View/Tasks/.meta_Task_Create.php
new file mode 100644
index 000000000..4ac484a90
--- /dev/null
+++ b/Topology/Process_Create_View/Tasks/.meta_Task_Create.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Topology/Process_Create_View/Tasks/Task_Create.php b/Topology/Process_Create_View/Tasks/Task_Create.php
new file mode 100644
index 000000000..70a772972
--- /dev/null
+++ b/Topology/Process_Create_View/Tasks/Task_Create.php
@@ -0,0 +1,25 @@
+
\ No newline at end of file
diff --git a/Topology/Process_Delete_View/.keep b/Topology/Process_Delete_View/.keep
new file mode 100644
index 000000000..e69de29bb
diff --git a/Topology/Process_Save_View/.meta_Tasks b/Topology/Process_Save_View/.meta_Tasks
new file mode 100644
index 000000000..8ab4921ff
--- /dev/null
+++ b/Topology/Process_Save_View/.meta_Tasks
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Topology/Process_Save_View/Tasks/.meta_Task_Save.php b/Topology/Process_Save_View/Tasks/.meta_Task_Save.php
new file mode 100644
index 000000000..4ac484a90
--- /dev/null
+++ b/Topology/Process_Save_View/Tasks/.meta_Task_Save.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Topology/Process_Save_View/Tasks/Task_Save.php b/Topology/Process_Save_View/Tasks/Task_Save.php
new file mode 100644
index 000000000..4e2368073
--- /dev/null
+++ b/Topology/Process_Save_View/Tasks/Task_Save.php
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/Topology/Process_Update_View/.meta_Tasks b/Topology/Process_Update_View/.meta_Tasks
new file mode 100644
index 000000000..f4c4fcfb3
--- /dev/null
+++ b/Topology/Process_Update_View/.meta_Tasks
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Topology/Process_Update_View/Tasks/.meta_Task_Manage_New.php b/Topology/Process_Update_View/Tasks/.meta_Task_Manage_New.php
new file mode 100644
index 000000000..202eec391
--- /dev/null
+++ b/Topology/Process_Update_View/Tasks/.meta_Task_Manage_New.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Topology/Process_Update_View/Tasks/.meta_Task_Update.php b/Topology/Process_Update_View/Tasks/.meta_Task_Update.php
new file mode 100644
index 000000000..202eec391
--- /dev/null
+++ b/Topology/Process_Update_View/Tasks/.meta_Task_Update.php
@@ -0,0 +1,29 @@
+
+
+
+
diff --git a/Topology/Process_Update_View/Tasks/Task_Manage_New.php b/Topology/Process_Update_View/Tasks/Task_Manage_New.php
new file mode 100644
index 000000000..2672e7762
--- /dev/null
+++ b/Topology/Process_Update_View/Tasks/Task_Manage_New.php
@@ -0,0 +1,48 @@
+ $value) {
+ $contains = false;
+
+ if($value["subtype"] == "cluster") {
+ foreach ($context["Nodes_MAJ"] as $value2) {
+ if($value2["cluster_id"] == $value["object_id"]) {
+ $contains = true;
+ break;
+ }
+ }
+ } else {
+ foreach ($context["Nodes_MAJ"] as $value2) {
+ if($value2["object_id"] == $value["object_id"]) {
+ $contains = true;
+ break;
+ }
+ }
+ }
+ if(!$contains) {
+ $TO_DELETE[] = $key;
+ }
+}
+
+foreach ($TO_DELETE as $value) {
+ unset($context["Nodes"][$value]);
+}
+
+unset($context["Nodes_MAJ"]);
+
+echo prepare_json_response(ENDED, "The new devices are managed", $context, false);
+
+?>
diff --git a/Topology/Process_Update_View/Tasks/Task_Update.php b/Topology/Process_Update_View/Tasks/Task_Update.php
new file mode 100644
index 000000000..53206b29f
--- /dev/null
+++ b/Topology/Process_Update_View/Tasks/Task_Update.php
@@ -0,0 +1,26 @@
+
\ No newline at end of file
diff --git a/Topology/Topology.xml b/Topology/Topology.xml
new file mode 100644
index 000000000..45983345a
--- /dev/null
+++ b/Topology/Topology.xml
@@ -0,0 +1,112 @@
+
+
+
+
+ service_id
+ 5
+ TRANSACTION
+
+ /images/eclipseIcons/page_obj.gif
+ Topology
+ 10000
+ 0
+ 5
+ true
+ false
+ true
+ 5
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 5
+ Create
+
+ false
+ CREATE
+
+ /opt/fmc_repository/Process/Topology/Process_Create_View/Tasks/
+
+ Create
+
+
+ /opt/fmc_repository/Process/Topology/Process_Update_View/Tasks/
+
+ Manage_New
+
+
+ 0
+
+
+ 5
+ Update
+
+ false
+ UPDATE
+
+ /opt/fmc_repository/Process/Topology/Process_Update_View/Tasks/
+
+ Update
+
+
+ /opt/fmc_repository/Process/Topology/Process_Update_View/Tasks/
+
+ Manage_New
+
+
+ 0
+
+
+ 5
+ Delete
+
+ false
+ DELETE
+
+ 0
+
+
+
+ 0
+ false
+ Device Polling
+ UPDATE
+
+ /opt/fmc_repository/Process/Topology/Process_Call_For_Device/Tasks/
+
+ Call Service
+
+
+ 0
+
+
+
+ 0
+ false
+ Save
+ UPDATE
+
+ /opt/fmc_repository/Process/Topology/Process_Save_View/Tasks/
+
+ Save
+
+
+ 0
+
+
diff --git a/Topology/Topology_Types/.meta_SNMP b/Topology/Topology_Types/.meta_SNMP
new file mode 100644
index 000000000..ea26ef15c
--- /dev/null
+++ b/Topology/Topology_Types/.meta_SNMP
@@ -0,0 +1,17 @@
+
+
+
+
diff --git a/Topology/Topology_Types/SNMP.php b/Topology/Topology_Types/SNMP.php
new file mode 100644
index 000000000..285655e3c
--- /dev/null
+++ b/Topology/Topology_Types/SNMP.php
@@ -0,0 +1,219 @@
+wo_newparams as $value) {
+ $deviceId = $value->id;
+ $name = $value->name;
+ //$error = launchParallelSNMP($deviceId, $name, $context ["view_type"]);
+ $error = singleSNMP($deviceId, $name, $context ["view_type"]);
+
+ if ($error != "") {
+ logTofile(debug_dump($error, "***TOPOLOGY CREATE ERROR***"));
+ }
+ }
+
+ return prepare_json_response(ENDED, "The topology has fully loaded", $context, false);
+}
+
+function topology_update_view() {
+ global $context;
+
+ if (!isset($context ["Nodes"])) {
+ $context ['Nodes'] = array ();
+ }
+
+ if (!isset($context ["Nodes_MAJ"])) {
+ $context ['Nodes_MAJ'] = array ();
+ }
+ $list = json_decode(_lookup_list_devices_by_customer_reference($context ['UBIQUBEID']), false);
+
+ foreach ($list->wo_newparams as $value) {
+ $deviceId = $value->id;
+ $name = $value->name;
+ //$error = launchParallelSNMP($deviceId, $name, $context ["view_type"]);
+ $error = singleSNMP($deviceId, $name, $context ["view_type"]);
+
+ if ($error != "") {
+ logTofile(debug_dump($error, "***TOPOLOGY CREATE ERROR***"));
+ }
+ }
+
+ return prepare_json_response(ENDED, "The topology has fully loaded", $context, false);
+}
+
+// **********SERVICE FUNCTIONS********** //
+function searchAdress($search, &$matches) {
+ return preg_match_all('#([0-9]{1,3})(\.[0-9]{1,3}){3}#', $search, $matches);
+}
+
+function readInformationsFromDevice($device_id, &$community, &$address) {
+ $info = json_decode(_device_read_by_id($device_id), true);
+
+ if ($info ["wo_status"] == "FAIL") {
+ return $info ["wo_comment"];
+ }
+
+ logTofile(debug_dump($info, "***TOPOLOGY READINFO INFODEVICE***"));
+
+ $address = $info ["wo_newparams"] ["managementAddress"];
+ $community = $info ["wo_newparams"] ["snmpCommunity"];
+
+ if ((empty($community) || $community == "") && (empty($address) || $address == "")) {
+ return "Site with id " . $device_id . " was not found";
+ } else if (empty($community) || $community == "") {
+ return "Community of site with id " . $device_id . " was not found";
+ } else if (empty($address) || $address == "") {
+ return "Address of site with id " . $device_id . " was not found";
+ } else {
+ return "";
+ }
+}
+
+function calcMask($maskAdr) {
+ $maskPart = explode(".", $maskAdr);
+ $mask = "";
+ foreach ($maskPart as $val) {
+ $mask .= decbin(intval($val));
+ }
+ $pos = strpos($mask, "0");
+ if ($pos !== false) {
+ return $pos;
+ } else {
+ return 32;
+ }
+}
+
+function getNetworkByAddressAndMask($address, $mask) {
+ $addressParts = explode(".", $address);
+ $networkAddressBinary = "";
+ foreach ($addressParts as $val) {
+ $morceauBinaire = decbin(intval($val));
+ while (strlen($morceauBinaire) < 8) {
+ $morceauBinaire = "0" . $morceauBinaire;
+ }
+ $networkAddressBinary .= $morceauBinaire;
+ }
+
+ $networkAddressBinary = substr($networkAddressBinary, 0, $mask);
+ while (strlen($networkAddressBinary) < 32) {
+ $networkAddressBinary .= "0";
+ }
+
+ $addressMasked = "";
+ for($i = 0; $i < 32; $i = $i + 8) {
+ $part = intval(substr($networkAddressBinary, $i, 8), 2);
+ $addressMasked .= $part . ".";
+ }
+
+ $addressMasked = substr($addressMasked, 0, strlen($addressMasked) - 1);
+ return $addressMasked;
+}
+
+function singleSNMP($device_id, $name) {
+ try {
+ $status = getStatus($device_id);
+ if($status == "UP") {
+ startSNMPForDevice($device_id, $name);
+ } else {
+ if($status == "UNREACHABLE") {
+ createTopology($device_id, $name, "router", "style/topology/img/router_ERROR.svg");
+ } else if($status == "NEVERREACHED") {
+ createTopology($device_id, $name, "router", "style/topology/img/router_NEVERREACHED.svg");
+ } else if($status == "CRITICAL") {
+ createTopology($device_id, $name, "router", "style/topology/img/router_CRITICAL.svg");
+ }
+ }
+ } catch (Exception $e) {
+ logTofile(debug_dump($e, "**************TOPOLOGY ERROR **************"));
+ echo prepare_json_response(FAILED, "FAILED", $context, true);
+ exit;
+ }
+}
+
+function launchParallelSNMP($deviceId, $name, $view_type) {
+ global $context;
+ global $process_id;
+
+ $ubiqube_id = $context ['UBIQUBEID'];
+ $service_instance = $context ['SERVICEINSTANCEID'];
+
+ $service_name = "Process/Topology/Topology";
+ $process_name = "Process/Topology/Process_Call_For_Device";
+
+ $add_service_array = $context;
+ $add_service_array ['device_id'] = $deviceId;
+ $add_service_array ['name'] = $name;
+ $json_body = json_encode($add_service_array);
+
+ _orchestration_launch_sub_process($ubiqube_id, $service_instance, $service_name, $process_name, $json_body);
+
+ logTofile("***TOPOLOGY LAUNCH SNMP $deviceId * $name***");
+}
+
+function startSNMPForDevice($deviceId, $name) {
+ global $context;
+ global $DO_NOT_DELETE;
+
+ $nodePlace = createTopology($deviceId, $name, "router", "style/topology/img/router_OK.svg");
+ $error = readInformationsFromDevice($deviceId, $community, $address);
+
+ if ($error == "") {
+ try {
+ checkSNMPResponds($community, $address);
+ $cmd = "snmpwalk -v2c -c $community $address IP-MIB::ipAdEntNetMask 2>&1";
+ logTofile(debug_dump($cmd, "***TOPOLOGY SNMP COMMAND***"));
+ exec($cmd, $value, $error);
+ if (!$error) {
+ $rep = array ();
+ foreach ($value as $search) {
+ if (searchAdress($search, $matches) != false) {
+ if ($matches [1] [0] != 127) {
+ $address_link = $matches [0] [0];
+ $maskAdr = $matches [0] [1];
+ $mask = calcMask($maskAdr);
+ $address_link_masked = getNetworkByAddressAndMask($address_link, $mask);
+ $addressAndMask = $address_link_masked . "/" . $mask;
+ createTopology(str_replace(".", "_", $addressAndMask), $addressAndMask, "network", "");
+ $context ['Nodes'] [$nodePlace] ["link"] [] ["id"] = $addressAndMask;
+ }
+ }
+ }
+ } else {
+ logTofile(debug_dump($value, "***TOPOLOGY START ERROR_1***"));
+ }
+ } catch (Exception $e) {
+ logTofile(debug_dump($e->getMessage(), "***TOPOLOGY START ERROR_2***"));
+ }
+ } else {
+ logTofile(debug_dump($error, "***TOPOLOGY START ERROR_3***"));
+ }
+}
+
+function getStatus($device_id) {
+ $info = json_decode(_device_get_status($device_id), true);
+ $status = $info ["wo_newparams"];
+
+ if (empty($status) || $status == "") {
+ return "Site with id " . $device_id . " was not found";
+ } else {
+ return $status;
+ }
+}
+
+function checkSNMPResponds($community, $address) {
+ $cmd_SNMP_RESPOND = "timeout 1 snmpwalk -v2c -c $community $address SNMPv2-MIB::sysName 2>&1";
+ exec($cmd_SNMP_RESPOND, $value, $error);
+ if ($error) {
+ throw new Exception("SNMP NOT AVAILABLE ON " . $address);
+ }
+}
+?>
diff --git a/Topology/Topology_Types/Template.php b/Topology/Topology_Types/Template.php
new file mode 100644
index 000000000..a4b9f9bc5
--- /dev/null
+++ b/Topology/Topology_Types/Template.php
@@ -0,0 +1,15 @@
+
\ No newline at end of file
diff --git a/Topology/Topology_Types/VLAN/VLAN.php b/Topology/Topology_Types/VLAN/VLAN.php
new file mode 100644
index 000000000..4d3eac006
--- /dev/null
+++ b/Topology/Topology_Types/VLAN/VLAN.php
@@ -0,0 +1,146 @@
+wo_newparams as $value) {
+ $deviceId = $value->id;
+ $ubiId = $value->ubiId;
+ $name = $value->name;
+ logTofile(debug_dump($deviceId, "***TOPOLOGY VLAN DEVICEID***"));
+
+ $status = getStatus($deviceId);
+ logTofile(debug_dump($status, "***TOPOLOGY VLAN STATUS***"));
+ $nodePlace = -1;
+ if ($status == "UP") {
+ $error = startVLANForDevice($deviceId, $ubiId, $name, $nodePlace);
+ if ($error) {
+ logTofile(debug_dump($error, "***TOPOLOGY VLAN ERROR***"));
+ }
+ } else {
+ if ($status == "UNREACHABLE") {
+ createTopology($deviceId, $name, "router", "style/topology/img/router_ERROR.svg");
+ } else if ($status == "NEVERREACHED") {
+ createTopology($deviceId, $name, "router", "style/topology/img/router_NEVERREACHED.svg");
+ } else if ($status == "CRITICAL") {
+ createTopology($deviceId, $name, "router", "style/topology/img/router_CRITICAL.svg");
+ }
+ }
+ }
+
+ $context ["Nodes"] = $GLOBALS ["Nodes"];
+ $ret = prepare_json_response(ENDED, "The topology has fully loaded", $context, true);
+ return $ret;
+}
+function topology_update_view($context) {
+ logTofile(debug_dump($context, "***TOPOLOGY VLAN CONTEXT***"));
+ if (isset($context ["Nodes"])) {
+ $GLOBALS ["Nodes"] = $context ["Nodes"];
+ unset($context ["Nodes"]);
+ } else {
+ $GLOBALS ["Nodes"] = array ();
+ }
+ $GLOBALS ["DO_NOT_DESTROY"] = array ();
+
+ $ubiqube_id = $context ['UBIQUBEID'];
+
+ $list = json_decode(_lookup_list_devices_by_customer_reference($ubiqube_id));
+
+ foreach ($list->wo_newparams as $value) {
+ $deviceId = $value->id;
+ $ubiId = $value->ubiId;
+ $name = $value->name;
+
+ array_push($GLOBALS ["DO_NOT_DESTROY"], $deviceId);
+
+ logTofile(debug_dump($deviceId, "***TOPOLOGY VLAN DEVICEID***"));
+
+ $nodePlace = -1;
+ $status = getStatus($deviceId);
+ logTofile(debug_dump($status, "***TOPOLOGY VLAN STATUS***"));
+ if ($status == "UP") {
+ $error = startVLANForDevice($deviceId, $ubiId, $name, $nodePlace);
+ if ($error != "") {
+ logTofile(debug_dump($error, "***TOPOLOGY VLAN ERROR***"));
+ }
+ } else {
+ if ($status == "UNREACHABLE") {
+ $nodePlace = createTopology($deviceId, $name, "router", "style/topology/img/router_ERROR.svg");
+ } else if ($status == "NEVERREACHED") {
+ $nodePlace = createTopology($deviceId, $name, "router", "style/topology/img/router_NEVERREACHED.svg");
+ } else if ($status == "CRITICAL") {
+ $nodePlace = createTopology($deviceId, $name, "router", "style/topology/img/router_CRITICAL.svg");
+ }
+ }
+
+ $cluster_id = $GLOBALS ["Nodes"] [$nodePlace] ["cluster_id"];
+ if (!in_array($cluster_id, $GLOBALS ["DO_NOT_DESTROY"])) {
+ array_push($GLOBALS ["DO_NOT_DESTROY"], $cluster_id);
+ }
+ }
+
+ foreach ($GLOBALS ["Nodes"] as $key => $value_verif) {
+ $destroy = true;
+ foreach ($GLOBALS ["DO_NOT_DESTROY"] as $value_not_destroy) {
+ if ($value_verif ["object_id"] == $value_not_destroy) {
+ $destroy = false;
+ }
+ }
+ if ($destroy) {
+ unset($GLOBALS ["Nodes"] [$key]);
+ }
+ }
+
+ $context ["Nodes"] = $GLOBALS ["Nodes"];
+ logTofile(debug_dump($context, "***TOPOLOGY VLAN CONTEXT***"));
+ return prepare_json_response(ENDED, "The topology has fully loaded", $context, true);
+}
+
+// **********SERVICE FUNCTIONS********** //
+// Don't delete $nodeplace : it's use in Update
+function startVLANForDevice($deviceId, $ubiId, $name, &$nodePlace) {
+ $nodePlace = createTopology($deviceId, $name, "router", "style/topology/img/router_OK.svg");
+
+ $instances_objname = "vlan";
+ $array = array (
+ $instances_objname
+ );
+ $vlans = json_decode(import_objects($deviceId, $array))->wo_newparams->vlan;
+ foreach ($vlans as $vlan) {
+ if (!in_array($vlan->object_id, $GLOBALS ["DO_NOT_DESTROY"])) {
+ array_push($GLOBALS ["DO_NOT_DESTROY"], $vlan->object_id);
+ }
+
+ if ($vlan->object_id == 1) {
+ createTopology($vlan->object_id, $vlan->name, "vlan", "", "#AA3BF2");
+ } else {
+ createTopology($vlan->object_id, $vlan->name, "vlan", "");
+ }
+ $GLOBALS ["Nodes"] [$nodePlace] ["link"] [] ["id"] = $vlan->object_id;
+ }
+
+ logTofile(debug_dump($GLOBALS ["Nodes"], "***TOPOLOGY GLOBALS***"));
+ return false;
+}
+
+function getStatus($device_id) {
+ $cmd = "/opt/ubi-jentreprise/bin/api/device/getDeviceStatus.sh " . $device_id;
+ $res = shell_exec($cmd);
+
+ preg_match('#[A-Za-z]*#', $res, $matches);
+ $status = substr($matches [0], 8, -9);
+
+ if (empty($status) || $status == "") {
+ return "Site with id " . $device_id . " was not found";
+ } else {
+ return $status;
+ }
+}
+?>
\ No newline at end of file