No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

NETCONF YANG API Reference

AR100, AR120, AR160, AR1200, AR2200, AR3200, and AR3600 V300R003

NETCONF YANG API Reference
Rate and give feedback :
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
SNMP

SNMP

NOTE:

AR100&AR120 series (except AR129CV&AR129CVW&AR129CGVW-L) do not support SNMP.

Data Model

The data model file matching the SNMP Agent is ietf-snmp-engine.yang.

Table 3-2102 SNMP Agent

Object

Description

snmp-engine

Indicates that the operation request (creating, deleting, and modifying) object is the SNMP Agent-related configurations. It is only used to contain sub-objects, but does not have any data meaning.

/ietf-snmp:snmp/engine/enabled

Indicates the SNMP Agent function is enabled.

The data model file matching the SNMP VACM is ietf-snmp-vacm.yang.

Table 3-2103 SNMP VACM

Object

Description

snmp-vacm

Indicates that the operation request (creating, deleting, and modifying) object is the SNMP VACM-related configurations. It is only used to contain sub-objects, but does not have any data meaning.

/ietf-snmp:snmp/vacm/group/member

Indicates the new SNMP group.

/ietf-snmp:snmp/usm/local/user

Indicates the new users.

/ietf-snmp:snmp/vacm/view/include

Indicates the MIB view information.

/ietf-snmp:snmp/vacm/view/exclude

Indicates the MIB view information.

/ietf-snmp:snmp/vacm/group/access

Indicates the security level of the SNMP group.

The data model file matching the SNMP USM is ietf-snmp-usm.yang.

Table 3-2104 SNMP USM

Object

Description

snmp-usm

Indicates that the operation request (creating, deleting, and modifying) object is the SNMP USM-related configurations. It is only used to contain sub-objects, but does not have any data meaning.

/ietf-snmp:snmp/usm/local/user

Indicates the new SNMP group.

The data model file matching the SNMP is huawei-snmp.yang.

Table 3-2105 SNMP

Object

Description

snmp

Indicates that the operation request (creating, deleting, and modifying) object is the SNMP-related configurations. It is only used to contain sub-objects, but does not have any data meaning.

ietf-snmp:snmp/huawei-snmp:source-interface

Indicates the source interface for sending traps.

ietf-snmp:snmp/huawei-snmp:target-host

Indicates the destination host of trap packet.

Creating the SNMP Configuration

This section provides a sample of creating the SNMP configuration.

Table 3-2106 Creating the SNMP configuration

Operation

XPATH

edit-config:merge

/ietf-snmp:snmp/vacm/

/ietf-snmp:snmp/usm/

/ietf-snmp:snmp/

Data Requirements
Table 3-2107 Creating the SNMP configuration

Item

Data

Description

Creating an SNMP group

userGroup1

Create an SNMP group, add users to the SNMP group, create or update the MIB view information, and set the security level of the SNMP group, the source interface for sending traps, and the destination host of trap packets.

Adding a user to the SNMP group

userName1

Creating or updating the MIB view information

groupNotifyViewName1

Setting the security level of the SNMP group

auth-no-priv

Setting the source interface for sending traps

GigabitEthernet0/0/1

Setting the destination host of trap packets

122.122.90.14

