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

S600-E V200R011C10 NETCONF YANG API Reference

This document describes the NETCONF API functions supported by the switch, including the data model and samples.
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).
VLAN Management

VLAN Management

This section describes the configuration model of VLAN management and provides examples of XML packets.

Data Model

The configuration model files matching VLAN management are huawei-vlan.yang and ietf-interfaces.yang.

Table 2-129  VLAN management

Object

Description

Value

Remarks

/huawei-vlan:vlans/management-vlan/vlanid

Indicates a management VLAN ID.

The value is an integer that ranges from 1 to 4094.

NA

/huawei-vlan:vlans/id

Indicates a VLAN ID.

The value is an integer that ranges from 1 to 4094.

NA

/ietf-interfaces:interfaces/interface/huawei-vlan:vlan/port-link-type

Indicates an interface type.

The value can be:
  • access: access interface
  • hybrid: hybrid interface
  • trunk: trunk interface
  • dot1q-tunnel: Dot1q tunnel interface

NA

/ietf-interfaces:interfaces/interface/huawei-vlan:vlan/default-vlan

Indicates the default VLAN ID.

The value is an integer that ranges from 1 to 4094.

NA

/ietf-interfaces:interfaces/interface/huawei-vlan:vlan/trunk

Indicates the trunk type.

-

NA

/ietf-interfaces:interfaces/interface/huawei-vlan:vlan/trunk-vlan

Enumerated value indicating:

VLAN list allowed by the trunk

VLAN Range allowed by the trunk

A VLAN ID is an integer that ranges from 1 to 4094.

The VLAN Range only supports inputting 1..4094.
NOTE:

VLAN Range supports full VLAN only.

The VLAN Range and the list in the trunk are mutually exclusive.

NA

/ietf-interfaces:interfaces/interface/huawei-vlan:vlan/hybrid

Indicates the hybrid type.

-

NA

/ietf-interfaces:interfaces/interface/huawei-vlan:vlan/hybrid-vlan

Indicates the VLAN ID allowed by the hybrid interface.

-

NA

/ietf-interfaces:interfaces/interface/huawei-vlan:vlan/name

Indicates a VLAN name.

The value is a string of 1 to 31 case-sensitive characters. The question mark (?) is not supported.

NA

/ietf-interfaces:interfaces/interface/huawei-vlan:vlan/description

Indicates the VLAN description.

The value is a string of 1 to 255 case-sensitive characters. The question mark (?) is not supported.

NA

Changing the Management VLAN

This section describes how to change the management VLAN using the rpc method.

Table 2-130  Changing the management VLAN

Operation

XPATH

rpc

/huawei-vlan:vlans/management-vlan/vlanid

Data requirement

Table 2-131  Changing the management VLAN

Item

Data

Description

VLAN ID

100

Changes the management VLAN to VLAN 100.

Request example

<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="17" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <edit-config>
        <target>
            <running/>
        </target>
        <config>
            <huawei-vlan:vlans xmlns:huawei-vlan="urn:huawei:params:xml:ns:yang:huawei-vlan">
                <huawei-vlan:vlan>
                    <huawei-vlan:id>100</huawei-vlan:id>
                </huawei-vlan:vlan>
                <huawei-vlan:management-vlan>
                    <huawei-vlan:vlanid>100</huawei-vlan:vlanid>
                </huawei-vlan:management-vlan>
            </huawei-vlan:vlans>
        </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="17">
    <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="18">
    <rpc-error>
        <error-type>application</error-type>
        <error-tag>operation-failed</error-tag>
        <error-severity>error</error-severity>
        <error-message>parse rpc config error.</error-message>
    </rpc-error>
</rpc-reply>

Creating VLAN

This section describes how to create VLAN using the rpc method.

Table 2-132  Creating VLAN

Operation

XPATH

rpc

/huawei-vlan:vlans/id

Data requirement

Table 2-133  Creating VLAN

Item

Data

Description

VLAN ID

100

