Uploaded image for project: 'Observium'
  1. Observium
  2. OBS-4906

CDP neighbour discovery identifies wrong remote device

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Minor
    • None
    • Professional Edition
    • Discovery
    • None

    Description

      1. If the device doesn't report the neighbour mac address in 
      cdpCacheDeviceId observium tries to identify the remote device by using cdpCacheAddress. But in situations where you have interfaces with anycast IPs (such in a EVPN-VXLAN network) get_entity_ids_ip_by_network could return multiple matches for a specific cdpCacheAddress, so there is a very high chance that get_autodiscovery_device_id selects the wrong neighbour device. cdpCachePrimaryMgmtAddr is probably more unique in the network, but there is no guarantee.
      2. The first issue can be mitigated by configuring "cdp format device-id mac-address". But at least on NXOS 10.3(4a) the mac address returned in cdpCacheDeviceId is lower case, but the regex only checks for upper case, causing observium to identify the neighbours based on IP and trigger the behaviour above.
       
      Fix for both:
      Index: includes/discovery/neighbours/cisco-cdp-mib.inc.php
      ===================================================================
      --- includes/discovery/neighbours/cisco-cdp-mib.inc.php (revision 13659)
      +++ includes/discovery/neighbours/cisco-cdp-mib.inc.php (working copy)
      @@ -69,7 +69,7 @@

               // Remote hostname
               // NOTE. cdpCacheDeviceId have undocumented limit by 40 chars!
      -        if (preg_match('/^([A-F\d]{2}\s?){6}$/', $cdp_entry['cdpCacheDeviceId'])) {
      +        if (preg_match('/^([A-Fa-z\d]{2}\s?){6}$/', $cdp_entry['cdpCacheDeviceId'])) {
                   // HEX mac address
                   // cdpCacheDeviceId.3.1 = "98 90 96 D1 59 5A "
                   $remote_hostname = $cdp_entry['cdpCacheDeviceId'];
      @@ -113,7 +113,7 @@
               }

               // Remote address
      -        $remote_address = hex2ip($cdp_entry['cdpCacheAddress']);
      +        $remote_address = hex2ip($cdp_entry['cdpCachePrimaryMgmtAddr']);

               // Last change
               /* Derp. Do not use Last change from neighbour, it's not correct for us

      Attachments

        Activity

          People

            landy Mike Stupalov
            ole.myhre Ole Myhre
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: