function KeyExtGet($root, $param)
{
    $raw_ret = DmExtGetStrsWithRootObj($root, $param);
    $key_ret = array();
    for ($i = 1; $i < count($raw_ret); $i++) {
        $tmp = array_keys($param, $raw_ret[$i][0]);
        $key = $tmp[0];
        $val = $raw_ret[$i][1];
        $key_ret[$key] = $val;
    }
    return $key_ret;
}
Example #2
0
		</tr>
		<tr class="odd">
			<td class="row-label "><div style="width: 100px">Modulation</div></td>
			<?php 
for ($i = 1; $i < count($ds_ids); $i++) {
    echo '<td><div style="width: 100px">' . $ds_tab[$i]['Modulation'] . '</div></td>';
}
?>
		</tr>
	</tbody>
	</table>
</div>

<?php 
$us_obj = "Device.X_CISCO_COM_CableModem.UpstreamChannel.";
$us_val = DmExtGetStrsWithRootObj($us_obj, array($us_obj));
$us_ids = DmExtGetInstanceIds($us_obj);
$us_tab = array();
for ($i = 1, $j = 1; $i < count($us_ids); $i++) {
    $us_tab[$i]['ChannelID'] = $us_val[$j++][1];
    $us_tab[$i]['Frequency'] = $us_val[$j++][1];
    $us_tab[$i]['PowerLevel'] = $us_val[$j++][1];
    $us_tab[$i]['ChannelType'] = $us_val[$j++][1];
    $us_tab[$i]['SymbolRate'] = $us_val[$j++][1];
    $us_tab[$i]['Modulation'] = $us_val[$j++][1];
    $us_tab[$i]['LockStatus'] = $us_val[$j++][1];
}
?>

<div class="module" style="overflow:auto">
	<table class="data" cellspacing="0" cellpadding="0">
Example #3
0
/**
 * Discription: 
 *     This function is a wrapper for Dinghua's group get api call, enabling caller
 *     access returned parameter values via key name of PHP array
 *              
 * argument:
 *     $root: name of the common root object name for all paramters,
 *      e.g. $root   = "Device.Hosts.Host.";
 *
 *     $paramArray: usually = array($root);	
 *      e.g. $paramNameArray = array("Device.Hosts.Host.");
 *
 *     $mapping_array: the specific parameters you want to obtain,
 *      e.g. $mapping_array  = array("IPAddress", "HostName", "Active");
 *
 *     $includeId: optional, if true to specify the object id via '__id' attribute.
 *
 * return: The expected multiple-dimension PHP array
 *      e.g.  $key_ret[$i]['IPAddress'], $key_ret[$i]['HostName'], $key_ret[$i]['Active']
 *
 * author: yaowu@cisco.com
 */
function getParaValues($root, $paramArray, $mapping_array, $includeId = false)
{
    $key_ret = array();
    $i = 0;
    $cId = NULL;
    $pId = NULL;
    $mapping_array_size = count($mapping_array);
    $raw_ret = DmExtGetStrsWithRootObj($root, $paramArray);
    if (isset($raw_ret)) {
        foreach ($raw_ret as $key => $value) {
            $leafValueName = getLeafName($value[0], $root);
            //value[0] is like Device.Hosts.Host.MACAddress
            if (in_array($leafValueName, $mapping_array)) {
                $pId = getObjIdInPath($value[0], $root);
                if (!isset($cId)) {
                    $cId = $pId;
                }
                if ($cId !== $pId) {
                    $cId = $pId;
                    $i++;
                }
                $key_ret[$i][$leafValueName] = $value[1];
                if ($includeId && !isset($key_ret[$i]['__id'])) {
                    $key_ret[$i]['__id'] = $pId;
                }
            }
        }
    }
    //dump($key_ret);
    return $key_ret;
}
		</table>
		<div name="show_hide" id="msg_no_data1" style="display:none"><br/>There is no data to display for Line 1.</div>
		<div name="show_hide" id="msg_no_data2" style="display:none"><br/>There is no data to display for Line 2.</div>
	</div>

