\OnuRegister
Class for registering ONU/ONT on ZTE OLTs.
Synopsis
class OnuRegister
{
- // constants
- const MODULE_CONFIG = 'ONUREG_ZTE';
- const VLAN_MODULE_RIGHTS = 'ZTEVLANBINDS';
- const REG_MODULE_RIGHTS = 'ONUREGZTE';
- const VLAN_MODULE_URL = '?module=ztevlanbinds';
- const MODULE_URL_EDIT_CARD = '?module=ztevlanbinds&edit_card=';
- const MODULE_URL_EDIT_BIND = '?module=ztevlanbinds&edit_bind=';
- const UNREG_URL = '?module=zteunreg';
- const UNREG_OLTLIST_URL = '?module=zteunreg&oltlist=true';
- const UNREG_ACT_URL = '?module=zteunreg®ister=true&oltip=';
- const UNREG_MASS_FIX_PREVIEW_URL = '?module=zteunreg&massfix=true&preview=true';
- const UNREG_MASS_FIX_RUN_URL = '?module=zteunreg&massfix=true&run=true';
- const UNREG_MASS_FIX_PREVIEW_OLT_URL = '?module=zteunreg&massfix=true&oltid=';
- const UNREG_MASS_FIX_RUN_OLT_URL = '?module=zteunreg&massfix=true&run=true&oltid=';
- const CARDS_TABLE = 'zte_cards';
- const BIND_TABLE = 'zte_vlan_bind';
- const PORT_ID_START = 268501248;
- const ONU_ID_START = 805830912;
- const ALT_ONU_ID_START = 2416967936;
- const GPON_RETRIES = 5;
- const SNMP_TEMPLATE_SECTION = 'onu_reg';
- const EMPTY_FIELD = '';
- const TYPE_FIELD = 'type';
- const INTERFACE_FIELD = 'interface';
- const OLTIP_FIELD = 'oltip';
- const OLTID_FIELD = 'swid';
- const MODELID_FIELD = 'modelid';
- const MODELID_PLACEHOLDER = '======';
- const VLAN_FIELD = 'vlan';
- const MACONU_FIELD = 'maconu';
- const MAC_ONU_FIELD = 'mac_onu';
- const SERIAL_FIELD = 'serial';
- const SN_FIELD = 'sn';
- const LOGIN_FIELD = 'login';
- const MAC_FIELD = 'mac';
- const RANDOM_MAC_FIELD = 'random_mac';
- const ROUTER_FIELD = 'router';
- const SAVE_FIELD = 'save';
- const PONIZER_ADD_FIELD = 'ponizer_add';
- const ONUDESCRIPTION_FIELD = 'onu_description';
- const DHCP_SNOOPING_FIELD = 'dhcp_snooping';
- const LOOPDETECT_FIELD = 'loopdetect';
- const ONUDESCRIPTION_AS_LOGIN_FIELD = 'onu_description_as_login';
- const GET_UNIVERSALQINQ_NONE = 'none';
- const GET_UNIVERSALQINQ_CVLAN = 'cvlan';
- const GET_UNIVERSALQINQ_PAIR = 'pair';
- const GET_UNIVERSALQINQ_CVLAN_POOL = 'cvlan_pool';
- const GET_UNIVERSALQINQ_PAIR_POOL = 'pair_pool';
- const GET_UNIVERSALQINQ = 'use_qinq';
- const NO_ERROR_CONNECTION = 'OK';
- const FIXABLE_FILE = 'exports/onureg_mass_update';
- const ERROR_NO_LOGIN_AVAILABLE = 'No connection data found. Switchlogin is empty or not set.';
- const ERROR_SNMP_CONNECTION_SET = 'SNMP connection type has set for this OLT. Use telnet/ssh instead.';
- const ERROR_NO_LICENSE = 'No license key available';
- const ERROR_NO_RIGHTS = 'Access denied';
- const ERROR_NOT_ENABLED = 'This module is disabled';
- const ERROR_WRONG_MODELID = 'Wrong modelid found. Do not use placeholder.';
- const ERROR_NOT_ALL_FIELDS = 'Some fields were not set.';
- const ERROR_NO_INTERFACE_SET = 'No interface value found.';
- const ERROR_NO_OLTIP_SET = 'No OLT IP address value found.';
- const ERROR_NO_VLAN_SET = 'No VLAN value found.';
- const ERROR_TOO_MANY_REGISTERED_ONU = 'Registered ONU count is';
- const ERROR_NEED_LICENSE_REISSUE_02 = 'Ask for new license. ETTO cards not supported for 64+ ONT installation in this license version.';
- const HUAWEI_NATIVE_VLAN_OPTION = 'ONUREG_HUAWEI_NATIVE_VLAN';
- const ERROR_ONU_EXISTS = 'ONU ALREADY EXISTS';
- // members
- protected array $billingCfg = ;
- protected array $allZteOlt = ;
- protected array $allHuaweiOlt = ;
- protected array $allOlt = ;
- protected array $allSwLogin = ;
- protected array $allCards = ;
- protected array $allBinds = ;
- protected array $cardSelector = ;
- protected array $portSelector = ;
- protected array $ponArray = ;
- protected array $onuArray = ;
- protected array $allOnu = ;
- protected array $allOnuSerial = ;
- protected array $allOnuMac = ;
- protected array $allOnuLogin = ;
- protected array $onuArrayAlt = ;
- protected array $onuModels = ;
- protected array $onuModelsSelector = ;
- protected array $eponCards = ;
- protected array $gponCards = ;
- protected $greed = '';
- protected string $avidity = '';
- protected $messages = '';
- protected string $snmp = '';
- protected integer $lastOnuId = 1;
- protected array $currentSnmpTemplate = ;
- protected string $currentSnmpCommunity = '';
- public string $currentOltSwId = '';
- public array $existId = ;
- public string $currentOltIp = '';
- public string $currentOltInterface = '';
- public string $currentPonType = '';
- public string $currentPonVersion = "0";
- protected string $vendor = 'ZTE';
- protected integer $servicePort = 1;
- public string $onuIdentifier = '';
- public string $error = '';
- public string $result = '';
- public string $svlan = '';
- public integer $vlan = 1;
- public integer $cvlan = 1;
- protected integer $svlanId = 1;
- protected array $allSvlan = ;
- protected array $usersQinQ = ;
- public string $onuInterface = '';
- public string $vportInterface = '';
- public bool $save = false;
- public bool $router = false;
- public string $onuModel = '';
- public string $login = '';
- public string $addMac = '';
- protected string $serial = '';
- public bool $ponizerAdd = false;
- protected boolean $ponizerReplace = false;
- public string $useUniversalQINQ = 'none';
- public string $onuDescription = '__empty';
- public string $onuDhcpSnooping = '__empty';
- public string $onuLoopdetect = '__empty';
- protected array $allUnreg = ;
- protected array $altCfg = ;
- protected $universalQinq;
- protected $vlanManagement;
- protected integer $nativeVlan = 0;
- protected array $labels = ;
- protected string $currentRunMac = '';
- protected string $currentRunSerial = '';
- // methods
- public void __construct()
- protected void loadOnu()
- protected void initSNMP()
- protected void loadConfig()
- protected void initMessages()
- public static array allEponCards()
- public static array allGponCards()
- protected static array allHuaweiCards()
- protected void loadOnuModels()
- protected void initGreed()
- public array getAvidity()
- protected void loadAllZteOlt()
- protected void loadAllHuaweiOlt()
- protected void loadAllOlt()
- protected void loadAllSwLogin()
- protected void loadZteBind()
- protected void loadZteCards()
- protected void loadCardSelector()
- protected void loadPortSelector()
- protected void loadOnuModelSelector()
- protected array loadCards()
- protected void loadCalculatedData()
- protected int getOltId()
- protected string getBindVlan()
- protected string correctInt()
- protected string hexToString()
- public void generateRandomOnuMac()
- protected void getAllUnauth()
- protected void vendorSet()
- protected void oltParseUnauth()
- protected void getAllUnauth_EPON_ZTE()
- protected void getAllUnauth_GPON_ZTE()
- protected void getAllUnauth_GPON_HUAWEI()
- protected void getAllUnauth_EPON_HUAWEI()
- protected string parseUncfgGpon()
- protected string serialNumberBinaryParse()
- protected string serialNumberPartsTranslate()
- protected void checkRegisteredOnu()
- protected void checkRegisteredOnuGPON()
- protected void checkRegisteredOnuEPON()
- protected void checkRegisteredOnuGPONZTE()
- protected void checkRegisteredOnuEPONZTE()
- protected void checkRegisteredOnuGPONHUAWEI()
- protected void checkRegisteredOnuEPONHUAWEI()
- protected string transformMac()
- public string checkOltParams()
- public void RegisterOnu()
- protected void sendRegisterCommand()
- protected void scriptExec()
- protected void qinqControl()
- protected void createQinqBinding()
- protected void deleteQinqBinding()
- protected bool onuCountControl()
- protected void ponizerLoginCheck()
- protected void ponizerControl()
- protected string getRegisterOnuScriptPath()
- protected void checkQinq()
- protected string getRegisterOnuCommand()
- protected string getSaveConfigCommand()
- public boolean createZteCard()
- public void editZteCard()
- public void deleteZteCard()
- public boolean createZteBind()
- public void deleteZteBind()
- public void editZteBind()
- public string listAllZteDevices()
- public string listZteDevice()
- public string listZteCard()
- public string createZteCardForm()
- public string editZteCardForm()
- public string setSNMPRequest()
- public string portSelectorForm()
- public string showAllInstalledCards()
- public string createZteBindForm()
- protected void getListZteBind()
- public string listZteBind()
- public string editZteBindForm()
- public string listAllUncfg()
- protected array getAllUniversalCvlans()
- protected string getCardName()
- protected array getQinqPairPool()
- public string registerOnuForm()
- public void getQinqByLogin()
- protected void qinqForm()
- public void universalQinqForm()
- public void listFixable()
- protected void getFixable()
- protected void storeFixable()
- public void onuMassRegister()
- protected void onuUnique()
- protected void checkSerialOnuExists()
- protected void checkMacOnuExists()
- protected void fixPonizer()
- protected void fixQinq()
Tasks
Line | Task |
---|---|
1174 | |
1350 | one day it will be added |
Constants
Name | Value |
---|---|
MODULE_CONFIG | 'ONUREG_ZTE' |
VLAN_MODULE_RIGHTS | 'ZTEVLANBINDS' |
REG_MODULE_RIGHTS | 'ONUREGZTE' |
VLAN_MODULE_URL | '?module=ztevlanbinds' |
MODULE_URL_EDIT_CARD | '?module=ztevlanbinds&edit_card=' |
MODULE_URL_EDIT_BIND | '?module=ztevlanbinds&edit_bind=' |
UNREG_URL | '?module=zteunreg' |
UNREG_OLTLIST_URL | '?module=zteunreg&oltlist=true' |
UNREG_ACT_URL | '?module=zteunreg®ister=true&oltip=' |
UNREG_MASS_FIX_PREVIEW_URL | '?module=zteunreg&massfix=true&preview=true' |
UNREG_MASS_FIX_RUN_URL | '?module=zteunreg&massfix=true&run=true' |
UNREG_MASS_FIX_PREVIEW_OLT_URL | '?module=zteunreg&massfix=true&oltid=' |
UNREG_MASS_FIX_RUN_OLT_URL | '?module=zteunreg&massfix=true&run=true&oltid=' |
CARDS_TABLE | 'zte_cards' |
BIND_TABLE | 'zte_vlan_bind' |
PORT_ID_START | 268501248 |
ONU_ID_START | 805830912 |
ALT_ONU_ID_START | 2416967936 |
GPON_RETRIES | 5 |
SNMP_TEMPLATE_SECTION | 'onu_reg' |
EMPTY_FIELD | '' |
TYPE_FIELD | 'type' |
INTERFACE_FIELD | 'interface' |
OLTIP_FIELD | 'oltip' |
OLTID_FIELD | 'swid' |
MODELID_FIELD | 'modelid' |
MODELID_PLACEHOLDER | '======' |
VLAN_FIELD | 'vlan' |
MACONU_FIELD | 'maconu' |
MAC_ONU_FIELD | 'mac_onu' |
SERIAL_FIELD | 'serial' |
SN_FIELD | 'sn' |
LOGIN_FIELD | 'login' |
MAC_FIELD | 'mac' |
RANDOM_MAC_FIELD | 'random_mac' |
ROUTER_FIELD | 'router' |
SAVE_FIELD | 'save' |
PONIZER_ADD_FIELD | 'ponizer_add' |
ONUDESCRIPTION_FIELD | 'onu_description' |
DHCP_SNOOPING_FIELD | 'dhcp_snooping' |
LOOPDETECT_FIELD | 'loopdetect' |
ONUDESCRIPTION_AS_LOGIN_FIELD | 'onu_description_as_login' |
GET_UNIVERSALQINQ_NONE | 'none' |
GET_UNIVERSALQINQ_CVLAN | 'cvlan' |
GET_UNIVERSALQINQ_PAIR | 'pair' |
GET_UNIVERSALQINQ_CVLAN_POOL | 'cvlan_pool' |
GET_UNIVERSALQINQ_PAIR_POOL | 'pair_pool' |
GET_UNIVERSALQINQ | 'use_qinq' |
NO_ERROR_CONNECTION | 'OK' |
FIXABLE_FILE | 'exports/onureg_mass_update' |
ERROR_NO_LOGIN_AVAILABLE | 'No connection data found. Switchlogin is empty or not set.' |
ERROR_SNMP_CONNECTION_SET | 'SNMP connection type has set for this OLT. Use telnet/ssh instead.' |
ERROR_NO_LICENSE | 'No license key available' |
ERROR_NO_RIGHTS | 'Access denied' |
ERROR_NOT_ENABLED | 'This module is disabled' |
ERROR_WRONG_MODELID | 'Wrong modelid found. Do not use placeholder.' |
ERROR_NOT_ALL_FIELDS | 'Some fields were not set.' |
ERROR_NO_INTERFACE_SET | 'No interface value found.' |
ERROR_NO_OLTIP_SET | 'No OLT IP address value found.' |
ERROR_NO_VLAN_SET | 'No VLAN value found.' |
ERROR_TOO_MANY_REGISTERED_ONU | 'Registered ONU count is' |
ERROR_NEED_LICENSE_REISSUE_02 | 'Ask for new license. ETTO cards not supported for 64+ ONT installation in this license version.' |
HUAWEI_NATIVE_VLAN_OPTION | 'ONUREG_HUAWEI_NATIVE_VLAN' |
ERROR_ONU_EXISTS | 'ONU ALREADY EXISTS' |
Members
protected
- $allBinds
—
array
Contains all data from zte_vlan_binds table. -
$allCards
Contains all data from zte_cards table. - $allHuaweiOlt
—
array
Contains all HUAWEI OLT devices. - $allOlt
—
array
Merge olt arrays into one - $allOnu
—
array
Contains all ponizer ONUs -
$allOnuLogin
Containts all onu users (login) - $allOnuMac
—
array
Contains all onu mac addresses - $allOnuSerial
—
array
Contains all onu serial numbers - $allSvlan
—
array
Contains all svlans - $allSwLogin
—
array
Contains all switches login and passwords. - $allUnreg
—
array
All unreg ONU - $allZteOlt
—
array
Contains all ZTE OLT devices. - $altCfg
—
array
Contains all alter.ini options - $avidity
—
array
Avidity runtime placeholder - $billingCfg
—
array
Contains all data from billing.ini - $cardSelector
—
array
Array for cards selector. - $currentRunMac
- $currentRunSerial
- $currentSnmpCommunity
—
string
Placeholder for current OLT's SNMP community. - $currentSnmpTemplate
—
array
Placeholder for current OLT's SNMP template. - $eponCards
—
array
Array for checking ports count for EPON cards - $gponCards
—
array
Array for checking ports count for GPON cards - $greed
—
Greed placeholder - $labels
- $lastOnuId
—
int
Contains last registered onu id. - $messages
—
System messages helper placeholder - $nativeVlan
—
int
Workaround for HUAWEI OLT gpon native vlan. - $onuArray
—
array
Array for ONU snmp counter. - $onuArrayAlt
—
array
Alternative array for ONU snmp counter. - $onuModels
—
array
Contains all onu models - $onuModelsSelector
—
array
Array for selecting onumodel; - $ponArray
—
array
Array for pon port snmp counter. -
$ponizerReplace
Replace onu if user already has onu - $portSelector
—
array
Array for ports selector. - $serial
—
string
Placeholder for onu serial number - $servicePort
—
integer
Contains count of all service ports on HUAWEI OLT - $snmp
—
array
SNMPHelper object instance - $svlanId
—
int
Contains SVLAN database id. - $universalQinq
—
Instance of UniversalQINQ class. - $usersQinQ
—
array
Contains all universal qinq bindings. - $vendor
—
string
Contains vendor name capital letters Default - ZTE - $vlanManagement
—
Instance of VlanManagement class.
public
- $addMac
—
string
Placeholder for Ponizer mac field. - $currentOltInterface
—
string
Placeholder for current OLT's PON interface; - $currentOltIp
—
string
Placeholder for current OLT's ip. - $currentOltSwId
—
integer
Placeholder for switch id for current OLT. - $currentPonType
—
string
Placeholder for PON interface type. Can be EPON or GPON. - $currentPonVersion
—
string
Version to handle different config within different software versions. - $cvlan
—
int
Placeholder for ONU cvlan - $error
—
string
Contains error message - $existId
—
array
Placeholder for already registered ONU IDs. - $login
—
string
Users login for adding data to ponizer. - $onuDescription
—
string
Contains onu description or '__empty' - $onuDhcpSnooping
—
string
Flag for enabling dhcp snooping - $onuIdentifier
—
string
Placeholder for ONU identifier. Mac or Serial. - $onuInterface
—
string
Placeholder for ONU interface name. - $onuLoopdetect
—
string
Flag for enabling loopdetec - $onuModel
—
int
ONU model id - $ponizerAdd
—
bool
Add ONU to Ponizer? - $result
—
string
Contains ONU registration process result. - $router
—
bool
Should ONU act like router? - $save
—
bool
Save config after ONU registration? - $svlan
—
string
Placeholder for ONU SVLAN. - $useUniversalQINQ
—
string
Should we use universal qinq and which type if yes? - $vlan
—
int
Placeholder for ONU VLAN. - $vportInterface
—
string
Placeholder for VPORT interface name.
Methods
protected
- allHuaweiCards() — Setter for huawei gpon cards.
- checkMacOnuExists()
- checkQinq() — Check if user has assiigned qinq pair and which mode was set for registration.
- checkRegisteredOnu() — Magic constant returns function name to concat it with pon type
- checkRegisteredOnuEPON()
- checkRegisteredOnuEPONHUAWEI()
- checkRegisteredOnuEPONZTE()
- checkRegisteredOnuGPON()
- checkRegisteredOnuGPONHUAWEI()
- checkRegisteredOnuGPONZTE()
- checkSerialOnuExists()
- correctInt() — Convert card name to interface name.
- createQinqBinding() — Write qinq binding to database
- deleteQinqBinding() — Delete qinq binding by login
- fixPonizer()
- fixQinq()
- getAllUnauth() — Get all unautheticated ONUs/ONTs.
- getAllUnauth_EPON_HUAWEI() — Getting unauthenticated gpon ONT from Huawei OLT.
- getAllUnauth_EPON_ZTE() — Get unautheticated epon ONT for specified OLT.
- getAllUnauth_GPON_HUAWEI() — Getting unauthenticated gpon ONT from Huawei OLT.
- getAllUnauth_GPON_ZTE() — Getting unauthenticated gpon ONT from ZTE OLT.
- getAllUniversalCvlans() — Fetching all qinq bindings by svlan_id.
- getBindVlan() — Find vlan binds for curtain pon interface.
- getCardName() — Find current card name.
- getFixable()
- getListZteBind()
- getOltId() — Find OLT id by IP.
- getQinqPairPool() — Find qinq pair pool
- getRegisterOnuCommand() — Compose command for onu registration.
- getRegisterOnuScriptPath() — Compose path to scripts.
- getSaveConfigCommand() — Compose command to save OLT configuration.
- hexToString() — Convert hex to string.
- initGreed() — Initializes greed mechanics
- initMessages() — Initializes system message helper object instance
- initSNMP() — Creates single instance of SNMPHelper object
- loadAllHuaweiOlt() — Load all OLTs that contain 'ZTE' word in snmp template name from `switches` and `switchmodels`.
- loadAllOlt() — Init all array per vendor and merge into single
- loadAllSwLogin() — Load all data from `switch_login` table.
- loadAllZteOlt() — Load all OLTs that contain 'ZTE' word in snmp template name from `switches` and `switchmodels`.
- loadCalculatedData() — Calculating snmp indexes for each OLT.
- loadCardSelector() — Loading all cards for specified OLT to array.
- loadCards() — Loads cards information
- loadConfig() — data loader functions section
- loadOnu() — Loads avaliable ONUs from database into private data property
- loadOnuModelSelector() — Load all onu models.
- loadOnuModels() — Loads all onu models into onuModels.
- loadPortSelector() — Loading all available ports for specified card.
- loadZteBind() — Load all data from `zte_vlan_binds` table filtered by switch id.
- loadZteCards() — Load all data from `zte_cards` table.
- oltParseUnauth()
- onuCountControl() — Count based on pon type onu count limits
- onuUnique()
- parseUncfgGpon() — Parse and transform raw snmp data into suitable array.
- ponizerControl() — Add onu to PONizer if options was set.
- ponizerLoginCheck()
- qinqControl() — Check if all options are set to get qinq binding
- qinqForm()
- scriptExec() — Execute script
- sendRegisterCommand() — Check options before running scripts
- serialNumberBinaryParse() — Parsing serial number in binary format and coverting it to needed format.
- serialNumberPartsTranslate() — Check mode to convert serial number string vs raw.
- storeFixable()
- transformMac() — Used to change mac format from xx:xx:xx:xx:xx:xx to xxxx.xxxx.xxxx
- vendorSet() — Setting vendor name to call proper function
public
- __construct() — Base class construction.
- RegisterOnu() — Make final checks with some data preparing.
- allEponCards() — Setter for epon cards
- allGponCards() — Setter for gpon cards.
- checkOltParams() — Used to check if connection values exact as we need.
- createZteBind() — Create new vlan binding.
- createZteBindForm() — Form for creating new vlan binding.
- createZteCard() — Register new card for specified OLT. Also checking for duplicates.
- createZteCardForm() — Form for registering new card.
- deleteZteBind() — Delete vlan binding entry from DB.
- deleteZteCard() — Delete card entry from DB.
- editZteBind() — Edit vlan bind entry.
- editZteBindForm() — Form for editing vlan binding.
- editZteCard() — Edit card name for specified slot number.
- editZteCardForm() — Form for editing card name.
- generateRandomOnuMac()
- getAvidity() — Returns current runtime
- getQinqByLogin()
- listAllUncfg() — Collect and show all unregistered onu.
- listAllZteDevices() — List all available ZTE devices.
- listFixable()
- listZteBind() — Lists all vlan bindings.
- listZteCard() — List all registered cards.
- listZteDevice() — Show selected ZTE device.
- onuMassRegister()
- portSelectorForm() — Form for selecting available ports for specified card.
- registerOnuForm() — Web form for register onu.
- setSNMPRequest() — Set hidden input for sending SNMP request to list all installed cards.
- showAllInstalledCards() — Lists all installed cards.
- universalQinqForm()