STP
此内容尚不支持你的语言。
This chapter provides examples on how to use Netconf to manage stp configurations on AsterNOS devices.
Create STP
Section titled “Create STP”Request example to create stp instance 3 via edit-config
<config> <top> <stp> <global> <enabled>true</enabled> <protocol>mstp</protocol> </global> <mstp> <config> <forward-delay>16</forward-delay> </config> <instances> <instance> <id>3</id> <priority>5</priority> <vlans>100</vlans> <interfaces> <interface> <name>Ethernet1</name> <priority>11</priority> </interface> </interfaces> </instance> </instances> </mstp> <interfaces> <interface> <name>Ethernet1</name> <bpdu-filter>true</bpdu-filter> <bpdu-guard>true</bpdu-guard> </interface> </interfaces> </stp> </top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:c5b484e2-f2ae-48b4-8261-fbd31dc35674"> <ok/></rpc-reply>GET All STP Configurations
Section titled “GET All STP Configurations”Request example to get all stp configurations via get-config
<filter type="subtree"> <top> <stp/> </top></filter>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:61ceaab6-5af0-4461-8cd2-e0924f9dab69"> <data> <top> <stp xmlns="http://asterfusion.com/ns/yang/asternos-stp"> <global> <enabled>true</enabled> <protocol>mstp</protocol> </global> <stp/> <rstp/> <mstp> <config> <forward-delay>16</forward-delay> <hello-time>2</hello-time> <max-age>20</max-age> </config> <instances> <instance> <id>0</id> <priority>8</priority> </instance> <instance> <id>3</id> <priority>5</priority> <vlans>100</vlans> <vlans>30</vlans> <interfaces> <interface> <name>Ethernet1</name> <priority>11</priority> </interface> </interfaces> </instance> </instances> </mstp> <interfaces> <interface> <name>Ethernet1</name> <bpdu-filter>true</bpdu-filter> <bpdu-guard>true</bpdu-guard> </interface> </interfaces> </stp> </top> </data></rpc-reply>Replace STP Mode
Section titled “Replace STP Mode”Request example to replace stp mode to stp via edit-config
<config> <top> <stp operation="replace"> <global> <enabled>true</enabled> <protocol>stp</protocol> </global> <stp> <config> <forward-delay>16</forward-delay> </config> <interfaces> <interface> <name>Ethernet1</name> <priority>3</priority> </interface> </interfaces> </stp> <interfaces> <interface> <name>Ethernet1</name> <bpdu-filter>true</bpdu-filter> <bpdu-guard>true</bpdu-guard> </interface> </interfaces> </stp> </top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:dc4b64f2-8e74-42db-b34d-fec5be9f97b6"> <ok/></rpc-reply>Disable STP Service
Section titled “Disable STP Service”Request example to disable stp via edit-config
<config> <top> <stp> <global operation="merge"> <enabled>false</enabled> </global> </stp> </top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:d93c885b-eb49-45e3-9755-a99279840c57"> <ok/></rpc-reply>Create STP Instances
Section titled “Create STP Instances”Request example to create stp instances via edit-config
<config> <top> <stp> <mstp> <config> <forward-delay>16</forward-delay> </config> <instances> <instance> <id>1</id> <priority>4</priority> <vlans>101</vlans> </instance> </instances> </mstp> </stp> </top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:aa560eb6-5868-49e4-9fa3-10820603983c"> <ok/></rpc-reply>Get All STP Instances
Section titled “Get All STP Instances”Request example to get all stp instances via get-config
<filter type="subtree"> <top> <stp> <mstp> <instances/> </mstp> </stp> </top></filter>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:9d08a754-1179-4193-a030-741936d47914"> <data> <top> <stp xmlns="http://asterfusion.com/ns/yang/asternos-stp"> <mstp> <instances> <instance> <id>0</id> <priority>8</priority> </instance> <instance> <id>1</id> <priority>4</priority> <vlans>101</vlans> </instance> <instance> <id>3</id> <priority>5</priority> <vlans>100</vlans> <interfaces> <interface> <name>Ethernet1</name> <priority>11</priority> </interface> </interfaces> </instance> </instances> </mstp> </stp> </top> </data></rpc-reply>Delete STP Instances
Section titled “Delete STP Instances”Request example to delete specified stp instances 1 via edit-config
<config> <top> <stp> <mstp> <instances> <instance operation="delete"> <id>1</id> </instance> </instances> </mstp> </stp> </top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:58cae6ce-bd38-4003-8ad9-e210ce6b130f"> <ok/></rpc-reply>Change STP Port Priority
Section titled “Change STP Port Priority”Request example to modify specified stp port priority via edit-config
<config> <top> <stp> <mstp> <instances> <instance> <id>1</id> <interfaces> <interface> <name>Ethernet1</name> <priority>7</priority> </interface> </interfaces> </instance> </instances> </mstp> </stp> </top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:e4f15f44-18dd-4db5-87f0-8a321920f841"> <ok/></rpc-reply>Set STP Interface BPDU
Section titled “Set STP Interface BPDU”Request example to set specified stp interface bpdu via edit-config
<config> <top> <stp> <interfaces> <interface> <name>Ethernet1</name> <bpdu-filter>true</bpdu-filter> <bpdu-guard>false</bpdu-guard> </interface> </interfaces> </stp> </top></config>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:b3badfb8-e55e-439e-88bc-e99bc41117de"> <ok/></rpc-reply>Shows Stp Information Of All Stp Instance
Section titled “Shows Stp Information Of All Stp Instance”Request example to show status of all stp instance via rpc show-stp.
<show-stp> <status/></show-stp>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:1babb2d8-a371-49f4-8857-1c765c12d914"> <data xmlns="http://asterfusion.com/ns/yang/asternos-stp"> Spanning-tree Mode: mstp mst_instance port port_role stp_state -------------- --------- ----------- ----------- 3 Ethernet1 Disabled discarding 3 Ethernet3 Designated forwarding 3 Ethernet7 Backup discarding mstpid ['1'] do not bind any vlans </data></rpc-reply>Shows Stp Information Of Specified Stp Instance
Section titled “Shows Stp Information Of Specified Stp Instance”Request example to show status of stp instance via rpc show-stp.
<show-stp> <stp_info> <stpid>1</stpid> </stp_info></show-stp>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:be3ccbb3-38d6-49e6-98e7-68d3fb8514fc"> <data xmlns="http://asterfusion.com/ns/yang/asternos-stp"> Spanning-tree Mode: mstp mst_instance port port_role stp_state -------------- --------- ----------- ----------- 3 Ethernet1 Disabled discarding 3 Ethernet3 Designated forwarding 3 Ethernet7 Backup discarding </data></rpc-reply>Shows Stp Interface Information of Specified Stp Instance
Section titled “Shows Stp Interface Information of Specified Stp Instance”Request example to show status of stp interface via rpc show-stp.
<show-stp> <stp_info> <stpid>1</stpid> <interface_name>Ethernet1</interface_name> </stp_info></show-stp>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:cfa844e5-3e4e-4ca2-91e2-e0029d6bcae7"> <data xmlns="http://asterfusion.com/ns/yang/asternos-stp"> Spanning-tree Mode: mstp mst_instance port port_role stp_state -------------- --------- ----------- ----------- 3 Ethernet1 Disabled discarding </data></rpc-reply>Shows Stp Instances Bind Info
Section titled “Shows Stp Instances Bind Info”Request example to show stp bind info via rpc show-stp.
<show-stp> <bind/></show-stp>Response example
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:2365ac63-6ba2-4bc6-bbbc-5bb2c671c7b5"> <data> <vlan_id>100</vlan_id> <stp_id>3</stp_id> </data></rpc-reply>