Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Reference/Common/Library/customer_rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ function _customer_delete_configuration_variable ($customer_reference, $name) {
*/
function _customer_attach_profile ($customer_reference, $profile_reference) {

$msa_rest_api = "customer/reference/{$customer_reference}/attach?profile={$profile_reference}";
$msa_rest_api = "customer/{$customer_reference}/attach?profile={$profile_reference}";
$curl_cmd = create_msa_operation_request(OP_PUT, $msa_rest_api);
$response = perform_curl_operation($curl_cmd, "ATTACH A PROFILE TO CUSTOMER");
return $response;
Expand All @@ -202,7 +202,7 @@ function _customer_attach_profile ($customer_reference, $profile_reference) {
*/
function _customer_detach_profile ($customer_reference, $profile_reference) {

$msa_rest_api = "customer/reference/{$customer_reference}/detach?profile={$profile_reference}";
$msa_rest_api = "customer/{$customer_reference}/detach?profile={$profile_reference}";
$curl_cmd = create_msa_operation_request(OP_PUT, $msa_rest_api);
$response = perform_curl_operation($curl_cmd, "DETACH A PROFILE FROM CUSTOMER");
return $response;
Expand Down
62 changes: 2 additions & 60 deletions Reference/Common/Library/device_rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ function _device_set_hostname_by_id ($device_id, $hostname) {
* @param $device_id
*/
function _device_get_nature_by_id ($device_id) {
$msa_rest_api = "device/v1/nature/{$device_id}";
$msa_rest_api = "device/v1/nature/device/{$device_id}";
$curl_cmd = create_msa_operation_request(OP_GET, $msa_rest_api);
$response = perform_curl_operation($curl_cmd, "READ DEVICE NATURE BY ID");
$response = json_decode($response, true);
Expand Down Expand Up @@ -486,17 +486,6 @@ function _device_update_credentials ($device_id, $login, $password) {
return $response;
}


function _device_do_update_firmware ($device_id) {
logToFile('[device_rest][do_update_firmware] update firmware on '.$device_id);
$api_cmd='/opt/ubi-jentreprise/bin/api/device/doFirmwareUpdateByDeviceId.sh '.$device_id;
logToFile("[device_rest][do_update_firmware] -> ".$api_cmd);
$res=shell_exec($api_cmd);
logToFile("[device_rest][do_update_firmware] ".$res);
return $res;
}


/**
* REST endpoint available in MSA NB : Update the firmware by rest
* Put $option='REST-API' to run the firmware update on the device via rest API. CLI by default
Expand All @@ -512,16 +501,6 @@ function _device_do_update_firmware_rest ($device_id, $option='') {
return $response;
}


function _device_check_update_firmware ($device_id) {
logToFile('[device_rest][check_update_firmware] update firmware on '.$device_id);
$api_cmd='/opt/ubi-jentreprise/bin/api/device/getFirmwareUpdateStatusByDeviceId.sh '.$device_id;
logToFile("[device_rest][check_update_firmware] -> ".$api_cmd);
$res=shell_exec($api_cmd);
logToFile("[device_rest][check_update_firmware] ".$res);
return $res;
}

/**
* REST endpoint available in MSA NB : Get the update firmware status by rest
* ex:
Expand All @@ -537,43 +516,6 @@ function _device_check_update_firmware_rest ($device_id) {
return $response;
}


function _device_create_configure_variable ($device_id, $variablename, $variablevalue) {
logToFile('[device_rest][create_configure_variable] Add variable '.$variablename.' ('.$variablevalue.') to '.$device_id);
$api_cmd='/opt/ubi-jentreprise/bin/api/deviceconfigurationvariable/createConfigurationVariable.sh '.$device_id.' '.$variablename.' '.$variablevalue;
logToFile("[device_rest][create_configure_variable] -> ".$api_cmd);
$res=shell_exec($api_cmd);
logToFile("[device_rest][create_configure_variable] ".$res);
return $res;
}

function _device_rollback_do_backup ($device_id) {
logToFile('[device_rest][rollback_do_backup] Backup device '.$device_id);
$api_cmd='/opt/ubi-jentreprise/bin/api/rollback/doBackup.sh '.$device_id;
logToFile("[device_rest][rollback_do_backup] -> ".$api_cmd);
$res=shell_exec($api_cmd);
logToFile("[device_rest][rollback_do_backup] ".$res);
return $res;
}

function _device_rollback_list_revision ($device_id) {
logToFile('[device_rest][rollback_list_revision] List revision for device '.$device_id);
$api_cmd='/opt/ubi-jentreprise/bin/api/rollback/doListRevisions.sh '.$device_id;
logToFile("[device_rest][rollback_list_revision] -> ".$api_cmd);
$res=shell_exec($api_cmd);
logToFile("[device_rest][rollback_list_revision] ".$res);
return $res;
}

function _device_rollback_do_restore ($device_id, $revision_id) {
logToFile('[device_rest][rollback_do_restore] Restore device '.$device_id.' using revision '.$revision_id);
$api_cmd='/opt/ubi-jentreprise/bin/api/rollback/doRestore.sh '.$device_id.' '.$revision_id;
logToFile("[device_rest][rollback_do_restore] -> ".$api_cmd);
$res=shell_exec($api_cmd);
logToFile("[device_rest][rollback_do_restore] ".$res);
return $res;
}

/**
* Get devices list by customer (customerId integer)
*
Expand All @@ -585,7 +527,7 @@ function _device_rollback_do_restore ($device_id, $revision_id) {
* $response
*/
function _device_get_by_customer ($customerId) {
$msa_rest_api = "lookup/v1/customers/{$customerId}/devices";
$msa_rest_api = "lookup/v1/customer/{$customerId}/devices";
$curl_cmd = create_msa_operation_request(OP_GET, $msa_rest_api);
$response = perform_curl_operation($curl_cmd, "GET DEVICES BY CUSTOMER");
return $response;
Expand Down
17 changes: 0 additions & 17 deletions Reference/Common/Library/lookup_rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,22 +93,5 @@ function _lookup_list_operator_ids ($manager_id) {
return $response;
}

/**
* List SecEngine Nodes
*
* curl -u ncroot:ubiqube -XGET http://localhost:10080/ubi-api-rest/lookup/sec_nodes
*/
function _lookup_list_sec_nodes () {
$msa_rest_api = "lookup/sec_nodes";
$curl_cmd = create_msa_operation_request(OP_GET, $msa_rest_api);
$response = perform_curl_operation($curl_cmd, "LIST SEC NODES");
$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;
}

?>
21 changes: 0 additions & 21 deletions Reference/Common/Library/orchestration_rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,27 +184,6 @@ function _orchestration_execute_service_by_instance ($ubiqube_id, $service_insta
return $response;
}

/**
curl -u ncroot:ubiqube -XPOST http://localhost:10080/ubi-api-rest/orchestration/service/execute/{ubiqubeId}?serviceName={serviceName}&processName={processName} -d '
{
"var1": "val1",
"var2": "val2"
}
'
*/
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}";
$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);
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/orchestration/service/execute/{externalReference}/{serviceExternalReference}?serviceName={serviceName}&processName={processName} -d '
* {
Expand Down
28 changes: 0 additions & 28 deletions Reference/Common/Library/order_command_rest.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,34 +77,6 @@ function _order_command_synchronize ($device_id, $connection_timeout = 300, $max
return $response;
}


function _obmf_create($message,$deviceId){
return _obmf_exec($message,$deviceId,"CREATE");
}

function _obmf_delete($message,$deviceId){
return _obmf_exec($message,$deviceId,"DELETE");
}

function _obmf_update($message,$deviceId){
return _obmf_exec($message,$deviceId,"UPDATE");
}

function _obmf_import($message,$deviceId){
return _obmf_exec($message,$deviceId,"IMPORT");
}

function _obmf_exec($message,$deviceId,$method){
$jsonFile='/tmp/'.rand().'.json';
shell_exec('echo '.json_encode($message).' > '.$jsonFile);
$cmd="/opt/ubi-jentreprise/bin/api/ordercommand/executeCommand.sh ".$deviceId." ".$method." ".$jsonFile;
logToFile("[OBMF_EXEC]".$cmd);
$res=shell_exec($cmd);
logToFile("[OBMF_EXEC]".$res);
shell_exec('rm -f '.$jsonFile);
return $res;
}

/**
*
<pre>
Expand Down
59 changes: 0 additions & 59 deletions Reference/Common/Library/widget_portal_rest.php

This file was deleted.