< Home

Configuring an SNMP Community

This section provides a sample of configuring an SNMP community using the rpc method.

Table 1 Configuring an SNMP community name

Operation

XPATH

rpc

  • /ietf-snmp:snmp/engine/enable-authen-traps
  • /ietf-snmp:snmp/community/index
  • /ietf-snmp:snmp/community/text-name
  • /ietf-snmp:snmp/community/security-name
  • /ietf-snmp:snmp/community/huawei-snmp:authority

Data Requirements

Item

Data

Description

Whether to enable the switch to send community authentication failure traps to the NMS

true

Enable the switch to send community name authentication failure traps to the NMS.

Community name index

1

Set the community index to 1.

Community name

root@123

Set the community to root@123.

Community security name

aa

Set the community security to aa.

Permission of the SNMP community

read-write

Set the permission of the SNMP community to read-write.

Request Example

<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="15" 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:enable-authen-traps>true</snmp:enable-authen-traps>
        </snmp:engine>
        <snmp:community>
          <snmp:index>1</snmp:index>
          <snmp:text-name>root@123</snmp:text-name>
          <snmp:security-name>aa</snmp:security-name>
          <hw-snmp:authority xmlns:hw-snmp="urn:huawei:params:xml:ns:yang:huawei-snmp">read-write</hw-snmp:authority>
        </snmp:community>
      </snmp:snmp>
    </config>
  </edit-config>
</rpc>

Response Example

# Sample of successful response
<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="15">
  <ok/>
</rpc-reply>
# Sample of failed response
<?xml version='1.0' encoding='UTF-8'?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="15">
  <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>
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic