Skip to content

Instantly share code, notes, and snippets.

@tcolgate
Created April 25, 2009 23:50
Show Gist options
  • Select an option

  • Save tcolgate/101808 to your computer and use it in GitHub Desktop.

Select an option

Save tcolgate/101808 to your computer and use it in GitHub Desktop.
(define l3list '(localhost))
(define (find-host )
(for-each
(lambda(router)
(session router
(let* ((arp (get (+ ipNetToMediaPhysAddressq
(% 2 (iid (walk vtpVlanState)))
(ip-as-oid hostip))))
(vlan (% 1 (iid arp)))
(mac (arp)))
(sesion l3-host (+ community vlan)
(let* ((interface (get (+ dot1dBasePortIfIndex
(get (+ dot1dTpFdbPor
(mac-as-oid mac))))))
(neighbour (walk (+ '(cdpCacheAddress cdpCacheAddressType)
(iid (walk pagpGroupIfIndex (pagpGroupIfIndex interface)))) ;uses a filter
(cdpCacheAddressType ipaddress)))
(port (session neighbour (+ community vlan) (get (+ ifDescr
(get (+ dot1dBasePortIfIndex
(get (+ dot1dTpFdbPort (mac-as-oid mac))))))))))
(format #t "Found ~a on ~a port ~a" hostip neighbour port)))))
l3list)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment