config = $config; $this->client = $client; } /** * @param integer $id Id nap. * @return mixed|null */ public function validNAP($id) { $resp = null; try { if (!is_null($id)) { $api = new NAPApi ( $this->client, $this->config); $api->setDisabledTenancy(true); $resp = $api->getById($id); } } catch (ApiException $e) { } return $resp; } /** * @param integer $id Id olt. * @return mixed|null */ public function validOLT($id) { $resp = null; try { if (!is_null($id)) { $api = new OLTApi ( $this->client, $this->config); $api->setDisabledTenancy(true); $resp = $api->getById($id); } } catch (ApiException $e) { } return $resp; } /** * @param integer $id Id olt model. * @return mixed|null */ public function validOLTModel($id) { $resp = null; try { if (!is_null($id)) { $api = new OLTModelApi( $this->client, $this->config); $api->setDisabledTenancy(true); $resp = $api->getById($id); } } catch (ApiException $e) { } return $resp; } /** * @param integer $id Id onu. * @return mixed|null */ public function validONU($id) { $resp = null; try { if (!is_null($id)) { $api = new ONUApi( $this->client, $this->config); $api->setDisabledTenancy(true); $resp = $api->getById($id); } } catch (ApiException $e) { } return $resp; } /** * @param integer $id onu model. * @return mixed|null */ public function validONUModel($id) { $resp = null; try { if (!is_null($id)) { $api = new ONUModelApi( $this->client, $this->config); $api->setDisabledTenancy(true); $resp = $api->getById($id); } } catch (ApiException $e) { } return $resp; } /** * @param integer $id Id profile. * @return mixed|null */ public function validProfile($id) { $resp = null; try { if (!is_null($id)) { $api = new ProfileApi( $this->client, $this->config); $api->setDisabledTenancy(true); $resp = $api->getById($id); } } catch (ApiException $e) { } return $resp; } /** * @param integer $id Id onu profile. * @return mixed|null */ public function validONUProfile($id) { $resp = null; try { if (!is_null($id)) { $api = new ONUProfileApi( $this->client, $this->config); $api->setDisabledTenancy(true); $resp = $api->getById($id); } } catch (ApiException $e) { } return $resp; } /** * @param integer $id Id vlan profile. * @return mixed|null */ public function validVLanProfile($id) { $resp = null; try { if (!is_null($id)) { $api = new VLanProfileApi( $this->client, $this->config); $api->setDisabledTenancy(true); $resp = $api->getById($id); } } catch (ApiException $e) { } return $resp; } /** * @param integer $id Id onu template. * @return mixed|null */ public function validONUTemplate($id) { $resp = null; try { if (!is_null($id)) { $api = new ONUTemplateApi( $this->client, $this->config); $api->setDisabledTenancy(true); $resp = $api->getById($id); } } catch (ApiException $e) { } return $resp; } /** * @param integer $id Id tcont profile. * @return mixed|null */ public function validTContProfile($id) { $resp = null; try { if (!is_null($id)) { $api = new TContProfileApi( $this->client, $this->config); $api->setDisabledTenancy(true); $resp = $api->getById($id); } } catch (ApiException $e) { } return $resp; } /** * @param integer $id Id traffic profile. * @return mixed|null */ public function validTrafficProfile($id) { $resp = null; try { if (!is_null($id)) { $api = new TrafficProfileApi( $this->client, $this->config); $api->setDisabledTenancy(true); $resp = $api->getById($id); } } catch (ApiException $e) { } return $resp; } /** * @param integer $id Id vlan id. * @return mixed|null */ public function validVLanID($id) { $resp = null; try { if (!is_null($id)) { $api = new VLanIDApi( $this->client, $this->config); $api->setDisabledTenancy(true); $resp = $api->getById($id); } } catch (ApiException $e) { } return $resp; } /** * @param mixed|string $ids Ids vlan id. * @return mixed|null */ public function validVLansID($ids) { if(!is_array($ids)) $ids = explode(",",$ids); $resp = array(); try { if (!is_null($ids)) { foreach($ids as $id) { if($id instanceof \Swagger\Client\FTTH\Model\VLanID) { $resp[] = $id; continue; } $api = new VLanIDApi( $this->client, $this->config); $api->setDisabledTenancy(true); $vlan = $api->getById($id); if(is_null($vlan)) return null; //vlan doesn't exist $resp[] = $vlan; } } } catch (ApiException $e) { } return $resp; } /** * @param integer $ponSerialNumber Pon serial number. * @param integer $tenancy Tenancy id. * @return mixed|null */ public function existsONU($ponSerialNumber, $tenancy) { $resp = null; try { if (!is_null($ponSerialNumber)) { $util = new \Utils(); $api = new ONUApi( $this->client, $this->config); $values = $api->getList(null, null, $ponSerialNumber, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, $tenancy, 1, 1000000, 0); $resp = $util->valueExistsLower($ponSerialNumber, $values, "getPonSerialNumber"); } } catch (ApiException $e) { } return $resp; } }