Citycom Service Ordering WIP 2025-08-05

This commit is contained in:
Frank Schubert
2025-08-05 09:54:36 +02:00
parent 07f2bad3c4
commit a2555a9e50
4 changed files with 17 additions and 6 deletions

View File

@@ -68,7 +68,6 @@ class SnoppCitycom extends Modules\ApiControllerModule
}
$cc_api_client = new \Citycom_OanApiClient(CITYCOM_OAN_API_USER, CITYCOM_OAN_API_PASS);
$cc_api = new \Citycom_OanApiHelper($cc_api_client);

View File

@@ -108,7 +108,12 @@ class PreorderCtag extends mfBaseModel {
// add to interface-list
$ros->add("/interface list member", ["interface" => $vlan_name, "list" => CITYCOM_OAN_API_NNI_IFLIST_NAME]);
$this->log->info(__METHOD__.": done => /interface list member add 'interface' => $vlan_name, 'list' => ".CITYCOM_OAN_API_NNI_IFLIST_NAME);
$this->log->info(__METHOD__.": done => /interface list member add interface=$vlan_name list=".CITYCOM_OAN_API_NNI_IFLIST_NAME);
// add to bridge CITYCOM_OAN_APU_NNI_BRIDGE_NAME
$ros->add("/interface bridge port", ["bridge" => CITYCOM_OAN_APU_NNI_BRIDGE_NAME, "interface" => $vlan_name]);
$this->log->info(__METHOD__.": done => /bridge port add bridge=".CITYCOM_OAN_APU_NNI_BRIDGE_NAME." interface=$vlan_name");
return true;
} catch(Exception $e) {

View File

@@ -5,6 +5,7 @@ class Citycom_OanApiClient {
private $username;
private $password;
private $token;
public $lastError;
public function __construct($user, $pass) {
@@ -194,6 +195,7 @@ class Citycom_OanApiClient {
"http" => [
"ignore_errors" => true,
"method" => "POST",
"content" => json_encode($data),
"header" => [
"Accept: application/json",
"Content-type: application/json",
@@ -203,6 +205,7 @@ class Citycom_OanApiClient {
];
$new_service = $this->runApiRequest($url, $ctx_options);
return $new_service;
}
@@ -332,6 +335,7 @@ class Citycom_OanApiClient {
$resp = json_decode($output);
//var_dump($resp);
if(!is_object($resp) || (property_exists($resp, "success") && !$resp->success)) {
$this->lastError = $output;
return false;
}

View File

@@ -156,8 +156,11 @@ 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) {
$this->log->error(__METHOD__.": Error creating service");
$this->log->error(__METHOD__.": Last Error: ".$this->api->lastError);
return false;
}
@@ -169,9 +172,9 @@ class Citycom_OanApiHelper {
"serial" => $new_service->ont->serial,
"fsan" => $new_service->ont->fsan,
],
];
];*/
/*$service_return[] = [
$service_return[] = [
"sublocation_id" => $sublocation_id,
"service_type" => $ctag_service_type,
"ctag" => $ctag,
@@ -179,7 +182,7 @@ class Citycom_OanApiHelper {
"serial" => "ONT123456",
"fsan" => "FSAN7890",
],
];*/
];
// save ctag
$ctag_data = $preorder_ctag_data;