MAC Address Management
This section describes the configuration model of MAC address management and provides examples of XML packets.
Data Model
The configuration model file matching MAC address table query is huawei-mac.yang.
Object |
Description |
Value Range |
Remarks |
---|---|---|---|
/huawei-mac: mac-address-table-get/get-num |
Indicates the maximum number of MAC address entries queried at one time. |
The value is an integer. A maximum of 1024 MAC address entries can be queried at a time. Even when the value is larger than 1024, a maximum of 1024 entries can be queried. |
N/A |
/huawei-mac: mac-address-table-get / destination-address/mac-address |
Indicates the MAC address. |
The value is in HH:HH:HH:HH:HH:HH format. An H is a hexadecimal number of 1 digit. The MAC address cannot be FF:FF:FF:FF:FF:FF, 00:00:00:00:00:00, or a multicast MAC address. |
N/A |
/huawei-mac: mac-address-table-get / destination-address/id-type |
Indicates the MAC address type. |
The value is of the enumerated type:
|
N/A |
/huawei-mac: mac-address-table-get / destination-address/id |
Indicates the VLAN ID, BD ID, or VSI name of the MAC address. |
|
N/A |
/huawei-mac: mac-address-table-get / destination-address/interface |
Indicates the interface name. |
The value is a string of 1 to 64 characters. It consists of the interface type and interface number. |
N/A |
/huawei-mac: mac-address-table-get / destination-address/search-type |
Indicates the MAC address search criteria. |
The value is of the enumerated type:
|
N/A |
/huawei-mac: mac-address-table-get / last-mac-address-details/last-mac-address |
Indicates that MAC addresses with a specified range are queried. |
The value is in HH:HH:HH:HH:HH:HH format. An H is a hexadecimal number of 1 digit. The MAC address cannot be FF:FF:FF:FF:FF:FF, 00:00:00:00:00:00, or a multicast MAC address. |
N/A |
/huawei-mac: mac-address-table-get / last-mac-address-details/last-id-type |
Indicates the type of MAC addresses with a specified range to be queried. |
The value is of the enumerated type:
|
N/A |
/huawei-mac: mac-address-table-get / last-mac-address-details/last-id |
Indicates the VLAN ID, BD ID, or VSI name of MAC addresses with a specified range to be queried. |
|
N/A |
/huawei-mac: mac-address-table-get / last-mac-address-details/interface |
Indicates the name of an interface where detailed MAC address entry information is queried. |
The value is a string of 1 to 64 characters. It consists of the interface type and interface number. |
N/A |
/huawei-mac: mac-address-table-get / last-mac-address-details/search-type |
Indicates the search criteria for querying MAC address entry information. |
The value is of the enumerated type:
|
N/A |
/huawei-mac: mac-address-table-get/ mac-address-details/mac-address |
Indicates the MAC address of which MAC address entry information is queried. |
The value is in HH:HH:HH:HH:HH:HH format. An H is a hexadecimal number of 1 digit. The MAC address cannot be FF:FF:FF:FF:FF:FF, 00:00:00:00:00:00, or a multicast MAC address. |
N/A |
/huawei-mac: mac-address-table-get/ mac-address-details/id-type |
Indicates the type of the MAC address of which MAC address entry information is queried. |
The value is of the enumerated type:
|
N/A |
/huawei-mac: mac-address-table-get/ mac-address-details/id |
Indicates the VLAN ID, BD ID, or VSI name of the MAC address of which MAC address entry information is queried. |
|
N/A |
/huawei-mac: mac-address-table-get/ mac-address-details/mac-type |
Indicates the type of MAC address entries. |
The value is of the enumerated type:
|
N/A |
/huawei-mac: mac-address-table-get/ mac-address-details/forwarding-interface |
Indicates the queried interface information. |
The value is a string of 1 to 64 characters. It consists of the interface type and interface number. |
N/A |
/huawei-mac: mac-address-table-get/has-more |
Query status. |
The value is of the Boolean type:
|
N/A |
/huawei-mac:mac-address-table-get/total-num |
Displays the number of MAC address entries of a specified type. |
The value is an integer. |
N/A |
/huawei-mac:mac-address-table/static-mac/mac-address |
Indicates the MAC address in a static MAC address entry. |
The value is in HH:HH:HH:HH:HH:HH format. An H is a hexadecimal number of 1 digit. The MAC address cannot be FF:FF:FF:FF:FF:FF, 00:00:00:00:00:00, or a multicast MAC address. |
N/A |
/huawei-mac:mac-address-table/static-mac/id-type |
Indicates the type of a static MAC address. |
The value is of the enumerated type:
|
Currently, only static MAC addresses of the VLAN type are supported. |
/huawei-mac:mac-address-table/static-mac/id |
Indicates the ID of the VLAN that the outbound interface belongs to. |
The value is an integer in the range from 1 to 4096. |
N/A |
/huawei-mac:mac-address-table/static-mac/interface |
Indicates that the outbound interface in the static MAC address entry is a specified interface. |
The value is a string of 1 to 64 characters. It consists of the interface type and interface number. |
N/A |
/ietf-interfaces:interfaces/interface/huawei-mac:mac-security/mac-limit/maxinum |
Indicates the maximum number of MAC addresses that can be learned. |
The value is an integer in the range from 0 to 32767. The value 0 indicates that the maximum number of MAC addresses that can be learned is not limited. |
This object is mandatory. |
/ietf-interfaces:interfaces/interface/huawei-mac:mac-security/mac-limit/action |
Indicates the action performed when the number of learned MAC address entries reaches the limit. |
The value is of the Boolean type:
The default action is discard. |
Before configuring this object, you must configure maxinum. |
/ietf-interfaces:interfaces/interface/huawei-mac:mac-security/mac-limit/alarm-enable |
Indicates whether the system generates an alarm when the number of learned MAC address entries reaches the limit. |
The value is of the Boolean type:
By default, an alarm is generated when the number of MAC address entries reaches the maximum. |
Before configuring this object, you must configure maxinum. |
Querying the MAC Address Table
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 |
GigabitEthernet1/0/24 |
The interface that the MAC address belongs to is GigabitEthernet1/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>GigabitEthernet1/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>GigabitEthernet1/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>
Configuring a Static MAC Address Entry
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 |
GigabitEthernet1/0/1 |
Configure the outbound interface GigabitEthernet1/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>GigabitEthernet1/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>GigabitEthernet1/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>
Configuring a MAC Address Learning Limit Rule
This section provides a sample of configuring a MAC address learning limit rule using the edit-config method.
Operation |
XPATH |
---|---|
edit-config |
/ietf-interfaces:interfaces/interface/huawei-mac:mac-security/mac-limit/maxinum /ietf-interfaces:interfaces/interface/huawei-mac:mac-security/mac-limit/action /ietf-interfaces:interfaces/interface/huawei-mac:mac-security/mac-limit/alarm-enable |
Data Requirements
Item |
Data |
Description |
---|---|---|
maxinum |
20 |
Set the maximum of MAC addresses that can be learned to 20. |
action |
forward |
Forward packets with new source MAC addresses but do not add the new MAC addresses to the MAC address table. |
alarm-enable |
false |
Do not generate an alarm when the number of MAC address entries reaches the limit. |
Request Example
<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="11" 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>GigabitEthernet1/0/1</if:name>
<if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:ethernetCsmacd</if:type>
<huawei-mac:mac-security xmlns:huawei-mac="urn:huawei:params:xml:ns:yang:huawei-mac">
<huawei-mac:mac-limit>
<huawei-mac:maxinum>20</huawei-mac:maxinum>
<huawei-mac:action>forward</huawei-mac:action>
<huawei-mac:alarm-enable>false</huawei-mac:alarm-enable>
</huawei-mac:mac-limit>
</huawei-mac:mac-security>
</if:interface>
</if:interfaces>
</config>
</edit-config>
</rpc>
Deletion Example
<?xml version='1.0' encoding='UTF-8'?>
<rpc message-id="12" 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>GigabitEthernet1/0/1</if:name>
<if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:ethernetCsmacd</if:type>
<huawei-mac:mac-security xmlns:huawei-mac="urn:huawei:params:xml:ns:yang:huawei-mac">
<huawei-mac:mac-limit xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" xc:operation="delete">
<huawei-mac:maxinum>20</huawei-mac:maxinum>
<huawei-mac:action>forward</huawei-mac:action>
<huawei-mac:alarm-enable>false</huawei-mac:alarm-enable>
</huawei-mac:mac-limit>
</huawei-mac:mac-security>
</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="11"> <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="11">
<rpc-error>
<error-app-tag>-1</error-app-tag>
<error-message>Failed to change the configurations of the action or alarm because the MAC-limit rule does not exist.</error-message>
<error-info>Error on node /ietf-interfaces:interfaces/interface[name="GigabitEthernet1/0/1"]/huawei-mac:mac-security/mac-limit</error-info>
</rpc-error>
</rpc-reply>