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.
7
The directory contains the following files:
9
example/board_test_2.erl - Code that uses eva & log functionality
10
/oms/src/oms.erl - The OMS application code (starts eva & log)
13
In order to start the example, you will have to:
14
1) copy the files (recursively) from the example directory to your own
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
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).
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).
34
7) Now you can try to use the functions in eva, log and board_test,
36
board_test:init_test().
37
board_test:init() or board_test:init_snmp()
39
The following is a transcript from a session that didn't use snmp.
40
It uses the simple_adaptation found in eva/examples.
43
(oms_test@balin)1> mnesia:create_schema([node()]).
45
(oms_test@balin)2> application:start(mnesia).
47
(oms_test@balin)3> oms:create().
49
(oms_test@balin)4> application:start(sasl).
51
(oms_test@balin)5> application:start(oms).
53
(oms_test@balin)6> board_test:init_test().
55
(oms_test@balin)7> board_test:init().
57
(oms_test@balin)8> simple_adaptation:start().
58
Initializing simple EVA adaptation...
60
(oms_test@balin)9> board_test:remove_board(1).
63
** Event: boardRemoved, 1 generated
65
(oms_test@balin)10> simple_adaptation:print_alarms().
70
(oms_test@balin)11> F1 = board_test:board_on_fire(1).
71
{oms_test@balin,{878,383915,155097}}
73
** minor alarm boardFailure of class equipment, 1 generated
75
(oms_test@balin)12> simple_adaptation:print_alarms().
78
minor equipment alarm boardFailure from {board,1}, probable cause: fire
81
(oms_test@balin)13> eva:clear_alarm(F1).
83
** Event: clear_alarm, 1 generated
86
(oms_test@balin)14> F2 = board_test:board_on_fire(1).
87
{oms_test@balin,{878,383976,840921}}
89
** minor alarm boardFailure of class equipment, 2 generated
91
(oms_test@balin)15> F3 = board_test:board_on_fire(2).
92
{oms_test@balin,{878,383982,649908}}
94
** minor alarm boardFailure of class equipment, 3 generated
96
(oms_test@balin)63> simple_adaptation:print_alarms().
98
minor equipment alarm boardFailure from {board,2}, probable cause: fire
99
minor equipment alarm boardFailure from {board,1}, probable cause: fire