ControllerBase

class mtf.network_port.controllers_base.ControllerBase

Base class for controllers that need to be cleaned up.

  • All controllers that need to be cleaned up should inherit from this class.

  • The controllers in the list of controllers will be automatically cleaned up when the cleanup_controllers() method is called.

  • The list of controllers will not be cleaned throughout the entire test series or other scenarios where cleanup is needed.

  • Any new controller class should inherit from the ControllerBase class to ensure automatic cleanup.

  • Any new controller class that inherit from the ControllerBase should not override __new__() method to be sure that any new instance is added to the controllers list.

Attributes:

_controller_base_instances (list): A list to keep track of controllers.

static __new__(cls, *args, **kwargs)

Initialize a new instance of the ControllerBase.

The instance will be automatically added to the list of controllers.

classmethod controllers_cleanup()

Clean up all controller instances.

Calls the clean_up() method for each instance.

clean_up() bool