This section provides a sample of configuring IP subnet-based VLAN assignment on an interface using the edit-config method.
Operation |
XPATH |
|---|---|
edit-config:config |
/huawei-vlan:vlans/vlan/ip-subnet-vlan /ietf-interfaces:interfaces/interface/huawei-vlan:ip-subnet-vlan-enable/enable |
Data Requirements
Item |
Data |
|---|---|
VLAN ID |
5 |
Source IP address or network address and mask length for IP subnet-based VLAN assignment |
10.1.1.1/24 |
802.1p priority of the VLAN associated with an IP address or subnet |
3 |
Interface on which IP subnet-based VLAN assignment is enabled |
Eth-Trunk1 |
Whether IP subnet-based VLAN assignment is enabled on an interface |
true |
Request Example
<?xml version="1.0" encoding="utf-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
<edit-config>
<target>
<running/>
</target>
<config xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<vlans xmlns="urn:huawei:params:xml:ns:yang:huawei-vlan">
<vlan nc:operation="replace">
<id>5</id>
<ip-subnet-vlan>
<ip-prefix>10.1.1.1/24</ip-prefix>
<priority>3</priority>
</ip-subnet-vlan>
</vlan>
</vlans>
<if:interfaces nc:operation="replace" xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<if:interface>
<if:name>Eth-Trunk1</if:name>
<if:type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</if:type>
<huawei-vlan:ip-subnet-vlan-enable xmlns:huawei-vlan="urn:huawei:params:xml:ns:yang:huawei-vlan">
<huawei-vlan:enable>true</huawei-vlan:enable>
</huawei-vlan:ip-subnet-vlan-enable>
</if:interface>
</if:interfaces>
</config>
</edit-config>
</rpc>
Deletion Example
<?xml version="1.0" encoding="utf-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2">
<edit-config>
<target>
<running/>
</target>
<config xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<vlans xmlns="urn:huawei:params:xml:ns:yang:huawei-vlan">
<vlan nc:operation="replace">
<id>5</id>
</vlan>
</vlans>
<if:interfaces nc:operation="replace" xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<if:interface>
<if:name>Eth-Trunk1</if:name>
<if:type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</if:type>
</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="1"> <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="1">
<rpc-error>
<error-app-tag>-1</error-app-tag>
<error-message> Invalid IP address.</error-message>
<error-info>Error on node /huawei-vlan:vlans/vlan[id="6"]</error-info>
</rpc-error>
</rpc-reply>