Skip to content

Commit

Permalink
feat: SUB operator
Browse files Browse the repository at this point in the history
  • Loading branch information
hairmare committed Jun 16, 2023
1 parent f6746da commit 53f7cef
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.coverage
__pycache__/
venv
site/
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Please raise an [issue](https://github.com/radiorabe/axia-pathfinder-client/issu
## Features

* partially implements the "SAPv2" protocol as described in the [pathfinder manual](https://www.telosalliance.com/images/Axia%20Products/Pathfinder%20PC/Support%20Files/PathFinder%20PC%20Manual-5.00.pdf)
* only "LOGIN" and "GET" operators are currently supported
* only "LOGIN", "GET" and "SUB" operators are currently supported
* "INDI" responses to "GET" requests get parsed and returned in a timeout governed timeout fashion
* Also works with xNode Telnet interfaces
* GPO responses to "GPO" requests are currently parsed
Expand Down
15 changes: 15 additions & 0 deletions pathfinder/operators/sub.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
SUB operator
https://docs.telosalliance.com/pathfinder-core-pro/pathfindercore-pro/appendix-a-sapv2#subscription-examples
"""
from typing import NoReturn

from pathfinder.operators.base import BaseOperator


class Sub(BaseOperator):
config = {"path": "."}

def execute(self) -> NoReturn:
self.client.write(f"SUB {self.config.get('path')}".encode("ascii") + b"\r\n")
12 changes: 12 additions & 0 deletions tests/test_sub.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import pytest

from pathfinder.operators.sub import Sub


class TestGetOperator:
def test_sub_root(self, client):
sub = Sub(client=client, config={"path": "."})

sub.execute()

sub.client.write.assert_called_with(b"SUB .\r\n")

0 comments on commit 53f7cef

Please sign in to comment.