This section provides a sample of delivering interface-based STP configurations to the device using the rpc method.
Operation |
XPATH |
|---|---|
rpc |
/ietf-interfaces:interfaces/interface/huawei-stp:stp |
Data Requirements
Item |
Data |
Description |
|---|---|---|
Interface name |
Eth-Trunk1 |
Set the interface name to Eth-Trunk1. |
Whether to enable STP on the interface |
true |
Enable STP on the interface. |
Interface as an edge port |
true |
Configure the interface as an edge port. |
Instance ID of the interface |
1 |
Set the instance ID of the interface to 1. |
Cost of a specified instance of the interface |
1 |
Set the cost of instance 1 of the interface to 1. |
Interface priority of a specified instance |
0 |
Set the interface priority of instance 1 to 0. |
Process ID of the interface |
1 |
Set the process ID of the interface to 1. |
Instance ID of a specified process on the interface |
1 |
Set the instance ID of process 1 on the interface to 1. |
Interface priority of a specified instance of a specified process |
0 |
Set the interface priority of instance 1 of process 1 to 0. |
Cost of a specified process on the interface |
1 |
Set the cost of process 1 on the interface to 1. |
Process ID bound to the interface |
1 |
Set the process ID bound to the interface to 1. |
Whether to enable process sharing on the interface |
true |
Enable process sharing on the interface. |
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>Eth-Trunk1</if:name>
<if:type xmlns:iana-if-type="urn:ietf:params:xml:ns:yang:iana-if-type">iana-if-type:ethernetCsmacd</if:type>
<huawei-stp:stp xmlns:huawei-stp="urn:huawei:params:xml:ns:yang:huawei-stp">
<huawei-stp:enable>true</huawei-stp:enable>
<huawei-stp:edged-port-enable>true</huawei-stp:edged-port-enable>
<huawei-stp:stp-port-instance>
<huawei-stp:port-instance>
<huawei-stp:instance-id>1</huawei-stp:instance-id>
<huawei-stp:cost>1</huawei-stp:cost>
<huawei-stp:port-priority>0</huawei-stp:port-priority>
</huawei-stp:port-instance>
</huawei-stp:stp-port-instance>
<huawei-stp:port-protection>loop-mode</huawei-stp:port-protection>
<huawei-stp:stp-mstp>
<huawei-stp:stp-mstp-instance>
<huawei-stp:process-mstp>
<huawei-stp:process-mstp-id>1</huawei-stp:process-mstp-id>
<huawei-stp:instance-id>1</huawei-stp:instance-id>
<huawei-stp:port-priority>0</huawei-stp:port-priority>
<huawei-stp:cost>1</huawei-stp:cost>
</huawei-stp:process-mstp>
</huawei-stp:stp-mstp-instance>
<huawei-stp:stp-mstp-bind>
<huawei-stp:process-list>
<huawei-stp:process-id>1</huawei-stp:process-id>
<huawei-stp:link-share-port>true</huawei-stp:link-share-port>
</huawei-stp:process-list>
</huawei-stp:stp-mstp-bind>
</huawei-stp:stp-mstp>
</huawei-stp:stp>
</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="12">
<rpc-error>
<error-type>application</error-type>
<error-tag>operation-failed</error-tag>
<error-severity>error</error-severity>
<error-path>/ietf-interfaces:interfaces/interface[name='Eth-Trunk1']/huawei-stp:stp/stp-mstp/stp-mstp-bind/process-list[processid='100000']/processid</error-path>
<error-message>parse rpc config error.(Invalid value "100000" in "processid" element.).</error-message>
</rpc-error>
</rpc-reply>