ponmngr: Add support for PLOAM password.

This commit is contained in:
Markus Gothe 2025-03-17 13:15:38 +01:00
parent 2a2650b43e
commit 363c2ff155
4 changed files with 49 additions and 0 deletions

View file

@ -53,6 +53,17 @@ set_serial_number() {
/userfs/bin/omcicfgCmd set sn "${vendor_id}${vssn}" /userfs/bin/omcicfgCmd set sn "${vendor_id}${vssn}"
} }
set_ploam_password() {
local passwd="$1"
local hex="$2"
if [ -z "$hex" -o "$hex" = "0" ]; then
/userfs/bin/omcicfgCmd set passwdAscii "${passwd}"
else
/userfs/bin/omcicfgCmd set passwdHex "${passwd}"
fi
}
set_equipment_id() { set_equipment_id() {
local eqid="$1" local eqid="$1"

View file

@ -16,6 +16,17 @@ set_serial_number() {
bs /b/c gpon onu_sn={vendor_id=$vendor_id,vendor_specific=$vssn} bs /b/c gpon onu_sn={vendor_id=$vendor_id,vendor_specific=$vssn}
} }
set_ploam_password() {
local passwd="$1"
local hex="$2"
if [ -z "$hex" -o "$hex" = "0" ]; then
passwd="$(echo -n "${passwd}" | hexdump -e '"%02X"' -v)"
fi
bs /b/c gpon password=${passwd}
}
set_equipment_id() { set_equipment_id() {
local equipment_id="$1" local equipment_id="$1"
[ -z "$equipment_id" ] && return [ -z "$equipment_id" ] && return

View file

@ -24,9 +24,21 @@ configure_serial_number() {
set_serial_number "${vendor_id}" "${vssn}" set_serial_number "${vendor_id}" "${vssn}"
} }
configure_ploam_password() {
local passwd="$(uci -q get xpon.ani.ploam_password)"
local hex="$(uci -q get xpon.ani.ploam_hexadecimalpassword)"
if [ -z "${passwd}" ]; then
return
fi
set_ploam_password "${passwd}" "${hex}"
}
start_service() { start_service() {
if [ "$(uci -q get xpon.ani.enable)" = "1" ]; then if [ "$(uci -q get xpon.ani.enable)" = "1" ]; then
configure_serial_number configure_serial_number
configure_ploam_password
apply_xpon_uci_config apply_xpon_uci_config
init_xpon init_xpon
else else

View file

@ -15,6 +15,19 @@ configure_serial_number() {
fi fi
} }
configure_ploam_password() {
# check if PLOAM password is present in the production data
local passwd="$(uci -q get xpon.ani.ploam_password)"
if [ -z "${passwd}" ]; then
local production_passwd="$(fw_printenv -n gponpswd)"
if [ -n ${#production_passwd} ]; then
uci set xpon.ani.ploam_password="${production_passwd}"
uci set xpon.ani.ploam_hexadecimalpassword=0
fi
fi
}
configure_loid_authentication() { configure_loid_authentication() {
local production_loid local production_loid
local production_loidpwd local production_loidpwd
@ -45,6 +58,7 @@ if [ -s "/etc/config/xpon" ]; then
if [ ${#SERIAL_NUMBER} -ne 12 ]; then if [ ${#SERIAL_NUMBER} -ne 12 ]; then
configure_serial_number configure_serial_number
fi fi
configure_ploam_password
configure_loid_authentication configure_loid_authentication
exit exit
else else
@ -56,5 +70,6 @@ touch /etc/config/xpon
uci set xpon.ani=ani uci set xpon.ani=ani
uci set xpon.ani.enable="1" uci set xpon.ani.enable="1"
configure_serial_number configure_serial_number
configure_ploam_password
configure_loid_authentication configure_loid_authentication