Request Example
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="43388053-ae36-43dd-915d-51897de94171">
 <edit-config>
  <target>
   <running/>
  </target>
  <error-option>rollback-on-error</error-option>
  <config>
   <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
    <interface>
     <name>GigabitEthernet0/0/1</name>
     <type xmlns:iana="urn:ietf:params:xml:ns:yang:iana-if-type">iana:ethernetCsmacd</type>
    </interface>
   </interfaces>
   <snmp xmlns="urn:ietf:params:xml:ns:yang:ietf-snmp">
    <vacm>
     <group xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
      <name>userGroup1</name>
      <member>
       <security-name>userName1</security-name>
       <security-model>usm</security-model>
      </member>
      <access>
       <context>userName1</context>
       <context-match>exact</context-match>
       <security-model>usm</security-model>
       <security-level>auth-no-priv</security-level>
       <read-view>groupReadViewName1</read-view>
       <write-view>groupWriteViewName1</write-view>
       <notify-view>groupNotifyViewName1</notify-view>
      </access>
     </group>
     <view xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
      <name>groupNotifyViewName1</name>
      <include>iso</include>
     </view>
     <view xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
      <name>groupWriteViewName1</name>
      <include>iso</include>
     </view>
     <view xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
      <name>groupReadViewName1</name>
      <include>iso</include>
     </view>
    </vacm>
    <engine>
     <enabled>true</enabled>
     <version>
      <v3/>
     </version>
    </engine>
    <usm>
     <local>
      <user xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
       <name>userName1</name>
       <auth>
        <md5>
         <key>aa:bb</key>
         <password xmlns="urn:huawei:params:xml:ns:yang:huawei-snmp">authenticationPwd</password>
        </md5>
       </auth>
       <priv>
        <aes>
         <key>aa:bb</key>
         <password xmlns="urn:huawei:params:xml:ns:yang:huawei-snmp">privacyPwd</password>
         <algorithm xmlns="urn:huawei:params:xml:ns:yang:huawei-snmp">aes128</algorithm>
        </aes>
       </priv>
      </user>
     </local>
    </usm>
    <source-interface xmlns="urn:huawei:params:xml:ns:yang:huawei-snmp">GigabitEthernet0/0/1</source-interface>
    <target-host xmlns="urn:huawei:params:xml:ns:yang:huawei-snmp" xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
     <security-name>userName1</security-name>
     <ip>122.122.90.14</ip>
     <port>32</port>
     <target-params>
      <v3>
       <security-level>auth-no-priv</security-level>
      </v3>
     </target-params>
    </target-host>
   </snmp>
  </config>
 </edit-config>
</rpc>
Response Example

Sample of successful response

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="43388053-ae36-43dd-915d-51897de94171"> 
  <ok/>
</rpc-reply>

Modifying the SNMP Configuration

This section provides a sample of modifying the SNMP configuration.

Table 3-2108 Modifying the SNMP configuration

Operation

XPATH

edit-config:replace

/ietf-snmp:snmp/vacm/

/ietf-snmp:snmp/usm/

ietf-snmp:snmp/

Data Requirements
Table 3-2109 Modifying the SNMP configuration

Item

Data

Description

Modifying an SNMP group

userGroup1

Modify a specified SNMP group, a user in the SNMP group, the security level of the SNMP group, the source interface for sending traps, and the destination host of trap packets.

Changing a user in the SNMP group

userName1 authenticationPwd

Modifying the security level of the SNMP group

auth-priv

Changing the source interface for sending traps

GigabitEthernet0/0/2

Changing the destination host of trap packets

122.122.90.18

Request Example
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="43388053-ae36-43dd-915d-51897de94171">
 <edit-config>
  <target>
   <running/>
  </target>
  <error-option>rollback-on-error</error-option>
  <config>
   <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
    <interface>
     <name>GigabitEthernet0/0/2</name>
     <type xmlns:iana="urn:ietf:params:xml:ns:yang:iana-if-type">iana:ethernetCsmacd</type>
    </interface>
   </interfaces>
   <snmp xmlns="urn:ietf:params:xml:ns:yang:ietf-snmp" xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="replace">
    <vacm>
     <group xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
      <name>userGroup1</name>
      <member>
       <security-name>userName1</security-name>
       <security-model>usm</security-model>
      </member>
      <access>
       <context>userName1</context>
       <context-match>exact</context-match>
       <security-model>usm</security-model>
       <security-level>auth-no-priv</security-level>
       <read-view>groupReadViewName1</read-view>
       <write-view>groupWriteViewName1</write-view>
       <notify-view>groupNotifyViewName1</notify-view>
      </access>
     </group>
     <view xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
      <name>groupNotifyViewName1</name>
      <include>iso</include>
     </view>
     <view xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
      <name>groupWriteViewName1</name>
      <include>iso</include>
     </view>
     <view xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
      <name>groupReadViewName1</name>
      <include>iso</include>
     </view>
    </vacm>
    <engine>
     <enabled>true</enabled>
     <version>
      <v3/>
     </version>
    </engine>
    <usm>
     <local>
      <user xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
      <name>userName1 authenticationPwd</name>
       <auth>
        <md5>
         <key>aa:bb</key>
         <password xmlns="urn:huawei:params:xml:ns:yang:huawei-snmp">authenticationPwd1</password>
        </md5>
       </auth>
       <priv>
        <aes>
         <key>aa:bb</key>
         <password xmlns="urn:huawei:params:xml:ns:yang:huawei-snmp">privacyPwd1</password>
         <algorithm xmlns="urn:huawei:params:xml:ns:yang:huawei-snmp">aes128</algorithm>
        </aes>
       </priv>
      </user>
     </local>
    </usm>
    <source-interface xmlns="urn:huawei:params:xml:ns:yang:huawei-snmp">GigabitEthernet0/0/2</source-interface>
    <target-host xmlns="urn:huawei:params:xml:ns:yang:huawei-snmp" xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
     <security-name>userName1</security-name>
     <ip>122.122.90.18</ip>
     <port>32</port>
     <target-params>
      <v3>
       <security-level>auth-no-priv</security-level>
      </v3>
     </target-params>
    </target-host>
   </snmp>
  </config>
 </edit-config>
