Skip to content

Commit

Permalink
Build PoE support functionality into get_poe_state
Browse files Browse the repository at this point in the history
  • Loading branch information
stveit committed Sep 4, 2023
1 parent 6f51c86 commit b9ace82
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions python/nav/portadmin/handlers.py
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand All @@ -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

Check warning on line 318 in python/nav/portadmin/handlers.py

View check run for this annotation

Codecov / codecov/patch

python/nav/portadmin/handlers.py#L318

Added line #L318 was not covered by tests

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"""
Expand Down

0 comments on commit b9ace82

Please sign in to comment.