/[cl-snmp]/cl-snmp/test.lisp
ViewVC logotype

Contents of /cl-snmp/test.lisp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations)
Sun Aug 11 21:50:25 2002 UTC (11 years, 8 months ago) by leinen
Branch: MAIN
CVS Tags: HEAD
Changes since 1.5: +4 -4 lines
Made necessary changes to work under "modern" Lisp.
1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2 ;;; File Name: test.lisp
3 ;;; Description: SNMP tests
4 ;;; Author: Simon Leinen (simon@liasun5)
5 ;;; Date Created: 27-May-92
6 ;;; RCS $Header: /tiger/var/lib/cvsroots/cl-snmp/cl-snmp/test.lisp,v 1.6 2002/08/11 21:50:25 leinen Exp $
7 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
8
9 (defpackage :sysman
10 (:use :common-lisp :asn.1 :snmp))
11
12 (in-package :snmp)
13
14 (eval-when (eval compile load)
15 (defun generate-host-list (base number)
16 (let ((hosts '()))
17 (dotimes (index number hosts)
18 (push (format nil "~A~D" base (- number index)) hosts)))))
19
20 (defparameter testhosts
21 (append (generate-host-list "liasun" 11)
22 (generate-host-list "liasg" 4)
23 ;; (generate-host-list "masg" 35)
24 ))
25
26 (defun test ()
27 (let ((hosts testhosts)
28 (attributes '(("sysContact" 0)
29 ("sysUpTime" 0)
30 ("sysLocation" 0))))
31 (let ((oids (mapcar #'(lambda (oid)
32 (make-object-id (mib-encode-oid *mib* oid)))
33 attributes))
34 (sessions (mapcar #'(lambda (host)
35 (open-snmp-session :host host))
36 hosts))
37 (answers '()))
38 (unwind-protect
39 (dolist (session sessions (nreverse answers))
40 (push (list (udp-session-remote-host session)
41 (snmp-get session oids))
42 answers))
43 (mapcar #'close-snmp-session sessions)))))

  ViewVC Help
Powered by ViewVC 1.1.5