Merge branch 'fronkdev' into 'master'
Added citycom manual service ordering script See merge request fronk/thetool!1598
This commit is contained in:
@@ -69,7 +69,7 @@ class Citycom_OanApiHelper {
|
||||
* @param $preorder Preorder
|
||||
* @param $sublocation_id integer
|
||||
* @param $data Array
|
||||
* @return boolean
|
||||
* @return boolean|Array
|
||||
*/
|
||||
public function orderServices($preorder, $sublocation_id, $data) {
|
||||
if(!is_numeric($sublocation_id) || !$sublocation_id) {
|
||||
@@ -117,19 +117,22 @@ class Citycom_OanApiHelper {
|
||||
|
||||
if(!$ctags) {
|
||||
$this->log->error(__METHOD__.": No New Free Ctags (Preorder ".$preorder->id.")");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(count($ctags) < count($want_services)) {
|
||||
$this->log->error(__METHOD__.": Not enough New Free CTags for Preorder ".$preorder->id);
|
||||
return false;
|
||||
}
|
||||
|
||||
$preorder_ctag_data = [
|
||||
"preorder_id" => $preorder->id,
|
||||
"network" => "citycom-oan-api",
|
||||
"network" => "citycom-oan",
|
||||
"stag" => $preorder->adb_hausnummer->vlan_stag,
|
||||
];
|
||||
|
||||
$service_count = 0;
|
||||
$service_return = [];
|
||||
foreach($cc_service_types as $stype) {
|
||||
// was this service type requested
|
||||
if(!in_array($stype->name, $want_services)) continue;
|
||||
@@ -138,6 +141,7 @@ class Citycom_OanApiHelper {
|
||||
$ctag_service_type = array_flip(CITYCOM_OAN_API_SERVICES_FOR_ORDER)[$stype->name];
|
||||
if(!$ctag_service_type) {
|
||||
$this->log->error(__METHOD__.": Cannot create Service ".$stype->name." for preorder ".$preorder->id." because no ctag service type defined");
|
||||
return false;
|
||||
}
|
||||
|
||||
$service_data = [
|
||||
@@ -152,17 +156,30 @@ class Citycom_OanApiHelper {
|
||||
//continue;
|
||||
|
||||
// register new Service with Citycom
|
||||
/*$new_service = $this->api->createService($service_data);
|
||||
$new_service = $this->api->createService($service_data);
|
||||
if(!$new_service) {
|
||||
return false;
|
||||
}*/
|
||||
}
|
||||
|
||||
$service_return = [
|
||||
$service_return[] = [
|
||||
"sublocation_id" => $sublocation_id,
|
||||
"service_type" => $ctag_service_type,
|
||||
"ctag" => $ctag,
|
||||
"ont" => [
|
||||
"serial" => $new_service->ont->serial,
|
||||
"fsan" => $new_service->ont->fsan,
|
||||
],
|
||||
];
|
||||
|
||||
/*$service_return[] = [
|
||||
"sublocation_id" => $sublocation_id,
|
||||
"service_type" => $ctag_service_type,
|
||||
"ctag" => $ctag,
|
||||
"ont" => [
|
||||
"serial" => "ONT123456",
|
||||
"fsan" => "FSAN7890",
|
||||
],
|
||||
];
|
||||
];*/
|
||||
|
||||
// save ctag
|
||||
$ctag_data = $preorder_ctag_data;
|
||||
@@ -181,13 +198,20 @@ class Citycom_OanApiHelper {
|
||||
$pct->configureNetwork();
|
||||
} catch(Exception $e) {
|
||||
$this->log->error(__METHOD__.": Error configuring network equipment (Preorder ".$preorder->id.")");
|
||||
|
||||
$mail = new Emailnotification();
|
||||
$mail->setFrom("office@xinon.at");
|
||||
$mail->setTo("schubert@sknetworx.net");
|
||||
$mail->setSubject("Fehler beim Konfigurieren von ctag auf Citycom NNI Router");
|
||||
$mail->setBody("Preorder ID: ".$preorder->id);
|
||||
$mail->send();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
return true;
|
||||
return $service_return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user