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

« back to all changes in this revision

Viewing changes to lib/snmp/test/snmp_test_mgr.erl

  • Committer: Bazaar Package Importer
  • Author(s): Sergei Golovan
  • Date: 2009-05-07 15:07:37 UTC
  • mfrom: (1.2.1 upstream) (5.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20090507150737-i4yb5elwinm7r0hc
Tags: 1:13.b-dfsg1-1
* Removed another bunch of non-free RFCs from original tarball
  (closes: #527053).
* Fixed build-dependencies list by adding missing comma. This requires
  libsctp-dev again. Also, added libsctp1 dependency to erlang-base and
  erlang-base-hipe packages because the shared library is loaded via
  dlopen now and cannot be added using dh_slibdeps (closes: #526682).
* Weakened dependency of erlang-webtool on erlang-observer to recommends
  to avoid circular dependencies (closes: #526627).
* Added solaris-i386 to HiPE enabled architectures.
* Made script sources in /usr/lib/erlang/erts-*/bin directory executable,
  which is more convenient if a user wants to create a target Erlang system.
* Shortened extended description line for erlang-dev package to make it
  fit 80x25 terminals.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
%%<copyright>
2
 
%% <year>1996-2007</year>
3
 
%% <holder>Ericsson AB, All Rights Reserved</holder>
4
 
%%</copyright>
5
 
%%<legalnotice>
 
1
%% 
 
2
%% %CopyrightBegin%
 
3
%% 
 
4
%% Copyright Ericsson AB 1996-2009. All Rights Reserved.
 
5
%% 
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
8
8
%% compliance with the License. You should have received a copy of the
9
9
%% Erlang Public License along with this software. If not, it can be
10
10
%% retrieved online at http://www.erlang.org/.
11
 
%%
 
11
%% 
12
12
%% Software distributed under the License is distributed on an "AS IS"
13
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
14
%% the License for the specific language governing rights and limitations
15
15
%% under the License.
16
 
%%
17
 
%% The Initial Developer of the Original Code is Ericsson AB.
18
 
%%</legalnotice>
19
 
%%
 
16
%% 
 
17
%% %CopyrightEnd%
 
18
%% 
 
19
 
20
20
-module(snmp_test_mgr).
21
21
 
22
22
%%----------------------------------------------------------------------
33
33
 
34
34
%% User interface
35
35
-export([start_link/1, start/1, stop/0, 
36
 
         d/0, g/1, s/1, gn/1, gn/0, r/0, gb/3, rpl/1,
 
36
         d/0, discovery/0, 
 
37
         g/1, s/1, gn/1, gn/0, r/0, gb/3, rpl/1,
37
38
         send_bytes/1,
38
39
         expect/2,expect/3,expect/4,expect/6,get_response/2, 
39
40
         receive_response/0,
71
72
    call(stop).
72
73
 
73
74
d() ->
 
75
    discovery().
 
76
 
 
77
discovery() ->
74
78
    call(discovery).
75
79
 
76
80
g(Oids) ->
189
193
    random:seed(A1,A2,A3),
190
194
    case (catch is_options_ok(Options)) of
191
195
        true ->
192
 
            put(debug,get_value(debug,Options,false)),
 
196
            put(debug, get_value(debug, Options, false)),
193
197
            d("init -> (~p) extract options",[self()]),
194
198
            PacksDbg    = get_value(packet_server_debug, Options, false),
195
199
            io:format("[~w] ~p -> PacksDbg: ~p~n", [?MODULE, self(), PacksDbg]),
233
237
                {Com, User, EngineId, CtxEngineId, mk_seclevel(SecLevel)},
234
238
            io:format("[~w] ~p -> VsnHdrD: ~p~n", [?MODULE, self(), VsnHdrD]),
235
239
            AgIp = case snmp_misc:assq(agent, Options) of
236
 
                       {value, Tuple4} when is_tuple(Tuple4),size(Tuple4)==4 ->
 
240
                       {value, Tuple4} when is_tuple(Tuple4) andalso 
 
241
                                            (size(Tuple4) =:= 4) ->
237
242
                           Tuple4;
238
243
                       {value, Host} when is_list(Host) ->
239
244
                           {ok, Ip} = snmp_misc:ip(Host),
481
486
%%----------------------------------------------------------------------
482
487
execute_discovery(State) ->
483
488
    Pdu   = make_discovery_pdu(),
484
 
    Reply = ?PACK_SERV:send_discovery_pdu(Pdu,State#state.packet_server),
485
 
    {Reply,State#state{last_sent_pdu = Pdu}}.
 
489
    Reply = ?PACK_SERV:send_discovery_pdu(Pdu, State#state.packet_server),
 
490
    {Reply, State#state{last_sent_pdu = Pdu}}.
486
491
 
487
492
 
488
493
execute_request(Operation, Data, State) ->
625
630
         varbinds     = Varbinds}.
626
631
 
627
632
make_discovery_pdu() ->
628
 
    make_pdu_impl(get, [?sysDescr_instance]).
 
633
    make_pdu_impl(get, []).
629
634
 
630
635
var_and_value_to_varbind({Oid, Type, Value}, MiniMIB) ->
631
636
    Oid2 = flatten_oid(Oid, MiniMIB),