Hi,
I have this NBI php script that behaves strangely:
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
$IMEI = $argv[1];
set_time_limit(180);
$client = new Client([
'timeout' => 5.0,
]);
$response = $client->request('GET', 'http://10.100.4.38:7557/devices/', [
'query' => [
'query' =>'{"InternetGatewayDevice.WANDevice.1.X_NOTION_WANNetConfigInfo.IMEI":"' . $IMEI . '"}',
'projection' => '_deviceID._id'
]
]);
$body = $response->getBody();
//var_dump(json_decode($body));
$arr = json_decode($body,true);
//print_r ($arr);
if (!$arr) {
echo "DNF \n";
exit;
}
$id = "";
foreach ($arr as $dev){
if (isset($dev["_id"])) {$id = $dev["_id"];}
}
//$file = "/var/log/genieacs/output.txt";
//file_put_contents($file, $id);
$response1 = $client->request('POST', 'http://10.100.4.38:7557/devices/' .$id. '/tasks?connection_request', [
'body' => '{ "name": "setParameterValues", "parameterValues": [["InternetGatewayDevice.DownloadDiagnostics.DownloadURL", "http://speedtest.bhtelecom.ba/100MB.bin", "xsd:string"], ["InternetGatewayDevice.DownloadDiagnostics.Interface", "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1", "xsd:string"],["InternetGatewayDevice.DownloadDiagnostics.DiagnosticsState", "Requested", "xsd:string"]] }'
]);
echo('ID is: '.$id);
$response2 = $client->request('POST', 'http://10.100.4.38:7557/devices/' . $id. '/tasks?connection_request', [
'body' => '{"name": "getParameterValues", "parameterNames": ["InternetGatewayDevice.DownloadDiagnostics.DiagnosticsState"]}'
]);
?>
Sometimes it runs both SPV and GPV methods, sometimes just SPV and sometimes just GPV.
What could be the reason for such a strange behavior?
Best regards,
Tarik