How to enable brctl stp using python script?

1.8k views Asked by At

In mininet I am building a topology using LinuxBridge from mininet.nodelib.LinuxBridge) instead of OVSKernelSwitch.

s1 = net.addSwitch('s1', cls=LinuxBridge)

we can enable the stp of s1 from the command line by

brctl stp s1 on

How to enable the STP of the bridge s1 directly from the writing python script instead of CLI.

For example, in OVSKernelSwitch we write:

s1.cmd('ovs-vsctl set bridge s1 stp-enable=true')

to enable the stp to break the loop in the network topology.

What is the brctl stp enable script? I have tried with:

s1.cmd('brctl stp' , s1, 'on')

but it is unable to enable the stp.

1

There are 1 answers

0
felipealencar On

You could try using call procedures in your Python script. Example:

from subprocess import call
...
call('brctl stp s1 on')