blob: 4a057775c71cc68de006a8682645924370ff902d [file] [log] [blame]
developer15a43312022-04-12 11:23:23 +08001#!/bin/sh
2
3####################################################################################
4# If not stated otherwise in this file or this component's Licenses.txt file the
5# following copyright and licenses apply:
6#
7# Copyright 2018 RDK Management
8#
9# Licensed under the Apache License, Version 2.0 (the "License");
10# you may not use this file except in compliance with the License.
11# You may obtain a copy of the License at
12#
13# http://www.apache.org/licenses/LICENSE-2.0
14#
15# Unless required by applicable law or agreed to in writing, software
16# distributed under the License is distributed on an "AS IS" BASIS,
17# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18# See the License for the specific language governing permissions and
19# limitations under the License.
20##################################################################################
21
22if [ -f /etc/os-release ] || [ -f /etc/device.properties ]; then
23 LOG_FOLDER="/rdklogs"
24else
25 LOG_FOLDER="/var/tmp"
26fi
27
28source /lib/rdk/t2Shared_api.sh
29
30. /etc/device.properties
31
32CONSOLEFILE="$LOG_FOLDER/logs/Consolelog.txt.0"
33
34echo_time()
35{
36 echo "`date +"%y%m%d-%T.%6N"` getPartnerId() called from: $0 - $1"
37}
38
39# Function to get partner_id
40getPartnerId()
41{
42#Get PartnerID set in the system via syscfg get command
43partner_id=`syscfg get PartnerID`
44syscfg_err=`echo $partner_id | grep -i error`
45
46#Try "dmcli" to retrieve partner_id if "sysconf" returned null. It's a fallback check.
47if [ "$partner_id" == "" ] || [ "$syscfg_err" != "" ];then
48 partner_id=`dmcli eRT getv Device.DeviceInfo.X_RDKCENTRAL-COM_Syndication.PartnerId | grep string | awk '{print $5}'`
49
50 #Check for PartnerID in device.properties if its not set already.
51 if [ "$partner_id" == "" ];then
52 if [ -f "/etc/device.properties" ];then
53# PARTNER_ID is read from etc/device.properties file
54 partner_id=`echo $PARTNER_ID`
55 if [ "$partner_id" == "" ];then
56 echo_time "partner_id is not available from syscfg.db or tr181 param or device.properties, defaulting to comcast..">>$CONSOLEFILE
57 t2CountNotify "SYS_ERROR_PartnerId_missing_sycfg"
58 echo "comcast"
59 else
60 echo_time "partner_id is not available from syscfg.db or tr181 param, value retrieved from device.properties : $partner_id">>$CONSOLEFILE
61 echo "$partner_id"
62 fi
63 else
64 echo_time "partner_id is not available, defaulting to comcast.">>$CONSOLEFILE
65 echo "comcast"
66 fi
67 else
68 echo_time "partner_id is not available from syscfg.db, value retrieved from tr181 param : $partner_id">>$CONSOLEFILE
69 echo "$partner_id"
70 fi
71else
72 echo_time "partner_id retrieved from syscfg.db : $partner_id">>$CONSOLEFILE
73 echo "$partner_id"
74fi
75}
76
77getExperience()
78{
79 echo ""
80}
81
82case=$1
83if [ "$case" = "GetPartnerID" ]; then
84 getPartnerId
85fi
86