This section provides a sample of configuring a static MAC address entry using the edit-config method.
Operation |
XPATH |
|---|---|
edit-config |
/huawei-mac:mac-address-table/static-mac/mac-address /huawei-mac:mac-address-table/static-mac/id-type /huawei-mac:mac-address-table/static-mac/id /huawei-mac:mac-address-table/static-mac/interface |
Data Requirements
Item |
Data |
Description |
|---|---|---|
mac-address |
00:00:c0:06:d3:00 |
Set the MAC address corresponding to the static MAC address entry. |
id-type |
vlan |
Configure a static MAC address of the VLAN type. |
id |
5 |
Set the ID of the VLAN to which the outbound interface belongs to 5. |
interface |
GigabitEthernet0/0/1 |
Configure the outbound interface GigabitEthernet0/0/1. |
Request Example
<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="3" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target>
<running/>
</target>
<config>
<huawei-mac:mac-address-table xmlns:huawei-mac="urn:huawei:params:xml:ns:yang:huawei-mac">
<huawei-mac:static-mac>
<huawei-mac:mac-address>00:00:c0:06:d3:00</huawei-mac:mac-address>
<huawei-mac:id-type>vlan</huawei-mac:id-type>
<huawei-mac:id>5</huawei-mac:id>
<huawei-mac:interface>GigabitEthernet0/0/1</huawei-mac:interface>
</huawei-mac:static-mac>
</huawei-mac:mac-address-table>
</config>
</edit-config>
</rpc>
Deletion Example
<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="2" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<edit-config>
<target>
<running/>
</target>
<config>
<huawei-mac:mac-address-table xmlns:huawei-mac="urn:huawei:params:xml:ns:yang:huawei-mac">
<huawei-mac:static-mac xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="delete">
<huawei-mac:mac-address>00:00:c0:06:d3:00</huawei-mac:mac-address>
<huawei-mac:id-type>vlan</huawei-mac:id-type>
<huawei-mac:id>5</huawei-mac:id>
<huawei-mac:interface>GigabitEthernet0/0/1</huawei-mac:interface>
</huawei-mac:static-mac>
</huawei-mac:mac-address-table>
</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="3"> <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="3">
<rpc-error>
<error-type>application</error-type>
<error-tag>invalid-value</error-tag>
<error-severity>error</error-severity>
<error-path>/huawei-mac:mac-address-table/static-mac[mac-address='00:03:00:03:00:02'][id-type='vlan'][id='5']</error-path>
<error-message>validation failed(Missing required element "interface" in "static-mac".).</error-message>
</rpc-error>
</rpc-reply>