<?php 
$locale = array();
$remote = array();
$metric = array("Call End Time", "Call Start Time", "Call Duration", "Line Number", "Remote IP Address", "Codec", "CW Errors", "CW Error Rate", "SNR", "Micro Reflections", "Downstream Power", "Upstream Power", "EQI Average", "EQI Minimum", "EQI Maximum", "EQI Instantaneous", "MOS-LQ", "MOS-CQ", "Echo Return Loss", "Signal Level", "Noise Level", "Loss Rate", "Pkt Loss Concealment", "Discard Rate", "Burst Density", "Gap Density", "Burst Duration", "Gap Duration", "Round Trip Delay", "Remote Signal Level", "Gmin", "R Factor", "External R Factor", "Jitter Buf Adaptive", "Jitter Buf Rate", "JB Nominal Delay", "JB Max Delay", "JB Abs.Max Delay", "Tx Packets", "Tx Octets", "Rx Packets", "Rx Octets", "Packet Loss", "Interval Jitter", "Originator", "Remote Interval Jitter");
$mmmmmm = array("--", "--", "--", "--", "--", "Remote Codec", "--", "--", "--", "--", "--", "--", "--", "--", "--", "--", "Remote MOS-LQ", "Remote MOS-CQ", "Remote Echo Return Loss", "Remote Signal Level", "Remote Noise Level", "Remote Loss Rate", "Remote Pkt Loss Concealment", "Remote Discard Rate", "Remote Burst Density", "Remote Gap Density", "Remote Burst Duration", "Remote Gap Duration", "Remote Round Trip Delay", "Remote Signal Level", "Remote Gmin", "Remote R Factor", "Remote External R Factor", "Remote Jitter Buf Adaptive", "Remote Jitter Buf Rate", "Remote JB Nominal Delay", "Remote JB Max Delay", "Remote JB Abs.Max Delay", "--", "--", "--", "--", "--", "--", "--", "--");
// $line = array_filter(explode(",", getInstanceIds("Device.X_CISCO_COM_MTA.LineTable.")));
// $line = array(1,2);
// for ($i=0; $i<count($line); $i++)
if ("display" == $action) {
    $dmroot = "Device.X_CISCO_COM_MTA.LineTable.{$line}.VQM.Calls.";
    $dmval = DmExtGetStrsWithRootObj($dmroot, array($dmroot));
    $call = array_filter(explode(",", getInstanceIds($dmroot)));
    // sleep(3);
    $t = 66;
    //total parameters number in a call
    for ($j = 0; $j < count($call); $j++) {
        //locale metric for line 1 of this call number
        $locale[$j] = array($dmval[$j * $t + 3][1], $dmval[$j * $t + 4][1], $dmval[$j * $t + 10][1], $line, $dmval[$j * $t + 9][1], $dmval[$j * $t + 1][1], $dmval[$j * $t + 11][1], $dmval[$j * $t + 5][1], $dmval[$j * $t + 12][1], $dmval[$j * $t + 13][1], $dmval[$j * $t + 14][1], $dmval[$j * $t + 15][1], $dmval[$j * $t + 16][1], $dmval[$j * $t + 17][1], $dmval[$j * $t + 18][1], $dmval[$j * $t + 19][1], $dmval[$j * $t + 20][1], $dmval[$j * $t + 21][1], $dmval[$j * $t + 22][1], $dmval[$j * $t + 23][1], $dmval[$j * $t + 24][1], $dmval[$j * $t + 25][1], $dmval[$j * $t + 6][1], $dmval[$j * $t + 26][1], $dmval[$j * $t + 27][1], $dmval[$j * $t + 28][1], $dmval[$j * $t + 29][1], $dmval[$j * $t + 30][1], $dmval[$j * $t + 31][1], $dmval[$j * $t + 42][1], $dmval[$j * $t + 32][1], $dmval[$j * $t + 33][1], $dmval[$j * $t + 34][1], $dmval[$j * $t + 7][1], $dmval[$j * $t + 35][1], $dmval[$j * $t + 36][1], $dmval[$j * $t + 37][1], $dmval[$j * $t + 38][1], $dmval[$j * $t + 60][1], $dmval[$j * $t + 61][1], $dmval[$j * $t + 62][1], $dmval[$j * $t + 63][1], $dmval[$j * $t + 64][1], $dmval[$j * $t + 65][1], $dmval[$j * $t + 8][1], $dmval[$j * $t + 66][1]);
        //remote metric for line 1 of this call number
        $remote[$j] = array("--", "--", "--", "--", "--", $dmval[$j * $t + 2][1], "--", "--", "--", "--", "--", "--", "--", "--", "--", "--", $dmval[$j * $t + 39][1], $dmval[$j * $t + 40][1], $dmval[$j * $t + 41][1], $dmval[$j * $t + 42][1], $dmval[$j * $t + 43][1], $dmval[$j * $t + 44][1], $dmval[$j * $t + 45][1], $dmval[$j * $t + 46][1], $dmval[$j * $t + 47][1], $dmval[$j * $t + 48][1], $dmval[$j * $t + 49][1], $dmval[$j * $t + 50][1], $dmval[$j * $t + 51][1], $dmval[$j * $t + 42][1], $dmval[$j * $t + 52][1], $dmval[$j * $t + 53][1], $dmval[$j * $t + 54][1], $dmval[$j * $t + 55][1], $dmval[$j * $t + 56][1], $dmval[$j * $t + 57][1], $dmval[$j * $t + 58][1], $dmval[$j * $t + 59][1], "--", "--", "--", "--", "--", "--", "--", "--");
    }
}
?>

<?php 
// for ($n=0; $n<count($line); $n++)
Example #5
0
function DmGetStrsWithRootObj($rootObjName, $paramNameArray)
{
    return DmExtGetStrsWithRootObj($rootObjName, $paramNameArray);
}