snmp-fiberhome
This module communicates with Fiberhome OLTs using the SNMP protocol. The module is capable of managing the OLT, Slots, Cards, Pon ports and ONUs by performing read and write functions directly in OLT.
Contents
Installation
This is a Node.js module available through the npm.
$ npm install --save snmp-fiberhome
It is loaded using the require() function:
const fh = require('snmp-fiberhome')
Usage
const fh = require('snmp-fiberhome')
const options = {
ip: '0.0.0.0',
community: 'default',
port: 161,
trapPort: 162,
enableWarnings: true,
enableLogs: true
}
fh.function(options, ...)
IMPORTANT! For ONUs using GPON technology, the macAddress
parameter in the following functions will receive the equipment SERIAL.
The following functions are assigned the slot
, pon
and onuId
parameters to specify a particular ONU. If you work with onuIndex, use the parseOnuIndex() function to convert onuIndex to an object containing the values of slot
, pon
and onuId
.
The onuIndex
parameter is calculated as follows:
slot*(2^25) + pon*(2^19) + onuId*(2^8) // for OLT AN5516
See the function convertToOnuIndex() to convert the onuIndex
parameter to slot
, pon
and onuId
OLT functions
getOltInformation()
Description: Get relevant information from OLT. If unable to connect to OLT, the return is false
.
Function signature:
getOltInformation(options: <object>) => Promise <object>
Example:
fh.getOltInformation(options).then(oltInfo => {
console.log(oltInfo)
})
Output:
{
alias: 'AN5516-01',
hardwareModel: 'An5516-01',
hardwareVersion: 'WKE2.115.331R1A',
ip: "1.2.3.4",
macAddress: '10-0b-d2-12-35-7d',
oid: '1.3.6.1.4.1.5875.800.1001.11',
slots: [11, 16, 19, 20],
softwareVersion: 'RP0700',
subrack: {
subrackIndex: 1,
subrackName: 'AN5516-06',
subrackType: 'An5516-06',
totalSlotNumber: 14
},
systemContact: 'DefaultsysContact',
systemLocation: 'DefaultsysLocation',
systemName: 'Test',
systemRunningTime: 133001838,
systemRunningTimeUnit: 'ms',
temperature: 39,
temperatureUnit: '°C'
}
getOltModel()
Description: Returns the OLT model. If unable to connect to OLT, the return is false
.
Function signature:
getOltModel(options: <object>) => Promise <string>
Example:
fh.getOltModel(options).then(onuModel => {
console.log(onuModel)
})
Output:
'An5516-01'
getSubrackInformation()
Description: Returns information regarding the subrack. If unable to connect to OLT, the return is false
.
Function signature:
getSubrackInformation(options <object>) => Promise <object>
Example:
fh.getSubrackInformation(options).then(info => {
console.log(info)
})
Output:
{
subrackIndex: 1,
subrackName: 'AN5516-06',
subrackType: 'An5516-06',
totalSlotNumber: 14
}
getPonPortList()
Description: Returns an array with the relevant information from all PON ports in the OLT. If unable to connect to OLT, the return is false
.
Function signature:
getPonPortList(options: <object>) => Promise <Array>
Example:
fh.getPonPortList(options).then(ponPorts => {
console.log(ponPorts)
})
Output:
[
{
authorizedOnus: 2,
portDescription: 'PON 11/1',
slot: 11,
pon: 1,
portUplinkRate: 1250,
portUplinkRateUnit: 'Mbit/s',
portDownlinkRate: 2500,
portDownlinkRateUnit: 'Mbit/s',
portEnableStatus: 'enable',
portEnableStatusValue: 1,
portIndex: 369623040,
portName: 'PON 11/1',
portOnlineStatus: 'online',
portOnlineStatusValue: 1,
portType: 'PON',
portTypeValue: 1
},
]
getPonPort()
Description: Returns the relevant information for a given PON port in OLT. If any of the input parameters is invalid, the return is false
.
Function signature:
getPonPort(options: <object>, slot: <number>, pon: <number>) => Promise <object>
Example:
fh.getPonPort(options, 11, 1).then(ponPort => {
console.log(ponPort)
})
Output:
{
authorizedOnus: 2,
portDescription: 'PON 11/1',
slot: 11,
pon: 1,
portUplinkRate: 1250,
portUplinkRateUnit: 'Mbit/s',
portDownlinkRate: 2500,
portDownlinkRateUnit: 'Mbit/s',
portEnableStatus: 'enable',
portEnableStatusValue: 1,
portIndex: 369623040,
portName: 'PON 11/1',
portOnlineStatus: 'online',
portOnlineStatusValue: 1,
portType: 'PON',
portTypeValue: 1
}
Slot functions
getSlots()
Description: Returns an array with the number of each slot. If unable to connect to OLT, the return is false
.
Function signature:
getSlots(options: <object>) => Promise <Array>
Example:
fh.getSlots(options).then(slots => {
console.log(slots)
})
Output:
[11, 16, 19, 20]
getSlotsInformationList()
Description: Returns an array with relevant information from all slots in the OLT. If unable to connect to OLT, the return is false
.
Function signature:
getSlotsInformationList(options: <object>) => Promise <Array>
Example:
fh.getSlotsInformationList(options).then(slots => {
console.log(slots)
})
Output:
[
{
slot: 11,
actualCardType: 'GC8B',
actualCardTypeValue: 527,
authorizedCardType: 'GC8B'
authorizedCardTypeValue: 527,
cardPresentStatus: 'present',
cardPresentStatusValue: 1,
cardInformation: {
availablePorts: 8,
numberOfPorts: 8,
cardStatus: 'normal',
cardStatusValue: 1,
cardType: 'GC8B',
cardTypeValue: 527,
cpu: 4.75,
cpuUnit: '%',
memory: 41.54,
memoryUnit: '%',
hardwareVersion: 'WKE2.200.012R1C',
slot: '11',
softwateVersion: 'RP0700'
}
},
]
Card functions
getCardList()
Description: Returns an array with relevant information from all cards. If unable to connect to OLT, the return is false
.
Function signature:
getCardList(options: <object>) => Promise <Array>
Example:
fh.getCardList(options).then(cards => {
console.log(cards)
})
Output:
[
{
availablePorts: 8,
numberOfPorts: 8,
cardStatus: 'normal',
cardStatusValue: 1,
cardType: 'GC8B',
cardTypeValue: 527,
cpu: 4.75,
cpuUnit: '%',
memory: 41.54,
memoryUnit: '%',
hardwareVersion: 'WKE2.200.012R1C',
slot: '11',
softwateVersion: 'RP0700'
},
]
getCard()
Description: Returns relevant information from a given card. If any of the input parameters is invalid, the return is false
.
Function signature:
getCard(options: <object>, slot: <number>) => Promise <object>
Example:
fh.getCard(options, 11).then(card => {
console.log(card)
})
Output:
{
availablePorts: 8,
numberOfPorts: 8,
cardStatus: 'normal',
cardStatusValue: 1,
cardType: 'GC8B',
cardTypeValue: 527,
cpu: 4.75,
cpuUnit: '%',
memory: 41.54,
memoryUnit: '%',
hardwareVersion: 'WKE2.200.012R1C',
slot: '11',
softwateVersion: 'RP0700'
}
ONU functions
For all the following functions, if the ONU, Pon port or Slot is not found, the return is false.
addAllOnus()
Description: This function performs ONU authorization and WAN and Vlans configuration for all unauthorized ONUs in a OLT. The input parameters wanProfiles
and lanPortProfiles
are not required. To learn more about the wanProfiles
input parameter see the setWan() function. To learn more about the lanPortProfiles
input parameter, see the setLanPorts() function. If the authorized ONU already contains any profiles configured for WAN or Vlan, the old settings will be replaced with the new ones. The return is an array that contains all authorized ONUs. If any of the input parameters is invalid, the return is false
.
Function signature:
addAllOnus(options: <object>, wanProfiles: <Array>, lanPortProfiles: <Array>) => Promise <Array>
Example:
fh.addAllOnus(options,
[
{ wanMode: 'internet', wanConnType: 'router', wanVlan: 2001, ipMode: 'pppoe', translationValue: 2000, svlan: 2000 },
{ wanMode: 'tr069', wanConnType: 'router', wanVlan: 2002, ipMode: 'dhcp', translationValue: 2000, svlan: 3000 }
],
[
{ lanPort: 1, vlans: [{ vlanMode: 'transparent', cvlanId: 2001 }, { vlanMode: 'tag', cvlanId: 3011, cos: 3 }] },
{ lanPort: 2, enablePort: false }
]
).then(authOnuList => {
console.log(authOnuList)
})
Output:
[
{
_onuIndex: 369623296,
slot: 11,
pon: 1,
onuId: 1,
macAddress: 'FHTT1231e796',
onuType: {
category: 'SFU',
code: 765,
mode: 'dual',
model: 'AN5506-04-F1',
type: 'GPON'
}
},
]
addOnu()
Description: Similar to the addAllOnus() function, but performs ONU authorization and WAN and Vlans configuration for a particular ONU. If any of the input parameters is invalid, the return is false
.
Function signature:
addOnu(options: <object>, onu: <object>, wanProfiles: <Array>, lanPortProfiles: <Array>) => Promise <object>
onu: <object>
parameter:
onu: {
slot: <number>,
pon: <number>,
onuTypeCode: <number>,
macAddress: <string>
}
Example:
fh.addOnu(options, { slot: 11, pon: 1, onuTypeCode: 765, macAddress: 'FHTT1231e796' },
[
{ wanMode: 'internet', wanConnType: 'router', wanVlan: 2001, ipMode: 'pppoe', translationValue: 2000, svlan: 2000 },
{ wanMode: 'tr069', wanConnType: 'router', wanVlan: 2002, ipMode: 'dhcp', translationValue: 2000, svlan: 3000 }
],
[
{ lanPort: 1, vlans: [{ vlanMode: 'transparent', cvlanId: 2001 }, { vlanMode: 'tag', cvlanId: 3011, cos: 3 }] },
{ lanPort: 2, enablePort: false }
]
).then(onu => {
console.log(onu)
})
Output:
{
_onuIndex: 369623296,
slot: 11,
onuId: 1,
pon: 1,
macAddress: 'FHTT1231e796',
onuType: {
category: 'SFU',
code: 765,
mode: 'dual',
model: 'AN5506-04-F1',
type: 'GPON'
}
}
authorizeOnu()
Description: Authorizes a particular ONU. WAN and Vlan settings can be made using the setWan() and setLanPorts() functions, respectively. All input parameters for authorizeOnu() can be obtained by the getUnauthorizedOnus() function. If any of the input parameters is invalid, the return is false
.
Function signature:
authorizeOnu(options: <object>, slot: <number>, pon: <number>, onuTypeCode: <number>, macAddress: <string>) => Promise <object>
Example:
fh.authorizeOnu(options, 11, 1, 765, 'FHTT1231e796').then(authOnu => {
console.log(authOnu)
})
Output:
{
slot: 11,
pon: 1,
macAddress: 'FHTT1231e796',
onuType: {
category: 'SFU',
code: 765,
mode: 'dual',
model: 'AN5506-04-F1',
type: 'GPON'
}
}
convertToOnuIndex()
Description: Convert slot
, pon
and onuId
parameters to onuIndex
.
Function signature:
convertToOnuIndex(slot: <number>, pon: <number>, onuId: <number>) => <number>
Example:
var onuIndex = fh.convertToOnuIndex(11, 1, 1)
console.log(onuIndex)
Output:
369623296
delOnu() and delOnuByMacAddress()
Description: Deletes a particular ONU. If the ONU is successfully deleted, the function returns the macAddress
of the respective ONU deleted, otherwise false
.
Function signature:
delOnu(options: <object>, slot: <number>, pon: <number>, onuId: <number>) => Promise <string>
Function signature:
delOnuByMacAddress(options: <object>, macAddress: <string>) => Promise <string>
Example:
fh.delOnu(options, 11, 1, 1).then(macAddress => {
console.log(macAddress)
})
fh.delOnuByMacAddress(options, 'FHTT1231e796').then(macAddress => {
console.log(macAddress)
})
Output:
'FHTT1231e796'
delWan()
Description: Deletes all WAN profiles from a given ONU. If successful, returns true
, otherwise false
.
Function signature:
delWan(options: <object>, slot: <number>, pon: <number>, onuId: <number>) => Promise <boolean>
Example:
fh.delWan(options, 11, 1, 1).then(del => {
console.log(del)
})
Output:
true
enableLanPorts()
Description: Enables and disables LAN ports for a specific ONU. If successful, the function returns onuIndex
, otherwise false
.
Function signature:
enableLanPorts(options: <objecy>, slot: <number>, pon: <number>, onuId: <number>, aLanPorts: <Array>) => Promise <number>
Example:
fh.enableLanPorts(options, 11, 1, 1,
[
{ lanPort: 2, enablePort: false },
{ lanPort: 3, enablePort: true }
]
).then(onuIndex => {
console.log(onuIndex)
})
Output:
369623296
getAuthorizedOnus()
Description: Returns an array containing all authorized ONUs in OLT. If unable to connect to OLT, the return is false
.
Function signature:
getAuthorizedOnus(options: <object>) => Promise <Array>
Example:
fh.getAuthorizedOnus(options).then(onuList => {
console.log(onuList)
})
Output:
[
{
_onuIndex: 369623296,
slot: 11,
pon: 1,
onuId: 1,
macAddress: 'FHTT1231e796'
},
]
getBasicOnuInfo()
Description: Retorns a ONU in OLT based on mac address. The ONU must be authorized.
NOTE: The input parameters slot
and pon
are not required, but the use will make the return faster. On success, returns an object containing basic ONU information, otherwise returns false
.
Function signature:
getBasicOnuInfo(options: <object>, macAddress: <string>, slot: <number>, pon: <number>) => Promise <object>
Example:
fh.getBasicOnuInfo(options, 'FHTT1231e796').then(onu => {
console.log(onu)
})
fh.getBasicOnuInfo(options, 'FHTT1231e796', 11, 1).then(onu => {
console.log(onu)
})
Output:
{
_onuIndex: 369623296,
slot: 11,
pon: 1,
onuId: 1,
macAddress: 'FHTT1231e796'
}
getLanPorts()
Description: Returns the LAN ports settings of a given ONU. If any of the input parameters is invalid, the return is false
.
Function signature:
getLanPorts(options: <object>, slot: <number>, pon: <number>, onuId: <number>) => Promise <Array>
Example:
fh.getLanPorts(options, 11, 1, 1).then(lanPorts => {
console.log(lanPorts)
})
Output:
[
{
lanPort: 1,
enablePort: true,
lanSettings: {
autoNegotiation: {
auto: true,
duplex: 'full',
portSpeed: '100M'
},
flowControl: false,
boardwidthSet: {
upstreamMin: 640,
upstreamMax: 1000000,
downstream: 1000000
},
igmpUpCvlan: {
id: 2001,
cos: 6,
tpId: 33024
},
igmpUpSvlan: {
id: null,
cos: null,
tpId: 33024
}
},
vlans: [
{vlanMode: 'transparent', cvlanId: 2001, cos: null, serviceType: 'multicast', tpId: 33024, tls: false, qInQ: false, translation: false},
{vlanMode: 'tag', cvlanId: 2002, cos: 3, serviceType: 'unicast', tpId: 33024, tls: false, qInQ: false, translation: false}
]
},
{
lanPort: 2,
enablePort: true,
lanSettings: {
},
vlans: [
{
vlanMode: 'transparent', cvlanId: 2001, cos: null, serviceType: 'unicast', tpId: 33024,
translation: {cos: 5, value: 4000},
qInQ: {serviceName: 'IPTV', vlanId: 404, cos: 7}
}
]
},
]
NOTE 1: EPON ONUs will contain the policing
and dsPolicing
parameters within the lanSettings
parameter, and bandwidthSet
within vlans
. The boardwidthSet
parameter is returned for GPON only.
NOTE 2: If the getLanPorts() function does not identify whether the ONU is EPON or GPON, an error will be displayed and the getLanPortsEPON()
or getLanPortsGPON()
functions can be used by passing the same input parameters as the getLanPorts() function.
getMacAddressList()
Description: Returns an array containing the mac address of all authorized ONUs in a given OLT. If unable to connect to OLT, the return is false
.
Function signature:
getMacAddressList(options: <object>) => Promise <Array>
Example:
fh.getMacAddressList(options).then(macAddressList => {
console.log(macAddressList)
})
Output:
[
{
_onuIndex: 369623296,
macAddress: 'FHTT1231e796'
},
]
getOnu()
Description: Returns relevant information from a particular ONU, such as: opticalPowers (signals), distance, model, macAddress, enters others. If any of the input parameters is invalid, the return is false
.
NOTE: For EPON technology some (or all) values may be returned as zero on opticalPower
Function signature:
getOnu(options: <object>, slot: <number>, pon: <number>, onuId: <number>) => Promise <object>
Example:
fh.getOnu(options, 11, 1, 1).then(onu => {
console.log(onu)
})
Output:
{
_onuIndex: 369623296,
slot: 11,
pon: 1,
onuId: 1,
macAddress: 'FHTT1231e796',
onuLogicAuthId: '',
onuLogicAuthIdPass: '',
onuStatus: 'online',
onuStatusValue: 1,
softwareVersion: 'RP2522',
systemName: '',
firmwareVersion: '',
hardwareVersion: 'GJ-2.134.285F4G',
ip: '0.0.0.0',
distance: {
_onuIndex: 369623296,
value: '1.282',
unit: 'km'
},
lastOffTime: {
_onuIndex: 369623296,
date: '2019-01-21',
time: '08:01:04'
},
opticalPower: {
_onuIndex: 369623296,
rxPower:{
value: '-19.25',
unit: 'dBm'
},
txPower: {
value: '3.03',
unit: 'dBm'
},
temperature: {
value: '45.10',
unit: '°C'
},
voltage: {
value: '3.21',
unit: 'V'
},
currTxBias: {
value: '9.70',
unit: 'mA'
}
},
onuType: {
category: 'SFU',
code: 765,
mode: 'dual',
model: 'AN5506-04-F1',
type: 'GPON'
},
upLinkInterface: {
downlinkRate: 2500,
downlinkRateUnit: 'Mbit/s',
portDescription: 'PON 11/1/1',
portName: 'PON 11/1/1',
portStatus: 'enable',
portStatusValue: 1,
portType: 1,
uplinkRate: 1250,
uplinkRateUnit: 'Mbit/s'
}
}
getOnuBandwidth()
Description: Returns the bandwidth of a given ONU. If any of the input parameters is invalid, the return is false
.
Function signature:
getOnuBandwidth(options: <object>, slot: <number>, pon: <number>, onuId: <number>) => Promise <object>
Example:
fh.getOnuBandwidth(options, 11, 1, 2).then(onu => {
console.log(onu)
})
Output:
{
_onuIndex: 369623552,
slot: 11,
pon: 1,
onuId: 2,
upBw: 2048,
downBw: 1024,
bandwidthUnit: 'Kbit/s'
}
getOnuDistance()
Description: Returns the distance traveled by the fiber to a particular ONU in the kilometer unit. If any of the input parameters is invalid, the return is false
.
Function signature:
getOnuDistance(options: <object>, slot: <number>, pon: <number>, onuId: <number>) => Promise <object>
Example:
fh.getOnuDistance(options, 11, 1, 1).then(onu => {
console.log(onu)
})
Output:
{
_onuIndex: 369623296,
value: '1.282',
unit: 'km'
}
getOnuIdList()
Description: Returns an array with the onuId
of all authorized ONUs in OLT. If unable to connect to OLT, the return is false
.
Function signature:
getOnuIdList(options: <object>) => Promise <Array>
Example:
fh.getOnuIdList(options).then(onuList => {
console.log(onuList)
})
Output:
[
{
_onuIndex: 369623296,
onuId: 1
},
{
_onuIndex: 369623552,
onuId: 2
},
]
getOnuIndexList()
Description: Returns an array with the index of all authorized ONUs in OLT. If unable to connect to OLT, the return is false
.
Function signature:
getOnuIndexList(options: <object>) => Promise <Array>
Example:
fh.getOnuIndexList(options).then(onuList => {
console.log(onuList)
})
Output:
[ 369623296, 371720448, 371720704 ]
getOnuLastOffTime()
Description: Returns the date and time of the last disconnection of a given ONU. Date Format: (year)-(month)-(day). Time format: (hour):(minute):(second). If any of the input parameters is invalid, the return is false
.
Function signature:
getOnuLastOffTime(options: <object>, slot: <number>, pon: <number>, onuId: <number>) => Promise <object>
Example:
fh.getOnuLastOffTime(options, 11, 1, 1).then(onu => {
console.log(onu)
})
Output:
{
_onuIndex: 369623296,
date: '2019-01-21',
time: '08:01:04'
}
getOnuListByPon()
Description: Returns a list of all connected ONUs on a given PON port. If any of the input parameters is invalid, the return is false
.
NOTE: Depending on the number of ONUs connected to the Pon port, the return may take time. Approximately 0.5 seconds for each ONU connected to the port.
Function signature:
getOnuListByPon(options: <object>, slot: <number>, pon: <number>) => Promise <Array>
Example:
fh.getOnuListByPon(options, 11, 1).then(onuList => {
console.log(onuList)
})
Output:
[
{
_onuIndex: 369623296,
slot: 11,
pon: 1,
onuId: 1,
macAddress: 'FHTT1231e796',
firmwareVersion: '',
hardwareVersion: 'GJ-2.134.285F4G',
ip: '0.0.0.0',
onuLogicAuthId: '',
onuLogicAuthIdPass: '',
onuStatus: 'online',
onuStatusValue: 1,
softwareVersion: 'RP2522',
systemName: '',
distance: {
_onuIndex: 369623296,
value: '1.283',
unit: 'km'
},
lastOffTime: {
_onuIndex: 369623296,
date: '2009-01-18',
time: '23:37:39'
},
onuType: {
category: 'SFU',
code: 765,
mode: 'dual',
model: 'AN5506-04-F1',
type:'GPON'
},
opticalPower: {
_onuIndex: 369623296,
rxPower:{
value: '-19.25',
unit: 'dBm'
},
txPower: {
value: '3.03',
unit: 'dBm'
},
temperature: {
value: '45.10',
unit: '°C'
},
voltage: {
value: '3.21',
unit: 'V'
},
currTxBias: {
value: '9.70',
unit: 'mA'
}
}
},
]
getOnuOpticalPower()
Description: Returns information related to the signals, voltage, temperature and bias current of a particular ONU. If any of the input parameters is invalid, the return is false
.
NOTE: For EPON technology some (or all) values may be returned as zero.
Function signature:
getOnuOpticalPower(options: <object>, slot: <number>, pon: <number>, onuId: <number>) => Promise <object>
Example:
fh.getOnuOpticalPower(options, 11, 1, 1).then(onuOpticalPower => {
console.log(onuOpticalPower)
})
Output:
{
_onuIndex: 369623296,
rxPower:{
value: '-19.25',
unit: 'dBm'
},
txPower: {
value: '3.03',
unit: 'dBm'
},
temperature: {
value: '45.10',
unit: '°C'
},
voltage: {
value: '3.21',
unit: 'V'
},
currTxBias: {
value: '9.70',
unit: 'mA'
}
}
getOnuOpticalPowerList()
Description: Returns a signal array of all authorized ONUs in OLT. If unable to connect to OLT, the return is false
.
IMPORTANT: Depending on the number of connected ONUs on the OLT, the return may take.
NOTE: For EPON technology some (or all) values may be returned as zero on opticalPower
Function signature:
getOnuOpticalPowerList(options: <object>) => Promise <Array>
Example:
fh.getOnuOpticalPowerList(options).then(onuList => {
console.log(onuList)
})
Output:
[
{
_onuIndex: 369623296
slot: 11,
pon: 1,
onuId: 1,
opticalPower: {
_onuIndex: 369623296,
rxPower:{
value: '-19.25',
unit: 'dBm'
},
txPower: {
value: '3.03',
unit: 'dBm'
},
temperature: {
value: '45.10',
unit: '°C'
},
voltage: {
value: '3.21',
unit: 'V'
},
currTxBias: {
value: '9.70',
unit: 'mA'
}
}
},
]
getOnuType()
Description: Returns ONU type information. If any of the input parameters is invalid, the return is false
.
Function signature:
getOnuType(options: <object>, slot: <number>, pon: <number>, onuId: <number>) => Promise <object>
Example:
fh.getOnuType(options, 11, 1, 1).then(onuType => {
console.log(onuType)
})
Output:
{
category: 'SFU',
code: 765,
mode: 'dual',
model: 'AN5506-04-F1',
type: 'GPON'
}
NOTE: The mode
parameter in onuType
is the reference to the ONU mode of operation, which can be:
- router: operates as a router only
- bridge: operates only as bridge
- dual: operates as a router and/or bridge
IMPORTANT! Not all ONUs will have the mode
parameter on onuType
getOnuUplinkInterface()
Description: Returns information regarding the uplink interface of a given ONU. If any of the input parameters is invalid, the return is false
.
Function signature:
getOnuUplinkInterface(options: <object>, slot: <number>, pon: <number>, onuId: <number>) => Promise <object>
Example:
fh.getOnuUplinkInterface(options, 11, 1, 1).then(upLink => {
console.log(upLink)
})
Output:
{
downlinkRate: 2500,
downlinkRateUnit: 'Mbit/s',
portDescription: 'PON 11/1/1',
portName: 'PON 11/1/1',
portStatus: 'enable',
portStatusValue: 1,
portType: 1,
uplinkRate: 1250,
uplinkRateUnit: 'Mbit/s'
}
getOnuWebAdmin()
Description: Returns an array of web access settings for a given ONU. If any of the input parameters is invalid, the return is false
.
Function signature:
getOnuWebAdmin(options: <object>, slot: <number>, pon: <number>, onuId: <number>) => Promise <Array>
Example:
fh.getOnuWebAdmin(options, 11, 1, 2).then(profiles => {
console.log(profiles)
})
Output:
[
{
group: 'common',
groupValue: 1,
webUsername: 'user1',
webPassword: '1111'
},
{
group: 'admin',
groupValue: 2,
webUsername: 'user2',
webPassword: '2222'
},
]
getUnauthorizedOnus()
Description: Returns an array containing all unauthorized ONUs in OLT. If unable to connect to OLT, the return is false
.
Function signature:
getUnauthorizedOnus(options: <object>) => Promise <Array>
Example:
fh.getUnauthorizedOnus(options).then(unauthOnus => {
console.log(unauthOnus)
})
Output:
[
{
index: 0,
slot: 11,
pon: 1,
macAddress: 'FHTT1231e796',
onuType: {
category: 'SFU',
code: 765,
mode: 'dual',
model: 'AN5506-04-F1',
type: 'GPON'
}
},
]
NOTE: The mode
parameter in onuType
is the reference to the ONU mode of operation, which can be:
- router: operates as a router only
- bridge: operates only as bridge
- dual: operates as a router and/or bridge
IMPORTANT! Not all ONUs will have the mode
parameter on onuType
getWan()
Description: Returns an array containing all wan profiles. To understand more about the returned parameters, see the setWan() function. If the ONU is not authorized, the return will be false
Function signature:
getWan(options: <object>, slot: <number>, pon: <number>, onuId: <number>) => Promise <Array>
Example:
fh.getWan(options, 11, 1, 1).then(wanProfiles => {
console.log(wanProfiles)
})
Output:
[
{
_wanIndex: 1,
wanName: '1_INTERNET_R_VID_2001',
wanMode: 'internet',
wanConnType: 'router',
wanVlan: 2001,
cos: null,
ipMode: 'pppoe',
pppoeMode: 'auto',
pppoeName: '',
pppoePassword: '',
pppoeProxy: false,
pppoeUsername: '',
qInQ: false,
wanIp: '0.0.0.0',
wanMask: '128.0.0.0',
wanGateway: '0.0.0.0',
wanMasterDNS: '0.0.0.0',
wanSlaveDNS: '0.0.0.0',
wanNat: true,
wanQoS: false,
lan: {
lan1: true,
lan2: true,
lan3: true,
lan4: true
},
ssid: {
ssid1: true,
ssid2: true,
ssid3: true,
ssid4: true
},
wanCos: 0,
svlan: 2000,
svlanCos: null,
tpid: 33024,
translationValue: 2000,
vlanMode: 'transparent'
},
]
parseOnuIndex()
Description: Converts a onuIndex
to slot
, pon
, and onuId
.
Function signature:
parseOnuIndex(onuIndex: <number>) => <object>
Example:
var onu = fh.parseOnuIndex(369623296)
console.log(onu)
Output:
{
_onuIndex: 369623296,
slot: 11,
pon: 1,
onuId: 1
}
setLanPorts()
Description: Configures the lan ports of a particular ONU, allowing you to add vlans as well as enable or disable the ports. Values for cvlanId
, translation.value
and vlanId
parameters must be within the range 1 to 4085. The parameter cos
must be within the range 0 to 7. If any of the input parameters is invalid, the return is false
.
Function signature:
setLanPorts(options: <object>, slot: <number>, pon: <number>, onuId: <number>, aLanPorts: <Array>) => Promise <number>
aLanPorts
parameter (basic):
aLanPorts = [
{
lanPort: <number>,
vlans: [
{
vlanMode: <string>,
cvlanId: <number>,
cos: <number>
},
]
},
]
aLanPorts
parameter (with optionals):
aLanPorts = [
{
lanPort: <number>,
enablePort: <boolean>,
clear: <boolean>,
autoNegotiation: {
auto: <boolean>,
portSpeed: <string>,
duplex: <string>
},
flowControl: <boolean>,
boardwidthSet: {
upstreamMin: <number>,
upstreamMax: <number>,
downstream: <number>
},
bandwidthSet:{
upMinGuaranteed: <number>,
upMaxAllowed: <number>,
downMinGuaranteed: <number>,
downMaxAllowed: <number>,
upstreamFixed: <number>
},
policing: {
cir: <number>,
cbs: <number>,
ebs: <number>
},
dsPolicing: {
cir: <number>,
pir: <number>
},
igmpUpCvlan: {
id: <number>,
cos: <number>,
tpId: <number>
},
igmpUpSvlan: {
id: <number>,
cos: <number>,
tpId: <number>
},
vlans: [
{
vlanMode: <string>,
cvlanId: <number>,
cos: <number>,
serviceType: <string>,
tls: <boolean>,
tpId: <number>
translation: {
value: <number>,
cos: <number>,
tpId: <number>
},
qInQ: {
serviceName: <string>,
cos: <number>,
vlanId: <number>,
tpId: <number>
}
},
]
},
]
NOTE: If the clear
parameter is set to true, all settings will be ignored if informed to a specific port. This option removes all vlans and sets the default settings. By default is false
.
Example:
fh.setLanPorts(options, 11, 1, 1, [
{
lanPort: 1,
vlans: [
{ vlanMode: 'transparent', cvlanId: 3001, serviceType: 'multicast' },
{ vlanMode: 'tag', cvlanId: 3002, cos: 3 },
]
},
{
lanPort: 3,
enablePort: false
},
{
lanPort: 4,
autoNegotiation: {
auto: false,
duplex: 'half',
portSpeed: '1000M'
},
flowControl: true,
boardwidthSet: {
upstreamMin: 600,
upstreamMax: 500000,
downstream: 500000
},
igmpUpCvlan: {
cos: 1,
id: 3001
},
igmpUpSvlan: {
cos: 2,
id: 3002
},
vlans: [
{ vlanMode: 'transparent', cvlanId: 3004, translation: { value: 3005, cos: 1 } },
{
tls: true,
qInQ: {
serviceName: 'iptv',
cos: 2
}
}
]
}
]).then(onuIndex => {
console.log(onuIndex)
})
NOTE: LAN port 2 will not be changed in the example above and LAN port 1 settings that go beyond the VLAN will not be changed either.
Output:
369623296
NOTE: If the setLanPorts() function does not identify whether the ONU is EPON or GPON, an error will be displayed and the setLanPortsEPON()
or setLanPortsGPON()
functions can be used by passing the same input parameters as the setLanPorts() function.
setOnuBandwidth()
Description: Sets the bandwidth of a given ONU. The input parameters upBw
and downBw
must be in the unit of Kbit/s and the values must be within the range 256 to 1000000. If any of the input parameters is invalid, the return is false
.
Function signature:
setOnuBandwidth(options: <object>, slot: <number>, pon: <number>, onuId: <number>, upBw: <number>, downBw: <number>) => Promise <number>
Example:
fh.setOnuBandwidth(options, 11, 1, 2, 2048, 1024).then(onuIndex => {
console.log(onuIndex)
})
Output:
369623552
setOnuWebAdmin()
Description: Set the ONU access settings via web. Returns true
on success and false
otherwise. Some ONUs only accept a single 'admin' group profile, such as AN5506-01-A1, but if more than one profile is entered, the group profile 'admin' will be set and the others will be ignored for this type of ONU. If any of the input parameters is invalid, the return is false
.
Function signature:
setOnuWebAdmin(options: <object>, slot: <number>, pon: <number>, onuId: <number>, aWebConfig: <Array>) => Promise <boolean>
Example:
fh.setOnuWebAdmin(options, 11, 1, 1, [
{username: 'user1', password: '1111', group: 'common'},
{username: 'user2', password: '2222', group: 'admin'},
{username: 'user3', password: '3333', group: 'common'}
]).then(config => {
console.log(config)
})
Output:
true
setWan()
Description: Performs the WAN settings. Values not entered in profiles
parameter will be set to false
, except for the lans
and ssids
parameters, which are all set to true by default. If any of the input parameters is invalid, the return is false
.
Function signature:
setWan(options: <object>, slot: <number>, pon: <number>, onuId: <number>, profiles: <Array>) => Promise <number>
profiles: <Array>
parameter:
var profile = {
wanMode:
wanConnType:
wanVlan:
wanCos:
wanNat:
ipMode:
wanIp:
wanMask:
wanGateway:
wanMasterDNS:
wanSlaveDNS:
pppoeProxy:
pppoeUsername:
pppoePassword:
pppoeName:
pppoeMode:
wanQoS:
vlanMode:
translationValue:
cos:
QinQ:
tpid:
svlan:
svlanCos:
lans: {
lan1:
lan2:
lan3:
lan4:
},
ssids: {
ssid1:
ssid2:
ssid3:
ssid4:
}
}
Example:
fh.setWan(options, 11, 1, 1, [
{ wanMode: 'internet', wanConnType: 'router', wanVlan: 2001, ipMode: 'pppoe', translationValue: 2000, svlan: 2000 },
{ wanMode: 'tr069', wanConnType: 'router', wanVlan: 2002, ipMode: 'dhcp', translationValue: 2000, svlan: 3000 }
]
).then(onuIndex => {
console.log(onuIndex)
})
Output:
369623296
If you need to assign different settings for some ONUs types according to the model, use the following example:
const fh = require('snmp-fiberhome')
const options = {
ip: '1.2.3.4',
community: 'default',
port: 161,
trapPort: 162
}
const Queue = require("promise-queue")
Queue.configure(require('vow').Promise)
const bridges = ['AN5506-01-A1', '...']
function example(options) {
var queue = new Queue(1, 10000)
fh.getUnauthorizedOnus(options).then(result => {
if (result.length > 0) {
console.log(`Unauthorized ONUs found: ${result.length} \nadd...`)
result.forEach(onu => {
if (bridges.includes(onu.onuType.model))
queue.add(f => fh.addOnu(options, onu,
[
{ wanMode: 'tr069', wanConnType: 'router', wanVlan: 3002, ipMode: 'dhcp', translationValue: 2000, svlan: 3000 }
],
[
{ lanPort: 1, vlans: [{ vlanMode: 'transparent', cvlanId: 2010 }] },
]
)).then(onuAuth => {
console.log('\t' + onuAuth.macAddress + ' - OK (bridge)')
})
else
queue.add(f => fh.addOnu(options, onu,
[
{ wanMode: 'internet', wanConnType: 'router', wanVlan: 2003, ipMode: 'pppoe', translationValue: 2000, svlan: 2000 },
{ wanMode: 'tr069', wanConnType: 'router', wanVlan: 2004, ipMode: 'dhcp', translationValue: 3000, svlan: 3000 }
],
[
{ lanPort: 1, vlans: [{ vlanMode: 'transparent', cvlanId: 3010 }, { vlanMode: 'tag', cvlanId: 3011, cos: 3 }] },
{ lanPort: 2, enablePort: false }
]
)).then(onuAuth => {
console.log('\t' + onuAuth.macAddress + ' - OK')
})
})
} else
console.log(`Unauthorized ONUs found: 0`)
})
}
example(options)
Tests
OLT | Status |
---|
AN5516-01 | Tested |
AN5516-06 | Tested |
AN5116 | Not implemented |
ONU | Tech | Status |
---|
AN5506-01-A1 | GPON | Tested |
AN5506-04-F1 | GPON | Tested |
- | EPON | Testing |
Bug fixes and features
Version 1.x.x of this module contains:
- Correction of parameters name 'multcast' to 'multicast'
- setLanPorts() and getLanPorts(): Added more features and changed some parameter names.
- addAllOnus(): changed some parameter names.
- addOnu(): changed some parameter names.
- enableLanPorts(): changed some parameter names.
- (version: 1.1.4)
- (version: 1.1.8)
- (version: 1.1.10)
- (version: 1.2.0)
- (version: 1.2.1)
- (version: 1.2.2)
authenticateOnu()
: Deprecated, but running for a while.- authorizeOnu(): Same functionality as
authenticateOnu()
function. - Unit testing and integration testing
- (version: 1.2.4)
- Unit tests and integration tests
- Documentation improvements
- Identify errors
- (version: 1.2.5)
- Documentation improvements
- Code improvements
- (version: 1.2.6)
- Fixed bug for COS parameter equal to zero
- (version: 1.2.7)
- getPonPort() and getPonPortList(): Added output parameters: 'slot' and 'pon'
Contributions
This module is sponsored by telecommunications company Valenet:
Help us!
Help us improve this module. If you have any information that the module does not provide or provides incompletely or incorrectly, please use our Github repository or email.
Pt-Br:
Ajude-nos a melhorar este módulo. Se você tiver alguma informação que o módulo não forneça ou forneça de maneira incompleta ou incorreta, use nosso repositório do Github ou email. Pode enviar em português Brasil também! :)
Repository: https://github.com/davibaltar/snmp-fiberhome
E-mail: davibaltar.npm@gmail.com
License
MIT License