Page MenuHomeVyOS Platform

nat source translations couldn't show metrics
Closed, ResolvedPublicBUG

Description

The operational command show nat source translations , is affected by an issue with python module script, it's the bug shown :

vyos@vyos:~$ show nat source translations
Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/nat.py", line 331, in <module>
    res = vyos.opmode.run(sys.modules[__name__])
  File "/usr/lib/python3/dist-packages/vyos/opmode.py", line 212, in run
    res = func(**args)
  File "/usr/libexec/vyos/op_mode/nat.py", line 296, in _wrapper
    return func(*args, **kwargs)
  File "/usr/libexec/vyos/op_mode/nat.py", line 326, in show_translations
    return _get_formatted_translation(nat_translation, direction, family, verbose)

basic config:

vyos@vyos:~$ show configuration commands  | match nat
set nat source rule 100 outbound-interface 'eth0'
set nat source rule 100 source address '10.1.1.0/24'
set nat source rule 100 translation address 'masquerade

Details

Difficulty level
Normal (likely a few hours)
Version
VyOS 1.4-rolling-202212310809
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Bug (incorrect behavior)

Event Timeline

fernando changed the task status from Open to Confirmed.Jan 2 2023, 8:25 PM
fernando created this task.
vyos@r14:~$ sudo /usr/libexec/vyos/op_mode/nat.py show_translations --direction source --family inet --raw
{
    "conntrack": {
        "error": true,
        "reason": "entries not found"
    }
}
vyos@r14:~$ 
vyos@r14:~$ 
vyos@r14:~$ sudo /usr/libexec/vyos/op_mode/nat.py show_translations --direction source --family inet 
Traceback (most recent call last):
  File "/usr/libexec/vyos/op_mode/nat.py", line 331, in <module>
    res = vyos.opmode.run(sys.modules[__name__])
  File "/usr/lib/python3/dist-packages/vyos/opmode.py", line 212, in run
    res = func(**args)
  File "/usr/libexec/vyos/op_mode/nat.py", line 296, in _wrapper
    return func(*args, **kwargs)
  File "/usr/libexec/vyos/op_mode/nat.py", line 326, in show_translations
    return _get_formatted_translation(nat_translation, direction, family, verbose)
NameError: name 'verbose' is not defined
vyos@r14:~$
Viacheslav changed the task status from Confirmed to In progress.Jan 3 2023, 11:18 AM
Viacheslav claimed this task.

PR https://github.com/vyos/vyos-1x/pull/1736

vyos@r14:~$ sudo /usr/libexec/vyos/op_mode/nat.py show_translations --direction source --family inet 
Entries not found
vyos@r14:~$ 
vyos@r14:~$ ping 1.1.1.1 source-address 192.0.2.1 count 1
PING 1.1.1.1 (1.1.1.1) from 192.0.2.1 : 56(84) bytes of data.
64 bytes from 1.1.1.1: icmp_seq=1 ttl=56 time=38.4 ms

--- 1.1.1.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 38.438/38.438/38.438/0.000 ms
vyos@r14:~$ 
vyos@r14:~$ 
vyos@r14:~$ sudo /usr/libexec/vyos/op_mode/nat.py show_translations --direction source --family inet 
Pre-NAT    Post-NAT        Proto    Timeout    Mark    Zone
---------  --------------  -------  ---------  ------  ------
192.0.2.1  192.168.122.14  icmp     27
vyos@r14:~$ 
vyos@r14:~$
Viacheslav moved this task from Need Triage to Finished on the VyOS 1.4 Sagitta board.