100 lines
2.1 KiB
PHP
100 lines
2.1 KiB
PHP
<?php
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
//require_once(get_cfg_var('COMMON_PATH') . "/ditest-php/test_framework.php");
|
|
require_once("../../common/ditest-php/test_framework.php");
|
|
require_once("./config.php");
|
|
///////////////////////////////////////////////////////////////////////////////
|
|
$test = new DiTest("DNCM config class", 1);
|
|
$test->goal("Verify config class is according to RPC");
|
|
|
|
////
|
|
// config:info
|
|
////
|
|
$test->step("Request config:info");
|
|
|
|
$req = array(
|
|
'dinetrpc' => 1,
|
|
'device:uid' => $cfgDeviceUid,
|
|
'req' => 'config:info',
|
|
'id' => 1887,
|
|
'time' => time() * 1000
|
|
);
|
|
|
|
$expectRepResult = array(
|
|
[
|
|
"uid" => $cfgConfigTCPHostUID,
|
|
"label" => "dncm-tcp-host",
|
|
"type" => "string",
|
|
"default" => $cfgConfigTCPHostDefault
|
|
],
|
|
[
|
|
"uid" => $cfgConfigTCPPortUID,
|
|
"label" => "dncm-tcp-port",
|
|
"type" => "string",
|
|
"default" => $cfgConfigTCPPortDefault
|
|
]
|
|
);
|
|
|
|
$reqrep = new RequestSocket($test, $cfgSMPZMQRequestURI);
|
|
$rep = $reqrep->send($req);
|
|
|
|
$test->equal($expectRepResult, $rep['result']);
|
|
|
|
////
|
|
// config:get uid 100 (dncm-tcp-host)
|
|
////
|
|
$test->step("Request config:get uid 100 (dncm-tcp-host)");
|
|
|
|
$req = array(
|
|
'dinetrpc' => 1,
|
|
'device:uid' => $cfgDeviceUid,
|
|
'req' => 'config:get',
|
|
'id' => 1888,
|
|
'time' => time() * 1000,
|
|
'params' => [
|
|
'uid' => $cfgConfigTCPHostUID
|
|
]
|
|
);
|
|
|
|
$expectRepResult = array(
|
|
[
|
|
"uid" => 100,
|
|
"value" => $cfgConfigTCPHost,
|
|
],
|
|
);
|
|
|
|
$reqrep = new RequestSocket($test, $cfgSMPZMQRequestURI);
|
|
$rep = $reqrep->send($req);
|
|
|
|
$test->equal(true, isset($rep['result']));
|
|
$test->equal($expectRepResult, $rep['result']);
|
|
|
|
////
|
|
// config:get uid 100 (dncm-tcp-port)
|
|
////
|
|
$test->step("Request config:get uid 100 (dncm-tcp-port)");
|
|
|
|
$req = array(
|
|
'dinetrpc' => 1,
|
|
'device:uid' => $cfgDeviceUid,
|
|
'req' => 'config:get',
|
|
'id' => 1889,
|
|
'time' => time() * 1000,
|
|
'params' => [
|
|
'uid' => $cfgConfigTCPPortUID
|
|
]
|
|
);
|
|
|
|
$expectRepResult = array(
|
|
[
|
|
"uid" => $cfgConfigTCPPortUID,
|
|
"value" => $cfgConfigTCPPort,
|
|
],
|
|
);
|
|
|
|
$reqrep = new RequestSocket($test, $cfgSMPZMQRequestURI);
|
|
$rep = $reqrep->send($req);
|
|
|
|
$test->equal(true, isset($rep['result']));
|
|
$test->equal($expectRepResult, $rep['result']);
|