summaryrefslogtreecommitdiff
path: root/lib/snmp
diff options
context:
space:
mode:
authorMicael Karlberg <bmk@erlang.org>2021-09-14 15:28:48 +0200
committerMicael Karlberg <bmk@erlang.org>2021-09-14 15:28:48 +0200
commite14f51072dfcad1b6da943d985b932d71bea91b7 (patch)
tree5915f171d912c48693f27d91446ad61f7e3eb656 /lib/snmp
parent5660e960e9a1fa73d98b3aecbd24cef15fcc66c4 (diff)
parent0d33f5ab8ec9aace1885984794e5d5a0ba82bb58 (diff)
downloaderlang-e14f51072dfcad1b6da943d985b932d71bea91b7.tar.gz
Merge branch 'bmk/snmp/20210906/backward_compat_cleanup/OTP-17612'
OTP-17612
Diffstat (limited to 'lib/snmp')
-rw-r--r--lib/snmp/doc/src/snmpm.xml333
-rw-r--r--lib/snmp/src/agent/snmpa.erl15
-rw-r--r--lib/snmp/src/agent/snmpa_agent.erl242
-rw-r--r--lib/snmp/src/agent/snmpa_mib.erl24
-rw-r--r--lib/snmp/src/agent/snmpa_net_if.erl12
-rw-r--r--lib/snmp/src/agent/snmpa_trap.erl18
-rw-r--r--lib/snmp/src/manager/snmpm.erl249
-rw-r--r--lib/snmp/src/manager/snmpm_config.erl88
-rw-r--r--lib/snmp/src/manager/snmpm_server.erl212
-rw-r--r--lib/snmp/test/snmp_agent_mibs_SUITE.erl4
-rw-r--r--lib/snmp/test/snmp_manager_config_SUITE.erl28
11 files changed, 43 insertions, 1182 deletions
diff --git a/lib/snmp/doc/src/snmpm.xml b/lib/snmp/doc/src/snmpm.xml
index 7b755c457a..961702c261 100644
--- a/lib/snmp/doc/src/snmpm.xml
+++ b/lib/snmp/doc/src/snmpm.xml
@@ -4,7 +4,7 @@
<erlref>
<header>
<copyright>
- <year>2004</year><year>2020</year>
+ <year>2004</year><year>2021</year>
<holder>Ericsson AB. All Rights Reserved.</holder>
</copyright>
<legalnotice>
@@ -554,59 +554,10 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1
<p>For <c>SnmpInfo</c>, see the user callback function
<seeerl marker="snmpm_user#handle_report">handle_report</seeerl>.</p>
- <!-- <marker id="sync_get"></marker> -->
<marker id="async_get2"></marker>
</desc>
</func>
- <!-- DEPRECATED
- <func>
- <name since="">sync_get(UserId, TargetName, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <name since="">sync_get(UserId, TargetName, ContextName, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <name since="">sync_get(UserId, TargetName, Oids, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <name since="">sync_get(UserId, TargetName, ContextName, Oids, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <name since="">sync_get(UserId, TargetName, ContextName, Oids, Timeout, ExtraInfo) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <fsummary>Synchronous <c>get-request</c></fsummary>
- <type>
- <v>UserId = term()</v>
- <v>TargetName = target_name()</v>
- <v>ContextName = string()</v>
- <v>Oids = [oid()]</v>
- <v>Timeout = integer()</v>
- <v>ExtraInfo = term()</v>
- <v>SnmpReply = snmp_reply()</v>
- <v>Remaining = integer()</v>
- <v>Reason = {send_failed, ReqId, R} | {invalid_sec_info, SecInfo, SnmpInfo} | term()</v>
- <v>R = term()</v>
- <v>SecInfo = [sec_info()]</v>
- <v>sec_info() = {sec_tag(), ExpectedValue, ReceivedValue}</v>
- <v>sec_tag() = atom()</v>
- <v>ExpectedValue = ReceivedValue = term()</v>
- <v>SnmpInfo = term()</v>
- </type>
- <desc>
- <p>Synchronous <c>get-request</c>. </p>
- <p><c>Remaining</c> is the remaining time of the given or
- default timeout time.</p>
- <p>When <em>Reason</em> is <em>{send_failed, ...}</em> it means that
- the net_if process failed to send the message. This could happen
- because of any number of reasons, i.e. encoding error. <em>R</em>
- is the actual reason in this case. </p>
- <p><c>ExtraInfo</c> is an opaque data structure passed on to
- the net-if process. The net-if process included in this
- application makes, with one exception, no use of this info,
- so the only use for it in such a configuration (when using the
- built in net-if) would be tracing. The one usage exception is:
- <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
- element is reserved for internal use. </p>
- <p>For <c>SnmpInfo</c>, see the user callback function
- <seeerl marker="snmpm_user#handle_report">handle_report</seeerl>.</p>
-
- <marker id="async_get2"></marker>
- </desc>
- </func>
- -->
-
<func>
<name since="OTP R14B03">async_get2(UserId, TargetName, Oids) -> {ok, ReqId} | {error, Reason}</name>
<name since="OTP R14B03">async_get2(UserId, TargetName, Oids, SendOpts) -> {ok, ReqId} | {error, Reason}</name>
@@ -645,49 +596,10 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1
for <em>this</em> request, they override any configuration done
when the agent was registered. </p>
- <!-- <marker id="async_get"></marker> -->
<marker id="sync_get_next2"></marker>
</desc>
</func>
- <!-- DEPRECATED
- <func>
- <name since="">async_get(UserId, TargetName, Oids) -> {ok, ReqId} | {error, Reason}</name>
- <name since="">async_get(UserId, TargetName, ContextName, Oids) -> {ok, ReqId} | {error, Reason}</name>
- <name since="">async_get(UserId, TargetName, Oids, Expire) -> {ok, ReqId} | {error, Reason}</name>
- <name since="">async_get(UserId, TargetName, ContextName, Oids, Expire) -> {ok, ReqId} | {error, Reason}</name>
- <name since="">async_get(UserId, TargetName, ContextName, Oids, Expire, ExtraInfo) -> {ok, ReqId} | {error, Reason}</name>
- <fsummary>Asynchronous <c>get-request</c></fsummary>
- <type>
- <v>UserId = term()</v>
- <v>TargetName = target_name()</v>
- <v>ContextName = string()</v>
- <v>Oids = [oid()]</v>
- <v>Expire = integer()</v>
- <v>ExtraInfo = term()</v>
- <v>ReqId = term()</v>
- <v>Reason = term()</v>
- </type>
- <desc>
- <p>Asynchronous <c>get-request</c>.</p>
- <p>The reply, if it arrives, will be delivered to the user
- through a call to the snmpm_user callback function
- <c>handle_pdu</c>.</p>
- <p>The <c>Expire</c> time indicates for how long the request is
- valid (after which the manager is free to delete it).</p>
- <p><c>ExtraInfo</c> is an opaque data structure passed on to
- the net-if process. The net-if process included in this
- application makes, with one exception, no use of this info,
- so the only use for it in such a configuration (when using the
- built in net-if) would be tracing. The one usage exception is:
- <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
- element is reserved for internal use. </p>
-
- <marker id="sync_get_next2"></marker>
- </desc>
- </func>
- -->
-
<func>
<name since="OTP R14B03">sync_get_next2(UserId, TargetName, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
<name since="OTP R14B03">sync_get_next2(UserId, TargetName, Oids, SendOpts) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
@@ -738,50 +650,9 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1
<p>For <c>SnmpInfo</c>, see the user callback function
<seeerl marker="snmpm_user#handle_report">handle_report</seeerl>.</p>
- <!-- <marker id="sync_get_next"></marker> -->
- <marker id="async_get_next2"></marker>
- </desc>
- </func>
-
- <!-- DEPRECATED
- <func>
- <name since="">sync_get_next(UserId, TargetName, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <name since="">sync_get_next(UserId, TargetName, ContextName, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <name since="">sync_get_next(UserId, TargetName, Oids, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <name since="">sync_get_next(UserId, TargetName, ContextName, Oids, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <name since="">sync_get_next(UserId, TargetName, ContextName, Oids, Timeout, ExtraInfo) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <fsummary>Synchronous <c>get-next-request</c></fsummary>
- <type>
- <v>UserId = term()</v>
- <v>TargetName = target_name()</v>
- <v>ContextName = string()</v>
- <v>Oids = [oid()]</v>
- <v>Timeout = integer()</v>
- <v>ExtraInfo = term()</v>
- <v>SnmpReply = snmp_reply()</v>
- <v>Remaining = integer()</v>
- <v>Reason = {send_failed, ReqId, R} | {invalid_sec_info, SecInfo, SnmpInfo} | term()</v>
- <v>R = term()</v>
- </type>
- <desc>
- <p>Synchronous <c>get-next-request</c>. </p>
- <p><c>Remaining</c> time of the given or default timeout time.</p>
- <p>When <em>Reason</em> is <em>{send_failed, ...}</em> it means that
- the net_if process failed to send the message. This could happen
- because of any number of reasons, i.e. encoding error. <em>R</em>
- is the actual reason in this case. </p>
- <p><c>ExtraInfo</c> is an opaque data structure passed on to
- the net-if process. The net-if process included in this
- application makes, with one exception, no use of this info,
- so the only use for it in such a configuration (when using the
- built in net-if) would be tracing. The one usage exception is:
- <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
- element is reserved for internal use. </p>
-
<marker id="async_get_next2"></marker>
</desc>
</func>
- -->
<func>
<name since="OTP R14B03">async_get_next2(UserId, TargetName, Oids) -> {ok, ReqId} | {error, Reason}</name>
@@ -818,48 +689,10 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1
for <em>this</em> request, they override any configuration done
when the agent was registered. </p>
- <!-- <marker id="async_get_next"></marker> -->
<marker id="sync_set2"></marker>
</desc>
</func>
- <!-- DEPRECATED
- <func>
- <name since="">async_get_next(UserId, TargetName, Oids) -> {ok, ReqId} | {error, Reason}</name>
- <name since="">async_get_next(UserId, TargetName, ContextName, Oids) -> {ok, ReqId} | {error, Reason}</name>
- <name since="">async_get_next(UserId, TargetName, Oids, Expire) -> {ok, ReqId} | {error, Reason}</name>
- <name since="">async_get_next(UserId, TargetName, ContextName, Oids, Expire) -> {ok, ReqId} | {error, Reason}</name>
- <name since="">async_get_next(UserId, TargetName, ContextName, Oids, Expire, ExtraInfo) -> {ok, ReqId} | {error, Reason}</name>
- <fsummary>Asynchronous <c>get-next-request</c></fsummary>
- <type>
- <v>UserId = term()</v>
- <v>TargetName = target_name()</v>
- <v>ContextName = string()</v>
- <v>Oids = [oid()]</v>
- <v>Expire = integer()</v>
- <v>ExtraInfo = term()</v>
- <v>ReqId = integer()</v>
- <v>Reason = term()</v>
- </type>
- <desc>
- <p>Asynchronous <c>get-next-request</c>. </p>
- <p>The reply will be delivered to the user through a call
- to the snmpm_user callback function <c>handle_pdu</c>.</p>
- <p>The <c>Expire</c> time indicates for how long the request is
- valid (after which the manager is free to delete it).</p>
- <p><c>ExtraInfo</c> is an opaque data structure passed on to
- the net-if process. The net-if process included in this
- application makes, with one exception, no use of this info,
- so the only use for it in such a configuration (when using the
- built in net-if) would be tracing. The one usage exception is:
- <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
- element is reserved for internal use. </p>
-
- <marker id="sync_set2"></marker>
- </desc>
- </func>
- -->
-
<func>
<name since="OTP R14B03">sync_set2(UserId, TargetName, VarsAndVals) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
<name since="OTP R14B03">sync_set2(UserId, TargetName, VarsAndVals, SendOpts) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
@@ -913,52 +746,9 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1
<p>For <c>SnmpInfo</c>, see the user callback function
<seeerl marker="snmpm_user#handle_report">handle_report</seeerl>.</p>
- <!-- <marker id="sync_set"></marker> -->
- <marker id="async_set2"></marker>
- </desc>
- </func>
-
- <!-- DEPRECATED
- <func>
- <name since="">sync_set(UserId, TargetName, VarsAndVals) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <name since="">sync_set(UserId, TargetName, ContextName, VarsAndVals) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <name since="">sync_set(UserId, TargetName, VarsAndVals, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <name since="">sync_set(UserId, TargetName, ContextName, VarsAndVals, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <name since="">sync_set(UserId, TargetName, ContextName, VarsAndVals, Timeout, ExtraInfo) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <fsummary>Synchronous <c>set-request</c></fsummary>
- <type>
- <v>UserId = term()</v>
- <v>TargetName = target_name()</v>
- <v>ContextName = string()</v>
- <v>VarsAndVals = vars_and_vals()</v>
- <v>Timeout = integer()</v>
- <v>ExtraInfo = term()</v>
- <v>SnmpReply = snmp_reply()</v>
- <v>Remaining = integer()</v>
- <v>Reason = {send_failed, ReqId, ActualReason} | {invalid_sec_info, SecInfo, SnmpInfo} | term()</v>
- <v>ActualReason = term()</v>
- </type>
- <desc>
- <p>Synchronous <c>set-request</c>. </p>
- <p><c>Remaining</c> time of the given or default timeout time.</p>
- <p>When <em>Reason</em> is <em>{send_failed, ...}</em> it means that
- the net_if process failed to send the message. This could happen
- because of any number of reasons, i.e. encoding error. <em>R</em>
- is the actual reason in this case. </p>
- <p>When <em>var_and_val()</em> is <em>{oid(), value()}</em>, the
- manager makes an educated guess based on the loaded mibs. </p>
- <p><c>ExtraInfo</c> is an opaque data structure passed on to
- the net-if process. The net-if process included in this
- application makes, with one exception, no use of this info,
- so the only use for it in such a configuration (when using the
- built in net-if) would be tracing. The one usage exception is:
- <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
- element is reserved for internal use. </p>
-
<marker id="async_set2"></marker>
</desc>
</func>
- -->
<func>
<name since="OTP R14B03">async_set2(UserId, TargetName, VarsAndVals) -> {ok, ReqId} | {error, Reason}</name>
@@ -1000,48 +790,9 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1
for <em>this</em> request, they override any configuration done
when the agent was registered. </p>
- <!-- <marker id="async_set"></marker> -->
- <marker id="sync_get_bulk2"></marker>
- </desc>
- </func>
-
- <!-- DEPRECATED
- <func>
- <name since="">async_set(UserId, TargetName, VarsAndVals) -> {ok, ReqId} | {error, Reason}</name>
- <name since="">async_set(UserId, TargetName, ContextName, VarsAndVals) -> {ok, ReqId} | {error, Reason}</name>
- <name since="">async_set(UserId, TargetName, VarsAndVals, Expire) -> {ok, ReqId} | {error, Reason}</name>
- <name since="">async_set(UserId, TargetName, ContextName, VarsAndVals, Expire) -> {ok, ReqId} | {error, Reason}</name>
- <name since="">async_set(UserId, TargetName, ContextName, VarsAndVals, Expire, ExtraInfo) -> {ok, ReqId} | {error, Reason}</name>
- <fsummary>Asynchronous <c>set-request</c></fsummary>
- <type>
- <v>UserId = term()</v>
- <v>TargetName = target_name()</v>
- <v>VarsAndVals = vars_and_vals()</v>
- <v>Expire = integer()</v>
- <v>ExtraInfo = term()</v>
- <v>ReqId = term()</v>
- <v>Reason = term()</v>
- </type>
- <desc>
- <p>Asynchronous <c>set-request</c>. </p>
- <p>The reply will be delivered to the user through a call
- to the snmpm_user callback function <c>handle_pdu</c>.</p>
- <p>The <c>Expire</c> time indicates for how long the request is
- valid (after which the manager is free to delete it).</p>
- <p>When <em>var_and_val()</em> is <em>{oid(), value()}</em>, the
- manager makes an educated guess based on the loaded mibs. </p>
- <p><c>ExtraInfo</c> is an opaque data structure passed on to
- the net-if process. The net-if process included in this
- application makes, with one exception, no use of this info,
- so the only use for it in such a configuration (when using the
- built in net-if) would be tracing. The one usage exception is:
- <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
- element is reserved for internal use. </p>
-
<marker id="sync_get_bulk2"></marker>
</desc>
</func>
- -->
<func>
<name since="OTP R14B03">sync_get_bulk2(UserId, TragetName, NonRep, MaxRep, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
@@ -1095,52 +846,10 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1
<p>For <c>SnmpInfo</c>, see the user callback function
<seeerl marker="snmpm_user#handle_report">handle_report</seeerl>.</p>
- <!-- <marker id="sync_get_bulk"></marker> -->
<marker id="async_get_bulk2"></marker>
</desc>
</func>
- <!-- DEPRECATED
- <func>
- <name since="">sync_get_bulk(UserId, TragetName, NonRep, MaxRep, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <name since="">sync_get_bulk(UserId, TragetName, NonRep, MaxRep, ContextName, Oids) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <name since="">sync_get_bulk(UserId, TragetName, NonRep, MaxRep, Oids, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <name since="">sync_get_bulk(UserId, TragetName, NonRep, MaxRep, ContextName, Oids, Timeout) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <name since="">sync_get_bulk(UserId, TragetName, NonRep, MaxRep, ContextName, Oids, Timeout, ExtraInfo) -> {ok, SnmpReply, Remaining} | {error, Reason}</name>
- <fsummary>Synchronous <c>get-bulk-request</c></fsummary>
- <type>
- <v>UserId = term()</v>
- <v>TargetName = target_name()</v>
- <v>NonRep = integer()</v>
- <v>MaxRep = integer()</v>
- <v>ContextName = string()</v>
- <v>Oids = [oid()]</v>
- <v>Timeout = integer()</v>
- <v>ExtraInfo = term()</v>
- <v>SnmpReply = snmp_reply()</v>
- <v>Remaining = integer()</v>
- <v>Reason = {send_failed, ReqId, R} | {invalid_sec_info, SecInfo, SnmpInfo} | term()</v>
- </type>
- <desc>
- <p>Synchronous <c>get-bulk-request</c> (See RFC1905).</p>
- <p><c>Remaining</c> time of the given or default timeout time.</p>
- <p>When <em>Reason</em> is <em>{send_failed, ...}</em> it means that
- the net_if process failed to send the message. This could happen
- because of any number of reasons, i.e. encoding error. <em>R</em>
- is the actual reason in this case. </p>
- <p><c>ExtraInfo</c> is an opaque data structure passed on to
- the net-if process. The net-if process included in this
- application makes, with one exception, no use of this info,
- so the only use for it in such a configuration (when using the
- built in net-if) would be tracing. The one usage exception is:
- <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
- element is reserved for internal use. </p>
-
- <marker id="async_get_bulk2"></marker>
- </desc>
- </func>
- -->
-
<func>
<name since="OTP R14B03">async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids) -> {ok, ReqId} | {error, Reason}</name>
<name since="OTP R14B03">async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts) -> {ok, ReqId} | {error, Reason}</name>
@@ -1178,49 +887,9 @@ priv_key = [integer()] (length is 16 if priv = usmDESPrivProtocol | usmAesCfb1
for <em>this</em> request, they override any configuration done
when the agent was registered. </p>
- <!-- <marker id="async_get_bulk"></marker> -->
- <marker id="cancel_async_request"></marker>
- </desc>
- </func>
-
- <!-- DEPRECATED
- <func>
- <name since="">async_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids) -> {ok, ReqId} | {error, Reason}</name>
- <name since="">async_get_bulk(UserId, TargetName, NonRep, MaxRep, ContextName, Oids) -> {ok, ReqId} | {error, Reason}</name>
- <name since="">async_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids, Expire) -> {ok, ReqId} | {error, Reason}</name>
- <name since="">async_get_bulk(UserId, TargetName, NonRep, MaxRep, ContextName, Oids, Expire) -> {ok, ReqId} | {error, Reason}</name>
- <name since="">async_get_bulk(UserId, TargetName, NonRep, MaxRep, ContextName, Oids, Expire, ExtraInfo) -> {ok, ReqId} | {error, Reason}</name>
- <fsummary>Asynchronous <c>get-bulk-request</c></fsummary>
- <type>
- <v>UserId = term()</v>
- <v>TargetName = target_name()</v>
- <v>NonRep = integer()</v>
- <v>MaxRep = integer()</v>
- <v>ContextName = string()</v>
- <v>Oids = [oid()]</v>
- <v>Expire = integer()</v>
- <v>ExtraInfo = term()</v>
- <v>ReqId = integer()</v>
- <v>Reason = term()</v>
- </type>
- <desc>
- <p>Asynchronous <c>get-bulk-request</c> (See RFC1905).</p>
- <p>The reply will be delivered to the user through a call
- to the snmpm_user callback function <c>handle_pdu</c>.</p>
- <p>The <c>Expire</c> time indicates for how long the request is
- valid (after which the manager is free to delete it).</p>
- <p><c>ExtraInfo</c> is an opaque data structure passed on to
- the net-if process. The net-if process included in this
- application makes, with one exception, no use of this info,
- so the only use for it in such a configuration (when using the
- built in net-if) would be tracing. The one usage exception is:
- <em>Any</em> tuple with <c>snmpm_extra_info_tag</c> as its first
- element is reserved for internal use. </p>
-
<marker id="cancel_async_request"></marker>
</desc>
</func>
- -->
<func>
<name since="">cancel_async_request(UserId, ReqId) -> ok | {error, Reason}</name>
diff --git a/lib/snmp/src/agent/snmpa.erl b/lib/snmp/src/agent/snmpa.erl
index 995e6d627d..74205e5716 100644
--- a/lib/snmp/src/agent/snmpa.erl
+++ b/lib/snmp/src/agent/snmpa.erl
@@ -149,6 +149,11 @@
%% Options specific to the above module
-type mib_storage_options() :: list().
+-type mib_module() :: atom().
+-type table_name() :: atom().
+-type variable_name() :: atom().
+-type mib_info() :: {mib_module(), [table_name()], [variable_name()]}.
+
%%-----------------------------------------------------------------
%% This utility function is used to convert an old SNMP application
@@ -340,11 +345,11 @@ unload_mib(Agent, Mib) ->
end.
unload_mibs(Mibs) ->
- unload_mibs(snmp_master_agent, Mibs, false).
+ unload_mibs(snmp_master_agent, Mibs).
unload_mibs(Agent, Mibs) when is_list(Mibs) ->
- snmpa_agent:unload_mibs(Agent, Mibs);
+ unload_mibs(Agent, Mibs, false);
unload_mibs(Mibs, Force)
- when is_list(Mibs) andalso ((Force =:= true) orelse (Force =:= false)) ->
+ when is_list(Mibs) andalso is_boolean(Force) ->
unload_mibs(snmp_master_agent, Mibs, Force).
-spec unload_mibs(Agent :: pid() | atom(),
@@ -353,7 +358,7 @@ unload_mibs(Mibs, Force)
ok | {error, {'unload aborted at', MibName :: string(), InternalReason :: not_loaded | term()}}.
unload_mibs(Agent, Mibs, Force)
- when is_list(Mibs) andalso ((Force =:= true) orelse (Force =:= false)) ->
+ when is_list(Mibs) andalso is_boolean(Force) ->
snmpa_agent:unload_mibs(Agent, Mibs, Force).
@@ -369,6 +374,8 @@ whereis_mib(Agent, Mib) when is_atom(Mib) ->
%% -
+-spec mibs_info() -> [mib_info()].
+
mibs_info() ->
[
{snmp_standard_mib,
diff --git a/lib/snmp/src/agent/snmpa_agent.erl b/lib/snmp/src/agent/snmpa_agent.erl
index 5039b08391..48630489fa 100644
--- a/lib/snmp/src/agent/snmpa_agent.erl
+++ b/lib/snmp/src/agent/snmpa_agent.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 1996-2020. All Rights Reserved.
+%% Copyright Ericsson AB 1996-2021. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -65,18 +65,11 @@
-export([increment_counter/3]).
-export([restart_worker/1, restart_set_worker/1, restart_notif_worker/1]).
-%% For backward compatibillity
--export([send_trap/6, send_trap/7]).
-
%% Internal exports
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3, tr_var/2, tr_varbind/1,
handle_pdu/8, worker/4, worker_loop/2,
do_send_trap/7, do_send_trap/8]).
-%% <BACKWARD-COMPAT>
--export([handle_pdu/7,
- load_mibs/2, unload_mibs/2]).
-%% </BACKWARD-COMPAT>
-include("snmpa_internal.hrl").
@@ -559,21 +552,9 @@ subagent_set(SubAgent, Arguments) ->
call(SubAgent, {subagent_set, Arguments, PduData}).
-%% Called by administrator (not agent; deadlock would occur)
-%% <BACKWARD-COMPAT>
-load_mibs(Agent, Mibs) ->
- load_mibs(Agent, Mibs, false).
-%% </BACKWARD-COMPAT>
-
load_mibs(Agent, Mibs, Force) ->
call(Agent, {load_mibs, Mibs, Force}).
-%% Called by administrator (not agent; deadlock would occur)
-%% <BACKWARD-COMPAT>
-unload_mibs(Agent, Mibs) ->
- unload_mibs(Agent, Mibs, false).
-%% </BACKWARD-COMPAT>
-
unload_mibs(Agent, Mibs, Force) ->
call(Agent, {unload_mibs, Mibs, Force}).
@@ -622,51 +603,6 @@ send_notification(Agent, Notification, SendOpts) ->
Msg = {send_notif, Notification, SendOpts},
maybe_call(Agent, Msg).
-%% <BACKWARD-COMPAT>
-send_trap(Agent, Trap, NotifyName, CtxName, Recv, Varbinds) ->
- ?d("send_trap -> entry with"
- "~n self(): ~p"
- "~n Agent: ~p [~p]"
- "~n Trap: ~p"
- "~n NotifyName: ~p"
- "~n CtxName: ~p"
- "~n Recv: ~p"
- "~n Varbinds: ~p",
- [self(), Agent, wis(Agent),
- Trap, NotifyName, CtxName, Recv, Varbinds]),
- SendOpts = [
- {receiver, Recv},
- {varbinds, Varbinds},
- {name, NotifyName},
- {context, CtxName},
- {extra, ?DEFAULT_NOTIF_EXTRA_INFO}
- ],
- send_notification(Agent, Trap, SendOpts).
-
-send_trap(Agent, Trap, NotifyName, CtxName, Recv, Varbinds, LocalEngineID) ->
- ?d("send_trap -> entry with"
- "~n self(): ~p"
- "~n Agent: ~p [~p]"
- "~n Trap: ~p"
- "~n NotifyName: ~p"
- "~n CtxName: ~p"
- "~n Recv: ~p"
- "~n Varbinds: ~p"
- "~n LocalEngineID: ~p",
- [self(), Agent, wis(Agent),
- Trap, NotifyName, CtxName, Recv, Varbinds, LocalEngineID]),
- SendOpts = [
- {receiver, Recv},
- {varbinds, Varbinds},
- {name, NotifyName},
- {context, CtxName},
- {extra, ?DEFAULT_NOTIF_EXTRA_INFO},
- {local_engine_id, LocalEngineID}
- ],
- send_notification(Agent, Trap, SendOpts).
-
-%% </BACKWARD-COMPAT>
-
%% -- Discovery functions --
@@ -863,51 +799,6 @@ handle_info({send_notif, Notification, SendOpts}, S) ->
{noreply, S}
end;
-%% <BACKWARD-COMPAT>
-handle_info({send_trap, Trap, NotifyName, ContextName, Recv, Varbinds}, S) ->
- ?vlog("[handle_info] send trap request:"
- "~n Trap: ~p"
- "~n NotifyName: ~p"
- "~n ContextName: ~p"
- "~n Recv: ~p"
- "~n Varbinds: ~p",
- [Trap, NotifyName, ContextName, Recv, Varbinds]),
- ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
- LocalEngineID = local_engine_id(S),
- case (catch handle_send_trap(S, Trap, NotifyName, ContextName,
- Recv, Varbinds, LocalEngineID, ExtraInfo)) of
- {ok, NewS} ->
- {noreply, NewS};
- {'EXIT', R} ->
- ?vinfo("Trap not sent:~n ~p", [R]),
- {noreply, S};
- _ ->
- {noreply, S}
- end;
-
-handle_info({send_trap, Trap, NotifyName, ContextName, Recv, Varbinds,
- LocalEngineID}, S) ->
- ?vlog("[handle_info] send trap request:"
- "~n Trap: ~p"
- "~n NotifyName: ~p"
- "~n ContextName: ~p"
- "~n Recv: ~p"
- "~n Varbinds: ~p"
- "~n LocalEngineID: ~p",
- [Trap, NotifyName, ContextName, Recv, Varbinds, LocalEngineID]),
- ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
- case (catch handle_send_trap(S, Trap, NotifyName, ContextName,
- Recv, Varbinds, LocalEngineID, ExtraInfo)) of
- {ok, NewS} ->
- {noreply, NewS};
- {'EXIT', R} ->
- ?vinfo("Trap not sent:~n ~p", [R]),
- {noreply, S};
- _ ->
- {noreply, S}
- end;
-%% </BACKWARD-COMPAT>
-
handle_info({forward_trap, TrapRecord, NotifyName, ContextName,
Recv, Varbinds, ExtraInfo}, S) ->
?vlog("[handle_info] forward trap request:"
@@ -929,30 +820,6 @@ handle_info({forward_trap, TrapRecord, NotifyName, ContextName,
{noreply, S}
end;
-%% <BACKWARD-COMPAT>
-handle_info({forward_trap, TrapRecord, NotifyName, ContextName,
- Recv, Varbinds}, S) ->
- ?vlog("[handle_info] forward trap request:"
- "~n TrapRecord: ~p"
- "~n NotifyName: ~p"
- "~n ContextName: ~p"
- "~n Recv: ~p"
- "~n Varbinds: ~p",
- [TrapRecord, NotifyName, ContextName, Recv, Varbinds]),
- ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
- LocalEngineID = ?DEFAULT_LOCAL_ENGINE_ID,
- case (catch maybe_send_trap(S, TrapRecord, NotifyName, ContextName,
- Recv, Varbinds, LocalEngineID, ExtraInfo)) of
- {ok, NewS} ->
- {noreply, NewS};
- {'EXIT', R} ->
- ?vinfo("Trap not sent:~n ~p", [R]),
- {noreply, S};
- _ ->
- {noreply, S}
- end;
-%% </BACKWARD-COMPAT>
-
handle_info({backup_done, Reply}, #state{backup = {_, From}} = S) ->
?vlog("[handle_info] backup done:"
"~n Reply: ~p", [Reply]),
@@ -1075,55 +942,6 @@ handle_call({send_notif, Notification, SendOpts}, _From, S) ->
{reply, {error, send_failed}, S}
end;
-%% <BACKWARD-COMPAT>
-handle_call({send_trap, Trap, NotifyName, ContextName, Recv, Varbinds},
- _From, S) ->
- ?vlog("[handle_call] send trap request:"
- "~n Trap: ~p"
- "~n NotifyName: ~p"
- "~n ContextName: ~p"
- "~n Recv: ~p"
- "~n Varbinds: ~p",
- [Trap, NotifyName, ContextName, Recv, Varbinds]),
- ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
- LocalEngineID = local_engine_id(S),
- case (catch handle_send_trap(S, Trap, NotifyName, ContextName,
- Recv, Varbinds, LocalEngineID, ExtraInfo)) of
- {ok, NewS} ->
- {reply, ok, NewS};
- {'EXIT', Reason} ->
- ?vinfo("Trap not sent:~n ~p", [Reason]),
- {reply, {error, {send_failed, Reason}}, S};
- _ ->
- ?vinfo("Trap not sent", []),
- {reply, {error, send_failed}, S}
- end;
-
-handle_call({send_trap, Trap, NotifyName,
- ContextName, Recv, Varbinds, LocalEngineID},
- _From, S) ->
- ?vlog("[handle_call] send trap request:"
- "~n Trap: ~p"
- "~n NotifyName: ~p"
- "~n ContextName: ~p"
- "~n Recv: ~p"
- "~n Varbinds: ~p"
- "~n LocalEngineID: ~p",
- [Trap, NotifyName, ContextName, Recv, Varbinds, LocalEngineID]),
- ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
- case (catch handle_send_trap(S, Trap, NotifyName, ContextName,
- Recv, Varbinds, LocalEngineID, ExtraInfo)) of
- {ok, NewS} ->
- {reply, ok, NewS};
- {'EXIT', Reason} ->
- ?vinfo("Trap not sent:~n ~p", [Reason]),
- {reply, {error, {send_failed, Reason}}, S};
- _ ->
- ?vinfo("Trap not sent", []),
- {reply, {error, send_failed}, S}
- end;
-%% </BACKWARD-COMPAT>
-
handle_call({discovery,
TargetName, Notification, ContextName, Vbs, DiscoHandler,
ExtraInfo},
@@ -1262,22 +1080,10 @@ handle_call({unregister_subagent, SubTreeOid}, _From, S) ->
end,
{reply, Reply, S};
-%% <BACKWARD-COMPAT>
-handle_call({load_mibs, Mibs}, _From, S) ->
- ?vlog("load mibs ~p", [Mibs]),
- {reply, snmpa_mib:load_mibs(get(mibserver), Mibs), S};
-%% </BACKWARD-COMPAT>
-
handle_call({load_mibs, Mibs, Force}, _From, S) ->
?vlog("[~w] load mibs ~p", [Force, Mibs]),
{reply, snmpa_mib:load_mibs(get(mibserver), Mibs, Force), S};
-%% <BACKWARD-COMPAT>
-handle_call({unload_mibs, Mibs}, _From, S) ->
- ?vlog("unload mibs ~p", [Mibs]),
- {reply, snmpa_mib:unload_mibs(get(mibserver), Mibs), S};
-%% </BACKWARD-COMPAT>
-
handle_call({unload_mibs, Mibs, Force}, _From, S) ->
?vlog("[~w] unload mibs ~p", [Force, Mibs]),
{reply, snmpa_mib:unload_mibs(get(mibserver), Mibs, Force), S};
@@ -1876,46 +1682,6 @@ worker_loop(Master, Report) ->
exit(normal);
-
-
- %% *************************************************************
- %%
- %% Kept for backward compatibillity reasons
- %%
- %% *************************************************************
-
- {Vsn, Pdu, PduMS, ACMData, Address, Extra} ->
- ?vtrace("worker_loop -> received request", []),
- handle_pdu2(Vsn, Pdu, PduMS, ACMData, Address,
- ?DEFAULT_GB_MAX_VBS, Extra),
- Master ! worker_available;
-
- %% We don't trap exits!
- {TrapRec, NotifyName, ContextName, Recv, Vbs} ->
- ?vtrace("worker_loop -> send trap:"
- "~n ~p", [TrapRec]),
- snmpa_trap:send_trap(TrapRec, NotifyName,
- ContextName, Recv, Vbs, get(net_if)),
- Master ! worker_available;
-
- %% We don't trap exits!
- {send_trap,
- TrapRec, NotifyName, ContextName, Recv, Vbs, LocalEngineID,
- ExtraInfo} ->
- ?vtrace("worker_loop -> send trap:"
- "~n ~p", [TrapRec]),
- snmpa_trap:send_trap(TrapRec, NotifyName,
- ContextName, Recv, Vbs,
- LocalEngineID, ExtraInfo,
- get(net_if)),
- Master ! worker_available;
-
- {verbosity, Verbosity} ->
- put(verbosity, snmp_verbosity:validate(Verbosity));
-
- terminate ->
- exit(normal);
-
_X ->
%% ignore
ignore_unknown
@@ -1972,12 +1738,6 @@ handle_snmp_pdu(_, _Vsn, _Pdu, _PduMS, _ACMData, _Address, _Extra, S) ->
S.
-%% Called via the spawn_thread function
-%% <BACKWARD-COMPAT>
-handle_pdu(Vsn, Pdu, PduMS, ACMData, Address, Extra, Dict) ->
- handle_pdu(Vsn, Pdu, PduMS, ACMData, Address, ?DEFAULT_GB_MAX_VBS, Extra,
- Dict).
-%% </BACKWARD-COMPAT>
handle_pdu(Vsn, Pdu, PduMS, ACMData, Address, GbMaxVBs, Extra, Dict) ->
lists:foreach(fun({Key, Val}) -> put(Key, Val) end, Dict),
put(sname, pdu_handler_short_name(get(sname))),
diff --git a/lib/snmp/src/agent/snmpa_mib.erl b/lib/snmp/src/agent/snmpa_mib.erl
index 8e594213f9..5ac258b7c1 100644
--- a/lib/snmp/src/agent/snmpa_mib.erl
+++ b/lib/snmp/src/agent/snmpa_mib.erl
@@ -47,11 +47,6 @@
-export([init/1, handle_call/3, handle_cast/2, handle_info/2, terminate/2,
code_change/3]).
-%% <BACKWARD-COMPAT>
--export([load_mibs/2, unload_mibs/2]).
-%% </BACKWARD-COMPAT>
-
-
-include_lib("kernel/include/file.hrl").
-include("snmpa_internal.hrl").
-include("snmp_types.hrl").
@@ -204,11 +199,6 @@ next(MibServer, Oid, MibView) ->
%% Returns: ok | {error, Reason}
%%----------------------------------------------------------------------
-%% <BACKWARD-COMPAT>
-load_mibs(MibServer, Mibs) ->
- load_mibs(MibServer, Mibs, false).
-%% </BACKWARD-COMPAT>
-
load_mibs(MibServer, Mibs, Force) ->
call(MibServer, {load_mibs, Mibs, Force}).
@@ -219,10 +209,6 @@ load_mibs(MibServer, Mibs, Force) ->
%% Force is a boolean
%% Returns: ok | {error, Reason}
%%----------------------------------------------------------------------
-%% <BACKWARD-COMPAT>
-unload_mibs(MibServer, Mibs) ->
- unload_mibs(MibServer, Mibs, false).
-%% </BACKWARD-COMPAT>
unload_mibs(MibServer, Mibs, Force) ->
call(MibServer, {unload_mibs, Mibs, Force}).
@@ -514,11 +500,6 @@ handle_call({next, Oid, MibView}, _From,
?vdebug("next -> Reply: ~p", [Reply]),
{reply, Reply, NewState};
-%% <BACKWARD-COMPAT>
-handle_call({load_mibs, Mibs}, From, State) ->
- handle_call({load_mibs, Mibs, false}, From, State);
-%% </BACKWARD-COMPAT>
-
handle_call({load_mibs, Mibs, Force}, _From,
#state{data = Data,
teo = TeOverride,
@@ -540,11 +521,6 @@ handle_call({load_mibs, Mibs, Force}, _From,
Mod:sync(NData),
{reply, Reply, State#state{data = NData, cache = NewCache}};
-%% <BACKWARD-COMPAT>
-handle_call({unload_mibs, Mibs}, From, State) ->
- handle_call({unload_mibs, Mibs, false}, From, State);
-%% </BACKWARD-COMPAT>
-
handle_call({unload_mibs, Mibs, Force}, _From,
#state{data = Data,
teo = TeOverride,
diff --git a/lib/snmp/src/agent/snmpa_net_if.erl b/lib/snmp/src/agent/snmpa_net_if.erl
index cdb68afef4..c32d94d95a 100644
--- a/lib/snmp/src/agent/snmpa_net_if.erl
+++ b/lib/snmp/src/agent/snmpa_net_if.erl
@@ -679,18 +679,6 @@ loop(#state{transports = Transports,
loop(NewS);
%% Discovery Inform
- %% <BACKWARD-COMPAT>
- {send_discovery, Pdu, MsgData, To, From} ->
- ?vdebug("received send discovery request: "
- "~n Pdu: ~p"
- "~n To: ~p"
- "~n From: ~p",
- [Pdu, To, toname(From)]),
- NewS = handle_send_discovery(S, Pdu, MsgData, To, From),
- loop(NewS);
- %% </BACKWARD-COMPAT>
-
- %% Discovery Inform
{send_discovery, Pdu, MsgData, To, From, ExtraInfo} ->
?vdebug("received send discovery request: "
"~n Pdu: ~p"
diff --git a/lib/snmp/src/agent/snmpa_trap.erl b/lib/snmp/src/agent/snmpa_trap.erl
index 9ee854b67d..f0e1e20713 100644
--- a/lib/snmp/src/agent/snmpa_trap.erl
+++ b/lib/snmp/src/agent/snmpa_trap.erl
@@ -34,11 +34,6 @@
send_inform/6]).
-export([init_discovery_inform/13, send_discovery_inform/5]).
-%% <BACKWARD-COMPAT>
--export([send_discovery/5,
- init_discovery_inform/12]).
-%% </BACKWARD-COMPAT>
-
-include_lib("snmp/include/snmp_types.hrl").
-include_lib("snmp/src/agent/snmpa_internal.hrl").
-include_lib("snmp/include/SNMPv2-MIB.hrl").
@@ -438,9 +433,6 @@ do_send_trap(TrapRec, NotifyName, ContextName, Recv, Vbs,
send_trap_pdus(Dests, ContextName, {TrapRec, VarbindList}, [], [], [],
Recv, LocalEngineID, ExtraInfo, NetIf).
-send_discovery(TargetName, Record, ContextName, Vbs, NetIf) ->
- ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
- send_discovery(TargetName, Record, ContextName, Vbs, NetIf, ExtraInfo).
send_discovery(TargetName, Record, ContextName, Vbs, NetIf, ExtraInfo) ->
case find_dest(TargetName) of
{ok, Dest} ->
@@ -718,16 +710,6 @@ send_discovery_pdu(Record, Dest, Vbs,
init_discovery_inform(Parent,
Dest,
SecModel, SecName, SecLevel, TargetName,
- ContextName, Timeout, Retry, Vbs, NetIf, Verbosity) ->
- ExtraInfo = ?DEFAULT_NOTIF_EXTRA_INFO,
- init_discovery_inform(Parent,
- Dest,
- SecModel, SecName, SecLevel, TargetName,
- ContextName, Timeout, Retry, Vbs, NetIf,
- Verbosity, ExtraInfo).
-init_discovery_inform(Parent,
- Dest,
- SecModel, SecName, SecLevel, TargetName,
ContextName, Timeout, Retry, Vbs, NetIf,
Verbosity, ExtraInfo) ->
put(verbosity, Verbosity),
diff --git a/lib/snmp/src/manager/snmpm.erl b/lib/snmp/src/manager/snmpm.erl
index ffa6b0012c..76bea05cc9 100644
--- a/lib/snmp/src/manager/snmpm.erl
+++ b/lib/snmp/src/manager/snmpm.erl
@@ -96,18 +96,6 @@
-export([format_reason/1, format_reason/2]).
-%% Backward compatibility exports (API version "2")
--export([
- sync_get/3, sync_get/4, sync_get/5, sync_get/6,
- async_get/3, async_get/4, async_get/5, async_get/6,
- sync_get_next/3, sync_get_next/4, sync_get_next/5, sync_get_next/6,
- async_get_next/3, async_get_next/4, async_get_next/5, async_get_next/6,
- sync_set/3, sync_set/4, sync_set/5, sync_set/6,
- async_set/3, async_set/4, async_set/5, async_set/6,
- sync_get_bulk/5, sync_get_bulk/6, sync_get_bulk/7, sync_get_bulk/8,
- async_get_bulk/5, async_get_bulk/6, async_get_bulk/7, async_get_bulk/8
- ]).
-
%% Application internal export
-export([start_link/3, snmpm_start_verify/2, snmpm_start_verify/3]).
-export([target_name/1, target_name/2]).
@@ -119,49 +107,6 @@
]).
--deprecated(
- [
- {sync_get, 3, "use snmpm:sync_get2/3 instead."},
- {sync_get, 4, "use snmpm:sync_get2/4 instead."},
- {sync_get, 5, "use snmpm:sync_get2/4 instead."},
- {sync_get, 6, "use snmpm:sync_get2/4 instead."},
-
- {async_get, 3, "use snmpm:async_get2/3 instead."},
- {async_get, 4, "use snmpm:async_get2/4 instead."},
- {async_get, 5, "use snmpm:async_get2/4 instead."},
- {async_get, 6, "use snmpm:async_get2/4 instead."},
-
- {sync_get_next, 3, "use snmpm:sync_get_next2/3 instead."},
- {sync_get_next, 4, "use snmpm:sync_get_next2/4 instead."},
- {sync_get_next, 5, "use snmpm:sync_get_next2/4 instead."},
- {sync_get_next, 6, "use snmpm:sync_get_next2/4 instead."},
-
- {async_get_next, 3, "use snmpm:async_get_next2/3 instead."},
- {async_get_next, 4, "use snmpm:async_get_next2/4 instead."},
- {async_get_next, 5, "use snmpm:async_get_next2/4 instead."},
- {async_get_next, 6, "use snmpm:async_get_next2/4 instead."},
-
- {sync_set, 3, "use snmpm:sync_set2/3 instead."},
- {sync_set, 4, "use snmpm:sync_set2/4 instead."},
- {sync_set, 5, "use snmpm:sync_set2/4 instead."},
- {sync_set, 6, "use snmpm:sync_set2/4 instead."},
-
- {async_set, 3, "use snmpm:async_set2/3 instead."},
- {async_set, 4, "use snmpm:async_set2/4 instead."},
- {async_set, 5, "use snmpm:async_set2/4 instead."},
- {async_set, 6, "use snmpm:async_set2/4 instead."},
-
- {sync_get_bulk, 5, "use snmpm:sync_get_bulk2/5 instead."},
- {sync_get_bulk, 6, "use snmpm:sync_get_bulk2/6 instead."},
- {sync_get_bulk, 7, "use snmpm:sync_get_bulk2/6 instead."},
- {sync_get_bulk, 8, "use snmpm:sync_get_bulk2/6 instead."},
-
- {async_get_bulk, 5, "use snmpm:async_get_bulk2/5 instead."},
- {async_get_bulk, 6, "use snmpm:async_get_bulk2/6 instead."},
- {async_get_bulk, 7, "use snmpm:async_get_bulk2/6 instead."},
- {async_get_bulk, 8, "use snmpm:async_get_bulk2/6 instead."}
- ]).
-
-include_lib("snmp/src/misc/snmp_debug.hrl").
-include_lib("snmp/include/snmp_types.hrl").
-include("snmpm_atl.hrl").
@@ -206,14 +151,14 @@ simple_conf() ->
{ok, _} ->
ok;
_ ->
- ok = snmp_config:write_manager_config(Cwd, "",
+ ok = snmp_config:write_manager_config(Cwd, "",
[{port, 5000},
{engine_id, "mgrEngine"},
{max_message_size, 484}])
end,
Conf = [{dir, Cwd}, {db_dir, Cwd}],
[{versions, Vsns}, {config, Conf}].
-
+
%% Simple start. Start a manager with default values.
start_link() ->
start_link(simple_conf()).
@@ -559,29 +504,6 @@ sync_get2(UserId, TargetName, Oids, SendOpts)
when is_list(Oids) andalso is_list(SendOpts) ->
snmpm_server:sync_get(UserId, TargetName, Oids, SendOpts).
-%% <BACKWARD-COMPAT>
-sync_get(UserId, TargetName, Oids) ->
- sync_get2(UserId, TargetName, Oids).
-
-sync_get(UserId, TargetName, Oids, Timeout)
- when is_list(Oids) andalso is_integer(Timeout) ->
- SendOpts = [{timeout, Timeout}],
- sync_get2(UserId, TargetName, Oids, SendOpts);
-sync_get(UserId, TargetName, Context, [OH|_] = Oids)
- when is_list(Context) andalso is_list(OH) ->
- SendOpts = [{context, Context}],
- sync_get2(UserId, TargetName, Oids, SendOpts).
-
-sync_get(UserId, TargetName, Context, Oids, Timeout) ->
- SendOpts = [{context, Context}, {timeout, Timeout}],
- sync_get2(UserId, TargetName, Oids, SendOpts).
-
-sync_get(UserId, TargetName, Context, Oids, Timeout, ExtraInfo) ->
- SendOpts = [{context, Context}, {timeout, Timeout}, {extra, ExtraInfo}],
- sync_get2(UserId, TargetName, Oids, SendOpts).
-%% </BACKWARD-COMPAT>
-
-
%% --- asynchronous get-request ---
%%
@@ -596,27 +518,6 @@ async_get2(UserId, TargetName, Oids, SendOpts)
when is_list(Oids) andalso is_list(SendOpts) ->
snmpm_server:async_get(UserId, TargetName, Oids, SendOpts).
-%% <BACKWARD-COMPAT>
-async_get(UserId, TargetName, Oids) ->
- async_get2(UserId, TargetName, Oids).
-
-async_get(UserId, TargetName, Oids, Expire) when is_integer(Expire) ->
- SendOpts = [{timeout, Expire}],
- async_get2(UserId, TargetName, Oids, SendOpts);
-async_get(UserId, TargetName, Context, Oids)
- when is_list(Context) andalso is_list(Oids) ->
- SendOpts = [{context, Context}],
- async_get2(UserId, TargetName, Oids, SendOpts).
-
-async_get(UserId, TargetName, Context, Oids, Expire) ->
- SendOpts = [{timeout, Expire}, {context, Context}],
- async_get2(UserId, TargetName, Oids, SendOpts).
-
-async_get(UserId, TargetName, Context, Oids, Expire, ExtraInfo) ->
- SendOpts = [{timeout, Expire}, {context, Context}, {extra, ExtraInfo}],
- async_get2(UserId, TargetName, Oids, SendOpts).
-%% </BACKWARD-COMPAT>
-
%% --- synchroneous get_next-request ---
%%
@@ -628,28 +529,6 @@ sync_get_next2(UserId, TargetName, Oids, SendOpts)
when is_list(Oids) andalso is_list(SendOpts) ->
snmpm_server:sync_get_next(UserId, TargetName, Oids, SendOpts).
-%% <BACKWARD-COMPAT>
-sync_get_next(UserId, TargetName, Oids) ->
- sync_get_next2(UserId, TargetName, Oids).
-
-sync_get_next(UserId, TargetName, Oids, Timeout)
- when is_list(Oids) andalso is_integer(Timeout) ->
- SendOpts = [{timeout, Timeout}],
- sync_get_next2(UserId, TargetName, Oids, SendOpts);
-sync_get_next(UserId, TargetName, Context, Oids)
- when is_list(Context) andalso is_list(Oids) ->
- SendOpts = [{context, Context}],
- sync_get_next2(UserId, TargetName, Oids, SendOpts).
-
-sync_get_next(UserId, TargetName, Context, Oids, Timeout) ->
- SendOpts = [{timeout, Timeout}, {context, Context}],
- sync_get_next2(UserId, TargetName, Oids, SendOpts).
-
-sync_get_next(UserId, TargetName, Context, Oids, Timeout, ExtraInfo) ->
- SendOpts = [{timeout, Timeout}, {context, Context}, {extra, ExtraInfo}],
- sync_get_next2(UserId, TargetName, Oids, SendOpts).
-%% </BACKWARD-COMPAT>
-
%% --- asynchronous get_next-request ---
%%
@@ -661,28 +540,6 @@ async_get_next2(UserId, TargetName, Oids, SendOpts)
when is_list(Oids) andalso is_list(SendOpts) ->
snmpm_server:async_get_next(UserId, TargetName, Oids, SendOpts).
-%% <BACKWARD-COMPAT>
-async_get_next(UserId, TargetName, Oids) ->
- async_get_next2(UserId, TargetName, Oids).
-
-async_get_next(UserId, TargetName, Oids, Expire)
- when is_list(Oids) andalso is_integer(Expire) ->
- SendOpts = [{timeout, Expire}],
- async_get_next2(UserId, TargetName, Oids, SendOpts);
-async_get_next(UserId, TargetName, Context, Oids)
- when is_list(Context) andalso is_list(Oids) ->
- SendOpts = [{context, Context}],
- async_get_next2(UserId, TargetName, Oids, SendOpts).
-
-async_get_next(UserId, TargetName, Context, Oids, Expire) ->
- SendOpts = [{timeout, Expire}, {context, Context}],
- async_get_next2(UserId, TargetName, Oids, SendOpts).
-
-async_get_next(UserId, TargetName, Context, Oids, Expire, ExtraInfo) ->
- SendOpts = [{timeout, Expire}, {context, Context}, {extra, ExtraInfo}],
- async_get_next2(UserId, TargetName, Oids, SendOpts).
-%% </BACKWARD-COMPAT>
-
%% --- synchroneous set-request ---
%%
@@ -694,28 +551,6 @@ sync_set2(UserId, TargetName, VarsAndVals, SendOpts)
when is_list(VarsAndVals) andalso is_list(SendOpts) ->
snmpm_server:sync_set(UserId, TargetName, VarsAndVals, SendOpts).
-%% <BACKWARD-COMPAT>
-sync_set(UserId, TargetName, VarsAndVals) ->
- sync_set2(UserId, TargetName, VarsAndVals).
-
-sync_set(UserId, TargetName, VarsAndVals, Timeout)
- when is_list(VarsAndVals) andalso is_integer(Timeout) ->
- SendOpts = [{timeout, Timeout}],
- sync_set2(UserId, TargetName, VarsAndVals, SendOpts);
-sync_set(UserId, TargetName, Context, VarsAndVals)
- when is_list(Context) andalso is_list(VarsAndVals) ->
- SendOpts = [{context, Context}],
- sync_set2(UserId, TargetName, VarsAndVals, SendOpts).
-
-sync_set(UserId, TargetName, Context, VarsAndVals, Timeout) ->
- SendOpts = [{timeout, Timeout}, {context, Context}],
- sync_set2(UserId, TargetName, VarsAndVals, SendOpts).
-
-sync_set(UserId, TargetName, Context, VarsAndVals, Timeout, ExtraInfo) ->
- SendOpts = [{timeout, Timeout}, {context, Context}, {extra, ExtraInfo}],
- sync_set2(UserId, TargetName, VarsAndVals, SendOpts).
-%% </BACKWARD-COMPAT>
-
%% --- asynchronous set-request ---
%%
@@ -727,28 +562,6 @@ async_set2(UserId, TargetName, VarsAndVals, SendOpts)
when is_list(VarsAndVals) andalso is_list(SendOpts) ->
snmpm_server:async_set(UserId, TargetName, VarsAndVals, SendOpts).
-%% <BACKWARD-COMPAT>
-async_set(UserId, TargetName, VarsAndVals) ->
- async_set2(UserId, TargetName, VarsAndVals).
-
-async_set(UserId, TargetName, VarsAndVals, Expire)
- when is_list(VarsAndVals) andalso is_integer(Expire) ->
- SendOpts = [{timeout, Expire}],
- async_set2(UserId, TargetName, VarsAndVals, SendOpts);
-async_set(UserId, TargetName, Context, VarsAndVals)
- when is_list(Context) andalso is_list(VarsAndVals) ->
- SendOpts = [{context, Context}],
- async_set2(UserId, TargetName, VarsAndVals, SendOpts).
-
-async_set(UserId, TargetName, Context, VarsAndVals, Expire) ->
- SendOpts = [{timeout, Expire}, {context, Context}],
- async_set2(UserId, TargetName, VarsAndVals, SendOpts).
-
-async_set(UserId, TargetName, Context, VarsAndVals, Expire, ExtraInfo) ->
- SendOpts = [{timeout, Expire}, {context, Context}, {extra, ExtraInfo}],
- async_set2(UserId, TargetName, VarsAndVals, SendOpts).
-%% </BACKWARD-COMPAT>
-
%% --- synchroneous get-bulk ---
%%
@@ -764,35 +577,6 @@ sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts)
snmpm_server:sync_get_bulk(UserId, TargetName,
NonRep, MaxRep, Oids, SendOpts).
-%% <BACKWARD-COMPAT>
-sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids) ->
- sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids).
-
-sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids, Timeout)
- when is_integer(NonRep) andalso
- is_integer(MaxRep) andalso
- is_list(Oids) andalso
- is_integer(Timeout) ->
- SendOpts = [{timeout, Timeout}],
- sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts);
-sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids)
- when is_integer(NonRep) andalso
- is_integer(MaxRep) andalso
- is_list(Context) andalso
- is_list(Oids) ->
- SendOpts = [{context, Context}],
- sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts).
-
-sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids, Timeout) ->
- SendOpts = [{timeout, Timeout}, {context, Context}],
- sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts).
-
-sync_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids, Timeout,
- ExtraInfo) ->
- SendOpts = [{timeout, Timeout}, {context, Context}, {extra, ExtraInfo}],
- sync_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts).
-%% </BACKWARD-COMPAT>
-
%% --- asynchronous get-bulk ---
%%
@@ -808,35 +592,6 @@ async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts)
snmpm_server:async_get_bulk(UserId, TargetName,
NonRep, MaxRep, Oids, SendOpts).
-%% <BACKWARD-COMPAT>
-async_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids) ->
- async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids).
-
-async_get_bulk(UserId, TargetName, NonRep, MaxRep, Oids, Expire)
- when is_integer(NonRep) andalso
- is_integer(MaxRep) andalso
- is_list(Oids) andalso
- is_integer(Expire) ->
- SendOpts = [{timeout, Expire}],
- async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts);
-async_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids)
- when is_integer(NonRep) andalso
- is_integer(MaxRep) andalso
- is_list(Context) andalso
- is_list(Oids) ->
- SendOpts = [{context, Context}],
- async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts).
-
-async_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids, Expire) ->
- SendOpts = [{timeout, Expire}, {context, Context}],
- async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts).
-
-async_get_bulk(UserId, TargetName, NonRep, MaxRep, Context, Oids, Expire,
- ExtraInfo) ->
- SendOpts = [{timeout, Expire}, {context, Context}, {extra, ExtraInfo}],
- async_get_bulk2(UserId, TargetName, NonRep, MaxRep, Oids, SendOpts).
-%% </BACKWARD-COMPAT>
-
cancel_async_request(UserId, ReqId) ->
diff --git a/lib/snmp/src/manager/snmpm_config.erl b/lib/snmp/src/manager/snmpm_config.erl
index 356ba44b08..06457d9167 100644
--- a/lib/snmp/src/manager/snmpm_config.erl
+++ b/lib/snmp/src/manager/snmpm_config.erl
@@ -38,7 +38,7 @@
register_agent/3, unregister_agent/2,
agent_info/0, agent_info/2, agent_info/3,
- update_agent_info/3, update_agent_info/4,
+ update_agent_info/3,
which_agents/0, which_agents/1,
is_known_engine_id/2,
@@ -94,9 +94,7 @@
%% Backward compatibillity exports
-export([
- register_user/3,
unregister_agent/3,
- update_agent_info/5,
is_known_engine_id/3,
get_agent_engine_id/2,
get_agent_engine_max_message_size/2,
@@ -109,12 +107,15 @@
check_manager_config/2,
check_user_config/1,
check_agent_config/1,
- check_usm_user_config/1]).
+ check_usm_user_config/1
+ ]).
%% gen_server callbacks
--export([init/1, handle_call/3, handle_cast/2, handle_info/2,
- code_change/3, terminate/2]).
+-export([
+ init/1, handle_call/3, handle_cast/2, handle_info/2,
+ code_change/3, terminate/2
+ ]).
%% Includes:
@@ -191,10 +192,6 @@ is_started() ->
backup(BackupDir) when is_list(BackupDir) ->
call({backup, BackupDir}).
-%% Backward compatibillity
-register_user(UserId, UserMod, UserData) ->
- register_user(UserId, UserMod, UserData, []).
-
register_user(UserId, UserMod, UserData, DefaultAgentConfig)
when (UserId =/= ?DEFAULT_USER) andalso is_list(DefaultAgentConfig) ->
case (catch verify_user_behaviour(UserMod)) of
@@ -214,20 +211,6 @@ register_user(UserId, _UserMod, _UserData, DefaultAgentConfig)
register_user(UserId, _, _, _) ->
{error, {bad_user_id, UserId}}.
-%% default_agent_config(DefaultAgentConfig) ->
-%% {ok, SystemDefaultAgentConfig} = agent_info(),
-%% default_agent_config(SystemDefaultAgentConfig, DefaultAgentConfig).
-
-%% default_agent_config([], DefaultAgentConfig) ->
-%% DefaultAgentConfig;
-%% default_agent_config([{Key, _} = Entry|T], DefaultAgentConfig) ->
-%% case lists:keymember(Key, 1, DefaultAgentConfig) of
-%% true ->
-%% default_agent_config(T, DefaultAgentConfig);
-%% false ->
-%% default_agent_config(T, [Entry|DefaultAgentConfig])
-%% end.
-
verify_user_behaviour(UserMod) ->
case snmp_misc:verify_behaviour(snmpm_user, UserMod) of
@@ -546,23 +529,6 @@ which_agents(UserId) ->
update_agent_info(UserId, TargetName, Info) ->
call({update_agent_info, UserId, TargetName, Info}).
-%% <BACKWARD-COMPAT-2>
-%% This is wrapped in the interface module, so this function is
-%% only here to catch code-upgrade problems.
-update_agent_info(UserId, TargetName, Item, Val) ->
- update_agent_info(UserId, TargetName, [{Item, Val}]).
-%% </BACKWARD-COMPAT-2>
-
-%% <BACKWARD-COMPAT-1>
-update_agent_info(UserId, Addr, Port, Item, Val) ->
- case agent_info(Addr, Port, target_name) of
- {ok, TargetName} ->
- update_agent_info(UserId, TargetName, Item, Val);
- Error ->
- Error
- end.
-%% </BACKWARD-COMPAT-1>
-
is_known_engine_id(EngineID, TargetName) ->
case agent_info(TargetName, engine_id) of
{ok, EngineID} ->
@@ -2444,18 +2410,6 @@ handle_call({update_agent_info, UserId, TargetName, Info},
Reply = handle_update_agent_info(UserId, TargetName, Info),
{reply, Reply, State};
-%% <BACKWARD-COMPAT>
-handle_call({update_agent_info, UserId, TargetName, Item, Val},
- _From, State) ->
- ?vlog("received update_agent_info request: "
- "~n UserId: ~p"
- "~n TargetName: ~p"
- "~n Item: ~p"
- "~n Val: ~p", [UserId, TargetName, Item, Val]),
- Reply = handle_update_agent_info(UserId, TargetName, Item, Val),
- {reply, Reply, State};
-%% </BACKWARD-COMPAT>
-
handle_call({register_usm_user, User}, _From, State) ->
?vlog("received register_usm_user request: "
"~n User: ~p", [User]),
@@ -2828,6 +2782,7 @@ handle_register_agent(UserId, TargetName, Config) ->
" FixedConfig: ~p", [FixedConfig]),
do_handle_register_agent(
TargetName, [{user_id, UserId}|FixedConfig]),
+
%% <DIRTY-BACKWARD-COMPATIBILLITY>
%% And now for some (backward compatibillity)
%% dirty crossref stuff
@@ -2841,25 +2796,6 @@ handle_register_agent(UserId, TargetName, Config) ->
{{Domain, Address, target_name}, TargetName}),
%% </DIRTY-BACKWARD-COMPATIBILLITY>
-%% %% First, insert this users default config
-%% ?vtrace("handle_register_agent -> store default config", []),
-%% do_handle_register_agent(TargetName, DefConfig),
-%% %% Second, insert the config for this agent
-%% ?vtrace("handle_register_agent -> store config", []),
-%% do_handle_register_agent(TargetName,
-%% [{user_id, UserId}|Config]),
-%% %% <DIRTY-BACKWARD-COMPATIBILLITY>
-%% %% And now for some (backward compatibillity)
-%% %% dirty crossref stuff
-%% ?vtrace("handle_register_agent -> lookup taddress", []),
-%% {ok, {Addr, Port} = TAddress} =
-%% agent_info(TargetName, taddress),
-%% ?vtrace("handle_register_agent -> taddress: ~p",
-%% [TAddress]),
-%% ?vtrace("handle_register_agent -> register cross-ref fix", []),
-%% ets:insert(snmpm_agent_table,
-%% {{Addr, Port, target_name}, TargetName}),
-%% %% </DIRTY-BACKWARD-COMPATIBILLITY>
ok;
_ ->
{error, {not_found, UserId}}
@@ -2964,14 +2900,6 @@ handle_update_agent_info(TargetName, Info) ->
{error, {failed_info_verification, Info, T, E}}
end.
-handle_update_agent_info(UserId, TargetName, Item, Val) ->
- ?vdebug("handle_update_agent_info -> entry with"
- "~n UserId: ~p"
- "~n TargetName: ~p"
- "~n Item: ~p"
- "~n Val: ~p", [UserId, TargetName, Item, Val]),
- handle_update_agent_info(TargetName, [{Item, Val}]).
-
do_update_agent_info(TargetName, Info) ->
?vtrace("do_update_agent_info -> entry with~n"
" TargetName: ~p~n"
diff --git a/lib/snmp/src/manager/snmpm_server.erl b/lib/snmp/src/manager/snmpm_server.erl
index ca18637b8d..07c3a335d8 100644
--- a/lib/snmp/src/manager/snmpm_server.erl
+++ b/lib/snmp/src/manager/snmpm_server.erl
@@ -571,24 +571,6 @@ handle_call({sync_get, Pid, UserId, TargetName, Oids, SendOpts},
{reply, Error, State}
end;
-%% <BACKWARD-COMPAT>
-%% The only case where this would be called is during code upgrade
-handle_call({sync_get,
- Pid, UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo},
- From, State) ->
- ?vlog("[~p,~p,~p] received sync_get request for: "
- "~n ~p", [UserId, TargetName, CtxName, Oids]),
- case (catch handle_sync_get(Pid,
- UserId, TargetName, CtxName, Oids,
- Timeout, ExtraInfo, From, State)) of
- ok ->
- {noreply, State};
- Error ->
- {reply, Error, State}
- end;
-%% </BACKWARD-COMPAT>
-
-
handle_call({sync_get_next, Pid, UserId, TargetName, Oids, SendOpts},
From, State) ->
?vlog("[~p,~p] received sync_get_next request for: "
@@ -603,24 +585,6 @@ handle_call({sync_get_next, Pid, UserId, TargetName, Oids, SendOpts},
end;
-%% <BACKWARD-COMPAT>
-%% The only case where this would be called is during code upgrade
-handle_call({sync_get_next,
- Pid, UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo},
- From, State) ->
- ?vlog("[~p,~p,~p] received sync_get_next request for"
- "~n ~p", [UserId, TargetName, CtxName, Oids]),
- case (catch handle_sync_get_next(Pid,
- UserId, TargetName, CtxName, Oids,
- Timeout, ExtraInfo, From, State)) of
- ok ->
- {noreply, State};
- Error ->
- {reply, Error, State}
- end;
-%% </BACKWARD-COMPAT>
-
-
%% Check agent version? This op not in v1
handle_call({sync_get_bulk,
Pid, UserId, TargetName, NonRep, MaxRep, Oids, SendOpts},
@@ -636,24 +600,6 @@ handle_call({sync_get_bulk,
{reply, Error, State}
end;
-%% <BACKWARD-COMPAT>
-%% The only case where this would be called is during code upgrade
-handle_call({sync_get_bulk, Pid, UserId, TargetName,
- NonRep, MaxRep, CtxName, Oids, Timeout, ExtraInfo},
- From, State) ->
- ?vlog("[~p,~p] received sync_get_bulk request for: ~p"
- "~n ~p", [UserId, TargetName, CtxName, Oids]),
- case (catch handle_sync_get_bulk(Pid,
- UserId, TargetName, CtxName,
- NonRep, MaxRep, Oids,
- Timeout, ExtraInfo, From, State)) of
- ok ->
- {noreply, State};
- Error ->
- {reply, Error, State}
- end;
-%% </BACKWARD-COMPAT>
-
handle_call({sync_set,
Pid, UserId, TargetName, VarsAndVals, SendOpts},
@@ -670,24 +616,6 @@ handle_call({sync_set,
end;
-%% <BACKWARD-COMPAT>
-%% The only case where this would be called is during code upgrade
-handle_call({sync_set, Pid, UserId, TargetName,
- CtxName, VarsAndVals, Timeout, ExtraInfo},
- From, State) ->
- ?vlog("[~p,~p,~p] received sync_set request for: "
- "~n ~p", [UserId, TargetName, CtxName, VarsAndVals]),
- case (catch handle_sync_set(Pid,
- UserId, TargetName, CtxName, VarsAndVals,
- Timeout, ExtraInfo, From, State)) of
- ok ->
- {noreply, State};
- Error ->
- {reply, Error, State}
- end;
-%% </BACKWARD-COMPAT>
-
-
handle_call({async_get, Pid, UserId, TargetName, Oids, SendOpts},
_From, State) ->
?vlog("[~p,~p] received async_get request for: "
@@ -698,19 +626,6 @@ handle_call({async_get, Pid, UserId, TargetName, Oids, SendOpts},
{reply, Reply, State};
-%% <BACKWARD-COMPAT>
-%% The only case where this would be called is during code upgrade
-handle_call({async_get, Pid, UserId, TargetName,
- CtxName, Oids, Expire, ExtraInfo},
- _From, State) ->
- ?vlog("[~p,~p,~p] received async_get request for: "
- "~n ~p", [UserId, TargetName, CtxName, Oids]),
- Reply = (catch handle_async_get(Pid, UserId, TargetName, CtxName, Oids,
- Expire, ExtraInfo, State)),
- {reply, Reply, State};
-%% </BACKWARD-COMPAT>
-
-
handle_call({async_get_next, Pid, UserId, TargetName, Oids, SendOpts},
_From, State) ->
?vlog("[~p,~p] received async_get_next request for: "
@@ -721,19 +636,6 @@ handle_call({async_get_next, Pid, UserId, TargetName, Oids, SendOpts},
{reply, Reply, State};
-%% <BACKWARD-COMPAT>
-%% The only case where this would be called is during code upgrade
-handle_call({async_get_next, Pid, UserId, TargetName,
- CtxName, Oids, Expire, ExtraInfo},
- _From, State) ->
- ?vlog("[~p,~p,~p] received async_get_next request for: ",
- [UserId, TargetName, CtxName, Oids]),
- Reply = (catch handle_async_get_next(Pid, UserId, TargetName, CtxName,
- Oids, Expire, ExtraInfo, State)),
- {reply, Reply, State};
-%% </BACKWARD-COMPAT>
-
-
%% Check agent version? This op not in v1
handle_call({async_get_bulk,
Pid, UserId, TargetName, NonRep, MaxRep, Oids, SendOpts},
@@ -747,21 +649,6 @@ handle_call({async_get_bulk,
{reply, Reply, State};
-%% <BACKWARD-COMPAT>
-%% The only case where this would be called is during code upgrade
-handle_call({async_get_bulk, Pid, UserId, TargetName,
- NonRep, MaxRep, CtxName, Oids, Expire, ExtraInfo},
- _From, State) ->
- ?vlog("[~p,~p,~p] received async_get_bulk request for: "
- "~n ~p", [UserId, TargetName, CtxName, Oids]),
- Reply = (catch handle_async_get_bulk(Pid,
- UserId, TargetName, CtxName,
- NonRep, MaxRep, Oids,
- Expire, ExtraInfo, State)),
- {reply, Reply, State};
-%% </BACKWARD-COMPAT>
-
-
handle_call({async_set,
Pid, UserId, TargetName, VarsAndVals, SendOpts},
_From, State) ->
@@ -773,19 +660,6 @@ handle_call({async_set,
{reply, Reply, State};
-%% <BACKWARD-COMPAT>
-%% The only case where this would be called is during code upgrade
-handle_call({async_set, Pid, UserId, TargetName,
- CtxName, VarsAndVals, Expire, ExtraInfo},
- _From, State) ->
- ?vlog("[~p,~p,~p] received async_set request for: "
- "~n ~p", [UserId, TargetName, CtxName, VarsAndVals]),
- Reply = (catch handle_async_set(Pid, UserId, TargetName, CtxName,
- VarsAndVals, Expire, ExtraInfo, State)),
- {reply, Reply, State};
-%% </BACKWARD-COMPAT>
-
-
handle_call({cancel_async_request, UserId, ReqId}, _From, State) ->
?vlog("received cancel_async_request request", []),
Reply = (catch handle_cancel_async_request(UserId, ReqId, State)),
@@ -1024,16 +898,6 @@ terminate(Reason, #state{nis_pid = NIS, gct = GCT, cbproxy = CBP}) ->
%%
%%----------------------------------------------------------------------
-handle_sync_get(Pid, UserId, TargetName, CtxName, Oids, Timeout, ExtraInfo,
- From, State) ->
- SendOpts =
- [
- {context, CtxName},
- {timeout, Timeout},
- {extra, ExtraInfo}
- ],
- handle_sync_get(Pid, UserId, TargetName, Oids, SendOpts, From, State).
-
handle_sync_get(Pid, UserId, TargetName, Oids, SendOpts, From, State) ->
?vtrace("handle_sync_get -> entry with"
"~n Pid: ~p"
@@ -1076,16 +940,6 @@ handle_sync_get(Pid, UserId, TargetName, Oids, SendOpts, From, State) ->
Error
end.
-handle_sync_get_next(Pid, UserId, TargetName, CtxName, Oids, Timeout,
- ExtraInfo, From, State) ->
- SendOpts =
- [
- {context, CtxName},
- {timeout, Timeout},
- {extra, ExtraInfo}
- ],
- handle_sync_get_next(Pid, UserId, TargetName, Oids, SendOpts, From, State).
-
handle_sync_get_next(Pid, UserId, TargetName, Oids, SendOpts,
From, State) ->
?vtrace("handle_sync_get_next -> entry with"
@@ -1131,18 +985,6 @@ handle_sync_get_next(Pid, UserId, TargetName, Oids, SendOpts,
end.
-handle_sync_get_bulk(Pid, UserId, TargetName, CtxName,
- NonRep, MaxRep, Oids, Timeout,
- ExtraInfo, From, State) ->
- SendOpts =
- [
- {context, CtxName},
- {timeout, Timeout},
- {extra, ExtraInfo}
- ],
- handle_sync_get_bulk(Pid, UserId, TargetName, NonRep, MaxRep, Oids,
- SendOpts, From, State).
-
handle_sync_get_bulk(Pid, UserId, TargetName, NonRep, MaxRep, Oids, SendOpts,
From, State) ->
?vtrace("handle_sync_get_bulk -> entry with"
@@ -1190,17 +1032,6 @@ handle_sync_get_bulk(Pid, UserId, TargetName, NonRep, MaxRep, Oids, SendOpts,
end.
-handle_sync_set(Pid, UserId, TargetName, CtxName, VarsAndVals, Timeout,
- ExtraInfo, From, State) ->
- SendOpts =
- [
- {context, CtxName},
- {timeout, Timeout},
- {extra, ExtraInfo}
- ],
- handle_sync_set(Pid, UserId, TargetName, VarsAndVals, SendOpts,
- From, State).
-
handle_sync_set(Pid, UserId, TargetName, VarsAndVals, SendOpts, From, State) ->
?vtrace("handle_sync_set -> entry with"
"~n Pid: ~p"
@@ -1245,16 +1076,6 @@ handle_sync_set(Pid, UserId, TargetName, VarsAndVals, SendOpts, From, State) ->
end.
-handle_async_get(Pid, UserId, TargetName, CtxName, Oids, Expire, ExtraInfo,
- State) ->
- SendOpts =
- [
- {context, CtxName},
- {timeout, Expire},
- {extra, ExtraInfo}
- ],
- handle_async_get(Pid, UserId, TargetName, Oids, SendOpts, State).
-
handle_async_get(Pid, UserId, TargetName, Oids, SendOpts, State) ->
?vtrace("handle_async_get -> entry with"
"~n Pid: ~p"
@@ -1294,16 +1115,6 @@ handle_async_get(Pid, UserId, TargetName, Oids, SendOpts, State) ->
end.
-handle_async_get_next(Pid, UserId, TargetName, CtxName, Oids, Expire,
- ExtraInfo, State) ->
- SendOpts =
- [
- {context, CtxName},
- {timeout, Expire},
- {extra, ExtraInfo}
- ],
- handle_async_get_next(Pid, UserId, TargetName, Oids, SendOpts, State).
-
handle_async_get_next(Pid, UserId, TargetName, Oids, SendOpts, State) ->
?vtrace("handle_async_get_next -> entry with"
"~n Pid: ~p"
@@ -1343,19 +1154,6 @@ handle_async_get_next(Pid, UserId, TargetName, Oids, SendOpts, State) ->
end.
-handle_async_get_bulk(Pid, UserId, TargetName, CtxName,
- NonRep, MaxRep, Oids, Expire,
- ExtraInfo, State) ->
- SendOpts =
- [
- {context, CtxName},
- {timeout, Expire},
- {extra, ExtraInfo}
- ],
- handle_async_get_bulk(Pid,
- UserId, TargetName, NonRep, MaxRep, Oids, SendOpts,
- State).
-
handle_async_get_bulk(Pid,
UserId, TargetName, NonRep, MaxRep, Oids, SendOpts,
State) ->
@@ -1398,16 +1196,6 @@ handle_async_get_bulk(Pid,
end.
-handle_async_set(Pid, UserId, TargetName, CtxName, VarsAndVals, Expire,
- ExtraInfo, State) ->
- SendOpts =
- [
- {context, CtxName},
- {timeout, Expire},
- {extra, ExtraInfo}
- ],
- handle_async_set(Pid, UserId, TargetName, VarsAndVals, SendOpts, State).
-
handle_async_set(Pid, UserId, TargetName, VarsAndVals, SendOpts, State) ->
?vtrace("handle_async_set -> entry with"
"~n Pid: ~p"
diff --git a/lib/snmp/test/snmp_agent_mibs_SUITE.erl b/lib/snmp/test/snmp_agent_mibs_SUITE.erl
index ce6ec80322..d5ee395b89 100644
--- a/lib/snmp/test/snmp_agent_mibs_SUITE.erl
+++ b/lib/snmp/test/snmp_agent_mibs_SUITE.erl
@@ -989,13 +989,13 @@ mibs_info(Pid) ->
load_mibs(Pid, Dir, Mibs0) ->
Mibs = [join(Dir, Mib) || Mib <- Mibs0],
- Res = snmpa_mib:load_mibs(Pid, Mibs),
+ Res = snmpa_mib:load_mibs(Pid, Mibs, false),
%% ?DBG("load_mibs -> "
%% "~n Res: ~p", [Res]),
Res.
unload_mibs(Pid, Mibs) ->
- Res = snmpa_mib:unload_mibs(Pid, Mibs),
+ Res = snmpa_mib:unload_mibs(Pid, Mibs, false),
%% ?DBG("unload_mibs -> "
%% "~n Res: ~p", [Res]),
Res.
diff --git a/lib/snmp/test/snmp_manager_config_SUITE.erl b/lib/snmp/test/snmp_manager_config_SUITE.erl
index f7f7fd6928..3eaf2d1af1 100644
--- a/lib/snmp/test/snmp_manager_config_SUITE.erl
+++ b/lib/snmp/test/snmp_manager_config_SUITE.erl
@@ -2037,18 +2037,18 @@ do_register_agent_using_file(Conf) ->
%% --
?IPRINT("EngineID (~p) for agent <~w,~w>", [EngineID2, AgentAddr2, AgentPort2]),
- ?line {ok, EngineID2} =
+ ?line {ok, EngineID2} =
snmpm_config:agent_info(AgentAddr2, AgentPort2, engine_id),
%% --
- ?line {ok, MMS2} =
+ ?line {ok, MMS2} =
snmpm_config:agent_info(AgentAddr2, AgentPort2, max_message_size),
NewMMS21 = 2048,
?IPRINT("try update agent info max-message-size to ~w for agent <~w,~w>",
[NewMMS21, AgentAddr2, AgentPort2]),
- ?line ok = snmpm_config:update_agent_info(UserId2, AgentAddr2, AgentPort2,
- max_message_size, NewMMS21),
- ?line {ok, NewMMS21} =
+ ?line ok = update_agent_info(UserId2, AgentAddr2, AgentPort2,
+ max_message_size, NewMMS21),
+ ?line {ok, NewMMS21} =
snmpm_config:agent_info(AgentAddr2, AgentPort2, max_message_size),
%% --
@@ -2057,8 +2057,8 @@ do_register_agent_using_file(Conf) ->
"with user ~w (not owner)",
[NewMMS21, AgentAddr2, AgentPort2, UserId1]),
?line {error, Reason01} =
- snmpm_config:update_agent_info(UserId1, AgentAddr2, AgentPort2,
- max_message_size, NewMMS21),
+ update_agent_info(UserId1, AgentAddr2, AgentPort2,
+ max_message_size, NewMMS21),
?IPRINT("expected failure. Reason01: ~p", [Reason01]),
?line {ok, NewMMS21} =
snmpm_config:agent_info(AgentAddr2, AgentPort2, max_message_size),
@@ -2069,9 +2069,9 @@ do_register_agent_using_file(Conf) ->
"for agent <~w,~w>",
[NewMMS22, AgentAddr2, AgentPort2]),
?line {error, Reason02} =
- snmpm_config:update_agent_info(UserId1, AgentAddr2, AgentPort2,
- max_message_size, NewMMS22),
- ?IPRINT("expected failure. Reason02: ~p", [Reason02]),
+ update_agent_info(UserId1, AgentAddr2, AgentPort2,
+ max_message_size, NewMMS22),
+ ?IPRINT("expected failre. Reason02: ~p", [Reason02]),
%% --
?IPRINT("done"),
@@ -2744,6 +2744,14 @@ otp8395_incr_counter(Counter, Initial, Increment, Max) ->
%% Internal functions
%%======================================================================
+update_agent_info(UserId, Addr, Port, Item, Val) ->
+ case snmpm_config:agent_info(Addr, Port, target_name) of
+ {ok, TargetName} ->
+ snmpm_config:update_agent_info(UserId, TargetName, [{Item, Val}]);
+ Error ->
+ Error
+ end.
+
config_start(Opts) ->
(catch snmpm_config:start_link(Opts)).