1%% 2%% %CopyrightBegin% 3%% 4%% Copyright Ericsson AB 1997-2016. All Rights Reserved. 5%% 6%% Licensed under the Apache License, Version 2.0 (the "License"); 7%% you may not use this file except in compliance with the License. 8%% You may obtain a copy of the License at 9%% 10%% http://www.apache.org/licenses/LICENSE-2.0 11%% 12%% Unless required by applicable law or agreed to in writing, software 13%% distributed under the License is distributed on an "AS IS" BASIS, 14%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15%% See the License for the specific language governing permissions and 16%% limitations under the License. 17%% 18%% %CopyrightEnd% 19%% 20 21-module(test2). 22 23-compile(export_all). 24 25%%----------------------------------------------------------------- 26%% Implements the Test2 MIB. Used to test processing 27%% of requests. 28%%----------------------------------------------------------------- 29tDescr(get, 2) -> 30 {noValue, noSuchName}; 31tDescr(get, 3) -> 32 {noValue, noSuchInstance}; 33tDescr(get, 4) -> 34 {noValue, noSuchObject}. 35 36tDescr(is_set_ok, "badValue", 2) -> 37 badValue; 38tDescr(is_set_ok, "inconsistentValue", 2) -> 39 inconsistentValue; 40tDescr(is_set_ok, "resourceUnavailable", 2) -> 41 resourceUnavailable; 42tDescr(is_set_ok, "inconsistentName", 2) -> 43 inconsistentName; 44tDescr(is_set_ok, "is_set_ok_fail", 2) -> 45 genErr; 46tDescr(set, "commit_fail", 2) -> 47 commitFailed. 48 49tGenErr(get, 1) -> 50 genErr; 51tGenErr(get, 2) -> 52 1=2; 53tGenErr(get, 3) -> 54 {value, "not an integer, I know"}. 55 56tInt(is_set_ok, 5, 3) -> 57 wrongValue. 58 59 60tTable(is_set_ok, [1,1], [{2, "noCreation"}]) -> 61 {noCreation, 2}; 62tTable(is_set_ok, [1,2], [{2, "inconsistentName"}]) -> 63 {inconsistentName, 2}; 64tTable(get_next, _RowIndex, Cols) -> 65 lists:map(fun(_) -> endOfTable end, Cols). 66 67%% Only 2 reqs are valid: 68%% gn([[tCnt2, 1]]) 69%% gn([[tCnt2, 2]]) 70%% ... or as: 71%% gb(0, 2,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