#!/bin/sh

RC=0


#######################################################
#
# MAIN
#
#######################################################
# import common variable and functions
. /opt/rcon/bin/sshr-base

cutLog
tracef "== Start of execution (getlocpubIP) [$(/bin/date)] =="


SYSTEMTYPE=$(detectSystem)
#echo "Current system is $SYSTEMTYPE"

#Exceptions
if [ "$SYSTEMTYPE" == "host_intl" ];then
  #Exception: Platform
  #echo "Exception, system = host"
  SYS_CLAN=$(getHaFileRecord "customer-lan.ip-address")
  RC=$?
else
  #Default:Customer LAN is used for public communication
  SYS_CLANIF=$(getValue $SYSTEMTYPE custlanif)
  RES=$?
  if [ $RES -ne 0 ]; then
    RC=254
  else
    #echo "Iface for public communication is $SYS_CLANIF"
    SYS_CLAN=$(getIfaceIP $SYS_CLANIF)
    RC=$?
  fi

fi

tracef "IP for public communication is \"$SYS_CLAN\" (res=$RC)"
tracef "== End of execution (getlocpubIP) [$(/bin/date)]"
tracef "."

echo $SYS_CLAN
exit $RC 

