Device name of Cisco IOSXR devices are wrongly updated
search cancel

Device name of Cisco IOSXR devices are wrongly updated

book

Article ID: 331253

calendar_today

Updated On:

Products

VMware Smart Assurance Network Observability

Issue/Introduction

Cisco IOSXR devices are getting discovered with devicename as System but Hostname is correct.
SNMP is not in use for these devices communication, only SSH/Telnet credentials are in use. 

Ex: 
DEV 1142 "System" UID="FOC" HOSTNAME="p-05.test.com" DOMAINNAME="test.com" SYSOBJECTID="NCS5500" ADDR="10.0.x.x" COMMUNITY="" RWCOMMUNITY="" PACKAGE="1265" PACKAGE_IS_SET="0" CM_MANAGED="-1" CREATE_DATE=<Date> AUTO_DISCOVERED=1

Environment

NCM - All supported releases

Resolution

Implement the below workaround in your environment:

In DS, follow the first 3 steps(a,b,c) if you don t have $VOYENCE_HOME/custompackage/cisco/iosxr directory.
If you already have the directory structure and stdfuncs.inc file at that path, take a backup of the file and skip to step d. 

a. Make a cisco directory in the custompackage directory as follows:
source /etc/voyence.conf
mkdir $VOYENCE_HOME/custompackage/cisco


b. Make a iosxr directory in the $VOYENCE_HOME/custompackage/cisco directory as follows:
mkdir $VOYENCE_HOME/custompackage/cisco/iosxr

c. Copy the stdfuncs.inc file from the package/cisco/ios directory to the custompackage/cisco/ios directory as follows:
cp $VOYENCE_HOME/package/cisco/iosxr/stdfuncs.inc $VOYENCE_HOME/custompackage/cisco/iosxr/stdfuncs.inc

d. Open stdfuncs.inc file at $VOYENCE_HOME/custompackage/cisco/iosxr directory:

Edit the below highlighted section from:
ciscoTermGetHostName(var session)
{
    if(m_showVer==0||m_showVer==""){
        m_showVer=getShowVer(session);
    }
    var hostName = trim(chomp(stdGetMatchedStrings(m_showVer,"(.*) uptime")));

    var hosts  = ciscoSendCommand(session,"show hosts"+stdEOL);
    var domain = trim(chomp(stdGetMatchedStrings(hosts,"Default domain is (.*)")));
    if( strlen(domain) > 0  &&  strfind(domain,"not set")==-1 )
        hostName += "."+domain;
    retVal = hostName;
    LOG="ciscoGetTermHostName =" + hostName;
}


To:
ciscoTermGetHostName(var session)
{
    // if(m_showVer==0||m_showVer==""){
   // m_showVer = ciscoSendCommand(session,"show version"+stdEOL);
   // }
   // var hostName = trim(chomp(stdGetMatchedStrings(m_showVer,"(.*) uptime")));
    if(m_config=="") {
        m_config=ciscoSendCommand(session,"show run"+stdEOL);
   }
    var hostName = trim(chomp(stdGetMatchedStrings(m_config,"hostname (.*)")));

    var hosts  = ciscoSendCommand(session,"show hosts"+stdEOL);
    var domain = trim(chomp(stdGetMatchedStrings(hosts,"Default domain is (.*)")));
    if( strlen(domain) > 0  &&  strfind(domain,"not set")==-1 )
        hostName += "."+domain;
    retVal = hostName;
    LOG="ciscoGetTermHostName =" + hostName;
}


Save and close the file.

e) Execute  service voyence restart .
f) Clear device cache and pull All on the device. (or)
Navigate to $VOYENCE_HOME/data/devserver/cm/cache/<deviceIDX>, delete the files SystemProperties.xml and Identity.xml and run pull selected of SystemProperties, Identity on the device. 

With this workaround, NCM is making use of entry after  hostname  string in  show run  command output of device, to retrieve the hostname.