This section describes how to configure an SNMPv3 user and user group using the rpc method.
Operation |
XPATH |
---|---|
rpc |
|
Item |
Data |
Description |
---|---|---|
Whether to enable the SNMP agent function on a switch |
true |
Enable the SNMP agent function on a switch. |
SNMPv3 user name |
test |
Configure an SNMPv3 user named test. |
Authentication password of an SNMPv3 user |
48:75:61:77:65:69:40:31:32:33 |
Set the authentication protocol of an SNMPv3 user to HMAC-MD5-96, and the authentication password to 48:75:61:77:65:69:40:31:32:33. |
Encryption password of an SNMPv3 user |
48:75:61:77:65:69:40:31:32:34 |
Set the encryption password of an SNMPv3 user to 48:75:61:77:65:69:40:31:32:34. |
Encryption algorithm of an SNMPv3 user |
des56 |
Set the encryption algorithm of an SNMPv3 user to DES-56. |
Name of an SNMPv3 user group |
ssq |
Configure an SNMPv3 user group named ssq. |
Context applicable to access rights |
1 |
Set the context applicable to access rights to 1. |
Security mode of an SNMPv3 user group |
usm |
Set the security mode of an SNMPv3 user group to usm. |
Security level of an SNMPv3 user group |
auth-priv |
Set the name security level of an SNMPv3 user group to auth-priv. |
Name of a MIB view with read-only permission applied to the SNMPv3 user group |
test_view |
Apply the MIB view test_view with read-only permission to the SNMPv3 user group. |
Name of a MIB view with notification permission applied to the SNMPv3 user group |
test_view |
Apply the MIB view test_view with notification permission to the SNMPv3 user group. |
MIB subtree that can be accessed by a MIB view |
1.3.6.1.2.1.1 |
Set the MIB subtree that can be accessed by a MIB view to 1.3.6.1.2.1.1. |
MIB subtree that cannot be accessed by a MIB view |
1.3.6.1.2.1.2 |
Set the MIB subtree that cannot be accessed by a MIB view to 1.3.6.1.2.1.2. |
<?xml version='1.0' encoding='UTF-8'?> <rpc message-id="3" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <edit-config> <target> <running/> </target> <config> <snmp:snmp xmlns:snmp="urn:ietf:params:xml:ns:yang:ietf-snmp"> <snmp:engine> <snmp:enabled>true</snmp:enabled> </snmp:engine> <snmp:usm> <snmp:local> <snmp:user> <snmp:name>test</snmp:name> <snmp:auth> <snmp:md5> <snmp:key>48:75:61:77:65:69:40:31:32:33</snmp:key> </snmp:md5> </snmp:auth> <snmp:priv> <snmp:des> <snmp:key>48:75:61:77:65:69:40:31:32:34</snmp:key> <hw-snmp:algorithm xmlns:hw-snmp="urn:huawei:params:xml:ns:yang:huawei-snmp">des56</hw-snmp:algorithm> </snmp:des> </snmp:priv> </snmp:user> </snmp:local> </snmp:usm> <snmp:vacm> <snmp:group> <snmp:name>ssq</snmp:name> <snmp:member> <snmp:security-name>test</snmp:security-name> <snmp:security-model>usm</snmp:security-model> </snmp:member> <snmp:access> <snmp:context>1</snmp:context> <snmp:security-model>usm</snmp:security-model> <snmp:security-level>auth-priv</snmp:security-level> <snmp:read-view>test_view</snmp:read-view> <snmp:notify-view>test_view</snmp:notify-view> </snmp:access> </snmp:group> <snmp:view> <snmp:name>test_view</snmp:name> <snmp:include>1.3.6.1.2.1.1</snmp:include> <snmp:exclude>1.3.6.1.2.1.2</snmp:exclude> </snmp:view> </snmp:vacm> </snmp:snmp> </config> </edit-config> </rpc>
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="3"> <ok/> </rpc-reply>
<?xml version='1.0' encoding='UTF-8'?> <rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="3"> <rpc-error> <error-app-tag>-1</error-app-tag> <error-message>Service process failed.</error-message> <error-info>Error on node/ietf-snmp:snmp/engine/enabled</error-info> </rpc-error> </rpc-reply>