---
title: STP
slug: enterprise-v6p1/stp
createdAt: 2025-12-18T08:23:38.249Z
---

# <font color="#1d50a2">AsterNOS-S</font><font color="#1d50a2">TP</font>

This chapter provides examples on how to use Netconf to manage stp configurations on AsterNOS devices.

## <font color="#1d50a2">Create STP</font>

Request example to create stp instance 3 via **edit-config**

```xml
<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

```xml
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:c5b484e2-f2ae-48b4-8261-fbd31dc35674">
    <ok/>
</rpc-reply>
```

## <font color="#1d50a2">GET All STP Configurations</font>

Request example to get all stp configurations via **get-config**

```xml
<filter type="subtree">
    <top>
        <stp/>
    </top>
</filter>
```

Response example

```xml
<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>
```

## <font color="#1d50a2">Replace STP Mode</font>

Request example to replace stp mode to stp via **edit-config**

```xml
<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

```xml
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:dc4b64f2-8e74-42db-b34d-fec5be9f97b6">
  <ok/>
</rpc-reply>
```

## <font color="#1d50a2">Disable STP Service</font>

Request example to disable stp via **edit-config**

```xml
<config>
    <top>
        <stp>
            <global operation="merge">
                <enabled>false</enabled>
            </global>
        </stp>
    </top>
</config>
```

Response example

```xml
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:d93c885b-eb49-45e3-9755-a99279840c57">
  <ok/>
</rpc-reply>
```

## <font color="#1d50a2">Create STP Instances</font>

Request example to create stp instances via **edit-config**

```xml
<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

```xml
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:aa560eb6-5868-49e4-9fa3-10820603983c">
  <ok/>
</rpc-reply>
```

## <font color="#1d50a2">Get All STP Instances</font>

Request example to get all stp instances via **get-config**

```xml
<filter type="subtree">
    <top>
        <stp>
            <mstp>
                <instances/>
            </mstp>
        </stp>
    </top>
</filter>
```

Response example

```xml
<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>
```

## <font color="#1d50a2">Delete STP Instances</font>

Request example to delete specified stp instances 1 via **edit-config**

```xml
<config>
    <top>
        <stp>
            <mstp>
                <instances>
                    <instance operation="delete">
                        <id>1</id>
                    </instance>
                </instances>
            </mstp>
        </stp>
    </top>
</config>
```

Response example

```xml
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:58cae6ce-bd38-4003-8ad9-e210ce6b130f">
  <ok/>
</rpc-reply>
```

## <font color="#1d50a2">Change STP Port Priority</font>

Request example to modify specified stp port priority via **edit-config**

```xml
<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

```xml
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:e4f15f44-18dd-4db5-87f0-8a321920f841">
  <ok/>
</rpc-reply>
```

## <font color="#1d50a2">Set STP Interface BPDU</font>

Request example to set specified stp interface bpdu via **edit-config**

```xml
<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

```xml
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:b3badfb8-e55e-439e-88bc-e99bc41117de">
  <ok/>
</rpc-reply>
```

## <font color="#1d50a2">Shows Stp Information Of All Stp Instance</font>

Request example to show status of all stp instance via rpc **show-stp**.

```xml
<show-stp>
  <status/>
</show-stp>
```

Response example

```xml
<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>
```

## <font color="#1d50a2">Shows Stp Information Of Specified Stp Instance</font>

Request example to show status of stp instance via rpc **show-stp**.

```xml
<show-stp>
  <stp_info>
    <stpid>1</stpid>
  </stp_info>
</show-stp>
```

Response example

```xml
<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>
```

## <font color="#1d50a2">Shows Stp Interface Information of Specified Stp Instance</font>

Request example to show status of stp interface via rpc **show-stp**.

```xml
<show-stp>
  <stp_info>
    <stpid>1</stpid>
    <interface_name>Ethernet1</interface_name>
  </stp_info>
</show-stp>
```

Response example

```xml
<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>
```

## <font color="#1d50a2">Shows Stp Instances Bind Info</font>

Request example to show stp bind info via rpc **show-stp**.

```xml
<show-stp>
  <bind/>
</show-stp>
```

Response example

```xml
<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>
```

