summaryrefslogtreecommitdiff
path: root/src/op_mode/conntrack.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-10-11 19:31:41 +0200
committerGitHub <noreply@github.com>2022-10-11 19:31:41 +0200
commit72cf07cc8df5623c30bcd61fa830ecbcd275e1cc (patch)
treec1f26dba4d32e36b3145f8e6cb44a209efab5555 /src/op_mode/conntrack.py
parente5507b247edc37c466ef0d023417c65ebbad409b (diff)
parente4071bfaede4971dca093ef459cce8c6caad2372 (diff)
downloadvyos-1x-72cf07cc8df5623c30bcd61fa830ecbcd275e1cc.tar.gz
vyos-1x-72cf07cc8df5623c30bcd61fa830ecbcd275e1cc.zip
Merge pull request #1581 from sever-sever/T4740
conntrack: T4740: Set correct error msg if enrties not found
Diffstat (limited to 'src/op_mode/conntrack.py')
-rwxr-xr-xsrc/op_mode/conntrack.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/op_mode/conntrack.py b/src/op_mode/conntrack.py
index b27aa6060..fff537936 100755
--- a/src/op_mode/conntrack.py
+++ b/src/op_mode/conntrack.py
@@ -48,6 +48,14 @@ def _get_raw_data(family):
Return: dictionary
"""
xml = _get_xml_data(family)
+ if len(xml) == 0:
+ output = {'conntrack':
+ {
+ 'error': True,
+ 'reason': 'entries not found'
+ }
+ }
+ return output
return _xml_to_dict(xml)
@@ -72,7 +80,8 @@ def get_formatted_output(dict_data):
:return: formatted output
"""
data_entries = []
- #dict_data = _get_raw_data(family)
+ if 'error' in dict_data['conntrack']:
+ return 'Entries not found'
for entry in dict_data['conntrack']['flow']:
orig_src, orig_dst, orig_sport, orig_dport = {}, {}, {}, {}
reply_src, reply_dst, reply_sport, reply_dport = {}, {}, {}, {}