Skip to content
This repository was archived by the owner on Apr 22, 2024. It is now read-only.
This repository was archived by the owner on Apr 22, 2024. It is now read-only.

Raise exception when user tries to enable interface in a disabled switch #1233

@cmagnobarbosa

Description

@cmagnobarbosa

Raise exception when user try to enable interface in a disabled switch.

Therefore, its necessary to change this code:
https://github.com/kytos/kytos/blob/master/kytos/core/interface.py#L144~#L150

    def enable(self):
        """Enable this interface instance.
        Also enable the switch instance this interface is attached to.
        """
        self.switch.enable()
        self._enabled = True

Suggestion:

    def enable(self):
        """Enable this interface instance.
        """
        if not self.switch.is_enabled():
          raise KytosSwitchDisabled() # or another suitable exception
        self._enabled = True

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions