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>GigabitEthernet0/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>GigabitEthernet0/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="GigabitEthernet0/0/1"]/huawei-mac:mac-security/mac-limit</error-info>
</rpc-error>
</rpc-reply>