</rpc>
Response Example

Sample of successful response

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="43388053-ae36-43dd-915d-51897de94171"> 
  <ok/>
</rpc-reply>

Deleting the SNMP Configuration

This section provides a sample of deleting the SNMP configuration.

Table 3-2110 Deleting the SNMP configuration

Operation

XPATH

edit-config:delete

/ietf-snmp:snmp/vacm/

/ietf-snmp:snmp/usm/

ietf-snmp:snmp/

Data Requirements
Table 3-2111 Deleting the SNMP configuration

Item

Data

Description

Deleting an SNMP group

userGroup1

Deletes the SNMP group userGroup1, a user in the group, the current MIB view configuration, and the configuration of the security level of the SNMP group. Disable the source interface for sending traps, and delete the destination host of trap packets.

Deleting a user from the SNMP group

userName1

Deleting the current MIB view configuration

groupNotifyViewName1

Deleting the configuration of the security level of the SNMP group

auth-no-priv

Deleting a destination host of trap packets

122.122.90.14

Request Example
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="078606b7-9d1d-4886-b462-d3ea8867202a">
 <edit-config>
  <target>
   <running/>
  </target>
  <error-option>rollback-on-error</error-option>
  <config>
   <snmp xmlns="urn:ietf:params:xml:ns:yang:ietf-snmp">
    <usm>
     <local>
      <user xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="delete">
       <name>userName1</name>
      </user>
     </local>
    </usm>
   </snmp>
   <snmp xmlns="urn:ietf:params:xml:ns:yang:ietf-snmp">
    <vacm>
     <group xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="delete">
      <name>userGroup1</name>
     </group>
    </vacm>
   </snmp>
   <snmp xmlns="urn:ietf:params:xml:ns:yang:ietf-snmp">
    <target-host xmlns="urn:huawei:params:xml:ns:yang:huawei-snmp" xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="delete">
     <security-name>userName1</security-name>
     <ip>122.122.90.14</ip>
    </target-host>
   </snmp>
   <snmp xmlns="urn:ietf:params:xml:ns:yang:ietf-snmp">
    <vacm>
     <view xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="delete">
      <name>groupNotifyViewName1</name>
     </view>
    </vacm>
   </snmp>
   <snmp xmlns="urn:ietf:params:xml:ns:yang:ietf-snmp">
    <vacm>
     <view xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="delete">
      <name>groupWriteViewName1</name>
     </view>
    </vacm>
   </snmp>
   <snmp xmlns="urn:ietf:params:xml:ns:yang:ietf-snmp">
    <vacm>
     <view xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="delete">
      <name>groupReadViewName1</name>
     </view>
    </vacm>
   </snmp>
  </config>
 </edit-config>
</rpc>
Response Example

Sample of successful response

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="078606b7-9d1d-4886-b462-d3ea8867202a"> 
  <ok/>
</rpc-reply>

Enabling the SNMP Agent Function

This section provides a sample of enabling the SNMP Agent function.

Table 3-2112 Enabling the SNMP Agent function

Operation

XPATH

edit-config:merge

/ietf-snmp:snmp/engine/enabled

Data Requirements
Table 3-2113 Enabling the SNMP Agent function

Item

Data

Description

SNMP Agent

TRUE

Enable the SNMP Agent function.

