1
0
mirror of https://github.com/checktheroads/hyperglass synced 2024-05-11 05:55:08 +00:00
2021-10-04 01:38:44 -07:00

30 lines
838 B
Python

"""Device output plugins."""
# Standard Library
from typing import TYPE_CHECKING, Union
# Project
from hyperglass.log import log
from hyperglass.types import Series
# Local
from ._base import PlatformPlugin, DirectivePlugin, HyperglassPlugin
if TYPE_CHECKING:
# Project
from hyperglass.models.data import OutputDataModel
from hyperglass.models.api.query import Query
OutputType = Union["OutputDataModel", Series[str]]
class OutputPlugin(HyperglassPlugin, DirectivePlugin, PlatformPlugin):
"""Plugin to interact with device command output."""
_type = "output"
def process(self, *, output: OutputType, query: "Query") -> OutputType:
"""Process or manipulate output from a device."""
log.warning("Output plugin '{}' has not implemented a 'process()' method", self.name)
return output