summaryrefslogtreecommitdiff
path: root/src/op_mode/conntrack.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2023-03-03 11:30:27 -0600
committerJohn Estabrook <jestabro@vyos.io>2023-03-05 19:38:07 -0600
commit1e72e1c68a708518526b8e090f5d6482671cbd57 (patch)
treeb1b040241ad157ba8cc165b42d47cf8d00fa5fc7 /src/op_mode/conntrack.py
parentae2db32a13d78c5014c7b770f2de28949a13a6c3 (diff)
downloadvyos-1x-1e72e1c68a708518526b8e090f5d6482671cbd57.tar.gz
vyos-1x-1e72e1c68a708518526b8e090f5d6482671cbd57.zip
op-mode: T5051: use typing.Literal in op-mode scripts
Diffstat (limited to 'src/op_mode/conntrack.py')
-rwxr-xr-xsrc/op_mode/conntrack.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/op_mode/conntrack.py b/src/op_mode/conntrack.py
index df213cc5a..ea7c4c208 100755
--- a/src/op_mode/conntrack.py
+++ b/src/op_mode/conntrack.py
@@ -15,6 +15,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
+import typing
import xmltodict
from tabulate import tabulate
@@ -23,6 +24,7 @@ from vyos.util import run
import vyos.opmode
+ArgFamily = typing.Literal['inet', 'inet6']
def _get_xml_data(family):
"""
@@ -126,7 +128,7 @@ def get_formatted_output(dict_data):
return output
-def show(raw: bool, family: str):
+def show(raw: bool, family: ArgFamily):
family = 'ipv6' if family == 'inet6' else 'ipv4'
conntrack_data = _get_raw_data(family)
if raw: