~ubuntu-branches/debian/squeeze/erlang/squeeze

« back to all changes in this revision

Viewing changes to lib/eva/example/README

  • Committer: Bazaar Package Importer
  • Author(s): Erlang Packagers, Sergei Golovan
  • Date: 2006-12-03 17:07:44 UTC
  • mfrom: (2.1.11 feisty)
  • Revision ID: james.westby@ubuntu.com-20061203170744-rghjwupacqlzs6kv
Tags: 1:11.b.2-4
[ Sergei Golovan ]
Fixed erlang-base and erlang-base-hipe prerm scripts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
This example directory contains an example of how the log and eva sub
2
 
applications can be combined into an ordinary application.  This
3
 
example application is called 'oms' (Operation and Maintenance
4
 
Subsystem).  The example shows how the eva & log applications can be
5
 
used with or without SNMP.
6
 
 
7
 
The directory contains the following files:
8
 
 
9
 
example/board_test_2.erl        - Code that uses eva & log functionality
10
 
       /oms/src/oms.erl       - The OMS application code (starts eva & log)
11
 
            ebin/oms.app
12
 
 
13
 
In order to start the example, you will have to:
14
 
  1) copy the files (recursively) from the example directory to your own
15
 
     directory
16
 
  2a) compile all .erl files
17
 
  2b) compile the BOARD-MIB:
18
 
       snmp:c("BOARD-MIB", [{db, mnesia}, {il, ["eva/priv/mibs"]}]).
19
 
  2c) compile oms/src/oms.erl, and put the oms.{jam.beam} file in the oms/ebin
20
 
      directory
21
 
  3) start erlang, and decide if you want to use snmp (default is true):
22
 
       erl -sname oms_test -pa oms/ebin -oms use_snmp true
23
 
  4) create mnesia schema and eva & log tables:
24
 
       mnesia:create_schema([node()]).
25
 
       application:start(mnesia).
26
 
       oms:create().
27
 
  5) If you want to use snmp, configure it:  snmp:config() and
28
 
     restart the system with -config sys
29
 
  6) Start sasl, snmp and oms:
30
 
       application:start(sasl).
31
 
       application:start(snmp).  % maybe
32
 
       application:start(oms).
33
 
 
34
 
  7) Now you can try to use the functions in eva, log and board_test,
35
 
     e.g., to initialize:
36
 
       board_test:init_test().
37
 
       board_test:init() or board_test:init_snmp()
38
 
 
39
 
The following is a transcript from a session that didn't use snmp.
40
 
It uses the simple_adaptation found in eva/examples.
41
 
 
42
 
 
43
 
(oms_test@balin)1> mnesia:create_schema([node()]).
44
 
ok
45
 
(oms_test@balin)2> application:start(mnesia).
46
 
ok
47
 
(oms_test@balin)3> oms:create().
48
 
ok
49
 
(oms_test@balin)4> application:start(sasl).
50
 
ok
51
 
(oms_test@balin)5> application:start(oms).
52
 
ok
53
 
(oms_test@balin)6> board_test:init_test().
54
 
ok
55
 
(oms_test@balin)7> board_test:init().
56
 
ok
57
 
(oms_test@balin)8> simple_adaptation:start(). 
58
 
Initializing simple EVA adaptation...
59
 
ok
60
 
(oms_test@balin)9> board_test:remove_board(1).
61
 
ok
62
 
 
63
 
** Event: boardRemoved, 1 generated
64
 
 
65
 
(oms_test@balin)10> simple_adaptation:print_alarms().
66
 
 
67
 
** Active alarm list
68
 
ok
69
 
 
70
 
(oms_test@balin)11> F1 = board_test:board_on_fire(1).
71
 
{oms_test@balin,{878,383915,155097}}
72
 
 
73
 
** minor alarm boardFailure of class equipment, 1 generated
74
 
 
75
 
(oms_test@balin)12> simple_adaptation:print_alarms().
76
 
 
77
 
** Active alarm list
78
 
        minor  equipment alarm boardFailure from {board,1}, probable cause: fire
79
 
ok
80
 
 
81
 
(oms_test@balin)13> eva:clear_alarm(F1).             
82
 
 
83
 
** Event: clear_alarm, 1 generated
84
 
ok
85
 
 
86
 
(oms_test@balin)14> F2 = board_test:board_on_fire(1).
87
 
{oms_test@balin,{878,383976,840921}}
88
 
 
89
 
** minor alarm boardFailure of class equipment, 2 generated
90
 
 
91
 
(oms_test@balin)15> F3 = board_test:board_on_fire(2).
92
 
{oms_test@balin,{878,383982,649908}}
93
 
 
94
 
** minor alarm boardFailure of class equipment, 3 generated
95
 
 
96
 
(oms_test@balin)63> simple_adaptation:print_alarms().
97
 
** Active alarm list
98
 
        minor  equipment alarm boardFailure from {board,2}, probable cause: fire
99
 
        minor  equipment alarm boardFailure from {board,1}, probable cause: fire
100
 
 
101