diff options
Diffstat (limited to 'src/op_mode/show_nat66_rules.py')
-rwxr-xr-x | src/op_mode/show_nat66_rules.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/op_mode/show_nat66_rules.py b/src/op_mode/show_nat66_rules.py index fe5113015..cd4c35b8a 100755 --- a/src/op_mode/show_nat66_rules.py +++ b/src/op_mode/show_nat66_rules.py @@ -42,9 +42,16 @@ if args.source or args.destination: data = data_json[idx] # If there is no index 3, we don't think this is the record we need to check + # We need to filter the rule for Len (expr) <= 3 first, which is not what we should be concerned with if len(data['expr']) <= 3: continue + # The following key values must exist + # When the rule JSON does not have some keys, this is not a rule we can work with + for keys in ['comment', 'chain', 'expr']: + if keys not in data: + continue + comment = data['comment'] rule = comment.replace('SRC-NAT66-','') rule = rule.replace('DST-NAT66-','') |