Indicates that VLAN 100 is created.

Request example

<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="25" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <edit-config>
        <target>
            <running/>
        </target>
        <config>
            <huawei-vlan:vlans xmlns:huawei-vlan="urn:huawei:params:xml:ns:yang:huawei-vlan">
                <huawei-vlan:vlan>
                    <huawei-vlan:id>100</huawei-vlan:id>
                </huawei-vlan:vlan>
            </huawei-vlan:vlans>
        </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="25">
    <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="26">
    <rpc-error>
        <error-type>application</error-type>
        <error-tag>operation-failed</error-tag>
        <error-severity>error</error-severity>
        <error-message>parse rpc config error.</error-message>
    </rpc-error>
</rpc-reply>

Adding Interfaces to VLAN

This section describes how to add interfaces to VLAN using the rpc method.

Table 2-134  Adding interfaces to VLAN

Operation

XPATH

edit-config:create

/ietf-interfaces:interfaces/interface/huawei-vlan:vlan/id

Data requirement

Table 2-135  Adding interfaces to VLAN

Item

Data

Description

VLAN ID

100, 101, 102

Adds interfaces to VLANs 100, 101, and 102.

Request example

<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="6" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <edit-config>
        <target>
            <running/>
        </target>
        <config>
            <if:interfaces xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces">
                <if:interface>
                    <if:name>GigabitEthernet0/0/3</if:name>
                    <if:type>ethernetCsmacd</if:type>
                    <huawei-vlan:vlan xmlns:huawei-vlan="urn:huawei:params:xml:ns:yang:huawei-vlan">
                        <huawei-vlan:port-link-type>trunk</huawei-vlan:port-link-type>
                        <huawei-vlan:trunk>
                            <huawei-vlan:trunk-vlan>100</huawei-vlan:trunk-vlan>
                        </huawei-vlan:trunk>
                        <huawei-vlan:trunk>
                            <huawei-vlan:trunk-vlan>101</huawei-vlan:trunk-vlan>
                        </huawei-vlan:trunk>
                        <huawei-vlan:trunk>
                            <huawei-vlan:trunk-vlan>102</huawei-vlan:trunk-vlan>
                        </huawei-vlan:trunk>
                    </huawei-vlan:vlan>
                </if:interface>
            </if:interfaces>
        </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="6">
    <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="7">
    <rpc-error>
        <error-type>application</error-type>
        <error-tag>operation-failed</error-tag>
        <error-severity>error</error-severity>
        <error-message>parse rpc config error.</error-message>
    </rpc-error>
</rpc-reply>

Change VLAN description and name

This chapter mainly introduces the configuration description and name under xml based on VLAN.

Table 2-136  Change VLAN description and name

Operation

XPATH

RPC

/huawei-vlan:vlans/name

/huawei-vlan:vlans/description

Data requirement

Table 2-137  Change VLAN description and name

Item

Data

Description

VLAN name

1000

Change the VLAN name to 1000

VLAN description

2000

Change the VLAN description to 2000

Request example

<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <edit-config>
    <target>
      <running/>
    </target>
    <config>
      <huawei-vlan:vlans xmlns:huawei-vlan="urn:huawei:params:xml:ns:yang:huawei-vlan">
        <huawei-vlan:vlan>
          <huawei-vlan:id>100</huawei-vlan:id>
          <huawei-vlan:name>1000</huawei-vlan:name>
          <huawei-vlan:description>2000</huawei-vlan:description>
        </huawei-vlan:vlan>
      </huawei-vlan:vlans>
    </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="0">
  <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="2">
  <rpc-error>
    <error-app-tag>1</error-app-tag>
    <error-message>Service process failed.</error-message>
    <error-info>Error on node /huawei-vlan:vlans/vlan[id="100"]/description</error-info>
  </rpc-error>
</rpc-reply>
Translation
Download
Updated: 2019-10-18

Document ID: EDOC1000178028

Views: 5142

Downloads: 0

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