Introduction to SDN OpenDayLight

Hello Brahim

It seems that ODL is a little cumbersome to use for such an emulation project. Also, ODL used to support the L2switch feature, which supported STP and LLDP, but that project is no longer being updated as seen from this repository.

The L2Switch was removed from the latest iteration of ODL, but older versions should still have it. If this is just a lab situation then using that should be OK. For more info on the setup and operation of the L2switch, take a look at this link:
https://docs.opendaylight.org/en/stable-fluorine/user-guide/l2switch-user-guide.html

Some alternatives to ODL include Ryu which is Python-based, which is good to learn anyway. You can find out more info about it here:
https://osrg.github.io/ryu/
And you can find a complete example for STP here:

https://osrg.github.io/ryu-book/en/html/spanning_tree.html

Take a look at these and let us know how you get along!

I hope this has been helpful!

Laz