Request Example
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="43388053-ae36-43dd-915d-51897de94171">
 <edit-config>
  <target>
   <running/>
  </target>
  <error-option>rollback-on-error</error-option>
  <config>
   <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
    <interface>
     <name>GigabitEthernet0/0/1</name>
     <type xmlns:iana="urn:ietf:params:xml:ns:yang:iana-if-type">iana:ethernetCsmacd</type>
    </interface>
   </interfaces>
   <snmp xmlns="urn:ietf:params:xml:ns:yang:ietf-snmp">
    <vacm>
     <group xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
      <name>userGroup1</name>
       <member>
        <security-name>userName1</security-name>
        <security-model>usm</security-model>
       </member>
      <access>
       <context>userName1</context>
       <context-match>exact</context-match>
       <security-model>usm</security-model>
       <security-level>auth-no-priv</security-level>
       <read-view>groupReadViewName1</read-view>
       <write-view>groupWriteViewName1</write-view>
       <notify-view>groupNotifyViewName1</notify-view>
      </access>
     </group>
     <view xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
      <name>groupNotifyViewName1</name>
      <include>iso</include>
     </view>
     <view xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
      <name>groupWriteViewName1</name>
      <include>iso</include>
     </view>
     <view xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
      <name>groupReadViewName1</name>
      <include>iso</include>
     </view>
    </vacm>
    <engine>
     <enabled>true</enabled>
     <version>
      <v3/>
     </version>
    </engine>
    <usm>
     <local>
      <user xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
       <name>userName1</name>
       <auth>
        <md5>
         <key>aa:bb</key>
         <password xmlns="urn:huawei:params:xml:ns:yang:huawei-snmp">authenticationPwd</password>
        </md5>
       </auth>
       <priv>
       <aes>
        <key>aa:bb</key>
        <password xmlns="urn:huawei:params:xml:ns:yang:huawei-snmp">privacyPwd</password>
        <algorithm xmlns="urn:huawei:params:xml:ns:yang:huawei-snmp">aes128</algorithm>
       </aes>
       </priv>
      </user>
     </local>
    </usm>
    <source-interface xmlns="urn:huawei:params:xml:ns:yang:huawei-snmp">GigabitEthernet0/0/1</source-interface>
    <target-host xmlns="urn:huawei:params:xml:ns:yang:huawei-snmp" xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="merge">
     <security-name>userName1</security-name>
     <ip>122.122.90.14</ip>
     <port>32</port>
     <target-params>
      <v3>
       <security-level>auth-no-priv</security-level>
      </v3>
     </target-params>
    </target-host>
   </snmp>
  </config>
 </edit-config>
</rpc>
Response Example

Sample of successful response

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="43388053-ae36-43dd-915d-51897de94171"> 
  <ok/>
</rpc-reply>

Disabling the SNMP Agent Function

This section provides a sample of disabling the SNMP Agent function.

Table 3-2114 Disabling the SNMP Agent function

Operation

XPATH

edit-config:delete

/ietf-snmp:snmp/engine/enabled

Data Requirements
Table 3-2115 Disabling the SNMP Agent function

Item

Data

Description

SNMP Agent

FALSE

Disable the SNMP Agent function.

Request Example
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="078606b7-9d1d-4886-b462-d3ea8867202a">
 <edit-config>
  <target>
   <running/>
  </target>
  <error-option>rollback-on-error</error-option>
  <config>
   <snmp xmlns="urn:ietf:params:xml:ns:yang:ietf-snmp">
    <usm>
     <local>
      <user xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="delete">
       <name>userName1</name>
      </user>
     </local>
    </usm>
   </snmp>
   <snmp xmlns="urn:ietf:params:xml:ns:yang:ietf-snmp">
    <vacm>
     <group xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="delete">
      <name>userGroup1</name>
     </group>
    </vacm>
   </snmp>
   <snmp xmlns="urn:ietf:params:xml:ns:yang:ietf-snmp">
    <target-host xmlns="urn:huawei:params:xml:ns:yang:huawei-snmp" xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="delete">
     <security-name>userName1</security-name>
     <ip>122.122.90.14</ip>
    </target-host>
   </snmp>
   <snmp xmlns="urn:ietf:params:xml:ns:yang:ietf-snmp">
    <vacm>
     <view xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="delete">
      <name>groupNotifyViewName1</name>
     </view>
    </vacm>
   </snmp>
   <snmp xmlns="urn:ietf:params:xml:ns:yang:ietf-snmp">
    <vacm>
     <view xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="delete">
      <name>groupWriteViewName1</name>
     </view>
    </vacm>
   </snmp>
   <snmp xmlns="urn:ietf:params:xml:ns:yang:ietf-snmp">
    <vacm>
     <view xmlns:ns0="urn:ietf:params:xml:ns:netconf:base:1.0" ns0:operation="delete">
      <name>groupReadViewName1</name>
     </view>
    </vacm>
   </snmp>
  </config>
 </edit-config>
</rpc>
Response Example

Sample of successful response

<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="078606b7-9d1d-4886-b462-d3ea8867202a"> 
  <ok/>
</rpc-reply>
Translation
Download
Updated: 2019-03-06

Document ID: EDOC1100022096

Views: 8273

Downloads: 69

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next