init web ems all
This commit is contained in:
395
wxc2_omc/configuration/bssomc/download.inc
Executable file
395
wxc2_omc/configuration/bssomc/download.inc
Executable file
@@ -0,0 +1,395 @@
|
||||
<?php
|
||||
include("nmicommand.inc"); /* Include this when you need to process nmi command */
|
||||
|
||||
/*
|
||||
* Retieve the parameters from database and create the NMI "Set" command
|
||||
*/
|
||||
function create_sql_string_from_meta_table($db,$bssid,$objectid,$tablename,
|
||||
&$sqlstring, &$parameters, &$attribute_id, &$attribute_type, &$default_value, $debug)
|
||||
{
|
||||
$name = explode("_",$tablename);
|
||||
$sqlstring = "SELECT Attribute_Name,Attribute_Id,Attribute_Type,Default_Value " .
|
||||
"FROM OMCR_Meta_Table WHERE Attribute_Type<>0 AND Attribute_Id<>'' AND Object_Name='$name[1]'";
|
||||
if ($debug) echo "$sqlstring <BR>"; else echo ".";
|
||||
echo "sql>$sqlstring <BR>";
|
||||
$res = mysql_query($sqlstring, $db) or
|
||||
die("Invalid query:$sqlstring\n" . mysqli_error($pubConn));
|
||||
while ( $row = mysqli_fetch_row($res) )
|
||||
{
|
||||
list($parameters[],$attribute_id[],$attribute_type[],$default_value[]) = $row;
|
||||
|
||||
}
|
||||
mysql_free_result($res);
|
||||
|
||||
$sqlstring = "SELECT " . join(",",$parameters) . " FROM $tablename WHERE bssid=$bssid AND ObjectId='$objectid'";
|
||||
echo "$sqlstring <BR>";
|
||||
}
|
||||
|
||||
/*
|
||||
* Create NMI Set Command for paramter download
|
||||
*/
|
||||
function create_nmi_command($db,$sqlstring,$parameters,$attribute_id,$attribute_type,$default_value,&$nmicommand,$debug)
|
||||
{
|
||||
if ($debug) echo "$sqlstring <BR>"; else echo ".";
|
||||
$res = mysql_query($sqlstring, $db) or
|
||||
die("Invalid query:$sqlstring\n" . mysqli_error($pubConn));
|
||||
$value = mysqli_fetch_row($res);
|
||||
mysql_free_result($res);
|
||||
$nmicommand = "set";
|
||||
for ($i=0;$i<sizeof($attribute_id);$i++)
|
||||
{
|
||||
if ($default_value[$i] != $value[$i])
|
||||
{
|
||||
if ($attribute_type[$i] == 1)
|
||||
$nmicommand .= " $attribute_id[$i]=$value[$i]";
|
||||
else if ($attribute_type[$i] == 2)
|
||||
$nmicommand .= " $attribute_id[$i]=\"$value[$i]\"";
|
||||
else if ($attribute_type[$i] == 3)
|
||||
{
|
||||
$param = explode("_",$attribute_id[$i]);
|
||||
$nmicommand .= " $param[0]=[$param[1]=$value[$i]]";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
echo "nmicmd = $nmicommand<BR>";
|
||||
}
|
||||
|
||||
/*
|
||||
* Set BssFunc->DownLoadInProgress parameters to zero and return the given return value
|
||||
*/
|
||||
function set_download_in_progress_zero($db,$bssid,$language,$return_value,$debug)
|
||||
{
|
||||
if ($debug) echo "==) oid BssFunc" . "<BR>"; else echo ".";
|
||||
$retval = send_nmicommand($db,$bssid,$language,"oid BssFunc",$resultcode, $responsecode,$response,$debug);
|
||||
if (($retval != 0) || ($resultcode[0] != 0))
|
||||
return -1;
|
||||
flush();
|
||||
if ($debug) echo "==) set DownLoadInProgress=0" . "<BR>"; else echo ".";
|
||||
$retval = send_nmicommand($db,$bssid,$language,"set DownLoadInProgress=0",
|
||||
$resultcode, $responsecode,$response,$debug);
|
||||
if (($retval != 0) || ($resultcode[0] != 0))
|
||||
return -1;
|
||||
flush();
|
||||
|
||||
return ($return_value);
|
||||
}
|
||||
|
||||
/*
|
||||
* Return 0 if success, otherwise -1
|
||||
*/
|
||||
function download_parameters($db,$bssid,$language,$debug)
|
||||
{
|
||||
$resultcode = $responsecode = $response = null;
|
||||
$retval = 0;
|
||||
if ($debug) echo "==) oid BssFunc" . "<BR>"; else echo ".";
|
||||
$retval = send_nmicommand($db,$bssid,$language,"oid BssFunc",$resultcode, $responsecode,$response,$debug);
|
||||
if (($retval != 0) || ($resultcode[0] != 0))
|
||||
return (set_download_in_progress_zero($db,$bssid,$language,-1,$debug));
|
||||
flush();
|
||||
if ($debug) echo "==) set DownLoadInProgress=1" . "<BR>"; else echo ".";
|
||||
$retval = send_nmicommand($db,$bssid,$language,"set DownLoadInProgress=1",
|
||||
$resultcode, $responsecode,$response,$debug);
|
||||
if (($retval != 0) || ($resultcode[0] != 0))
|
||||
return (set_download_in_progress_zero($db,$bssid,$language,-1,$debug));
|
||||
flush();
|
||||
|
||||
$objectlist = Array(
|
||||
"Card.0.10",
|
||||
"Bsc.0",
|
||||
"AIf.0",
|
||||
"ALinkSet.0.0",
|
||||
"ALink.0.0.0"
|
||||
);
|
||||
$tablenamelist = Array(
|
||||
"OMCR_ClockMod",
|
||||
"OMCR_Bsc",
|
||||
"OMCR_AIf",
|
||||
"OMCR_ALinkSet",
|
||||
"OMCR_ALink"
|
||||
);
|
||||
|
||||
/*********************************************************
|
||||
* For each ALink object, download ALink object parameters
|
||||
*********************************************************/
|
||||
$sqlstring = "SELECT SUBSTRING_INDEX(ObjectId,'.',-1) FROM OMCR_BSSTREE WHERE bssid=$bssid" .
|
||||
" AND Presence=1 AND ObjectId='ALink.0.0.%'" .
|
||||
" AND ObjectId<>'ALink.0.0.0'";
|
||||
$res = mysql_query($sqlstring, $db) or
|
||||
die("Invalid query: $sqlstring\n" . mysqli_error($pubConn));
|
||||
while ((list($row) = mysqli_fetch_row($res)) != null)
|
||||
{
|
||||
if ($debug) echo "==) oid ALinkSet.0.0" . "<BR>"; else echo ".";
|
||||
$retval = send_nmicommand($db,$bssid,$language,"oid ALinkSet.0.0",
|
||||
$resultcode, $responsecode,$response,$debug);
|
||||
if (($retval != 0) || ($resultcode[0] != 0))
|
||||
return (set_download_in_progress_zero($db,$bssid,$language,-1,$debug));
|
||||
flush();
|
||||
if ($debug) echo "==) create ALink $row" . "<BR>"; else echo ".";
|
||||
$retval = send_nmicommand($db,$bssid,$language,"create ALink $row",
|
||||
$resultcode, $responsecode,$response,$debug);
|
||||
if (($retval != 0) || ($resultcode[0] != 0))
|
||||
return (set_download_in_progress_zero($db,$bssid,$language,-1,$debug));
|
||||
flush();
|
||||
$objectlist = array_merge($objectlist, Array ( "ALink.0.0.$row"));
|
||||
$tablenamelist = array_merge($tablenamelist, Array("OMCR_ALink"));
|
||||
}
|
||||
|
||||
/*********************************************************
|
||||
* For each E1 Card, download E1port object parameters
|
||||
*********************************************************/
|
||||
$sqlstring = "SELECT SUBSTRING_INDEX(ObjectId,'.',-1) FROM OMCR_BSSTREE WHERE bssid=$bssid" .
|
||||
" AND Presence=1 AND ObjectId REGEXP 'Card.0.[1-8]$'";
|
||||
$res = mysql_query($sqlstring, $db) or
|
||||
die("Invalid query: $sqlstring\n" . mysqli_error($pubConn));
|
||||
$e1trmod_id_list = null;
|
||||
while ( $row = mysqli_fetch_row($res) )
|
||||
{
|
||||
list($e1trmod_id_list[]) = $row;
|
||||
}
|
||||
for ($i=0; $i<sizeof($e1trmod_id_list); $i++)
|
||||
{
|
||||
$objectlist = array_merge($objectlist,
|
||||
Array ( "Port.0.$e1trmod_id_list[$i].0",
|
||||
"Port.0.$e1trmod_id_list[$i].1")
|
||||
);
|
||||
$tablenamelist = array_merge($tablenamelist, Array("OMCR_E1port", "OMCR_E1port"));
|
||||
}
|
||||
|
||||
/*********************************************************
|
||||
* For each DCard in E1 Card, download Dsp parameters
|
||||
*********************************************************/
|
||||
// $sqlstring = "SELECT ObjectId FROM OMCR_BSSTREE WHERE bssid=$bssid" .
|
||||
// " AND Presence=1 AND ObjectId REGEXP 'Dsp.0.[1-8].0.[0-3]$'";
|
||||
// $res = mysql_query($sqlstring, $db) or
|
||||
// die("Invalid query: $sqlstring\n" . mysqli_error($pubConn));
|
||||
// $dsp_list = null;
|
||||
// while ( $row = mysqli_fetch_row($res) )
|
||||
// {
|
||||
// list($dsp_list[]) = $row;
|
||||
// }
|
||||
// foreach ($dsp_list as $dsp)
|
||||
// {
|
||||
// array_push($objectlist, $dsp);
|
||||
// array_push($tablenamelist, "OMCR_TrauDsp");
|
||||
// }
|
||||
|
||||
/***************************************************************************************
|
||||
* Download parameters to BSC based on OMCR_Meta_Table for the objects in $objectlist[]
|
||||
***************************************************************************************/
|
||||
for ($i=0; $i<sizeof($objectlist); $i++)
|
||||
{
|
||||
$parameters=$attribute_type=$default_value=$nmicommand=null;
|
||||
|
||||
$objectid = $objectlist[$i];
|
||||
$tablename = $tablenamelist[$i];
|
||||
create_sql_string_from_meta_table(
|
||||
$db,$bssid,$objectid,$tablename,$sqlstring,$parameters,$attribute_id,$attribute_type,$default_value,$debug);
|
||||
create_nmi_command($db,$sqlstring,$parameters,$attribute_id,$attribute_type,$default_value,$nmicommand,$debug);
|
||||
if (strcmp($nmicommand,"set"))
|
||||
{
|
||||
if ($debug) echo "==) oid $objectid" . "<BR>"; else echo ".";
|
||||
$retval = send_nmicommand($db,$bssid,$language,"oid $objectid",
|
||||
$resultcode, $responsecode,$response,$debug);
|
||||
if (($retval != 0) || ($resultcode[0] != 0))
|
||||
return (set_download_in_progress_zero($db,$bssid,$language,-1,$debug));
|
||||
flush();
|
||||
if ($debug) echo "==) $nmicommand" . "<BR>"; else echo ".";
|
||||
$retval = send_nmicommand($db,$bssid,$language,"$nmicommand",
|
||||
$resultcode, $responsecode,$response,$debug);
|
||||
if (($retval != 0) || ($resultcode[0] != 0))
|
||||
return (set_download_in_progress_zero($db,$bssid,$language,-1,$debug));
|
||||
flush();
|
||||
}
|
||||
}
|
||||
|
||||
/*********************************************
|
||||
* For each BtsMgr, download parameters
|
||||
*********************************************/
|
||||
$sqlstring = "SELECT SUBSTRING_INDEX(ObjectId,'.',-1) FROM OMCR_BSSTREE" .
|
||||
" WHERE bssid=$bssid AND Presence=1 AND ObjectId Like 'BtsMgr.%'";
|
||||
if ($debug) echo "$sqlstring<BR>\n"; else echo ".";
|
||||
$res = mysql_query($sqlstring, $db) or
|
||||
die("Invalid query: $sqlstring\n" . mysqli_error($pubConn));
|
||||
|
||||
$btsmgr_list=null;
|
||||
while ( $row = mysqli_fetch_row($res) )
|
||||
{
|
||||
list($btsmgr_list[]) = $row;
|
||||
}
|
||||
mysql_free_result($res);
|
||||
|
||||
//for ($i=0; $i<sizeof($btsmgr_list); $i++)
|
||||
foreach ($btsmgr_list as $btsid)
|
||||
{
|
||||
//$btsid = $btsmgr_list[$i];
|
||||
|
||||
$objectlist = Array(
|
||||
"AbisMgr.$btsid.0", "Bts.$btsid.0",
|
||||
"AdjHand.$btsid.0.0", "AdjHand.$btsid.0.1", "AdjHand.$btsid.0.2", "AdjHand.$btsid.0.3",
|
||||
"AdjHand.$btsid.0.4", "AdjHand.$btsid.0.5", "AdjHand.$btsid.0.6", "AdjHand.$btsid.0.7",
|
||||
"AdjHand.$btsid.0.8", "AdjHand.$btsid.0.9", "AdjHand.$btsid.0.10", "AdjHand.$btsid.0.11",
|
||||
"AdjHand.$btsid.0.12", "AdjHand.$btsid.0.13", "AdjHand.$btsid.0.14", "AdjHand.$btsid.0.15",
|
||||
"AdjHand.$btsid.0.16", "AdjHand.$btsid.0.17", "AdjHand.$btsid.0.18", "AdjHand.$btsid.0.19",
|
||||
"AdjHand.$btsid.0.20", "AdjHand.$btsid.0.21", "AdjHand.$btsid.0.22", "AdjHand.$btsid.0.23",
|
||||
"AdjHand.$btsid.0.24", "AdjHand.$btsid.0.25", "AdjHand.$btsid.0.26", "AdjHand.$btsid.0.27",
|
||||
"AdjHand.$btsid.0.28", "AdjHand.$btsid.0.29", "AdjHand.$btsid.0.30", "AdjHand.$btsid.0.31",
|
||||
"BtsMgr_Shelf.$btsid.0"
|
||||
);
|
||||
$tablenamelist = Array(
|
||||
"OMCR_AbisMgr", "OMCR_Bts",
|
||||
"OMCR_AdjHand", "OMCR_AdjHand", "OMCR_AdjHand", "OMCR_AdjHand",
|
||||
"OMCR_AdjHand", "OMCR_AdjHand", "OMCR_AdjHand", "OMCR_AdjHand",
|
||||
"OMCR_AdjHand", "OMCR_AdjHand", "OMCR_AdjHand", "OMCR_AdjHand",
|
||||
"OMCR_AdjHand", "OMCR_AdjHand", "OMCR_AdjHand", "OMCR_AdjHand",
|
||||
"OMCR_AdjHand", "OMCR_AdjHand", "OMCR_AdjHand", "OMCR_AdjHand",
|
||||
"OMCR_AdjHand", "OMCR_AdjHand", "OMCR_AdjHand", "OMCR_AdjHand",
|
||||
"OMCR_AdjHand", "OMCR_AdjHand", "OMCR_AdjHand", "OMCR_AdjHand",
|
||||
"OMCR_AdjHand", "OMCR_AdjHand", "OMCR_AdjHand", "OMCR_AdjHand",
|
||||
"OMCR_Wavex"
|
||||
);
|
||||
|
||||
if ($debug) echo "<HR>";
|
||||
if ($debug) echo "==) oid BssFunc" . "<BR>"; else echo ".";
|
||||
$retval = send_nmicommand($db,$bssid,$language,"oid BssFunc",
|
||||
$resultcode, $responsecode,$response,$debug);
|
||||
if (($retval != 0) || ($resultcode[0] != 0))
|
||||
return (set_download_in_progress_zero($db,$bssid,$language,-1,$debug));
|
||||
flush();
|
||||
if ($debug) echo "==) create BtsMgr $btsid" . "<BR>"; else echo ".";
|
||||
$retval = send_nmicommand($db,$bssid,$language,"create BtsMgr $btsid",
|
||||
$resultcode, $responsecode,$response,$debug);
|
||||
if (($retval != 0) || ($resultcode[0] != 0))
|
||||
return (set_download_in_progress_zero($db,$bssid,$language,-1,$debug));
|
||||
flush();
|
||||
//echo "==) oid BtsMgr_Shelf.$btsid.0" . "<BR>";
|
||||
//$retval = send_nmicommand($db,$bssid,$language,"oid BtsMgr_Shelf.$btsid.0",
|
||||
// $resultcode, $responsecode,$response,$debug);
|
||||
//if (($retval != 0) || ($resultcode[0] != 0))
|
||||
// return (set_download_in_progress_zero($db,$bssid,$language,-1,$debug));
|
||||
//flush();
|
||||
|
||||
|
||||
/*************************
|
||||
* Create E1TrMod
|
||||
*************************/
|
||||
$sqlstring = "SELECT SUBSTRING_INDEX(ObjectId,'.',-1) FROM OMCR_BSSTREE WHERE bssid=$bssid" .
|
||||
" AND Presence=1 AND ObjectId REGEXP 'BtsMgr_Shelf_Card.$btsid.0.[1-8]$'";
|
||||
if ($debug) echo "$sqlstring<BR>\n"; else echo ".";
|
||||
$res = mysql_query($sqlstring, $db) or
|
||||
die("Invalid query: $sqlstring\n" . mysqli_error($pubConn));
|
||||
$card_id_list = null;
|
||||
while ( $row = mysqli_fetch_row($res) )
|
||||
{
|
||||
list($card_id_list[]) = $row;
|
||||
}
|
||||
mysql_free_result($res);
|
||||
|
||||
for ($j=0; $j<sizeof($card_id_list); $j++)
|
||||
{
|
||||
if ($debug) echo "==) oid BtsMgr_Shelf.$btsid.0" . "<BR>"; else echo "<BR>.";
|
||||
$retval = send_nmicommand($db,$bssid,$language,"oid BtsMgr_Shelf.$btsid.0",
|
||||
$resultcode, $responsecode,$response,$debug);
|
||||
if (($retval != 0) || ($resultcode[0] != 0))
|
||||
return (set_download_in_progress_zero($db,$bssid,$language,-1,$debug));
|
||||
flush();
|
||||
if ($card_id_list[$j] == 1)
|
||||
{
|
||||
$objectlist = array_merge($objectlist,
|
||||
Array ( "BtsMgr_Shelf_Card_Port.$btsid.0.$card_id_list[$j].0",
|
||||
"BtsMgr_Shelf_Card_Port.$btsid.0.$card_id_list[$j].1")
|
||||
);
|
||||
$tablenamelist = array_merge($tablenamelist, Array("OMCR_E1port", "OMCR_E1port"));
|
||||
|
||||
if ($debug) echo "==) create E1trmod $card_id_list[$j]" . "<BR>"; else echo ".";
|
||||
$retval = send_nmicommand($db,$bssid,$language,"create E1trmod $card_id_list[$j]",
|
||||
$resultcode, $responsecode,$response,$debug);
|
||||
}
|
||||
else
|
||||
{
|
||||
$objectlist = array_merge($objectlist,
|
||||
Array ( "Trx.$btsid.0.$card_id_list[$j]",
|
||||
"RCarrier.$btsid.0.$card_id_list[$j]",
|
||||
"TrxCh.$btsid.0.$card_id_list[$j].0",
|
||||
"TrxCh.$btsid.0.$card_id_list[$j].1",
|
||||
"TrxCh.$btsid.0.$card_id_list[$j].2",
|
||||
"TrxCh.$btsid.0.$card_id_list[$j].3",
|
||||
"TrxCh.$btsid.0.$card_id_list[$j].4",
|
||||
"TrxCh.$btsid.0.$card_id_list[$j].5",
|
||||
"TrxCh.$btsid.0.$card_id_list[$j].6",
|
||||
"TrxCh.$btsid.0.$card_id_list[$j].7")
|
||||
);
|
||||
$tablenamelist = array_merge($tablenamelist,
|
||||
Array ( "OMCR_Trx", "OMCR_RCarrier",
|
||||
"OMCR_TrxCh","OMCR_TrxCh",
|
||||
"OMCR_TrxCh","OMCR_TrxCh",
|
||||
"OMCR_TrxCh","OMCR_TrxCh",
|
||||
"OMCR_TrxCh","OMCR_TrxCh")
|
||||
);
|
||||
|
||||
if ($debug) echo "==) create TrxMod $card_id_list[$j]" . "<BR>"; else echo ".";
|
||||
$retval = send_nmicommand($db,$bssid,$language,"create TrxMod $card_id_list[$j]",
|
||||
$resultcode, $responsecode,$response,$debug);
|
||||
}
|
||||
if (($retval != 0) || ($resultcode[0] != 0))
|
||||
return (set_download_in_progress_zero($db,$bssid,$language,-1,$debug));
|
||||
flush();
|
||||
}
|
||||
|
||||
for ($j=0; $j<sizeof($objectlist); $j++)
|
||||
{
|
||||
$parameters=$attribute_type=$default_value=$nmicommand=null;
|
||||
|
||||
$objectid = $objectlist[$j];
|
||||
$tablename = $tablenamelist[$j];
|
||||
create_sql_string_from_meta_table(
|
||||
$db,$bssid,$objectid,$tablename,$sqlstring,$parameters,$attribute_id,$attribute_type,$default_value,$debug);
|
||||
create_nmi_command($db,$sqlstring,$parameters,$attribute_id,$attribute_type,$default_value,$nmicommand,$debug);
|
||||
if (strcmp($nmicommand,"set"))
|
||||
{
|
||||
if ($debug) echo "==) oid $objectid" . "<BR>"; else echo ".";
|
||||
$retval = send_nmicommand($db,$bssid,$language,"oid $objectid",
|
||||
$resultcode, $responsecode,$response,$debug);
|
||||
if (($retval != 0) || ($resultcode[0] != 0))
|
||||
return (set_download_in_progress_zero($db,$bssid,$language,-1,$debug));
|
||||
flush();
|
||||
if ($debug) echo "==) $nmicommand" . "<BR>"; else echo ".";
|
||||
$retval = send_nmicommand($db,$bssid,$language,"$nmicommand",
|
||||
$resultcode, $responsecode,$response,$debug);
|
||||
if (($retval != 0) || ($resultcode[0] != 0))
|
||||
return (set_download_in_progress_zero($db,$bssid,$language,-1,$debug));
|
||||
flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($debug) echo "==) oid BssFunc" . "<BR>"; else echo ".";
|
||||
$retval = send_nmicommand($db,$bssid,$language,"oid BssFunc",
|
||||
$resultcode, $responsecode,$response,$debug);
|
||||
if (($retval != 0) || ($resultcode[0] != 0))
|
||||
return -1;
|
||||
flush();
|
||||
if ($debug) echo "==) set DownLoadInProgress=0" . "<BR>"; else echo ".";
|
||||
$retval = send_nmicommand($db,$bssid,$language,"set DownLoadInProgress=0",
|
||||
$resultcode, $responsecode,$response,$debug);
|
||||
if (($retval != 0) || ($resultcode[0] != 0))
|
||||
return -1;
|
||||
flush();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* upload parameters from BSC to OMC
|
||||
* Return 0 if success, otherwise -1
|
||||
*/
|
||||
function upload_parameters($db,$bssid,$debug)
|
||||
{
|
||||
if ($debug) echo "==) Upload parameters" . "<BR>"; else echo ".";
|
||||
$retval = send_nmicommand($db,$bssid,$language,"upload $bssid",
|
||||
$resultcode, $responsecode,$response,$debug);
|
||||
if (($retval != 0) || ($resultcode[0] != 0))
|
||||
return -1;
|
||||
flush();
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user