Devices:
OLT ONT Implementation Devices Snmp Version Devicetypes: Olt Flag
This commit is contained in:
@@ -17,6 +17,7 @@ class DeviceModel
|
||||
public $addr_city = null;
|
||||
public $gps_long = null;
|
||||
public $create_by = null;
|
||||
public $snmp_version = null;
|
||||
public $edit_by = null;
|
||||
public $create = null;
|
||||
public $edit = null;
|
||||
@@ -137,6 +138,49 @@ class DeviceModel
|
||||
return $where;
|
||||
}
|
||||
|
||||
public static function getOltCustomer($ip)
|
||||
{
|
||||
$items = [];
|
||||
$db = FronkDB::singleton();
|
||||
// $sql = "SELECT Patching.id,lastname,firstname,customer_number,company,device_name,device_port FROM `Patching`
|
||||
//LEFT JOIN OrderProduct ON (Patching.termination_id=OrderProduct.termination_id)
|
||||
//LEFT JOIN `Order` ON (`Order`.id=OrderProduct.order_id)
|
||||
//LEFT JOIN Address ON Address.id=`Order`.owner_id
|
||||
//WHERE Patching.`device_name` LIKE '".$ip."%'";
|
||||
// $res = $db->query($sql);
|
||||
// if ($db->num_rows($res)) {
|
||||
// while ($data = $db->fetch_array($res)) {
|
||||
// $devicePort = str_replace($ip, "", $data['device_name']);
|
||||
// $devicePort=trim($devicePort);
|
||||
// $devicePort=ltrim($devicePort,"/");
|
||||
// $devicePort=ltrim($devicePort,"-");
|
||||
// $devicePort=$devicePort."/".$data['device_port'];
|
||||
// $devicePort=str_replace("/","-",$devicePort);
|
||||
// $devicePort=rtrim($devicePort,"-");
|
||||
// $items[$devicePort] = $data;
|
||||
//
|
||||
//
|
||||
// }
|
||||
// }
|
||||
$sql = "Select Patching.id,lastname,firstname,customer_number,company,device_name,device_port,value_string FROM Workflowvalue
|
||||
LEFT JOIN Termination ON Termination.id=Workflowvalue.object_id
|
||||
LEFT JOIN Patching ON Termination.id = Patching.termination_id
|
||||
LEFT JOIN OrderProduct ON (Patching.termination_id=OrderProduct.termination_id)
|
||||
LEFT JOIN `Order` ON (`Order`.id=OrderProduct.order_id)
|
||||
LEFT JOIN Address ON Address.id=`Order`.owner_id
|
||||
WHERE `item_id` = '55'";
|
||||
$res = $db->query($sql);
|
||||
if ($db->num_rows($res)) {
|
||||
while ($data = $db->fetch_array($res)) {
|
||||
$ontSn=$data['value_string'];
|
||||
$ontSn= str_replace("HWTC","48575443",$ontSn);
|
||||
|
||||
$items[$ontSn] = $data;
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
public static function getconifg($id)
|
||||
{
|
||||
$response = "";
|
||||
@@ -215,4 +259,92 @@ class DeviceModel
|
||||
endif;
|
||||
return json_decode($response);
|
||||
}
|
||||
|
||||
public static function getoltInfo($ip, $portid = '', $adv = '')
|
||||
{
|
||||
if ($portid) {
|
||||
$portid = "/" . $portid;
|
||||
}
|
||||
if ($adv) {
|
||||
$adv = "/" . $adv;
|
||||
}
|
||||
$url = TT_MBI_API_URL . TT_MBI_API_VERSION . '/deviceoltinfo/' . $ip . $portid . $adv;
|
||||
$response = "";
|
||||
if (TT_MBI_API_ENABLE) :
|
||||
$curl = curl_init();
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => $url,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => '',
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_SSL_VERIFYHOST => false,
|
||||
CURLOPT_SSL_VERIFYPEER => false,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Authorization: Bearer ' . TT_MBI_API_KEY),
|
||||
));
|
||||
$response = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
endif;
|
||||
return json_decode($response);
|
||||
}
|
||||
|
||||
public static function getontInfo($ip, $portid = '', $ont = '')
|
||||
{
|
||||
$portid = "/" . $portid;
|
||||
$ont = "/ont/" . $ont;
|
||||
$url = TT_MBI_API_URL . TT_MBI_API_VERSION . '/deviceoltinfo/' . $ip . $portid . $ont;
|
||||
|
||||
$response = "";
|
||||
if (TT_MBI_API_ENABLE) :
|
||||
$curl = curl_init();
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => $url,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => '',
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_SSL_VERIFYHOST => false,
|
||||
CURLOPT_SSL_VERIFYPEER => false,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'GET',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Authorization: Bearer ' . TT_MBI_API_KEY),
|
||||
));
|
||||
$response = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
endif;
|
||||
return json_decode($response);
|
||||
}
|
||||
|
||||
public static function changeoltSplitter($id, $portid, $ports)
|
||||
{
|
||||
|
||||
$url = TT_MBI_API_URL . TT_MBI_API_VERSION . '/deviceoltsetsplitter/' . $id . "/" . $portid . "/" . $ports;
|
||||
$response = "";
|
||||
if (TT_MBI_API_ENABLE) :
|
||||
$curl = curl_init();
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => $url,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => '',
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 0,
|
||||
CURLOPT_SSL_VERIFYHOST => false,
|
||||
CURLOPT_SSL_VERIFYPEER => false,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => 'POST',
|
||||
CURLOPT_HTTPHEADER => array(
|
||||
'Authorization: Bearer ' . TT_MBI_API_KEY),
|
||||
));
|
||||
$response = curl_exec($curl);
|
||||
curl_close($curl);
|
||||
endif;
|
||||
return json_decode($response);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user