From b9ace824c52768718fa3e16fb57d4c64d37f867e Mon Sep 17 00:00:00 2001 From: Simon Oliver Tveit Date: Mon, 4 Sep 2023 20:39:49 +0200 Subject: [PATCH] Build PoE support functionality into get_poe_state --- python/nav/portadmin/handlers.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/python/nav/portadmin/handlers.py b/python/nav/portadmin/handlers.py index f56fbfbedb..250342272d 100644 --- a/python/nav/portadmin/handlers.py +++ b/python/nav/portadmin/handlers.py @@ -15,7 +15,7 @@ # """Interface definition for PortAdmin management handlers""" import time -from typing import List, Tuple, Dict, Any, Sequence, Union +from typing import List, Tuple, Dict, Any, Sequence, Union, Optional import logging from dataclasses import dataclass @@ -302,7 +302,7 @@ def set_poe_state(self, interface: manage.Interface, state: PoeState): def get_poe_states( self, interfaces: Sequence[manage.Interface] = None - ) -> Dict[int, PoeState]: + ) -> Dict[int, Optional[PoeState]]: """Retrieves current PoE state for interfaces on this device. :param interfaces: Optional sequence of interfaces to filter for, as fetching @@ -313,13 +313,10 @@ def get_poe_states( :returns: A dict mapping interfaces to their discovered PoE state. The key matches the `ifindex` attribute for the related Interface object. + The value will be None if the interface does not support PoE. """ raise NotImplementedError - def interface_supports_poe(self, interface: manage.Interface) -> bool: - """Returns True if this interface supports PoE""" - raise NotImplementedError - class ManagementError(Exception): """Base exception class for device management errors"""