View Issue Details

IDProjectCategoryView StatusLast Update
0000299easycwmpBugpublic2017-10-12 11:45
Reportersuperkid Assigned To 
PriorityhighSeveritymajorReproducibilityalways
Status newResolutionopen 
PlatformLinuxOSOpenwrtOS Versionbarrier breaker
Summary0000299: added obj/param but does not show on ACS
DescriptionI added vendor-specific object and parameters on deviceinfo
but we encountered problem like

DeviceInfo.UpTime does not appear on their ACS
some vendor-specific items isn't seen on ACS like X_STREAM_COM.IMEI and X_STREAM_COM.IMSI

is our script wrong?

I attached the script for reference
TagsNo tags attached.

Activities

superkid

2017-10-11 05:31

reporter  

device_info (9,270 bytes)   
#!/bin/sh
# Copyright (C) 2015 PIVA Software <www.pivasoftware.com>
# 	Author: MOHAMED Kallel <mohamed.kallel@pivasoftware.com>

#common_execute_method_param "$parameter" "$permission" "$get_cmd" "$set_cmd" "xsd:$type" "$forcedinform"
#  $forcedinform should be set to 1 if the parameter is included in the inform message otherwise empty
#  Default of $type = string

#############################
#   Entry point functuons   #
#############################

prefix_list="$prefix_list $DMROOT.DeviceInfo."
entry_execute_method_list="$entry_execute_method_list entry_execute_method_root_DeviceInfo"
entry_execute_method_list_forcedinform="$entry_execute_method_list_forcedinform  entry_execute_method_root_DeviceInfo"

entry_execute_method_root_DeviceInfo() {
	case "$1" in ""|"$DMROOT."|"$DMROOT.DeviceInfo."*)
		common_execute_method_obj "$DMROOT.DeviceInfo." "0"
		common_execute_method_param "$DMROOT.DeviceInfo.DeviceLog" "0" "echo `dmesg | tail -n1`"
		common_execute_method_param "$DMROOT.DeviceInfo.Manufacturer" "0" "$UCI_GET easycwmp.@device[0].manufacturer" "" "" "1"
		common_execute_method_param "$DMROOT.DeviceInfo.ManufacturerOUI" "0" "$UCI_GET easycwmp.@device[0].oui" "" "" "1"
		common_execute_method_param "$DMROOT.DeviceInfo.ProductClass" "0" "$UCI_GET easycwmp.@device[0].product_class" "" "" "1"
		common_execute_method_param "$DMROOT.DeviceInfo.ProvisioningCode" "1" "$UCI_GET easycwmp.@local[0].provisioning_code" "device_info_set_provisioningcode" "" "1"
		common_execute_method_param "$DMROOT.DeviceInfo.SerialNumber" "0" "$UCI_GET easycwmp.@device[0].serial_number" "" "" "1"
		common_execute_method_param "$DMROOT.DeviceInfo.SoftwareVersion" "0" "$UCI_GET easycwmp.@device[0].software_version" "" "" "1"
		common_execute_method_param "$DMROOT.DeviceInfo.UpTime" "0" "device_info_get_uptime" "" "xsd:unsignedInt"
		common_execute_method_obj "$DMROOT.DeviceInfo.MemoryStatus." "0"
		common_execute_method_param "$DMROOT.DeviceInfo.MemoryStatus.Total" "0" "device_info_get_total_memory"
		common_execute_method_param "$DMROOT.DeviceInfo.MemoryStatus.Free" "0" "device_info_get_free_memory"
		sub_entry_deviceinfo_vendorspecific	
		return 0;
		;;
	esac
	return $E_INVALID_PARAMETER_NAME;
}

sub_entry_deviceinfo_vendorspecific(){
	get_status_info
	get_pci_value
	common_execute_method_obj "$DMROOT.DeviceInfo.X_STREAM_COM." "0"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.ModelName" "0" "$UCI_GET easycwmp.@device[0].product_class" "" "" "1"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.IMEI" "0" "$UCI_GET easycwmp.@device[0].imei"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.IMSI" "0" "$UCI_GET easycwmp.@device[0].imsi"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.FirmwareVersion" "0" "$UCI_GET easycwmp.@device[0].firmware_version" "" "" "1"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.InnerVersion" "0" "$UCI_GET easycwmp.@device[0].inner_version" "" "" "1"	
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.APN" "0" "network_get_apn" "network_info_set easycwmp.@network[0].apn" "" "1" #read only for now
	common_execute_method_obj "$DMROOT.DeviceInfo.X_STREAM_COM.Status." "0"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.Status.RSRP" "0" "$UCI_GET easycwmp.@status[0].rsrp" "" "" "1"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.Status.RSRQ" "0" "$UCI_GET easycwmp.@status[0].rsrq" "" "" "1"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.Status.RSSI" "0" "$UCI_GET easycwmp.@status[0].rssi" "" "" "1"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.Status.SINR" "0" "$UCI_GET easycwmp.@status[0].sinr" "" "" "1"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.Status.AveSINR" "0" "$UCI_GET easycwmp.@status[0].ave_sinr" "" "" "1"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.Status.CINR" "0" "$UCI_GET easycwmp.@status[0].cinr" "" "" "1"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.Status.MaxTransmitPower" "0" "$UCI_GET easycwmp.@status[0].max_transmit_power" "" "" "1"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.Status.eNodeB_ID" "0" "$UCI_GET easycwmp.@status[0].e_nodeb_id" "" "" "1"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.Status.Cell_ID" "0" "$UCI_GET easycwmp.@status[0].cell_id" "" "" "1"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.Status.E-UTRAN" "0" "$UCI_GET easycwmp.@status[0].e_utran" "" "" "1"
	#TODO should display as read-only all possible values, this .PCI should be r/w and shows the current cell
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.PCI" "0" "$UCI_GET easycwmp.@device[0].pci" "" "" "1"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.PCIList" "1" "$UCI_GET easycwmp.@device[0].pci_list" "set_pci_list" "" "1"
	#GPS longitude/latitude and accuracy
	common_execute_method_obj "$DMROOT.DeviceInfo.X_STREAM_COM.GPS." "0"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.GPS.Longitude" "0" "$UCI_GET easycwmp.@device[0].longitude" "" "" "1"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.GPS.Latitude" "0" "$UCI_GET easycwmp.@device[0].latitude" "" "" "1"
	common_execute_method_param "$DMROOT.DeviceInfo.X_STREAM_COM.GPS.Accuracy" "0" "$UCI_GET easycwmp.@device[0].accuracy" "" "" "1"

}

#######################################
#   Data model parameters functions   #
#######################################

device_info_get_total_memory() {
		cut -d: -f 2 /proc/meminfo | head -n 1| tail -n 1 |  tr -d " kKbB"
}

device_info_get_free_memory() {
		cut -d: -f 2 /proc/meminfo | head -n 2| tail -n 1 | tr -d " kKbB" 
}

device_info_set_provisioningcode() {
	local val="$1"
	$UCI_SET easycwmp.@local[0].provisioning_code="$val"
	return 0
}

########################################
# Display Up Time in dd/hh/mm/ss
########################################
device_info_get_uptime() {
	local val=`awk -F '.' '{ print $1 }' /proc/uptime`
	display_time $val
	echo $val > /tmp/val
}

display_time() {
	local num=$1
	local sec min hour day
	day=0
	hour=0
	min=0
	sec=0
	if [ $num -ge 60 ]
	then
		sec=`expr $num % 60`
		num=`expr $num / 60`
		if [ $num -ge 60 ]
		then
			min=`expr $num % 60`
			num=`expr $num / 60`
			if [ $num -ge 24 ]
			then
				hour=`expr $num % 24`
				day=`expr $num / 24`
			else hour=$num
			fi
		else min=$num
		fi
	else sec=$num
	fi
	echo "$day"d "$hour"h "$min"m "$sec"s
}
###########################################
###### Vendor-Specific #######
###########################################
network_get_apn() {
	/usr/bin/bluestream_cwmp 2
	local val=`cat "/etc/cwmpfile" | grep "DEVICE_APN" | cut -f 2 -d '=' | sed "s/'//g"`
	[ -n "$val" ] && $UCI_SET easycwmp.@network[0].apn="$val"
	$UCI_GET easycwmp.@network[0].apn
	return 0
}

