bisdn / basebox

A tiny OpenFlow controller for OF-DPA switches.
Mozilla Public License 2.0
45 stars 9 forks source link

add proper lifecycle management of vlan STGs #333

Closed KanjiMonster closed 3 years ago

KanjiMonster commented 3 years ago

Add proper lifecycle management for STP STGs so they get deleted once not needed anymore.

Description

Currently STP STGs are only created, but never destroyed any more. To fix this, add the required implementations for removing STGs, and implement handling bridge vlan removal notifications. Since we need to know when we can remove the group as well, let our internal state cache for calculation the effective STP states notify if it creates the map for a vlan (i.e. we need to create the STG), and if it removes the map because it removed the last member (i.e. we can drop the STG).

Since this will eventually lead to us needing to reuse STG IDs, add code for finding the next free ID, and keep track of used IDs in a bitmap.

How Has This Been Tested?

Ran a full pipeline on the Questone 2As (17666)

KanjiMonster commented 3 years ago

Haven't done a style check, so marking temporarily as draft

KanjiMonster commented 3 years ago

Fixed all one style issue.

hilmarm commented 3 years ago

Seems to work fine for adding and deleting stg groups, tested on celestica questone.

How is the user notified about too many STG groups being created? i.e. what should happen if you try to add more than 512 STGs?

KanjiMonster commented 3 years ago

i.e. what should happen if you try to add more than 512 STGs?

Basebox will log an error message failing to create more STG. There isn't really we can do much about it, as we cannot prevent the user from creating more than 510 different vlans on a bridge.

hilmarm commented 3 years ago

i.e. what should happen if you try to add more than 512 STGs?

Basebox will log an error message failing to create more STG. There isn't really we can do much about it, as we cannot prevent the user from creating more than 510 different vlans on a bridge.

This is the basebox log when creating more than 512VLANs:

get_members: lag does not exist for port53 ether ba:07:e3:9f:30:98 master swbridge <broadcast,multicast,up,running,lowerup> group 0

Should we add an additional log warning when this happens?

KanjiMonster commented 3 years ago

i.e. what should happen if you try to add more than 512 STGs?

Basebox will log an error message failing to create more STG. There isn't really we can do much about it, as we cannot prevent the user from creating more than 510 different vlans on a bridge.

This is the basebox log when creating more than 512VLANs:

get_members: lag does not exist for port53 ether ba:07:e3:9f:30:98 master swbridge <broadcast,multicast,up,running,lowerup> group 0

This is a completely unrelated message.

Should we add an additional log warning when this happens?

Added an error log if this happens.