This section describes how to query the MAC address table using the rpc method.
Operation |
XPATH |
---|---|
rpc |
/huawei-mac:mac-address-table-get |
Data Requirement
Item |
Data |
Description |
---|---|---|
Maximum number of MAC address entries |
1 |
Only one MAC address entry is queried. |
MAC address |
00:00:c0:06:d3:00 |
MAC address entries with the specified MAC address are queried. |
MAC address type |
vlan |
The MAC address type is VLAN. |
VLAN ID |
1 |
The VLAN that the MAC address belongs to is VLAN 1. |
Interface name |
GigabitEthernet0/0/24 |
The interface that the MAC address belongs to is GigabitEthernet0/0/24. |
Query type |
mac |
MAC address entries are queried based on MAC addresses. |
Request Example
<?xml version="1.0" encoding="UTF-8"?> <rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="5149ccae-4028-11e7-b553-f0be7a3afb52"> <huawei-mac:mac-address-table-get xmlns:huawei-mac="urn:huawei:params:xml:ns:yang:huawei-mac"> <huawei-mac:get-num>1</huawei-mac:get-num> <huawei-mac:destination-address> <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>1</huawei-mac:id> <huawei-mac:interface>GigabitEthernet0/0/24</huawei-mac:interface> <huawei-mac:search-type>mac</huawei-mac:search-type> </huawei-mac:destination-address> </huawei-mac:mac-address-table-get> </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="7d83014f-4048-11e7-86a3-f0be7a3afb52"> <data> <mac-address-table-get xmlns="urn:huawei:params:xml:ns:yang:huawei-mac"> <mac-address-details> <mac-address>00:00:c0:06:d3:00</mac-address> <id>1</id> <forwarding-interface>GigabitEthernet0/0/24</forwarding-interface> <id-type>vlan</id-type> <mac-type>dynamic</mac-type> </mac-address-details> <has-more>false</has-more> </mac-address-table-get> </data> </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="5149ccae-4028-11e7-b553-f0be7a3afb52"> <data> <mac-address-table-get xmlns="urn:huawei:params:xml:ns:yang:huawei-mac"> <has-more>false</has-more> </mac-address-table-get> </data> </rpc-reply>