< Home

Adding Interfaces to VLAN

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

Table 1 Adding interfaces to VLAN

Operation

XPATH

edit-config:create

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

Data requirement

Table 2 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 xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-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>
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >