diff options
author | Christian Breunig <christian@breunig.cc> | 2024-05-16 20:10:06 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-16 20:10:06 +0200 |
commit | 899ed3cc932ba657aaa5ddbcf01b7a0cc31bc336 (patch) | |
tree | 9a9b1f418f6a2270996eb6f4741a751bbb47937a | |
parent | bfec382819adb46a9b7092fa70eaa545e8478eb0 (diff) | |
parent | 9ea1d74e4f01f07b7af4feb5c57e58b1b388118d (diff) | |
download | vyos-1x-899ed3cc932ba657aaa5ddbcf01b7a0cc31bc336.tar.gz vyos-1x-899ed3cc932ba657aaa5ddbcf01b7a0cc31bc336.zip |
Merge pull request #3462 from nvollmar/T4519
op mode: T4519: Show DUID instead of IAID_DUID
-rw-r--r-- | op-mode-definitions/dhcp.xml.in | 2 | ||||
-rwxr-xr-x | src/op_mode/dhcp.py | 8 |
2 files changed, 5 insertions, 5 deletions
diff --git a/op-mode-definitions/dhcp.xml.in b/op-mode-definitions/dhcp.xml.in index 97af506db..6114142f0 100644 --- a/op-mode-definitions/dhcp.xml.in +++ b/op-mode-definitions/dhcp.xml.in @@ -130,7 +130,7 @@ <properties> <help>Show DHCPv6 server leases sorted by the specified key</help> <completionHelp> - <list>end iaid_duid ip last_communication pool remaining state type</list> + <list>end duid ip last_communication pool remaining state type</list> </completionHelp> </properties> <command>${vyos_op_scripts_dir}/dhcp.py show_server_leases --family inet6 --sort $6</command> diff --git a/src/op_mode/dhcp.py b/src/op_mode/dhcp.py index a7143d664..54d492cda 100755 --- a/src/op_mode/dhcp.py +++ b/src/op_mode/dhcp.py @@ -37,7 +37,7 @@ time_string = "%a %b %d %H:%M:%S %Z %Y" config = ConfigTreeQuery() lease_valid_states = ['all', 'active', 'free', 'expired', 'released', 'abandoned', 'reset', 'backup'] sort_valid_inet = ['end', 'mac', 'hostname', 'ip', 'pool', 'remaining', 'start', 'state'] -sort_valid_inet6 = ['end', 'iaid_duid', 'ip', 'last_communication', 'pool', 'remaining', 'state', 'type'] +sort_valid_inet6 = ['end', 'duid', 'ip', 'last_communication', 'pool', 'remaining', 'state', 'type'] ArgFamily = typing.Literal['inet', 'inet6'] ArgState = typing.Literal['all', 'active', 'free', 'expired', 'released', 'abandoned', 'reset', 'backup'] @@ -105,7 +105,7 @@ def _get_raw_server_leases(family='inet', pool=None, sorted=None, state=[], orig if family == 'inet6': data_lease['last_communication'] = lease.last_communication.timestamp() - data_lease['iaid_duid'] = _format_hex_string(lease.host_identifier_string) + data_lease['duid'] = _format_hex_string(lease.duid) lease_types_long = {'na': 'non-temporary', 'ta': 'temporary', 'pd': 'prefix delegation'} data_lease['type'] = lease_types_long[lease.type] @@ -175,11 +175,11 @@ def _get_formatted_server_leases(raw_data, family='inet'): remain = lease.get('remaining') lease_type = lease.get('type') pool = lease.get('pool') - host_identifier = lease.get('iaid_duid') + host_identifier = lease.get('duid') data_entries.append([ipaddr, state, start, end, remain, lease_type, pool, host_identifier]) headers = ['IPv6 address', 'State', 'Last communication', 'Lease expiration', 'Remaining', 'Type', 'Pool', - 'IAID_DUID'] + 'DUID'] output = tabulate(data_entries, headers, numalign='left') return output |