network_info_set() {
	local cfg=$1
	local val=$2
	
	$UCI_SET $cfg="$val"
	#set apn
	/usr/bin/bluestream_cwmp 3 $val
	#check this part, maybe need to call get_apn
	local new=`cat "/etc/cwmpfile" | grep "DEVICE_APN" | cut -f 2 -d '=' | sed "s/'//g"`
	[ -n "$new" ] && $UCI_SET $cfg="$new"
	return 0
}

get_status_info() {
#for service-initiated update of status
	/usr/bin/bluestream_cwmp 1 #socket client 
	local val
	val=`cat "/etc/cwmpfile" | grep "DEVICE_RSRP" | cut -f 2 -d '=' | sed "s/'//g"`
	[ -n "$val" ] && $UCI_SET easycwmp.@status[0].rsrp="$val dBm"
	val=`cat "/etc/cwmpfile" | grep "DEVICE_RSRQ" | cut -f 2 -d '=' | sed "s/'//g"`
	[ -n "$val" ] && $UCI_SET easycwmp.@status[0].rsrq="$val dB"
	val=`cat "/etc/cwmpfile" | grep "DEVICE_RSSI" | cut -f 2 -d '=' | sed "s/'//g"`
	[ -n "$val" ] && $UCI_SET easycwmp.@status[0].rssi="$val dBm"
	val=`cat "/etc/cwmpfile" | grep "DEVICE_SINR" | cut -f 2 -d '=' | sed "s/'//g"`
	[ -n "$val" ] && $UCI_SET easycwmp.@status[0].sinr="$val dB"
	val=`cat "/etc/cwmpfile" | grep "DEVICE_AVESINR" | cut -f 2 -d '=' | sed "s/'//g"`
	[ -n "$val" ] && $UCI_SET easycwmp.@status[0].ave_sinr="$val dB"
	val=`cat "/etc/cwmpfile" | grep "DEVICE_CINR" | cut -f 2 -d '=' | sed "s/'//g"`
	[ -n "$val" ] && $UCI_SET easycwmp.@status[0].cinr="$val dB"
	val=`cat "/etc/cwmpfile" | grep "DEVICE_TRANSMIT_POWER" | cut -f 2 -d '=' | sed "s/'//g"`
	[ -n "$val" ] && $UCI_SET easycwmp.@status[0].max_transmit_power="$val dBm"
	val=`cat "/etc/cwmpfile" | grep "DEVICE_E_NODEB_ID" | cut -f 2 -d '=' | sed "s/'//g"`
	[ -n "$val" ] && $UCI_SET easycwmp.@status[0].e_nodeb_id="$val"
	val=`cat "/etc/cwmpfile" | grep "DEVICE_CELL_ID" | cut -f 2 -d '=' | sed "s/'//g"`
	[ -n "$val" ] && $UCI_SET easycwmp.@status[0].cell_id="$val"
	val=`cat "/etc/cwmpfile" | grep "DEVICE_E_UTRAN" | cut -f 2 -d '=' | sed "s/'//g"`
	[ -n "$val" ] && $UCI_SET easycwmp.@status[0].e_utran="$val"
	$UCI_COMMIT easycwmp
#for service-initiated update of status
}

get_pci_value() {
	/usr/bin/bluestream_cwmp 7
	local val
	val=`cat "/etc/cwmpfile" | grep "DEVICE_PCI" | cut -f 2 -d '=' | sed "s/'//g"`
	[ -n "$val" ] && $UCI_SET easycwmp.@device[0].pci="$val"
}

set_pci_list(){
	local val="$1"
	if [ -z $val ]; then 
		return 0
	fi
	val=`echo $val | tr A-Z a-z`
	$UCI_SET easycwmp.@device[0].pci_list="$val"
	/usr/bin/bluestream_cwmp 8 $val #socket client set pci on modem
	return 0
}


###########################################
device_info (9,270 bytes)   

mohamed.kallel

2017-10-12 11:45

administrator   ~0000813

The verification of your customized work could not be done as free support of EasyCwmp.
Please refer to our commercial services.

Issue History

Date Modified Username Field Change
2017-10-11 05:31 superkid New Issue
2017-10-11 05:31 superkid File Added: device_info
2017-10-12 11:45 mohamed.kallel Note Added: 0000813