icwmp/scripts/functions/lan_interfaces

50 lines
1.9 KiB
Bash

#!/bin/sh
# Copyright (C) 2013-2015 Inteno Broadband Technology AB
# Author Anis Ellouze <anis.ellouze@pivasoftware.com>
prefix_list="$prefix_list InternetGatewayDevice.LANInterfaces."
get_lan_ethernet_interface_number() {
local nbr=`db get hw.board.ethernetLanPorts | wc -w`
echo ${nbr:-0}
}
get_lan_wlan_configuration_number() {
local nbr=`uci show wireless |grep "wireless.@wifi-iface\[[0-9]\]\+=wifi-iface" | awk -F '[][]' '{print $2}' | wc -l`
echo ${nbr:-0}
}
get_cache_InternetGatewayDevice_LANInterfaces() {
local ei wi=0
get_object_cache_generic "InternetGatewayDevice.LANInterfaces." "0"
get_param_cache_generic "InternetGatewayDevice.LANInterfaces.LANEthernetInterfaceNumberOfEntries" "0" "get_lan_ethernet_interface_number" "" "" "xsd:unsignedInt"
get_param_cache_generic "InternetGatewayDevice.LANInterfaces.LANWLANConfigurationNumberOfEntries" "0" "get_lan_wlan_configuration_number" "" "" "xsd:unsignedInt"
get_object_cache_generic "InternetGatewayDevice.LANInterfaces.LANEthernetInterfaceConfig." "0"
for ei in `db get hw.board.ethernetLanPorts`; do
local li=${ei#eth}
get_object_cache_generic "InternetGatewayDevice.LANInterfaces.LANEthernetInterfaceConfig.$li." "0"
get_param_cache_generic "InternetGatewayDevice.LANInterfaces.LANEthernetInterfaceConfig.$li.X_INTENO_COM_EthName" "0" "echo $ei"
done
get_object_cache_generic "InternetGatewayDevice.LANInterfaces.WLANConfiguration." "0"
local nwi=`get_lan_wlan_configuration_number`
while [ $((wi++)) -lt $nwi ]; do
get_object_cache_generic "InternetGatewayDevice.LANInterfaces.WLANConfiguration.$wi." "0"
done
}
add_object_InternetGatewayDevice_LANInterfaces() {
return $FAULT_CPE_INVALID_PARAMETER_NAME
}
delete_object_InternetGatewayDevice_LANInterfaces() {
return $FAULT_CPE_INVALID_PARAMETER_NAME
}
get_dynamic_InternetGatewayDevice_LANInterfaces() {
return $FAULT_CPE_NO_FAULT
}
get_dynamic_linker_InternetGatewayDevice_LANInterfaces() {
return $FAULT_CPE_NO_FAULT
}